Pārlūkot izejas kodu

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

Lijy 1 gadu atpakaļ
vecāks
revīzija
2b3d536796

+ 5 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserController.java

@@ -237,6 +237,11 @@ public class UserController {
         return userService.setActive(id, isActive);
     }
 
+    @RequestMapping("/setActiveByIds")
+    public HttpRespMsg setActiveByIds(String ids, int isActive) {
+        return userService.setActiveByIds(ids, isActive);
+    }
+
     @RequestMapping("/exportUsers")
     public HttpRespMsg exportUsers(Integer containInvalid) {
         return userService.exportUsers(containInvalid,request);

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/UserMapper.java

@@ -50,4 +50,6 @@ public interface UserMapper extends BaseMapper<User> {
     List<User> getInActiveList(ArrayList<Integer> deptIds, String startDate, String endDate);
 
     List<User> getInActiveBewttenStartAndEndList(ArrayList<Integer> deptIds, String startDate, String endDate);
+
+    void updateActiveByIds(List<String> array, int isActive);
 }

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/UserService.java

@@ -103,4 +103,6 @@ public interface UserService extends IService<User> {
     HttpRespMsg initSystemForAd(String companyName) throws Exception;
 
     HttpRespMsg syncDeptWithAD(HttpServletRequest request) throws Exception;
+
+    HttpRespMsg setActiveByIds(String ids, int isActive);
 }

+ 26 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java

@@ -1819,6 +1819,32 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 
         return msg;
     }
+
+    @Override
+    public HttpRespMsg setActiveByIds(String ids, int isActive) {
+        HttpRespMsg msg = new HttpRespMsg();
+        if (!StringUtils.isEmpty(ids)){
+            List<String> array = JSONArray.parseArray(ids, String.class);
+            if (array.size()>0){
+                //判断人数
+                String token = request.getHeader("Token");
+                User user = userMapper.selectById(token);
+                if (isActive == 1 && userMapper.selectCount(new QueryWrapper<User>()
+                        .eq("company_id", user.getCompanyId()).eq("is_active", 1)) >=
+                        (companyMapper.selectById(user.getCompanyId()).getStaffCountMax())) {
+                    //msg.setError("公司人员已达上限,无法启用");
+                    msg.setError(MessageUtils.message("register.fullError"));
+                } else {
+                    userMapper.updateActiveByIds(array,isActive);
+                }
+            }else {
+                msg.setError(MessageUtils.message("other.peopleNull"));
+            }
+        }else {
+            msg.setError(MessageUtils.message("other.peopleNull"));
+        }
+        return msg;
+    }
 //
 //    private String getAccessToken(String code) {
 //        String accessToken = "";
@@ -3369,7 +3395,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
         }
         return new HttpRespMsg();
     }
-
     public LdapContext adLogin() {
 
         LdapContext ldapContext = null;

+ 7 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/UserMapper.xml

@@ -225,4 +225,11 @@
                AND r.create_date BETWEEN #{startDate} AND #{endDate})
           AND induction_date BETWEEN #{startDate} AND #{endDate} AND inactive_date BETWEEN #{startDate} AND #{endDate}
     </select>
+
+    <update id="updateActiveByIds">
+        update user set is_active=1 WHERE id IN
+        <foreach collection="array" item="id" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+    </update>
 </mapper>

+ 42 - 0
fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue

@@ -271,6 +271,7 @@
                 <el-button size="small" type="primary" @click="handleSelectionZzjgbtn3" v-if="user.userNameNeedTranslate != 1">{{ $t('modifyingDepartments') }}</el-button>
                 <el-button size="small" type="primary" @click="handJue">{{ $t('modifyingRoles') }}</el-button>
                 <el-button size="small" type="primary" @click="workingHoursDialogClick()">修正工时所属部门</el-button>
+                <el-button size="small" type="primary" @click="handleSelectionUser()">批量启用员工</el-button>
                
                 
                 
@@ -1888,6 +1889,47 @@ export default {
       this.handljues = true;
       // console.log('触发了')
     },
+    handleSelectionUser() {
+      // console.log(this.handleSelectionZzjgDate)
+      //接口调用样例代码如下
+      var ids = [];
+      for (
+        let index = 0;
+        index < this.handleSelectionZzjgDate.length;
+        index++
+      ) {
+        ids.push(this.handleSelectionZzjgDate[index].id);
+      }
+      // console.log(ids);
+
+      this.http.post(
+        "/user/setActiveByIds",
+        {
+          ids: JSON.stringify(ids),
+          isActive:1
+        },
+        (res) => {
+          if (res.code == "ok") {
+            this.$message({
+              message: this.$t('message.modifyTheSuccess'),
+              type: "success",
+            });
+            this.getUser();
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error",
+            });
+          }
+        },
+        (error) => {
+          this.$message({
+            message: error,
+            type: "error",
+          });
+        }
+      );
+    },
     handTrue() {
       var arr = [];
       for (var i in this.handleSelectionZzjgDate) {