|
@@ -3,16 +3,17 @@
|
|
|
namespace app\admin\controller;
|
|
|
|
|
|
use app\admin\common\AdminController;
|
|
|
-use app\common\api\Response;
|
|
|
-use app\common\model\TalentAllowance as TaModel;
|
|
|
use think\facade\Db;
|
|
|
+use app\common\api\Response;
|
|
|
use app\common\api\DictApi;
|
|
|
-use app\common\state\AllowanceStateEnum;
|
|
|
-use app\common\state\AllowanceProjectEnum;
|
|
|
use app\common\api\TalentAllowanceApi;
|
|
|
+use app\common\api\TalentLogApi;
|
|
|
+use app\common\model\TalentAllowance as TaModel;
|
|
|
use app\common\model\TalentChecklog;
|
|
|
+use app\common\model\TalentAllowanceArrange;
|
|
|
use app\common\state\ProjectState;
|
|
|
-use app\common\api\TalentLogApi;
|
|
|
+use app\common\state\AllowanceStateEnum;
|
|
|
+use app\common\state\AllowanceProjectEnum;
|
|
|
|
|
|
/**
|
|
|
* Description of TalentAllowance
|
|
@@ -101,7 +102,7 @@ class TalentAllowance extends AdminController {
|
|
|
$oldObj = TalentAllowanceApi::getInfoById($obj["id"]);
|
|
|
|
|
|
if (!$oldObj) {
|
|
|
- return new Response(Response::ERROR, "不存在的申请记录");
|
|
|
+ return new Response(Response::ERROR, "审核对象不存在");
|
|
|
}
|
|
|
|
|
|
$newObj = [];
|
|
@@ -143,92 +144,196 @@ class TalentAllowance extends AdminController {
|
|
|
]);
|
|
|
return new Response(Response::SUCCESS, "审核成功");
|
|
|
}
|
|
|
-
|
|
|
- public function submitCheck(){
|
|
|
+
|
|
|
+ public function submitCheck() {
|
|
|
$id = $this->request["id"];
|
|
|
$process = $this->request["process"];
|
|
|
- $old = TalentAllowanceApi::getInfoById($param["id"]);
|
|
|
+ $old = TalentAllowanceApi::getInfoById($id);
|
|
|
+ if (!$old) {
|
|
|
+ return new Response(Response::ERROR, "审核对象不存在");
|
|
|
+ }
|
|
|
+ $updCheck = [];
|
|
|
$updCheck["id"] = $id;
|
|
|
- /**查询审核日志*/
|
|
|
+ /* * 查询审核日志 */
|
|
|
$log = TalentLogApi::getLastLogByStep($id, ProjectState::JBT, $process);
|
|
|
if (!$log) {
|
|
|
return new Response(Response::ERROR, "请先审核后再提交");
|
|
|
}
|
|
|
$updCheck["checkMsg"] = $log["description"];
|
|
|
- /**判断到达的最高流程*/
|
|
|
- $updCheck["highProcess"] = !$old["highProcess"] || $old["highProcess"] < $process? $process : $old["process"];
|
|
|
- $newLog = null;
|
|
|
+ /* * 判断到达的最高流程 */
|
|
|
+ $updCheck["highProcess"] = !$old["highProcess"] || $old["highProcess"] < $process ? $process : $old["process"];
|
|
|
switch ($process) {
|
|
|
case 1:
|
|
|
- Company checkCompany = this.companyService.selectById(info.getCompanyId());
|
|
|
- TalentDepcheckstate tds = this.talentDepcheckstateService.selectOne(new EntityWrapper<TalentDepcheckstate>().eq("mainId", info.getId()).eq("companyId", info.getCompanyId()));
|
|
|
- tds.setState(log.getState());
|
|
|
- if (log.getState() == BasicStateEnum.RCRD_BASIC_PASS.getCode()) {
|
|
|
- tds.setSubmitTime(DateUtil.getTime());
|
|
|
+ switch ($log["state"]) {
|
|
|
+ case 3:
|
|
|
+ $updCheck["firstPassTime"] = $old["firstPassTime"];
|
|
|
+ if (!$old["firstPassTime"]) {
|
|
|
+ $updCheck["firstPassTime"] = date("Y-m-d H:i:s");
|
|
|
+ }
|
|
|
+ $updCheck["submitTime"] = date("Y-m-d H:i:s");
|
|
|
+ $updCheck["checkState"] = AllowanceStateEnum::NEED_REVIEW;
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ $updCheck["checkState"] = AllowanceStateEnum::FIRST_REJECT;
|
|
|
+ break;
|
|
|
+ case -1:
|
|
|
+ $updCheck["checkState"] = AllowanceStateEnum::NOTPASS;
|
|
|
+ $updCheck["recommendAllowanceType"] = 3;
|
|
|
+ $updCheck["recommendMoney"] = 0;
|
|
|
+ $updCheck["recommendAllowanceMsg"] = "审核不通过,不予兑现";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ return new Response(Response::ERROR, "未知的审核状态");
|
|
|
}
|
|
|
- this.talentDepcheckstateService.updateById(tds);
|
|
|
- /**判断所有部门是否全部通过*/
|
|
|
- info.setFirstPassTime(old.getFirstPassTime());
|
|
|
- Boolean isSuccess = validFirstIsFinish(info);
|
|
|
- newLog = new TalentChecklog(ProjectEnum.JBT.getCode(), info.getId(), null, StateConst.ACTIVE_YES, log.getState(),
|
|
|
- info.getProcess(), AllowanceStateEnum.valueOf(old.getCheckState()) + "->" + AllowanceStateEnum.valueOf(info.getCheckState()), log.getDescription() + "(" + checkCompany.getName() + ")", DateUtil.getTime(),
|
|
|
- ShiroKit.getUser().getAccount() + "(" + company.getName() + ")");
|
|
|
- newLog.setCompanyId(info.getCompanyId());
|
|
|
- this.talentChecklogService.delete(new EntityWrapper<TalentChecklog>().eq("mainId", info.getId()).eq("active", StateConst.ACTIVE_NO).eq("companyId", info.getCompanyId()));
|
|
|
- this.talentChecklogService.insert(newLog);
|
|
|
+ //添加日志
|
|
|
+ TalentChecklog::create([
|
|
|
+ 'id' => getStringId(),
|
|
|
+ 'mainId' => $id,
|
|
|
+ 'type' => intval(ProjectState::JBT),
|
|
|
+ 'typeFileId' => null,
|
|
|
+ 'active' => 1,
|
|
|
+ 'state' => $log["state"],
|
|
|
+ 'step' => $process,
|
|
|
+ 'stateChange' => AllowanceStateEnum::getStateName($old["checkState"]) . "->" . AllowanceStateEnum::getStateName($updCheck["checkState"]),
|
|
|
+ 'description' => $log["checkMsg"],
|
|
|
+ 'createTime' => date("Y-m-d H:i:s", time()),
|
|
|
+ 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
|
|
|
+ ]);
|
|
|
break;
|
|
|
case 2:
|
|
|
- if (old.getCheckState() != AllowanceStateEnum.NEED_VISIT_CHECK.getCode() && old.getCheckState() != AllowanceStateEnum.REVIEW_REJECT.getCode()) {
|
|
|
- return new ResponseObj(ResponseObj.FAILD, "不在审核范围内");
|
|
|
+ if ($old["checkState"] != AllowanceStateEnum::NEED_VISIT_CHECK && $old["checkState"] != AllowanceStateEnum::REVIEW_REJECT) {
|
|
|
+ return new Response(Response::ERROR, "不在审核范围内");
|
|
|
}
|
|
|
- info.setCheckState(AllowanceStateEnum.NEED_REVIEW.getCode());
|
|
|
- info.setVisitPassTime(DateUtil.getTime());
|
|
|
- newLog = new TalentChecklog(ProjectEnum.JBT.getCode(), info.getId(), null,
|
|
|
- StateConst.ACTIVE_YES, BasicStateEnum.RCRD_BASIC_PASS.getCode(), info.getProcess(),
|
|
|
- AllowanceStateEnum.valueOf(old.getCheckState()) + "->" + AllowanceStateEnum.valueOf(info.getCheckState())
|
|
|
- , "走访核查提交审核", DateUtil.getTime(), ShiroKit.getUser().getAccount() + "(" + company.getName() + ")");
|
|
|
- this.talentChecklogService.insert(newLog);
|
|
|
+ $updCheck["checkState"] = AllowanceStateEnum::NEED_REVIEW;
|
|
|
+ $updCheck["visitPassTime"] = date("Y-m-d H:i:s");
|
|
|
+ //添加日志
|
|
|
+ TalentChecklog::create([
|
|
|
+ 'id' => getStringId(),
|
|
|
+ 'mainId' => $id,
|
|
|
+ 'type' => intval(ProjectState::JBT),
|
|
|
+ 'typeFileId' => null,
|
|
|
+ 'active' => 1,
|
|
|
+ 'state' => 3,
|
|
|
+ 'step' => $process,
|
|
|
+ 'stateChange' => AllowanceStateEnum::getStateName($old["checkState"]) . "->" . AllowanceStateEnum::getStateName($updCheck["checkState"]),
|
|
|
+ 'description' => "走访核查提交审核",
|
|
|
+ 'createTime' => date("Y-m-d H:i:s", time()),
|
|
|
+ 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
|
|
|
+ ]);
|
|
|
break;
|
|
|
case 3:
|
|
|
- if (log.getState() == BasicStateEnum.RCRD_BASIC_NOTPASS.getCode()) {
|
|
|
- info.setCheckState(AllowanceStateEnum.NOTPASS.getCode());
|
|
|
- info.setRecommendAllowanceType(3);
|
|
|
- info.setRecommendMoney(BigDecimal.ZERO);
|
|
|
- info.setRecommendAllowanceMsg("审核不通过,不予兑现");
|
|
|
- }
|
|
|
- if (log.getState() == BasicStateEnum.RCRD_BASIC_REJECT.getCode()) {
|
|
|
- /**设置驳回单位为上级驳回*/
|
|
|
- if (old.getToProcess() == 1) {
|
|
|
- info.setCheckState(AllowanceStateEnum.REJECT_TO_FIRST.getCode());
|
|
|
- if (FengStringUtil.isEmpOrNull(old.getToDep())) {
|
|
|
- return new ResponseObj(ResponseObj.FAILD, "请设置驳回单位后再提交 ");
|
|
|
+ switch ($log["state"]) {
|
|
|
+ case 3:
|
|
|
+ $updCheck["checkState"] = AllowanceStateEnum::REVIEW_PASS;
|
|
|
+ $updCheck["reviewPassTime"] = date("Y-m-d H:i:s");
|
|
|
+ /* * * 在此处需要判断津补贴类型 */
|
|
|
+ $arrangeList = $this->validateAllowanceType(&$updCheck);
|
|
|
+ TalentAllowanceArrange::update($arrangeList);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ if ($old["toProcess"] == 1) {
|
|
|
+ $updCheck["checkState"] = AllowanceStateEnum::REJECT_TO_FIRST;
|
|
|
+ } else if ($old["toProcess"] == 2) {
|
|
|
+ $updCheck["checkState"] = AllowanceStateEnum::REVIEW_REJECT;
|
|
|
}
|
|
|
- List<Company> companies = this.companyService.selectList(new EntityWrapper<Company>().in("code", old.getToDep()));
|
|
|
- String ids = companies.stream().map(Company::getId).collect(Collectors.joining(","));
|
|
|
- this.talentDepcheckstateService.updateForSet("state=" + BasicStateEnum.RCRD_BASIC_UPREJECT.getCode(), new EntityWrapper<TalentDepcheckstate>().eq("mainId", old.getId()).in("companyId", ids));
|
|
|
- } else if (old.getToProcess() == 2) {
|
|
|
- info.setCheckState(AllowanceStateEnum.REVIEW_REJECT.getCode());
|
|
|
- }
|
|
|
- info.setToProcess(null);
|
|
|
- info.setToDep("");
|
|
|
- }
|
|
|
- if (log.getState() == BasicStateEnum.RCRD_BASIC_PASS.getCode()) { //通过,计算金额
|
|
|
- info.setCheckState(AllowanceStateEnum.REVIEW_PASS.getCode());
|
|
|
- info.setReviewPassTime(DateUtil.getTime());
|
|
|
- /*** 在此处需要判断津补贴类型*/
|
|
|
- List<TalentAllowanceArrange> arrangeList = validateAllowanceType(info);
|
|
|
- this.talentAllowanceArrangeService.updateBatchById(arrangeList);
|
|
|
+ $updCheck["toProcess"] = null;
|
|
|
+ $updCheck["toDep"] = "";
|
|
|
+ break;
|
|
|
+ case -1:
|
|
|
+ $updCheck["checkState"] = AllowanceStateEnum::NOTPASS;
|
|
|
+ $updCheck["recommendAllowanceType"] = 3;
|
|
|
+ $updCheck["recommendMoney"] = 0;
|
|
|
+ $updCheck["recommendAllowanceMsg"] = "审核不通过,不予兑现";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ return new Response(Response::ERROR, "未知的审核状态");
|
|
|
}
|
|
|
- newLog = new TalentChecklog(ProjectEnum.JBT.getCode(), info.getId(), null,
|
|
|
- StateConst.ACTIVE_YES, log.getState(), info.getProcess(),
|
|
|
- AllowanceStateEnum.valueOf(old.getCheckState()) + "->" + AllowanceStateEnum.valueOf(info.getCheckState())
|
|
|
- , log.getDescription(), DateUtil.getTime(), ShiroKit.getUser().getAccount() + "(" + company.getName() + ")");
|
|
|
- this.talentChecklogService.delete(new EntityWrapper<TalentChecklog>().eq("mainId", info.getId()).eq("active", StateConst.ACTIVE_NO));
|
|
|
- this.talentChecklogService.insert(newLog);
|
|
|
+ //添加日志
|
|
|
+ TalentChecklog::create([
|
|
|
+ 'id' => getStringId(),
|
|
|
+ 'mainId' => $id,
|
|
|
+ 'type' => intval(ProjectState::JBT),
|
|
|
+ 'typeFileId' => null,
|
|
|
+ 'active' => 1,
|
|
|
+ 'state' => $log["state"],
|
|
|
+ 'step' => $process,
|
|
|
+ 'stateChange' => AllowanceStateEnum::getStateName($old["checkState"]) . "->" . AllowanceStateEnum::getStateName($updCheck["checkState"]),
|
|
|
+ 'description' => $log["checkMsg"],
|
|
|
+ 'createTime' => date("Y-m-d H:i:s", time()),
|
|
|
+ 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
|
|
|
+ ]);
|
|
|
break;
|
|
|
}
|
|
|
- this.talentAllowanceInfoService.updateById(info);
|
|
|
- return new ResponseObj(ResponseObj.SUCCESS, "提交审核成功");
|
|
|
+ TalentChecklog::delete($log["id"]);
|
|
|
+ TaModel::update($updCheck);
|
|
|
+ return new Response(Response::SUCCESS, "提交审核成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ private function validateAllowanceType($info) {
|
|
|
+ $old = TalentAllowanceApi::getInfoById($info["id"]);
|
|
|
+ $talentTypeMap = DictApi::selectByParentCode("enterprise_tag");
|
|
|
+ $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
|
|
|
+ /* * 查询工作单位记录 */
|
|
|
+ $initDetailList = \app\common\model\TalentAllowancecontractDetail::where("mainId", $info["id"])->select()->toArray();
|
|
|
+ $detaiPdList = []; //用于判定类型
|
|
|
+ $detailMonthList = []; //用于计算月份
|
|
|
+ $recommendAllowanceMsg = [];
|
|
|
+
|
|
|
+ foreach ($initDetailList as $detail) {
|
|
|
+ $projectList = \app\common\model\TalentAllowanceProject::where("baseId", $detail["id"])->select()->toArray();
|
|
|
+ $projectMap = [];
|
|
|
+ foreach ($projectList as $project) {
|
|
|
+ switch ($project["project"]) {
|
|
|
+ case AllowanceProjectEnum::PROJECT_TAX:
|
|
|
+ case AllowanceProjectEnum::PROJECT_WAGES:
|
|
|
+ case AllowanceProjectEnum::PROJECT_SB_PENSION:
|
|
|
+ case AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT:
|
|
|
+ case AllowanceProjectEnum::PROJECT_SB_MEDICA:
|
|
|
+ break;
|
|
|
+ case AllowanceProjectEnum::PROJECT_ATTENDANCE:
|
|
|
+ break;
|
|
|
+ case AllowanceProjectEnum::PROJECT_WORKDAY:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ $projectMap[$project["project"]] = $project;
|
|
|
+ }
|
|
|
+ $detail["list"] = $projectList;
|
|
|
+ $detail["projectMap"] = $projectMap;
|
|
|
+ $detail["enterpriseName"] = $enterpriseMap[$detail["enterpriseId"]];
|
|
|
+ $detail["talentTypeName"] = $talentTypeMap[$detail["talentType"]];
|
|
|
+ /* * 筛选符合条件的人才标签 */
|
|
|
+ $detaiPdList[] = $detail;
|
|
|
+ $detailMonthList[] = $detail;
|
|
|
+ }
|
|
|
+// /**查询人才标签字典表*/
|
|
|
+// Set<String> retainMonths = new TreeSet<>((o1, o2) -> {
|
|
|
+// int o1Int = Integer.parseInt(o1);
|
|
|
+// int o2Int = Integer.parseInt(o2);
|
|
|
+// return o1Int - o2Int;
|
|
|
+// });
|
|
|
+// /**集成电路优秀人才*/
|
|
|
+// if($this->user["type"] == 2) {
|
|
|
+// /**获取各个项目的综合月份*/
|
|
|
+// Map<Integer, Set<String>> monthMap = $this->mergeMonth($detailMonthList);
|
|
|
+// Map<Integer, Map<String, Integer>> monthAndDayMap = $this->mergeMonthNeedDay($detailMonthList);
|
|
|
+// info.setRecommendAllowanceType(1);
|
|
|
+// info.setRecommendAllowanceMsg("");
|
|
|
+// TalentInfo talentInfo = this.talentInfoService.selectById(info.getTalentId());
|
|
|
+// List<TalentAllowanceProject> projectList = this.talentAllowanceProjectService.selectList(new EntityWrapper<TalentAllowanceProject>().eq("mainId", info.getId()));
|
|
|
+// Set<String> set = AllowanceICDecideUtil.valideAllowanceType(info, talentInfo, projectList, monthMap, monthAndDayMap);
|
|
|
+// info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "\n综合以上所有判断得到最终补贴类型为:");
|
|
|
+// if (info.getRecommendAllowanceType() == 1) {
|
|
|
+// info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "人才津贴;可享受月份为:" + set.stream().collect(Collectors.joining(",")) + "\n");
|
|
|
+// }
|
|
|
+// if (info.getRecommendAllowanceType() == 2)
|
|
|
+// info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "一次性交通补贴;");
|
|
|
+// if (info.getRecommendAllowanceType() == 3)
|
|
|
+// info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "不予兑现;");
|
|
|
+// retainMonths.addAll(set);
|
|
|
+// }
|
|
|
+// info.setRecommendMonths(StringUtils.join(retainMonths.toArray(), ","));
|
|
|
+// List<TalentAllowanceArrange> arrangeList = calculateAllowance(info, retainMonths, detailMonthList);
|
|
|
+// return arrangeList;
|
|
|
}
|
|
|
|
|
|
/**
|