|
@@ -14,6 +14,7 @@ use app\common\model\TalentAllowanceArrange;
|
|
|
use app\common\state\ProjectState;
|
|
|
use app\common\state\AllowanceStateEnum;
|
|
|
use app\common\state\AllowanceProjectEnum;
|
|
|
+use app\common\state\AllowanceTypeEnum;
|
|
|
use app\common\model\AmountStandard as AsModel;
|
|
|
|
|
|
/**
|
|
@@ -947,23 +948,139 @@ class TalentAllowance extends AdminController {
|
|
|
$obj["identifyCondition"] = \StrUtil::getRequestDecodeParam($this->request, "identifyCondition");
|
|
|
$obj["isSupple"] = \StrUtil::getRequestDecodeParam($this->request, "isSupple");
|
|
|
$obj["checkState"] = \StrUtil::getRequestDecodeParam($this->request, "checkState");
|
|
|
+ $obj["publicState"] = \StrUtil::getRequestDecodeParam($this->request, "publicState");
|
|
|
$obj["companyName"] = \StrUtil::getRequestDecodeParam($this->request, "companyName");
|
|
|
$obj["introductionMode"] = \StrUtil::getRequestDecodeParam($this->request, "introductionMode");
|
|
|
$obj["firstJJStartTime"] = \StrUtil::getRequestDecodeParam($this->request, "firstJJStartTime");
|
|
|
$obj["firstJJEndTime"] = \StrUtil::getRequestDecodeParam($this->request, "firstJJEndTime");
|
|
|
$obj["process"] = intval(\StrUtil::getRequestDecodeParam($this->request, "process"));
|
|
|
$obj["type"] = $this->user["type"];
|
|
|
- $list = [];
|
|
|
+ $where = [];
|
|
|
+ $where[] = ["ta.type", "=", $this->user["type"]];
|
|
|
+ $this->setTalentAllowanceInfoForExport($where, $obj, $obj["process"]);
|
|
|
switch ($obj["process"]) {
|
|
|
case 1:
|
|
|
+ $where[] = ["ta.checkState", "in", [1, 5, 10, 13, 15, 20, 25, 30]];
|
|
|
break;
|
|
|
case 2:
|
|
|
+ $where[] = ["ta.firstPassTime", "EXP", Db::raw("is not null")];
|
|
|
break;
|
|
|
case 3:
|
|
|
+ $where[] = ["ta.visitPassTime", "EXP", Db::raw("is not null")];
|
|
|
break;
|
|
|
case 4:
|
|
|
+ if ($obj["publicState"]) {
|
|
|
+ $where[] = ["publicState", "=", $param["publicState"]];
|
|
|
+ }
|
|
|
+ $where[] = ["ta.checkState", "in", [-1, 30]];
|
|
|
break;
|
|
|
}
|
|
|
+ $projects = [
|
|
|
+ AllowanceProjectEnum::PROJECT_TAX,
|
|
|
+ AllowanceProjectEnum::PROJECT_WAGES,
|
|
|
+ AllowanceProjectEnum::PROJECT_ATTENDANCE,
|
|
|
+ AllowanceProjectEnum::PROJECT_SB_PENSION,
|
|
|
+ AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT,
|
|
|
+ AllowanceProjectEnum::PROJECT_SB_MEDICA,
|
|
|
+ ];
|
|
|
+ $months = [];
|
|
|
+ for ($m = 1; $m <= 12; $m++) {
|
|
|
+ $months[] = $m . "月";
|
|
|
+ }
|
|
|
+ $columns = [["年度", [1, 2]], ["所属镇街", [1, 2]], ["姓名", [1, 2]], ["性别", [1, 2]], ["证件号码", [1, 2]], ["人才层次", [1, 2]], ["认定条件", [1, 2]], ["认定条件取得时间", [1, 2]], ["认定条件名称", [1, 2]], ["公布入选月份", [1, 2]], ["津补贴类型", [1, 2]], ["兑现月份", [1, 2]], ["兑现金额", [1, 2]], ["金额说明", [1, 2]], ["审核状态", [1, 2]], ["缴纳单位", [1, 2]]];
|
|
|
+ $infoCols = count($columns);
|
|
|
+ for ($i = 0; $i < count($projects); $i++) {
|
|
|
+ $columns[] = [AllowanceProjectEnum::getProjectName($projects[$i]), $months];
|
|
|
+ }
|
|
|
+ $list = \app\common\model\TalentAllowanceProject::alias("pro")
|
|
|
+ ->field("ta.id,ta.year,ta.enterpriseId as curEnterpriseId,ta.address,ta.name,ta.sex,ta.idCard,ta.talentArrange,ta.identifyCondition,ta.identifyGetTime,ta.identifyConditionName,ta.identifyMonth,ta.allowanceType,ta.months,ta.money,ta.moneyDesc,ta.checkState,ta.publicState,pro.project,pro.months as pre_months,con.enterpriseId,con.startTime,con.endTime,con.entryTime,con.quitTime,con.isQuit")
|
|
|
+ ->leftJoin("un_talent_allowance_info ta", "ta.id=pro.mainId")
|
|
|
+ ->leftJoin("un_talent_allowancecontract_detail con", "pro.baseId=con.id")
|
|
|
+ ->where($where)
|
|
|
+ ->order("ta.year desc,ta.createTime desc,pro.project asc")
|
|
|
+ ->select()->toArray();
|
|
|
+ $tmpList = [];
|
|
|
+
|
|
|
+ $levelMap = DictApi::selectByParentCode("talent_arrange");
|
|
|
+ $streetMap = DictApi::selectByParentCode("street");
|
|
|
+ $where = [];
|
|
|
+ $where[] = ["id", "in", array_column($list, "identifyCondition")];
|
|
|
+ $icmap = \app\common\model\TalentCondition::where($where)->column("name", "id");
|
|
|
+
|
|
|
+ $where = [];
|
|
|
+ $where[] = ["id", "in", array_column($list, "enterpriseId")];
|
|
|
+ $enterpriseMap = \app\common\model\Enterprise::where($where)->column("name", "id");
|
|
|
+ foreach ($list as $item) {
|
|
|
+ //组装数据
|
|
|
+ if (!$tmpList[$item["id"]]) {
|
|
|
+ $tmpList[$item["id"]]["curEnterpriseId"] = $item["curEnterpriseId"];
|
|
|
+ $tmpList[$item["id"]]["info"] = [$item["year"], $streetMap[$item["address"]], $item["name"], $item["sex"] == 1 ? "男" : "女", $item["idCard"], $levelMap[$item["talentArrange"]],
|
|
|
+ $icmap[$item["identifyCondition"]], $item["identifyGetTime"], $item["identifyConditionName"], $item["identifyMonth"], AllowanceTypeEnum::getTypeName($item["allowanceType"]), $item["months"], $item["money"],
|
|
|
+ $item["moneyDesc"], $this->getCheckStateName($item["checkState"], $item["publicState"], $item["allowanceType"])];
|
|
|
+ }
|
|
|
+ if (!$tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]]) {
|
|
|
+ $tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]] = [
|
|
|
+ "startTime" => $item["startTime"],
|
|
|
+ "endTime" => $item["endTime"],
|
|
|
+ "entryTime" => $item["entryTime"],
|
|
|
+ "isQuit" => $item["isQuit"]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ $tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]]["projects"][$item["project"]] = $item["pre_months"];
|
|
|
+ }
|
|
|
+ $rows = [];
|
|
|
+ $colorset = [];
|
|
|
+ foreach ($tmpList as $id => $item) {
|
|
|
+ foreach ($item["enterprise"] as $enterpriseId => $enterprise) {
|
|
|
+ $row = $item["info"];
|
|
|
+ $row[] = $this->user["uid"] == $enterpriseId ? "本单位" : $enterpriseMap[$enterpriseId];
|
|
|
+ for ($i = 0; $i < count($projects); $i++) {
|
|
|
+ if (strpos($enterprise["projects"][$projects[$i]], "=") === false) {
|
|
|
+ $months = array_filter(explode(",", $enterprise["projects"][$projects[$i]]));
|
|
|
+ for ($m = 1; $m <= 12; $m++) {
|
|
|
+ $_month = str_pad($m, 2, "0", STR_PAD_LEFT);
|
|
|
+ if (in_array($_month, $months)) {
|
|
|
+ $row[] = "✔";
|
|
|
+ $colorset[] = [sprintf("%s%d", getExcelColumnByIndex($infoCols + $i * 12 + $m - 1), count($rows) + 3), "29dd23"];
|
|
|
+ } else {
|
|
|
+ $row[] = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $months = array_filter(explode(",", $enterprise["projects"][$projects[$i]]));
|
|
|
+ $_months = [];
|
|
|
+ foreach ($months as $month) {
|
|
|
+ $kv = explode("=", $month);
|
|
|
+ $_months[$kv[0]] = $kv[1];
|
|
|
+ }
|
|
|
+ for ($m = 1; $m <= 12; $m++) {
|
|
|
+ $_month = str_pad($m, 2, "0", STR_PAD_LEFT);
|
|
|
+ $days = $_months[$_month];
|
|
|
+ if ($days && $days > 0) {
|
|
|
+ $row[] = $days . "天";
|
|
|
+ $colorset[] = [sprintf("%s%d", getExcelColumnByIndex($infoCols + $i * 12 + $m - 1), count($rows) + 3), "29dd23"];
|
|
|
+ } else {
|
|
|
+ $row[] = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $rows[] = $row;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $cols = $infoCols + count($projects) * 12 - 1;
|
|
|
+ $settings = [
|
|
|
+ "width" => [["A", 8], ["C", 12], ["D", 6], ["E", 20], ["F", 12], ["G", 70], ["H", 12], ["I", 15], ["J", 12], ["K", 12], ["P", 30]],
|
|
|
+ "height" => [18],
|
|
|
+ "freeze" => "D3",
|
|
|
+ "color" => $colorset
|
|
|
+ ];
|
|
|
+ for ($i = 0; $i < count($projects) * 12; $i++) {
|
|
|
+ $settings["width"][] = [getExcelColumnByIndex($infoCols + $i), 6]; //批设置项目的宽度
|
|
|
+ }
|
|
|
+ $settings["background-color"][] = [sprintf("%s2:%s2", getExcelColumnByIndex($infoCols), getExcelColumnByIndex($cols)), "E1F1DE"];
|
|
|
+ export($columns, $rows, "津补贴申报名单", $settings);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private function validateAllowanceType(&$info) {
|
|
@@ -1668,6 +1785,141 @@ class TalentAllowance extends AdminController {
|
|
|
}
|
|
|
return $where;
|
|
|
}
|
|
|
+
|
|
|
+ private function setTalentAllowanceInfoForExport($where, $query, $process) {
|
|
|
+ if (\StrUtil::isNotEmpAndNull($query["year"])) {
|
|
|
+ $where[] = ["ta.year", "=", $query["year"]];
|
|
|
+ }
|
|
|
+ if (\StrUtil::isNotEmpAndNull($query["enterpriseName"])) {
|
|
|
+ $where[] = ["ta.enterpriseName", "like", "%" . $query["enterpriseName"] . "%"];
|
|
|
+ }
|
|
|
+ if (\StrUtil::isNotEmpAndNull($query["name"])) {
|
|
|
+ $where[] = ["ta.name", "like", "%" . $query["name"] . "%"];
|
|
|
+ }
|
|
|
+ if (\StrUtil::isNotEmpAndNull($query["talentType"])) {
|
|
|
+ $where[] = ["ta.talentType", "=", $query["talentType"]];
|
|
|
+ }
|
|
|
+ if (\StrUtil::isNotEmpAndNull($query["talentArrange"])) {
|
|
|
+ $where[] = ["ta.talentArrange", "=", $query["talentArrange"]];
|
|
|
+ }
|
|
|
+ if (\StrUtil::isNotEmpAndNull($query["identifyCondition"])) {
|
|
|
+ $where[] = ["ta.identifyCondition", "=", $query["identifyCondition"]];
|
|
|
+ }
|
|
|
+ if (\StrUtil::isNotEmpAndNull($query["address"])) {
|
|
|
+ $where[] = ["ta.address", "=", $query["address"]];
|
|
|
+ }
|
|
|
+ if ($query["recommendAllowanceType"]) {
|
|
|
+ $where[] = ["ta.recommendAllowanceType", "=", $query["recommendAllowanceType"]];
|
|
|
+ }
|
|
|
+ if ($query["publicState"]) {
|
|
|
+ $where[] = ["ta.publicState", "=", $query["publicState"]];
|
|
|
+ }
|
|
|
+ if (\StrUtil::isNotEmpAndNull($query["introductionMode"])) {
|
|
|
+ $where[] = ["ta.introductionMode", "=", $query["introductionMode"]];
|
|
|
+ }
|
|
|
+ if (\StrUtil::isNotEmpAndNull($query["firstJJStartTime"])) {
|
|
|
+ $where[] = ["ta.firstInJJTime", ">=", $query["firstJJStartTime"]];
|
|
|
+ }
|
|
|
+ if (\StrUtil::isNotEmpAndNull($query["firstJJEndTime"])) {
|
|
|
+ $where[] = ["ta.firstInJJTime", "<=", $query["firstJJEndTime"]];
|
|
|
+ }
|
|
|
+ if ($process == 4) {
|
|
|
+ if ($query["isSupple"]) {
|
|
|
+ $where[] = ["ta.isSupple", "=", $query["isSupple"]];
|
|
|
+ }
|
|
|
+ if ($query["isPublicCheck"]) {
|
|
|
+ $where[] = ["ta.isPublicCheck", "=", $query["isPublicCheck"]];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($query["checkState"]) {
|
|
|
+ if ($query["checkState"] == -1) {
|
|
|
+ $where[] = ["ta.checkState", "=", $query["checkState"]];
|
|
|
+ } else {
|
|
|
+ if ($process == 1) {
|
|
|
+ switch ($query["checkState"]) {
|
|
|
+ case 0: //保存未提交
|
|
|
+ $where[] = ["ta.checkState", "=", 1];
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ $where[] = ["ta.checkState", "=", 5];
|
|
|
+ break;
|
|
|
+ case 2: //驳回
|
|
|
+ $where[] = ["ta.checkState", "=", 10];
|
|
|
+ break;
|
|
|
+ case 3: //通过
|
|
|
+ $where[] = ["ta.checkState", "in", [15, 20, 30, 25]];
|
|
|
+ break;
|
|
|
+ case 4: //重新提交
|
|
|
+ $where[] = ["ta.checkState", "=", 5];
|
|
|
+ $where[] = ["ta.highProcess", ">=", $process];
|
|
|
+ break;
|
|
|
+ case 5: //上级驳回
|
|
|
+ $where[] = ["ta.checkState", "=", 13];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($process == 2) {
|
|
|
+ switch ($query["checkState"]) {
|
|
|
+ case 1:
|
|
|
+ $where[] = ["ta.checkState", "=", 15];
|
|
|
+ break;
|
|
|
+ case 2: //驳回
|
|
|
+ $where[] = ["ta.checkState", "in", [1, 5, 10]];
|
|
|
+ $where[] = ["ta.highProcess", ">=", $process];
|
|
|
+ break;
|
|
|
+ case 3: //通过
|
|
|
+ $where[] = ["ta.checkState", "in", [20, 30]];
|
|
|
+ break;
|
|
|
+ case 9: //重新提交
|
|
|
+ $where[] = ["ta.checkState", "=", 15];
|
|
|
+ $where[] = ["ta.highProcess", ">=", $process];
|
|
|
+ break;
|
|
|
+ case 4: //上级驳回
|
|
|
+ $where[] = ["ta.checkState", "=", 25];
|
|
|
+ break;
|
|
|
+ case -1:
|
|
|
+ $where[] = ["ta.checkState", "=", -1];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($process == 3) {
|
|
|
+ switch ($query["checkState"]) {
|
|
|
+ case -1:
|
|
|
+ $where[] = ["ta.checkState", "=", -1];
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ $where[] = ["ta.checkState", "=", 20];
|
|
|
+ break;
|
|
|
+ case 2: //驳回
|
|
|
+ $where[] = ["ta.checkState", "in", [1, 5, 10, 15, 25]];
|
|
|
+ $where[] = ["ta.highProcess", ">=", $process];
|
|
|
+ break;
|
|
|
+ case 3: //通过
|
|
|
+ $where[] = ["ta.checkState", "=", 30];
|
|
|
+ break;
|
|
|
+ case 9: //重新提交
|
|
|
+ $where[] = ["ta.checkState", "=", 20];
|
|
|
+ $where[] = ["ta.highProcess", ">=", $process];
|
|
|
+ break;
|
|
|
+ case 4: //上级驳回
|
|
|
+ $where[] = ["ta.checkState", "=", 35];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($process == 4) {
|
|
|
+ switch ($query["checkState"]) {
|
|
|
+ case -1:
|
|
|
+ $where[] = ["ta.checkState", "=", -1];
|
|
|
+ break;
|
|
|
+ case 3: //通过
|
|
|
+ $where[] = ["ta.checkState", "=", 30];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $where;
|
|
|
+ }
|
|
|
|
|
|
private function translateToChinese(&$obj) {
|
|
|
if (\StrUtil::isNotEmpAndNull($obj["address"])) {
|
|
@@ -1720,5 +1972,42 @@ class TalentAllowance extends AdminController {
|
|
|
}unset($info);
|
|
|
return $list;
|
|
|
}
|
|
|
+
|
|
|
+ private function getCheckStateName($checkState, $publicState, $allowanceType) {
|
|
|
+ switch ($checkState) {
|
|
|
+ case 1:
|
|
|
+ return "待提交";
|
|
|
+ case 5:
|
|
|
+ case 13:
|
|
|
+ case 15:
|
|
|
+ case 20:
|
|
|
+ case 25:
|
|
|
+ case 35:
|
|
|
+ return "审核中";
|
|
|
+ case 10:
|
|
|
+ return "已驳回";
|
|
|
+ case - 1:
|
|
|
+ if ($publicState >= 3) {
|
|
|
+ return "审核不通过";
|
|
|
+ } else {
|
|
|
+ return "审核中";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 30:
|
|
|
+ if ($publicState == 1) {
|
|
|
+ return "待核查征信";
|
|
|
+ } else if ($publicState == 2) {
|
|
|
+ return "待公示";
|
|
|
+ } else if ($publicState == 3) {
|
|
|
+ return "公示中";
|
|
|
+ } else if ($publicState == 4) {
|
|
|
+ return $allowanceType != 3 ? "待兑现" : "不予兑现";
|
|
|
+ } else if ($publicState == 5) {
|
|
|
+ return "已兑现";
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ return "未知状态";
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|