sugangqiang 1 ano atrás
pai
commit
5b596eb189

+ 105 - 0
app/admin/controller/AmountStandard.php

@@ -0,0 +1,105 @@
+<?php
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+namespace app\admin\controller;
+
+use app\admin\common\AdminController;
+use think\facade\Db;
+use app\common\api\Response;
+use app\common\api\DictApi;
+
+/**
+ * Description of AmountStandard
+ *
+ * @author sgq
+ */
+class AmountStandard extends AdminController {
+
+    public function index() {
+        return view("");
+    }
+
+    public function list() {
+        $params = $this->request->param();
+        $order = $params["order"] ?: "asc";
+        $offset = $params["offset"] ?: 0;
+        $limit = $params["limit"] ?: 10;
+        $where[] = ["type", "=", $this->user["type"]];
+        if ($params["allowanceType"]) {
+            $where[] = ["allowanceType", "=", $params["allowanceType"]];
+        }
+        $count = Db::table("sys_amount_standard")->where($where)->count();
+        $list = Db::table("sys_amount_standard")->where($where)->limit($offset, $limit)->order("createTime " . $order)->select()->toArray();
+        $levelMap = DictApi::selectByParentCode("talent_arrange");
+        foreach ($list as &$item) {
+            $item["talentArrangeName"] = $levelMap[$item["talentArrange"]];
+        }unset($item);
+        return json(["total" => $count, "rows" => $list]);
+    }
+
+    public function add() {
+        if ($this->request->isPost()) {
+            return $this->save();
+        }
+        return view("edit", ["type" => $this->user["type"]]);
+    }
+
+    public function edit() {
+        $info = Db::table("sys_amount_standard")->where("id", $this->request["id"])->find();
+        if ($this->request->isPost()) {
+            return $this->save();
+        }
+        return view("", ["info" => $info, "type" => $this->user["type"]]);
+    }
+
+    public function detail() {
+        $info = Db::table("sys_amount_standard")->where("id", $this->request["id"])->find();
+        return view("", ["info" => $info, "type" => $this->user["type"]]);
+    }
+
+    public function delete() {
+        if (!$this->request["id"])
+            return new Response(Response::ERROR, "删除失败");
+        Db::table("sys_amount_standard")->where("id", $this->request["id"])->delete();
+        return new Response(Response::SUCCESS, "删除成功");
+    }
+
+    private function save() {
+        $param = $this->request->param();
+        if (!$param) {
+            return new Response(Response::ERROR, "请填写相关信息");
+        }
+        if (!$param["money"] || !is_numeric($param["money"]) || $param["money"] < 0) {
+            return new Response(Response::ERROR, "金额填写错误");
+        }
+        $data["type"] = $this->user["type"];
+        $data["allowanceType"] = $param["allowanceType"];
+        $data["talentArrange"] = $param["talentArrange"];
+        $data["money"] = $param["money"];
+        $data["description"] = $param["description"];
+        try {
+            if ($param["id"]) {
+                $data["id"] = $param["id"];
+                $data["updateTime"] = date("Y-m-d H:i:s");
+                $data["updateUser"] = $this->user["uid"];
+                Db::table("sys_amount_standard")->save($data);
+                $msg = "修改成功";
+            } else {
+                $data["id"] = getStringId();
+                $data["createTime"] = date("Y-m-d H:i:s");
+                $data["createUser"] = $this->user["uid"];
+                Db::table("sys_amount_standard")->insert($data);
+                $msg = "添加成功";
+            }
+            return new Response(Response::SUCCESS, $msg);
+        } catch (\think\db\exception\DbException $ex) {
+            return new Response(Response::ERROR, "数据异常,操作失败:" . $ex->getCode());
+        }
+    }
+
+}

+ 177 - 72
app/admin/controller/TalentAllowance.php

