|
@@ -140,7 +140,31 @@ class TalentAllowance extends EnterpriseController {
|
|
|
return \StrUtil::back(new Response(Response::ERROR, sprintf("第%d行申请补贴类型错误,请仔细检查内容无误后再重新提交", $no)), "TalentAllowanceInfo.importCallBack");
|
|
|
}
|
|
|
if ($allowanceType == "工作津贴") {
|
|
|
+ $projects = AllowanceProjectEnum::getProjectsByEnterpriseType($info["type"]);
|
|
|
for ($i = 3; $i < 9; $i++) {
|
|
|
+ $project = 1;
|
|
|
+ switch ($i) {
|
|
|
+ case 3:
|
|
|
+ $project = AllowanceProjectEnum::PROJECT_TAX;
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ $project = AllowanceProjectEnum::PROJECT_WAGES;
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ $project = AllowanceProjectEnum::PROJECT_ATTENDANCE;
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ $project = AllowanceProjectEnum::PROJECT_SB_PENSION;
|
|
|
+ break;
|
|
|
+ case 7:
|
|
|
+ $project = AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT;
|
|
|
+ break;
|
|
|
+ case 8:
|
|
|
+ $project = AllowanceProjectEnum::PROJECT_SB_MEDICA;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (!in_array($project, $projects))
|
|
|
+ continue;
|
|
|
$monthstr = str_replace([" ", ","], ",", trim($row[$i]));
|
|
|
$months = array_filter(explode(",", $monthstr));
|
|
|
if (!$months)
|
|
@@ -288,7 +312,8 @@ class TalentAllowance extends EnterpriseController {
|
|
|
"talentId" => $id,
|
|
|
"year" => $year,
|
|
|
"idCard" => $ti["card_number"],
|
|
|
- "id" => getStringId()
|
|
|
+ "id" => getStringId(),
|
|
|
+ "type" => $ti["enterpriseType"]
|
|
|
];
|
|
|
/* * 1.获取上一年度的人才层次 */
|
|
|
$arrangeList = $this->getLastYearTalentType($data, $ti);
|
|
@@ -373,11 +398,18 @@ class TalentAllowance extends EnterpriseController {
|
|
|
private function getLastYearTalentType($info, $talentInfo) {
|
|
|
$arrangeList = [];
|
|
|
/* * * 添加人才层次记录 */
|
|
|
+ $oldStartTimeField = "oldIdentifyMonth";
|
|
|
+ $newStartTimeField = "newIdentifyMonth";
|
|
|
+ if ($info["type"] == CommonConst::ENTERPRISE_JC) {
|
|
|
+ $oldStartTimeField = "oldIdentifyGetTime";
|
|
|
+ $newStartTimeField = "newIdentifyGetTime";
|
|
|
+ }
|
|
|
+
|
|
|
$where = [];
|
|
|
$where[] = ["idCard", "=", $info["idCard"]];
|
|
|
$where[] = ["checkState", "=", MainState::PASS];
|
|
|
$where[] = ["isPublic", ">=", 5];
|
|
|
- $where[] = ["oldIdentifyMonth", "<=", $info["year"] . "-12-31"];
|
|
|
+ $where[] = [$oldStartTimeField, "<=", $info["year"] . "-12-31"];
|
|
|
$typeList = TalentTypeChange::where($where)->field("oldTalentArrange,oldIdentifyCondition,oldIdentifyGetTime,oldIdentifyOutTime,oldIdentifyMonth,oldCertificateStartTime,oldCertificateOutTime,newIdentifyMonth")->order("createTime desc")->select()->toArray();
|
|
|
$typeList[] = [
|
|
|
"oldTalentArrange" => $talentInfo["talent_arrange"],
|
|
@@ -396,8 +428,8 @@ class TalentAllowance extends EnterpriseController {
|
|
|
});
|
|
|
$commonMonth = [];
|
|
|
foreach ($typeList as $talentTypeChange) {
|
|
|
- $startTime = $talentTypeChange["oldIdentifyMonth"];
|
|
|
- $endTime = $talentTypeChange["newIdentifyMonth"];
|
|
|
+ $startTime = $talentTypeChange[$oldStartTimeField];
|
|
|
+ $endTime = $talentTypeChange[$newStartTimeField];
|
|
|
$monthList = \DateUtil::getMonthBetweenDatesNotBegin($startTime, $endTime);
|
|
|
if ($monthList) {
|
|
|
$monthList = array_intersect($monthList, $totalMonth);
|
|
@@ -499,16 +531,7 @@ class TalentAllowance extends EnterpriseController {
|
|
|
$count = 0;
|
|
|
foreach ($contractList as $detail) {
|
|
|
$count++;
|
|
|
- $projects = [
|
|
|
- //AllowanceProjectEnum::PROJECT_CONTRACT,
|
|
|
- AllowanceProjectEnum::PROJECT_TAX,
|
|
|
- AllowanceProjectEnum::PROJECT_WAGES,
|
|
|
- AllowanceProjectEnum::PROJECT_ATTENDANCE,
|
|
|
- AllowanceProjectEnum::PROJECT_SB_PENSION,
|
|
|
- AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT,
|
|
|
- AllowanceProjectEnum::PROJECT_SB_MEDICA,
|
|
|
- //AllowanceProjectEnum::PROJECT_WORKDAY,
|
|
|
- ];
|
|
|
+ $projects = AllowanceProjectEnum::getProjectsByEnterpriseType($info["type"]);
|
|
|
$list = [];
|
|
|
foreach ($projects as $project) {
|
|
|
$months = "";
|
|
@@ -929,9 +952,13 @@ class TalentAllowance extends EnterpriseController {
|
|
|
$whr[] = ["ti.enterprise_id", "=", $this->user["uid"]];
|
|
|
$whr[] = ["e.type", "=", $this->user["type"]];
|
|
|
$whr[] = ["ti.id", "not in", $ids];
|
|
|
- $list = \app\enterprise\model\Talent::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")->field("ti.id,ti.name,ti.card_number as idCard,ti.cur_entry_time")->where($whr)->select()->toArray();
|
|
|
+ $list = \app\enterprise\model\Talent::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")->field("ti.id,ti.name,ti.card_number as idCard,ti.cur_entry_time,e.`type` as eType")->where($whr)->select()->toArray();
|
|
|
foreach ($list as $info) {
|
|
|
- if (strtotime($year . "-12-31") >= strtotime($info["identifyMonth"])) {
|
|
|
+ $identifyTime = $info["identifyMonth"];
|
|
|
+ if ($info["eType"] == CommonConst::ENTERPRISE_JC) {
|
|
|
+ $identifyTime = $info["identifyGetTime"] ?: $info["identifyMonth"];
|
|
|
+ }
|
|
|
+ if (strtotime($year . "-12-31") >= strtotime($identifyTime)) {
|
|
|
$res[] = $info;
|
|
|
} else {
|
|
|
$whereTypeChange = [];
|
|
@@ -940,7 +967,11 @@ class TalentAllowance extends EnterpriseController {
|
|
|
$whereTypeChange[] = ["isPublic", "=", 6];
|
|
|
$typeChanges = TalentTypeChange::where($whereTypeChange)->select()->toArray();
|
|
|
foreach ($typeChanges as $typeChange) {
|
|
|
- if (strtotime($year . "-12-31") >= strtotime($typeChange["oldIdentifyMonth"])) {
|
|
|
+ $oldIdentifyTime = $typeChange["oldIdentifyMonth"];
|
|
|
+ if ($typeChange["type"] == CommonConst::ENTERPRISE_JC) {
|
|
|
+ $oldIdentifyTime = $typeChange["oldIdentifyGetTime"] ?: $typeChange["oldIdentifyMonth"];
|
|
|
+ }
|
|
|
+ if (strtotime($year . "-12-31") >= strtotime($oldIdentifyTime)) {
|
|
|
$res[] = $info;
|
|
|
break;
|
|
|
}
|