java110 преди 3 години
родител
ревизия
1bb953f416

+ 25 - 15
java110-bean/src/main/java/com/java110/po/examineStaff/ExamineStaffPo.java

@@ -17,6 +17,7 @@ package com.java110.po.examineStaff;
 
 import java.io.Serializable;
 import java.util.Date;
+
 /**
  * 类表述: Po 数据模型实体对象 基本保持与数据库模型一直 用于 增加修改删除 等时的数据载体
  * add by 吴学文 at 2023-03-07 15:57:29 mail: 928255095@qq.com
@@ -28,41 +29,50 @@ import java.util.Date;
 public class ExamineStaffPo implements Serializable {
 
     private String esId;
-private String staffName;
-private String statusCd = "0";
-private String communityId;
-private String staffId;
-public String getEsId() {
+    private String staffName;
+    private String statusCd = "0";
+    private String communityId;
+    private String staffId;
+
+    public String getEsId() {
         return esId;
     }
-public void setEsId(String esId) {
+
+    public void setEsId(String esId) {
         this.esId = esId;
     }
-public String getStaffName() {
+
+    public String getStaffName() {
         return staffName;
     }
-public void setStaffName(String staffName) {
+
+    public void setStaffName(String staffName) {
         this.staffName = staffName;
     }
-public String getStatusCd() {
+
+    public String getStatusCd() {
         return statusCd;
     }
-public void setStatusCd(String statusCd) {
+
+    public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
     }
-public String getCommunityId() {
+
+    public String getCommunityId() {
         return communityId;
     }
-public void setCommunityId(String communityId) {
+
+    public void setCommunityId(String communityId) {
         this.communityId = communityId;
     }
-public String getStaffId() {
+
+    public String getStaffId() {
         return staffId;
     }
-public void setStaffId(String staffId) {
+
+    public void setStaffId(String staffId) {
         this.staffId = staffId;
     }
 
 
-
 }

+ 64 - 68
java110-db/src/main/resources/mapper/user/ExamineStaffProjectV1ServiceDaoImplMapper.xml

@@ -5,93 +5,89 @@
 <mapper namespace="examineStaffProjectV1ServiceDaoImpl">
 
 
-
-
-
     <!-- 保存员工考核项目信息 add by wuxw 2018-07-03 -->
     <insert id="saveExamineStaffProjectInfo" parameterType="Map">
         insert into examine_staff_project(
-es_id,esp_id,community_id,project_id
-) values (
-#{esId},#{espId},#{communityId},#{projectId}
-)
+        es_id,esp_id,community_id,project_id
+        ) values (
+        #{esId},#{espId},#{communityId},#{projectId}
+        )
     </insert>
 
 
-
     <!-- 查询员工考核项目信息 add by wuxw 2018-07-03 -->
     <select id="getExamineStaffProjectInfo" parameterType="Map" resultType="Map">
-        select  t.es_id,t.es_id esId,t.esp_id,t.esp_id espId,t.status_cd,t.status_cd statusCd,t.community_id,t.community_id communityId,t.project_id,t.project_id projectId 
-from examine_staff_project t 
-where 1 =1 
-<if test="esId !=null and esId != ''">
-   and t.es_id= #{esId}
-</if> 
-<if test="espId !=null and espId != ''">
-   and t.esp_id= #{espId}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="projectId !=null and projectId != ''">
-   and t.project_id= #{projectId}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        select t.es_id,t.es_id esId,t.esp_id,t.esp_id espId,t.status_cd,t.status_cd
+        statusCd,t.community_id,t.community_id communityId,t.project_id,t.project_id projectId
+        from examine_staff_project t
+        where 1 =1
+        <if test="esId !=null and esId != ''">
+            and t.es_id= #{esId}
+        </if>
+        <if test="espId !=null and espId != ''">
+            and t.esp_id= #{espId}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="projectId !=null and projectId != ''">
+            and t.project_id= #{projectId}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
 
     </select>
 
 
-
-
     <!-- 修改员工考核项目信息 add by wuxw 2018-07-03 -->
     <update id="updateExamineStaffProjectInfo" parameterType="Map">
-        update  examine_staff_project t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="esId !=null and esId != ''">
-, t.es_id= #{esId}
-</if> 
-<if test="communityId !=null and communityId != ''">
-, t.community_id= #{communityId}
-</if> 
-<if test="projectId !=null and projectId != ''">
-, t.project_id= #{projectId}
-</if> 
- where 1=1 <if test="espId !=null and espId != ''">
-and t.esp_id= #{espId}
-</if> 
+        update examine_staff_project t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="projectId !=null and projectId != ''">
+            , t.project_id= #{projectId}
+        </if>
+        where 1=1
+        <if test="espId !=null and espId != ''">
+            and t.esp_id= #{espId}
+        </if>
+        <if test="esId !=null and esId != ''">
+            and t.es_id= #{esId}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
 
     </update>
 
     <!-- 查询员工考核项目数量 add by wuxw 2018-07-03 -->
-     <select id="queryExamineStaffProjectsCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from examine_staff_project t 
-where 1 =1 
-<if test="esId !=null and esId != ''">
-   and t.es_id= #{esId}
-</if> 
-<if test="espId !=null and espId != ''">
-   and t.esp_id= #{espId}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="projectId !=null and projectId != ''">
-   and t.project_id= #{projectId}
-</if> 
+    <select id="queryExamineStaffProjectsCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from examine_staff_project t
+        where 1 =1
+        <if test="esId !=null and esId != ''">
+            and t.es_id= #{esId}
+        </if>
+        <if test="espId !=null and espId != ''">
+            and t.esp_id= #{espId}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="projectId !=null and projectId != ''">
+            and t.project_id= #{projectId}
+        </if>
 
 
-     </select>
+    </select>
 
 </mapper>

+ 43 - 1
service-user/src/main/java/com/java110/user/cmd/examine/SaveExamineStaffCmd.java

@@ -15,6 +15,7 @@
  */
 package com.java110.user.cmd.examine;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.annotation.Java110Cmd;
 import com.java110.core.annotation.Java110Transactional;