@@ -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;
     }
 
     /**

+ 78 - 0
app/admin/view/amount_standard/edit.html

@@ -0,0 +1,78 @@
+{extend name="layout/content"}
+{block name="content"}
+<div class="ibox float-e-margins">
+    <div class="ibox-content">
+        <form id="amountForm">
+            <div class="form-horizontal">
+                <div class="row">
+                    <div class="col-sm-6">
+                        <input type="hidden" id="id" name="id" value="{$info.id}">
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">
+                                人才类型
+                            </label>
+                            <div class="col-sm-9">
+                                <select class="form-control" id="type" name="type" selectVal="{$info.type}">
+                                    <option value="">---请选择---</option>
+                                    {eq name="type" value="1"}<option value="1">晋江市优秀人才</option>{/eq}
+                                    {eq name="type" value="2"}<option value="2">集成电路优秀人才</option>{/eq}
+                                    {eq name="type" value="5"}<option value="5">卫健人才</option>{/eq}
+                                    {eq name="type" value="6"}<option value="6">高教人才</option>{/eq}
+                                </select>
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">
+                                津贴类型
+                            </label>
+                            <div class="col-sm-9">
+                                <select class="form-control" id="allowanceType" name="allowanceType" selectVal="{$info.allowanceType}">
+                                    <option value="">---请选择---</option>
+                                    <option value="1">工作津贴</option>
+                                    <option value="2">一次性交通补贴</option>
+                                </select>
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">备注</label>
+                            <div class="col-sm-9">
+                                <input class="form-control" id="description" name="description" value="{$info.description}" type="text">
+                            </div>
+                        </div>
+                    </div>
+                    <div class="col-sm-6">
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">
+                                人才层次
+                            </label>
+                            <div class="col-sm-9">
+                                <select class="form-control" id="talentArrange" name="talentArrange" selectVal="{$info.talentArrange}">
+                                </select>
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">金额</label>
+                            <div class="col-sm-9">
+                                <input class="form-control" id="money" name="money" value="{$info.money}" type="text">
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="row btn-group-m-t">
+                    <div class="col-sm-12" style="text-align: center">
+                        <button type="button" class="btn btn-sm btn-info " onclick="{gt name='info.id' value='0'}AmountStandardInfoDlg.editSubmit(){else/}AmountStandardInfoDlg.addSubmit(){/gt}" id="ensure">
+                            <i class="fa fa-check"></i>&nbsp;提交
+                        </button>
+                        <button type="button" class="btn btn-sm btn-danger " onclick="AmountStandardInfoDlg.close()" id="cancel">
+                            <i class="fa fa-eraser"></i>&nbsp;取消
+                        </button>
+                    </div>
+                </div>
+            </div>
+        </form>
+    </div>
+</div>
+<script type="text/javascript">
+    document.write('<script src="/static/modular/system/amountStandard/amountStandard_info.js?v=' + (new Date()).getTime() + '"><\/script>');
+</script>
+{/block}

+ 69 - 0
app/admin/view/amount_standard/index.html

@@ -0,0 +1,69 @@
+{extend name="layout/content"}
+{block name="content"}
+<div class="row">
+    <div class="col-sm-12">
+        <div class="ibox float-e-margins">
+            <div class="ibox-title">
+                <h5>人才津贴配置管理</h5>
+            </div>
+            <div class="ibox-content">
+                <div class="row row-lg">
+                    <div class="col-sm-12">
+                        <div class="row">
+                            <div class="col-sm-3">
+                                <div class="input-group input-group-sm">
+                                    <div class="input-group-btn">
+                                        <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">
+                                            津贴类型
+                                        </button>
+                                    </div>
+                                    <select class="form-control" id="allowanceType">
+                                        <option value="">---请选择---</option>
+                                        <option value="1">工作津贴(元/月)</option>
+                                        <option value="2">一次性交通补贴(元)</option>
+                                    </select>
+                                </div>
+                            </div>
+                            <div class="col-sm-3">
+                                <button type="button" class="btn btn-sm btn-primary " onclick="AmountStandard.search()" id="">
+                                    <i class="fa fa-search"></i>&nbsp;搜索
+                                </button>
+                                <button type="button" class="btn btn-sm btn-primary " onclick="AmountStandard.reset()" id="">
+                                    <i class="fa fa-trash"></i>&nbsp;重置
+                                </button>
+                            </div>
+                        </div>
+                        <div class="hidden-xs" id="AmountStandardTableToolbar" role="group">
+                            {if condition="chkCommission('/admin/amountStandard/add','/amountStandard/add')"} 
+                            <button type="button" class="btn btn-sm btn-primary " onclick="AmountStandard.openAddAmountStandard()" id="">
+                                <i class="fa fa-plus"></i>&nbsp;添加
+                            </button>
+                            {/if}  
+                            {if condition="chkCommission('/admin/amountStandard/update','/amountStandard/update')"}   
+                            <button type="button" class="btn btn-sm btn-primary " onclick="AmountStandard.openAmountStandardDetail()" id="">
+                                <i class="fa fa-edit"></i>&nbsp;修改
+                            </button>
+                            {/if}  
+                            {if condition="chkCommission('/admin/amountStandard/delete','/amountStandard/delete')"}   
+                            <button type="button" class="btn btn-sm btn-primary " onclick="AmountStandard.delete()" id="">
+                                <i class="fa fa-remove"></i>&nbsp;删除
+                            </button>
+                            {/if}
+                        </div>
+                        <table id="AmountStandardTable" class="table-condensed" style="font-size: 14px;table-layout: fixed!important;" data-mobile-responsive="true" data-click-to-select="true">
+                            <thead>
+                                <tr>
+                                    <th data-field="selectItem" data-checkbox="true"></th>
+                                </tr>
+                            </thead>
+                        </table>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<script type="text/javascript">
+    document.write('<script src="/static/modular/system/amountStandard/amountStandard.js?v=' + (new Date()).getTime() + '"><\/script>');
+</script>
+{/block}

+ 7 - 2
app/enterprise/controller/TalentAllowance.php

@@ -266,7 +266,7 @@ class TalentAllowance extends EnterpriseController {
         foreach ($typeList as $talentTypeChange) {
             $startTime = $talentTypeChange["oldIdentifyMonth"];
             $endTime = $talentTypeChange["newIdentifyMonth"];
-            $monthList = \DateUtil::getMonthBetweenDatesNotEnd($startTime, $endTime);
+            $monthList = \DateUtil::getMonthBetweenDatesNotBegin($startTime, $endTime);
             if ($monthList) {
                 $monthList = array_intersect($monthList, $totalMonth);
             }
@@ -338,6 +338,10 @@ class TalentAllowance extends EnterpriseController {
             $monthList = \DateUtil::getMonthBetweenDates($quit["entryTime"], \StrUtil::isEmpOrNull($quit["quitTime"]) ? $year . "-12-31" : $quit["quitTime"]);
             $monthList = array_intersect($monthList, $totalMonth);
             if ($monthList) {
+                $sb = '';
+                foreach ($monthList as $month) {
+                    $sb .= substr($month, 5, 2) . ",";
+                }
                 $list[] = [
                     "id" => getStringId(),
                     "mainId" => $info["id"],
@@ -351,7 +355,8 @@ class TalentAllowance extends EnterpriseController {
                     "gygb" => $quit["gygb"],
                     "identifyGetTime" => $quit["identifyGetTime"],
                     "isQuit" => \StrUtil::isEmpOrNull($quit["quitTime"]) ? 2 : 1,
-                    "post" => $quit["post"]
+                    "post" => $quit["post"],
+                    "months" => rtrim($sb, ",")
                 ];
             }
         }

+ 20 - 1
extend/DateUtil.php

@@ -21,7 +21,7 @@ class DateUtil {
     }
 
     /**
-     * 获取某个时间段内所有月份 (包含开头不包含结尾月份)
+     * 获取某个时间段内所有月份 (包含开头月份,不包含结尾月份)
      * @param minDate
      * @param maxDate
      * @return
@@ -38,4 +38,23 @@ class DateUtil {
         return $months;
     }
 
+    /**
+     * 获取某个时间段内所有月份 (不包含开头月份,包含结尾月份)
+     * @param minDate
+     * @param maxDate
+     * @return
+     * @throws ParseException
+     */
+    public static function getMonthBetweenDatesNotBegin($minDate, $maxDate) {
+        $sTime = strtotime(date('Y-m-01', strtotime($minDate)));
+        $eTime = strtotime(date('Y-m-01', strtotime($maxDate)));
+        $months = [];
+        $sTime = strtotime("next month", $sTime); //第一个月跳过
+        while ($sTime <= $eTime) {
+            $months[] = date('Y-m', $sTime);
+            $sTime = strtotime('next month', $sTime);
+        }
+        return $months;
+    }
+
 }

