|
@@ -13,6 +13,9 @@ use app\common\api\BatchApi;
|
|
|
use app\common\api\HouseApi;
|
|
|
use app\common\model\TalentLog;
|
|
|
use app\common\api\DictApi;
|
|
|
+use app\common\state\CommonConst;
|
|
|
+use app\common\state\MainState;
|
|
|
+use app\common\api\Response;
|
|
|
|
|
|
/**
|
|
|
* Description of House
|
|
@@ -412,8 +415,105 @@ class House extends EnterpriseController {
|
|
|
return json(["msg" => "删除成功"]);
|
|
|
}
|
|
|
|
|
|
- public function getTalentInfo($id) {
|
|
|
-
|
|
|
+ public function getTalentInfo($id, $year, $declareType) {
|
|
|
+ $ti = \app\common\api\VerifyApi::getTalentInfoById($id);
|
|
|
+ if ($ti["enterpriseType"] == CommonConst::ENTERPRISE_NORMAL) {
|
|
|
+ $response = $this->getTalentArrange($ti, $year);
|
|
|
+ if ($response->code == 500) {
|
|
|
+ return $response;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (en . getType() == 1) {
|
|
|
+ /* List<String> totalMonth = DateUtil.getMonthBetweenDates(year + "-01-01", year + "-12-31");
|
|
|
+ TalentInfo resInfo = (TalentInfo) responseObj.getObj();
|
|
|
+ ti.setTalentArrange(resInfo.getTalentArrange());
|
|
|
+ ti.setIdentifyCondition(resInfo.getIdentifyCondition());
|
|
|
+ ti.setIdentifyConditionName(resInfo.getIdentifyConditionName());
|
|
|
+ ti.setIdentifyGetTime(resInfo.getIdentifyGetTime());
|
|
|
+ ti.setCertificateStartTime(resInfo.getCertificateStartTime());
|
|
|
+ ti.setQzgccrcActiveTime(resInfo.getQzgccrcActiveTime());
|
|
|
+ /**校验上一年度人才标签 */
|
|
|
+ /* responseObj = getTalentType(ti, declareType);
|
|
|
+ if (responseObj.getCode() == 500) {
|
|
|
+ return responseObj;
|
|
|
+ }
|
|
|
+ TalentQuit resQuit = (TalentQuit) responseObj.getObj();
|
|
|
+ ti.setTalentType(resQuit.getTalentType()); */
|
|
|
+ }
|
|
|
+ //查询房产库中是否存在房产信息
|
|
|
+ /* Housepurchase housepurchase = new Housepurchase();
|
|
|
+ housepurchase.setIdCard(ti.getIdCard());
|
|
|
+ HousepurchaseHouseInfo houseInfo = HousepurchaseUtil.getHouseInfo(housepurchase.getIdCard());
|
|
|
+ Map<String, Object> res = new HashMap<>();
|
|
|
+ res.put("talentInfo", ti);
|
|
|
+ res.put("houseInfo", houseInfo);
|
|
|
+ return new ResponseObj(ResponseObj.SUCCESS, "", res); */
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param talentInfo
|
|
|
+ * @param year
|
|
|
+ * @description 获取上一年度的人才层次,规则如下:上一年度存在多个人才层次则取占比大的人才层次,占比相同则取人才层次高者
|
|
|
+ * @returns com.stylefeng.guns.core.common.model.ResponseObj
|
|
|
+ * @author Liu
|
|
|
+ * @date 2020/5/6
|
|
|
+ * */
|
|
|
+ private function getTalentArrange($talentInfo, $year) {
|
|
|
+ /**
|
|
|
+ * 判定在申报年度内或之前是否认定,申报年度之后认定无效,根据公布入选月份判断(此处还要考虑人才层次变更)
|
|
|
+ */
|
|
|
+ $year = substr($year, 0, 4);
|
|
|
+ $identifyTimeField = "identifyMonth";
|
|
|
+ $oldStartTimeField = "oldIdentifyMonth";
|
|
|
+ $newStartTimeField = "newIdentifyMonth";
|
|
|
+ if ($talentInfo["enterpriseType"] == CommonConst::ENTERPRISE_JC) {
|
|
|
+ $identifyTimeField = "identifyGetTime";
|
|
|
+ $oldStartTimeField = "oldIdentifyGetTime";
|
|
|
+ $newStartTimeField = "newIdentifyGetTime";
|
|
|
+ }
|
|
|
+
|
|
|
+ $where = [];
|
|
|
+ $where[] = ["idCard", "=", $talentInfo["card_number"]];
|
|
|
+ $where[] = ["checkState", "=", MainState::PASS];
|
|
|
+ $where[] = ["isPublic", "=", 6];
|
|
|
+ $where[] = [$oldStartTimeField, "<=", $year . "-12-31"];
|
|
|
+ $typeChanges = TalentTypeChange::where($where)->field("oldTalentArrange,oldIdentifyCondition,oldIdentifyGetTime,oldIdentifyOutTime,oldIdentifyConditionName,oldIdentifyMonth,oldCertificateStartTime,oldCertificateOutTime,newIdentifyMonth,newIdentifyGetTime")->order("createTime desc")->select()->toArray();
|
|
|
+ $jjList = [];
|
|
|
+ $unionList = [];
|
|
|
+ $totalMonth = \DateUtil::getMonthBetweenDates($year . "-01-01", $year . "-12-31");
|
|
|
+ if (!$typeChanges && strtotime($year . "-12-31") > strtotime($talentInfo[$identifyTimeField])) {
|
|
|
+ return new Response(Response::ERROR, "在上一年度未认定优秀人才,无法申报");
|
|
|
+ } else {
|
|
|
+ $typeChanges[] = [
|
|
|
+ "oldTalentArrange" => $talentInfo["talent_arrange"],
|
|
|
+ "oldIdentifyCondition" => $talentInfo["talent_condition"],
|
|
|
+ "oldIdentifyGetTime" => $talentInfo["identifyGetTime"],
|
|
|
+ "oldIdentifyOutTime" => $talentInfo["identifyExpireTime"],
|
|
|
+ "oldIdentifyConditionName" => $talentInfo["identifyConditionName"],
|
|
|
+ "oldIdentifyMonth" => $talentInfo["identifyMonth"],
|
|
|
+ "oldCertificateStartTime" => $talentInfo["certificateGetTime"],
|
|
|
+ "oldCertificateOutTime" => $talentInfo["certificateExpireTime"] ?: date("Y-m-d", strtotime(sprintf("%s +6 years -1 days", $talentInfo["certificateGetTime"]))),
|
|
|
+ "newIdentifyMonth" => ($year + 1) . "-01-01",
|
|
|
+ "newIdentifyGetTime" => ($year + 1) . "-01-01"
|
|
|
+ ];
|
|
|
+ foreach ($typeChanges as $typeChange) {
|
|
|
+ $monthList = \DateUtil::getMonthBetweenDatesNotEnd($typeChange["oldCertificateStartTime"], $typeChange["oldCertificateOutTime"]);
|
|
|
+ $res = \DateUtil::getEveryMonthDayBetween($typeChange["oldCertificateStartTime"], $typeChange["oldCertificateOutTime"], $monthList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ for (TalentTypeChange typeChange : typeChanges) {
|
|
|
+ List<String> monthList = DateUtil . getMonthBetweenDatesNotEnd(typeChange . getOldCertificateStartTime(), typeChange . getOldCertificateOutTime());
|
|
|
+ Map<String, Integer> res = DateUtil . getEveryMonthDayBetween(typeChange . getOldCertificateStartTime(), typeChange . getOldCertificateOutTime(), monthList);
|
|
|
+ if (res . size() > 0) {
|
|
|
+ unionList . removeAll(monthList);
|
|
|
+ unionList . addAll(monthList);
|
|
|
+ TalentInfo info = new TalentInfo(typeChange . getOldTalentArrange(), typeChange . getOldIdentifyCondition(), typeChange . getOldIdentifyGetTime(), typeChange . getOldIdentifyConditionName(), typeChange . getOldCertificateStartTime(), typeChange . getOldCertificateOutTime(), typeChange . getOldIdentifyMonth());
|
|
|
+ info . setDayMap(res);
|
|
|
+ jjList . add(info);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|