@@ -22,8 +23,12 @@ import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.dto.user.UserDto;
+import com.java110.intf.user.IExamineStaffProjectV1InnerServiceSMO;
 import com.java110.intf.user.IExamineStaffV1InnerServiceSMO;
+import com.java110.intf.user.IUserV1InnerServiceSMO;
 import com.java110.po.examineStaff.ExamineStaffPo;
+import com.java110.po.examineStaffProject.ExamineStaffProjectPo;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
@@ -32,6 +37,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.List;
+
 /**
  * 类表述:保存
  * 服务编码:examineStaff.saveExamineStaff
@@ -52,25 +59,60 @@ public class SaveExamineStaffCmd extends Cmd {
     @Autowired
     private IExamineStaffV1InnerServiceSMO examineStaffV1InnerServiceSMOImpl;
 
+    @Autowired
+    private IExamineStaffProjectV1InnerServiceSMO examineStaffProjectV1InnerServiceSMOImpl;
+
+    @Autowired
+    private IUserV1InnerServiceSMO userV1InnerServiceSMOImpl;
+
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "staffId", "请求报文中未包含staffId");
-        Assert.hasKeyAndValue(reqJson, "staffName", "请求报文中未包含staffName");
+        Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId");
+
+        if (!reqJson.containsKey("projectIds")) {
+            throw new CmdException("没包含考核项目");
+        }
+
+        JSONArray projectIds = reqJson.getJSONArray("projectIds");
 
+        if (projectIds == null || projectIds.size() < 1) {
+            throw new CmdException("没包含考核项目");
+        }
     }
 
     @Override
     @Java110Transactional
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
 
+        UserDto userDto = new UserDto();
+        userDto.setUserId(reqJson.getString("staffId"));
+        List<UserDto> userDtos = userV1InnerServiceSMOImpl.queryUsers(userDto);
+
+        Assert.listOnlyOne(userDtos, "员工不存在");
+
+
         ExamineStaffPo examineStaffPo = BeanConvertUtil.covertBean(reqJson, ExamineStaffPo.class);
         examineStaffPo.setEsId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
+        examineStaffPo.setStaffName(userDtos.get(0).getStaffName());
         int flag = examineStaffV1InnerServiceSMOImpl.saveExamineStaff(examineStaffPo);
 
         if (flag < 1) {
             throw new CmdException("保存数据失败");
         }
 
+        JSONArray projectIds = reqJson.getJSONArray("projectIds");
+
+        ExamineStaffProjectPo tmpExamineStaffProjectPo = null;
+        for(int projectIndex = 0;projectIndex < projectIds.size();projectIndex ++){
+            tmpExamineStaffProjectPo = new ExamineStaffProjectPo();
+            tmpExamineStaffProjectPo.setEsId(examineStaffPo.getEsId());
+            tmpExamineStaffProjectPo.setCommunityId(examineStaffPo.getCommunityId());
+            tmpExamineStaffProjectPo.setProjectId(projectIds.getString(projectIndex));
+            tmpExamineStaffProjectPo.setEspId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
+            examineStaffProjectV1InnerServiceSMOImpl.saveExamineStaffProject(tmpExamineStaffProjectPo);
+        }
+
         cmdDataFlowContext.setResponseEntity(ResultVo.success());
     }
 }

+ 0 - 76
service-user/src/main/java/com/java110/user/cmd/examine/SaveExamineStaffProjectCmd.java

@@ -1,76 +0,0 @@
-/*
- * Copyright 2017-2020 吴学文 and java110 team.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.java110.user.cmd.examine;
-
-import com.alibaba.fastjson.JSONObject;
-import com.java110.core.annotation.Java110Cmd;
-import com.java110.core.annotation.Java110Transactional;
-import com.java110.core.context.ICmdDataFlowContext;
-import com.java110.core.event.cmd.Cmd;
-import com.java110.core.event.cmd.CmdEvent;
-import com.java110.core.factory.GenerateCodeFactory;
-import com.java110.intf.user.IExamineStaffProjectV1InnerServiceSMO;
-import com.java110.po.examineStaffProject.ExamineStaffProjectPo;
-import com.java110.utils.exception.CmdException;
-import com.java110.utils.util.Assert;
-import com.java110.utils.util.BeanConvertUtil;
-import com.java110.vo.ResultVo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * 类表述:保存
- * 服务编码:examineStaffProject.saveExamineStaffProject
- * 请求路劲:/app/examineStaffProject.SaveExamineStaffProject
- * add by 吴学文 at 2023-03-07 16:09:46 mail: 928255095@qq.com
- * open source address: https://gitee.com/wuxw7/MicroCommunity
- * 官网:http://www.homecommunity.cn
- * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
- * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
- */
-@Java110Cmd(serviceCode = "examine.saveExamineStaffProject")
-public class SaveExamineStaffProjectCmd extends Cmd {
-
-    private static Logger logger = LoggerFactory.getLogger(SaveExamineStaffProjectCmd.class);
-
-    public static final String CODE_PREFIX_ID = "10";
-
-    @Autowired
-    private IExamineStaffProjectV1InnerServiceSMO examineStaffProjectV1InnerServiceSMOImpl;
-
-    @Override
-    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
-        Assert.hasKeyAndValue(reqJson, "esId", "请求报文中未包含esId");
-Assert.hasKeyAndValue(reqJson, "projectId", "请求报文中未包含projectId");
-
-    }
-
-    @Override
-    @Java110Transactional
-    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
-
-       ExamineStaffProjectPo examineStaffProjectPo = BeanConvertUtil.covertBean(reqJson, ExamineStaffProjectPo.class);
-        examineStaffProjectPo.setEspId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
-        int flag = examineStaffProjectV1InnerServiceSMOImpl.saveExamineStaffProject(examineStaffProjectPo);
-
-        if (flag < 1) {
-            throw new CmdException("保存数据失败");
-        }
-
-        cmdDataFlowContext.setResponseEntity(ResultVo.success());
-    }
-}