+ 41 - 38
public/static/modular/system/amountStandard/amountStandard.js

@@ -2,8 +2,8 @@
  * 人才津贴配置管理初始化
  */
 var AmountStandard = {
-    id: "AmountStandardTable",	//表格id
-    seItem: null,		//选中的条目
+    id: "AmountStandardTable", //表格id
+    seItem: null, //选中的条目
     table: null,
     layerIndex: -1
 };
@@ -14,32 +14,35 @@ var AmountStandard = {
 AmountStandard.initColumn = function () {
     return [
         {field: 'selectItem', radio: true},
-            {title: '人才类型', field: 'type', visible: true, align: 'center', valign: 'middle',
-                formatter:function (value,row,index) {
-                    if(value==1){
-                        return "晋江市现代产业体系人才";
-                    }
-                    if(value==2){
-                        return "集成电路优秀人才";
-                    }
+        {title: '人才类型', field: 'type', visible: true, align: 'center', valign: 'middle',
+            formatter: function (value, row, index) {
+                if (value == 1) {
+                    return "晋江市现代产业体系人才";
                 }
-            },
-            {title: '津贴类别', field: 'allowanceType', visible: true, align: 'center', valign: 'middle',
-                formatter:function (value,row,index) {
-                    if(value==1){
-                        return "人才津贴";
-                    }
-                    if(value==2){
-                        return "交通津贴";
-                    }
-                    if(value==3){
-                        return "购房补贴";
-                    }
+                if (value == 2) {
+                    return "集成电路优秀人才";
                 }
-            },
-            {title: '人才层次', field: 'talentArrangeName', visible: true, align: 'center', valign: 'middle'},
-            {title: '金额', field: 'money', visible: true, align: 'center', valign: 'middle'},
-            {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle'}
+                if (value == 5) {
+                    return "卫健人才";
+                }
+                if (value == 6) {
+                    return "高教人才";
+                }
+            }
+        },
+        {title: '津贴类别', field: 'allowanceType', visible: true, align: 'center', valign: 'middle',
+            formatter: function (value, row, index) {
+                if (value == 1) {
+                    return "工作津贴";
+                }
+                if (value == 2) {
+                    return "一次性交通津贴";
+                }
+            }
+        },
+        {title: '人才层次', field: 'talentArrangeName', visible: true, align: 'center', valign: 'middle'},
+        {title: '金额', field: 'money', visible: true, align: 'center', valign: 'middle'},
+        {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle'}
     ];
 };
 
@@ -48,10 +51,10 @@ AmountStandard.initColumn = function () {
  */
 AmountStandard.check = function () {
     var selected = $('#' + this.id).bootstrapTable('getSelections');
-    if(selected.length == 0){
+    if (selected.length == 0) {
         Feng.info("请先选中表格中的某一记录!");
         return false;
-    }else{
+    } else {
         AmountStandard.seItem = selected[0];
         return true;
     }
@@ -67,7 +70,7 @@ AmountStandard.openAddAmountStandard = function () {
         area: ['800px', '420px'], //宽高
         fix: false, //不固定
         maxmin: true,
-        content: Feng.ctxPath + '/amountStandard/amountStandard_add'
+        content: Feng.ctxPath + '/admin/amountStandard/add'
     });
     this.layerIndex = index;
 };
@@ -83,7 +86,7 @@ AmountStandard.openAmountStandardDetail = function () {
             area: ['800px', '420px'], //宽高
             fix: false, //不固定
             maxmin: true,
-            content: Feng.ctxPath + '/amountStandard/amountStandard_update/' + AmountStandard.seItem.id
+            content: Feng.ctxPath + '/admin/amountStandard/edit/id/' + AmountStandard.seItem.id
         });
         this.layerIndex = index;
     }
@@ -94,18 +97,18 @@ AmountStandard.openAmountStandardDetail = function () {
  */
 AmountStandard.delete = function () {
     if (this.check()) {
-        var operation = function() {
-            var ajax = new $ax(Feng.ctxPath + "/amountStandard/delete", function (data) {
-                if(data.code==200){
+        var operation = function () {
+            var ajax = new $ax(Feng.ctxPath + "/admin/amountStandard/delete", function (data) {
+                if (data.code == 200) {
                     AmountStandard.table.refresh();
                     Feng.success(data.msg);
-                }else{
+                } else {
                     Feng.info(data.msg);
                 }
             }, function (data) {
                 Feng.error("删除失败!" + data.responseJSON.message + "!");
             });
-            ajax.set("amountStandardId", this.seItem.id);
+            ajax.set("id", AmountStandard.seItem.id);
             ajax.start();
         };
         Feng.confirm("确定要删除吗?", operation);
@@ -116,7 +119,7 @@ AmountStandard.delete = function () {
  * 查询表单提交参数对象
  * @returns {{}}
  */
-AmountStandard.formParams = function() {
+AmountStandard.formParams = function () {
     var queryData = {};
     queryData['type'] = $("#type").val();
     queryData['allowanceType'] = $("#allowanceType").val();
@@ -133,7 +136,7 @@ AmountStandard.search = function () {
 /**
  * 重置
  */
-AmountStandard.reset = function (){
+AmountStandard.reset = function () {
     $("#type").val("");
     $("#allowanceType").val("");
 }
@@ -141,7 +144,7 @@ AmountStandard.reset = function (){
 
 $(function () {
     var defaultColunms = AmountStandard.initColumn();
-    var table = new BSTable(AmountStandard.id, "/amountStandard/list", defaultColunms);
+    var table = new BSTable(AmountStandard.id, "/admin/amountStandard/list", defaultColunms);
     table.setPaginationType("server");
     AmountStandard.table = table.init();
 });

+ 32 - 28
public/static/modular/system/amountStandard/amountStandard_info.js

@@ -2,7 +2,7 @@
  * 初始化人才津贴配置详情对话框
  */
 var AmountStandardInfoDlg = {
-    amountStandardInfoData : {},
+    amountStandardInfoData: {},
     validateFields: {
         type: {
             validators: {
@@ -30,9 +30,9 @@ var AmountStandardInfoDlg = {
                 notEmpty: {
                     message: '津贴类型不能为空'
                 },
-                regexp :{
-                    regexp: /^\d+$/,
-                    message:"只能输入数字"
+                regexp: {
+                    regexp: /^\d*\.?\d*$/,
+                    message: "只能输入数字"
                 }
             }
         }
@@ -42,7 +42,7 @@ var AmountStandardInfoDlg = {
 /**
  * 清除数据
  */
-AmountStandardInfoDlg.clearData = function() {
+AmountStandardInfoDlg.clearData = function () {
     this.amountStandardInfoData = {};
 }
 
@@ -52,7 +52,7 @@ AmountStandardInfoDlg.clearData = function() {
  * @param key 数据的名称
  * @param val 数据的具体值
  */
-AmountStandardInfoDlg.set = function(key, val) {
+AmountStandardInfoDlg.set = function (key, val) {
     this.amountStandardInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
     return this;
 }
@@ -63,28 +63,28 @@ AmountStandardInfoDlg.set = function(key, val) {
  * @param key 数据的名称
  * @param val 数据的具体值
  */
-AmountStandardInfoDlg.get = function(key) {
+AmountStandardInfoDlg.get = function (key) {
     return $("#" + key).val();
 }
 
 /**
  * 关闭此对话框
  */
-AmountStandardInfoDlg.close = function() {
+AmountStandardInfoDlg.close = function () {
     parent.layer.close(window.parent.AmountStandard.layerIndex);
 }
 
 /**
  * 收集数据
  */
-AmountStandardInfoDlg.collectData = function() {
+AmountStandardInfoDlg.collectData = function () {
     this
-    .set('id')
-    .set('type')
-    .set('allowanceType')
-    .set('talentArrange')
-    .set('money')
-    .set('description');
+            .set('id')
+            .set('type')
+            .set('allowanceType')
+            .set('talentArrange')
+            .set('money')
+            .set('description');
 }
 
 /**
@@ -99,22 +99,22 @@ AmountStandardInfoDlg.validate = function () {
 /**
  * 提交添加
  */
-AmountStandardInfoDlg.addSubmit = function() {
+AmountStandardInfoDlg.addSubmit = function () {
     this.clearData();
     this.collectData();
     if (!this.validate()) {
         return;
     }
     //提交信息
-    var ajax = new $ax(Feng.ctxPath + "/amountStandard/add", function(data){
-        if(data.code=="200"){
+    var ajax = new $ax(Feng.ctxPath + "/admin/amountStandard/add", function (data) {
+        if (data.code == 200) {
             Feng.success(data.msg);
             window.parent.AmountStandard.table.refresh();
             AmountStandardInfoDlg.close();
-        }else{
+        } else {
             Feng.error(data.msg);
         }
-    },function(data){
+    }, function (data) {
         Feng.error("添加失败!" + data.responseJSON.message + "!");
     });
     ajax.set(this.amountStandardInfoData);
@@ -124,25 +124,29 @@ AmountStandardInfoDlg.addSubmit = function() {
 /**
  * 提交修改
  */
-AmountStandardInfoDlg.editSubmit = function() {
+AmountStandardInfoDlg.editSubmit = function () {
     this.clearData();
     this.collectData();
     if (!this.validate()) {
         return;
     }
     //提交信息
-    var ajax = new $ax(Feng.ctxPath + "/amountStandard/update", function(data){
-        Feng.success(data.msg);
-        window.parent.AmountStandard.table.refresh();
-        AmountStandardInfoDlg.close();
-    },function(data){
+    var ajax = new $ax(Feng.ctxPath + "/admin/amountStandard/edit", function (data) {
+        if (data.code == 200) {
+            Feng.success(data.msg);
+            window.parent.AmountStandard.table.refresh();
+            AmountStandardInfoDlg.close();
+        } else {
+            Feng.error(data.msg);
+        }
+    }, function (data) {
         Feng.error("修改失败!" + data.responseJSON.message + "!");
     });
     ajax.set(this.amountStandardInfoData);
     ajax.start();
 }
 
-$(function() {
+$(function () {
     Feng.initValidator("amountForm", AmountStandardInfoDlg.validateFields);
     //下拉框数据动态加载
     Feng.addAjaxSelect({
@@ -150,7 +154,7 @@ $(function() {
         "displayCode": "code",
         "displayName": "name",
         "type": "GET",
-        "url": Feng.ctxPath + "/dict/findChildDictByCode?code=un_talentLevel"
+        "url": Feng.ctxPath + "/common/tool/findChildDictByCode?code=talent_arrange"
     });
     //下拉框数据回显
     $("select").each(function () {