|
@@ -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;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|