+ 48 - 0
service-user/src/main/java/com/java110/user/cmd/examine/UpdateExamineStaffCmd.java

@@ -15,14 +15,20 @@
  */
 package com.java110.user.cmd.examine;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.annotation.Java110Cmd;
 import com.java110.core.annotation.Java110Transactional;
 import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.dto.user.UserDto;
+import com.java110.intf.user.IExamineStaffProjectV1InnerServiceSMO;
 import com.java110.intf.user.IExamineStaffV1InnerServiceSMO;
+import com.java110.intf.user.IUserV1InnerServiceSMO;
 import com.java110.po.examineStaff.ExamineStaffPo;
+import com.java110.po.examineStaffProject.ExamineStaffProjectPo;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
@@ -31,6 +37,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.List;
+
 
 /**
  * 类表述:更新
@@ -51,17 +59,39 @@ public class UpdateExamineStaffCmd extends Cmd {
     @Autowired
     private IExamineStaffV1InnerServiceSMO examineStaffV1InnerServiceSMOImpl;
 
+    @Autowired
+    private IExamineStaffProjectV1InnerServiceSMO examineStaffProjectV1InnerServiceSMOImpl;
+
+    @Autowired
+    private IUserV1InnerServiceSMO userV1InnerServiceSMOImpl;
+
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "esId", "esId不能为空");
+        Assert.hasKeyAndValue(reqJson, "staffId", "staffId不能为空");
         Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
 
+        if (!reqJson.containsKey("projectIds")) {
+            throw new CmdException("没包含考核项目");
+        }
+
+        JSONArray projectIds = reqJson.getJSONArray("projectIds");
+
+        if (projectIds == null || projectIds.size() < 1) {
+            throw new CmdException("没包含考核项目");
+        }
     }
 
     @Override
     @Java110Transactional
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
 
+        UserDto userDto = new UserDto();
+        userDto.setUserId(reqJson.getString("staffId"));
+        List<UserDto> userDtos = userV1InnerServiceSMOImpl.queryUsers(userDto);
+
+        Assert.listOnlyOne(userDtos, "员工不存在");
+
         ExamineStaffPo examineStaffPo = BeanConvertUtil.covertBean(reqJson, ExamineStaffPo.class);
         int flag = examineStaffV1InnerServiceSMOImpl.updateExamineStaff(examineStaffPo);
 
@@ -69,6 +99,24 @@ public class UpdateExamineStaffCmd extends Cmd {
             throw new CmdException("更新数据失败");
         }
 
+        ExamineStaffProjectPo tmpExamineStaffProjectPo = null;
+        tmpExamineStaffProjectPo = new ExamineStaffProjectPo();
+        tmpExamineStaffProjectPo.setEsId(examineStaffPo.getEsId());
+        tmpExamineStaffProjectPo.setCommunityId(examineStaffPo.getCommunityId());
+        examineStaffProjectV1InnerServiceSMOImpl.deleteExamineStaffProject(tmpExamineStaffProjectPo);
+
+
+        JSONArray projectIds = reqJson.getJSONArray("projectIds");
+
+        for(int projectIndex = 0;projectIndex < projectIds.size();projectIndex ++){
+            tmpExamineStaffProjectPo = new ExamineStaffProjectPo();
+            tmpExamineStaffProjectPo.setEsId(examineStaffPo.getEsId());
+            tmpExamineStaffProjectPo.setCommunityId(examineStaffPo.getCommunityId());
+            tmpExamineStaffProjectPo.setProjectId(projectIds.getString(projectIndex));
+            tmpExamineStaffProjectPo.setEspId(GenerateCodeFactory.getGeneratorId("11"));
+            examineStaffProjectV1InnerServiceSMOImpl.saveExamineStaffProject(tmpExamineStaffProjectPo);
+        }
+
         cmdDataFlowContext.setResponseEntity(ResultVo.success());
     }
 }

+ 0 - 74
service-user/src/main/java/com/java110/user/cmd/examine/UpdateExamineStaffProjectCmd.java

@@ -1,74 +0,0 @@
-/*
- * Copyright 2017-2020 吴学文 and java110 team.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.java110.user.cmd.examine;
-
-import com.alibaba.fastjson.JSONObject;
-import com.java110.core.annotation.Java110Cmd;
-import com.java110.core.annotation.Java110Transactional;
-import com.java110.core.context.ICmdDataFlowContext;
-import com.java110.core.event.cmd.Cmd;
-import com.java110.core.event.cmd.CmdEvent;
-import com.java110.intf.user.IExamineStaffProjectV1InnerServiceSMO;
-import com.java110.po.examineStaffProject.ExamineStaffProjectPo;
-import com.java110.utils.exception.CmdException;
-import com.java110.utils.util.Assert;
-import com.java110.utils.util.BeanConvertUtil;
-import com.java110.vo.ResultVo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * 类表述:更新
- * 服务编码:examineStaffProject.updateExamineStaffProject
- * 请求路劲:/app/examineStaffProject.UpdateExamineStaffProject
- * add by 吴学文 at 2023-03-07 16:09:46 mail: 928255095@qq.com
- * open source address: https://gitee.com/wuxw7/MicroCommunity
- * 官网:http://www.homecommunity.cn
- * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
- * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
- */
-@Java110Cmd(serviceCode = "examine.updateExamineStaffProject")
-public class UpdateExamineStaffProjectCmd extends Cmd {
-
-    private static Logger logger = LoggerFactory.getLogger(UpdateExamineStaffProjectCmd.class);
-
-
-    @Autowired
-    private IExamineStaffProjectV1InnerServiceSMO examineStaffProjectV1InnerServiceSMOImpl;
-
-    @Override
-    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
-        Assert.hasKeyAndValue(reqJson, "espId", "espId不能为空");
-        Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
-
-    }
-
-    @Override
-    @Java110Transactional
-    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
-
-        ExamineStaffProjectPo examineStaffProjectPo = BeanConvertUtil.covertBean(reqJson, ExamineStaffProjectPo.class);
-        int flag = examineStaffProjectV1InnerServiceSMOImpl.updateExamineStaffProject(examineStaffProjectPo);
-
-        if (flag < 1) {
-            throw new CmdException("更新数据失败");
-        }
-
-        cmdDataFlowContext.setResponseEntity(ResultVo.success());
-    }
-}