Selaa lähdekoodia

生物防控人员

523096025 1 vuosi sitten
vanhempi
commit
17b8e3b8bf

+ 1 - 1
huimv-receive/src/main/java/com/huimv/receive/config/ApiPrefixAutoConfiguration.java

@@ -10,7 +10,7 @@ public class ApiPrefixAutoConfiguration implements WebMvcConfigurer {
 
     @Override
     public void configurePathMatch(PathMatchConfigurer configurer) {
-        configurer.addPathPrefix("/huatongApi",  c -> c.isAnnotationPresent(RestController.class));
+        configurer.addPathPrefix("/secureApi",  c -> c.isAnnotationPresent(RestController.class));
     }
 
 }

+ 26 - 27
huimv-receive/src/main/java/com/huimv/receive/config/InterceptorConfig.java

@@ -1,27 +1,26 @@
-package com.huimv.receive.config;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-
-/**
- * @Description: 注册验证tocken的拦截器
- * @Author
- * @Date 2021/4/19 20:41
- * @Version V1.0
- */
-@Configuration
-public class InterceptorConfig implements WebMvcConfigurer {
-    @Bean
-    public JWTInterceptor jwtInterceptor(){
-        return new JWTInterceptor();
-    }
-
-    @Override
-    public void addInterceptors(InterceptorRegistry registry) {
-        registry.addInterceptor(jwtInterceptor()).
-                excludePathPatterns("/huatongApi/admin/my/*")
-                .excludePathPatterns("/huatongApi/receive/feed");
-    }
-}
+//package com.huimv.receive.config;
+//
+//import org.springframework.context.annotation.Bean;
+//import org.springframework.context.annotation.Configuration;
+//import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+//
+///**
+// * @Description: 注册验证tocken的拦截器
+// * @Author
+// * @Date 2021/4/19 20:41
+// * @Version V1.0
+// */
+//@Configuration
+//public class InterceptorConfig implements WebMvcConfigurer {
+//    @Bean
+//    public JWTInterceptor jwtInterceptor(){
+//        return new JWTInterceptor();
+//    }
+//
+//    @Override
+//    public void addInterceptors(InterceptorRegistry registry) {
+//        registry.addInterceptor(jwtInterceptor()).
+//                excludePathPatterns("/secureApi/admin/my/**");
+//    }
+//}

+ 82 - 82
huimv-receive/src/main/java/com/huimv/receive/config/JWTInterceptor.java

@@ -1,82 +1,82 @@
-package com.huimv.receive.config;
-
-import com.alibaba.fastjson.JSONObject;
-import com.huimv.receive.common.token.TokenConstant;
-import com.huimv.receive.common.token.TokenSign;
-import io.jsonwebtoken.Claims;
-import org.springframework.web.method.HandlerMethod;
-import org.springframework.web.servlet.HandlerInterceptor;
-import org.springframework.web.servlet.ModelAndView;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * <p>
- * jwt拦截器
- * </p>
- *
- * @since 2021/4/19
- */
-public class JWTInterceptor implements HandlerInterceptor {
-
-
-    @Override
-    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
-        // 如果不是映射到方法,则直接通过
-        if (!(handler instanceof HandlerMethod)) {
-            return true;
-        }
-
-        response.setContentType("application/json;charset=utf-8");
-        // 获取token
-        String token = request.getHeader("accessToken");
-
-
-        if (null == token) {
-            Map<String, Object> map = new HashMap<>();
-            map.put("data", "token is null");
-            map.put("code", "401");
-            response.setStatus(401);
-            response.getWriter().write(JSONObject.toJSONString(map));
-            return false;
-        } else {
-            Claims claims = TokenSign.getClaims(token);
-            if (claims == null) {
-                Map<String, Object> map = new HashMap<>();
-                map.put("data", "token is overdue");
-                map.put("code", "403");
-                response.setStatus(403);
-                response.getWriter().write(JSONObject.toJSONString(map));
-                return false;
-            }
-
-            boolean result = TokenSign.verify(token);
-            if (result) {
-                //更新存储的token信息
-                TokenConstant.updateTokenMap(token);
-                return true;
-            }
-            Map<String, Object> map = new HashMap<>();
-            map.put("data", "token is null");
-            map.put("code", "401");
-            response.setStatus(401);
-            response.getWriter().write(JSONObject.toJSONString(map));
-            return false;
-
-        }
-    }
-
-
-    @Override
-    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
-
-    }
-
-    @Override
-    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
-
-    }
-}
+//package com.huimv.receive.config;
+//
+//import com.alibaba.fastjson.JSONObject;
+//import com.huimv.receive.common.token.TokenConstant;
+//import com.huimv.receive.common.token.TokenSign;
+//import io.jsonwebtoken.Claims;
+//import org.springframework.web.method.HandlerMethod;
+//import org.springframework.web.servlet.HandlerInterceptor;
+//import org.springframework.web.servlet.ModelAndView;
+//
+//import javax.servlet.http.HttpServletRequest;
+//import javax.servlet.http.HttpServletResponse;
+//import java.util.HashMap;
+//import java.util.Map;
+//
+///**
+// * <p>
+// * jwt拦截器
+// * </p>
+// *
+// * @since 2021/4/19
+// */
+//public class JWTInterceptor implements HandlerInterceptor {
+//
+//
+//    @Override
+//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
+//        // 如果不是映射到方法,则直接通过
+//        if (!(handler instanceof HandlerMethod)) {
+//            return true;
+//        }
+//
+//        response.setContentType("application/json;charset=utf-8");
+//        // 获取token
+//        String token = request.getHeader("accessToken");
+//
+//
+//        if (null == token) {
+//            Map<String, Object> map = new HashMap<>();
+//            map.put("data", "token is null");
+//            map.put("code", "401");
+//            response.setStatus(401);
+//            response.getWriter().write(JSONObject.toJSONString(map));
+//            return false;
+//        } else {
+//            Claims claims = TokenSign.getClaims(token);
+//            if (claims == null) {
+//                Map<String, Object> map = new HashMap<>();
+//                map.put("data", "token is overdue");
+//                map.put("code", "403");
+//                response.setStatus(403);
+//                response.getWriter().write(JSONObject.toJSONString(map));
+//                return false;
+//            }
+//
+//            boolean result = TokenSign.verify(token);
+//            if (result) {
+//                //更新存储的token信息
+//                TokenConstant.updateTokenMap(token);
+//                return true;
+//            }
+//            Map<String, Object> map = new HashMap<>();
+//            map.put("data", "token is null");
+//            map.put("code", "401");
+//            response.setStatus(401);
+//            response.getWriter().write(JSONObject.toJSONString(map));
+//            return false;
+//
+//        }
+//    }
+//
+//
+//    @Override
+//    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
+//
+//    }
+//
+//    @Override
+//    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
+//
+//    }
+//}

+ 106 - 15
huimv-receive/src/main/java/com/huimv/receive/controller/SysUserController.java

@@ -1,12 +1,29 @@
 package com.huimv.receive.controller;
 
 
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.huimv.receive.common.utils.IDCardValidator;
+import com.huimv.receive.common.utils.PhoneNumberValidator;
+import com.huimv.receive.common.utils.Result;
+import com.huimv.receive.common.utils.ResultCode;
+import com.huimv.receive.entity.SysAccountMultilevel;
+import com.huimv.receive.entity.SysUser;
+import com.huimv.receive.service.ISysAccountMultilevelService;
+import com.huimv.receive.service.ISysUserService;
 import com.huimv.receive.service.IUserService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 @RestController
 @RequestMapping("/admin/user")
@@ -15,21 +32,12 @@ public class SysUserController {
     @Autowired
     private IUserService iUserService;
 
-//    @PostMapping("/add")
-//    public Result addUser(@RequestBody User user){
-//        return  iUserService.addUser(user);
-//    }
-//
-//    @PostMapping("/edit")
-//    public Result updateUser(@RequestBody User user){
-//        return iUserService.updateUser(user);
-//    }
-//
-//    @RequestMapping("/remove")
-//    public Result removeUser(@RequestParam("userIds") List<Integer> userIds) {
-//
-//        return iUserService.removeUser(userIds);
-//    }
+    @Autowired
+    private ISysUserService sysUserService;
+
+    @Autowired
+    private ISysAccountMultilevelService accountMultilevelService;
+
 
     @PostMapping("/list")
     public JSONObject listUser(@RequestBody Map map) {
@@ -39,5 +47,88 @@ public class SysUserController {
         String searchStr = (String)map.get("searchStr");
         return iUserService.findUserAccount(searchStr,pageNum,pageSize);
     }
+    //员工分页查询
+    @PostMapping("/page")
+    public Result page(@RequestBody Map map) {
+        return sysUserService.pageAll(map);
+    }
+
+    //员工新增
+    @PostMapping("/add")
+    public Result add(@RequestBody SysUser sysUser) {
+        String cardType = sysUser.getCardType();
+        String cardNum = sysUser.getCardNum();
+        if ("身份证".equals(cardType) && !IDCardValidator.isValidIDCard(cardNum))
+            return new Result(10001,"身份证格式不正确",false);
+
+        String userPhone = sysUser.getUserPhone();
+        if (!PhoneNumberValidator.isValidPhoneNumber(userPhone))
+            return new Result(10001,"手机号格式不正确",false);
+
+        int count = sysUserService.count(new QueryWrapper<SysUser>().eq("card_type", cardType).eq("card_num", cardNum));
+        if (count >0)
+            return new Result(10001,"身份证已存在",false);
+
+        int countUserPhone = sysUserService.count(new QueryWrapper<SysUser>().eq("user_phone", userPhone));
+        if (countUserPhone >0)
+            return new Result(10001,"身份证已存在",false);
+        if (ObjectUtil.isNotEmpty(sysUser.getBirthday())){
+            sysUser.setAge(DateUtil.ageOfNow(sysUser.getBirthday()));
+        }
+        sysUserService.save(sysUser);
+        return new Result(10000,"保存成功",true);
+    }
+
+    //查询工作地点
+    @PostMapping("/listWorkLocation")
+    public Result listWorkLocation(@RequestBody Map map) {
+        return sysUserService.listWorkLocation(map);
+    }
+
+    @PostMapping("/update")
+    public Result update(@RequestBody SysUser sysUser) {
+        String cardType = sysUser.getCardType();
+        String cardNum = sysUser.getCardNum();
+        if ("身份证".equals(cardType) && !IDCardValidator.isValidIDCard(cardNum))
+            return new Result(10001,"身份证格式不正确",false);
+
+        String userPhone = sysUser.getUserPhone();
+        if (!PhoneNumberValidator.isValidPhoneNumber(userPhone))
+            return new Result(10001,"手机号格式不正确",false);
+
+        int count = sysUserService.count(new QueryWrapper<SysUser>().eq("card_type", cardType).eq("card_num", cardNum));
+        if (count >1)
+            return new Result(10001,"身份证已存在",false);
+
+        int countUserPhone = sysUserService.count(new QueryWrapper<SysUser>().eq("user_phone", userPhone));
+        if (countUserPhone >1)
+            return new Result(10001,"身份证已存在",false);
+        if (ObjectUtil.isNotEmpty(sysUser.getBirthday())){
+            sysUser.setAge(DateUtil.ageOfNow(sysUser.getBirthday()));
+        }
+        sysUserService.save(sysUser);
+        return new Result(10000,"保存成功",true);
+    }
+
+    @PostMapping("/remove")
+    @Transactional
+    public Result remove(@RequestBody Map<String,String> map) {
+        String ids = map.get("ids");
+        if (StringUtils.isBlank(ids))
+            return new Result(10001,"所选用户不存在",false);
+        List<String> collection = Arrays.stream(ids.split(","))
+                .collect(Collectors.toList());
+         sysUserService.removeByIds(collection);
+         //删除账号
+        accountMultilevelService.remove(new QueryWrapper<SysAccountMultilevel>().in("user_id",collection));
+        return new Result(10000,"删除成功",true);
+    }
+
+    //账号查询
+    @PostMapping("/pageAccount")
+    public Result pageAccount(@RequestBody Map<String,Object> map) {
+        return  sysUserService.pageAccount(map);
+    }
+
 
 }

+ 1 - 0
huimv-receive/src/main/java/com/huimv/receive/entity/SysAccountMultilevel.java

@@ -60,5 +60,6 @@ public class SysAccountMultilevel extends Model {
     private String papersType;
     private String papersCode;
     private String wechatId;
+    private Integer userId;
 
 }

+ 158 - 0
huimv-receive/src/main/java/com/huimv/receive/entity/SysUser.java

@@ -0,0 +1,158 @@
+package com.huimv.receive.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author author
+ * @since 2023-09-04
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("sys_user")
+public class SysUser implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 员工工号
+     */
+    private String userId;
+
+    /**
+     * 员工姓名
+     */
+    private String userName;
+
+    /**
+     * 0 男  1女
+     */
+    private Integer male;
+
+    /**
+     * 民族
+     */
+    private String nation;
+
+    /**
+     * 国籍
+     */
+    private String nationality;
+
+    /**
+     * 籍贯
+     */
+    private String nativePlace;
+
+    /**
+     * 出生日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
+    private Date birthday;
+
+    /**
+     * 政治面貌
+     */
+    private String politicsPace;
+
+    /**
+     * 户口类型
+     */
+    private String peopleType;
+
+    /**
+     * 教育水平
+     */
+    private String educationalLevel;
+
+    /**
+     * 证件类型
+     */
+    private String cardType;
+
+    /**
+     * 年龄
+     */
+    private Integer age;
+
+    /**
+     * 证件号码
+     */
+    private String cardNum;
+
+    /**
+     * 个人电话
+     */
+    private String userPhone;
+
+    /**
+     * 办公电话
+     */
+    private String publicPhone;
+
+    /**
+     * 个人邮箱
+     */
+    private String userMali;
+
+    /**
+     * 办公邮箱
+     */
+    private String publicMali;
+
+    /**
+     * 入职时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
+    private Date entryTime;
+
+    /**
+     * 试用期
+     */
+    private String probation;
+
+    /**
+     * 部门
+     */
+    private String department;
+
+    /**
+     * 工作岗位 1 场长,3生物安全负责人 ,4 pcr 检测人员,5洗消站点工作人员
+     */
+    private Integer job;
+
+    /**
+     * 工作性质
+     */
+    private String jobType;
+
+    /**
+     * 工作地点
+     */
+    private String workLocation;
+
+    /**
+     * 1人员初级洗消站 2净区 3人员二级洗消站 4场内 5生产区 6车辆初级洗消站 7车辆二级洗消站 8中转料塔外围 9车辆三级洗消站 10销售中转站 11环保区洗消中心 12环保区净区 13洗消中心净区
+     */
+    private Integer workLocationType;
+    private String farmId;
+
+
+}

+ 16 - 0
huimv-receive/src/main/java/com/huimv/receive/mapper/SysUserMapper.java

@@ -0,0 +1,16 @@
+package com.huimv.receive.mapper;
+
+import com.huimv.receive.entity.SysUser;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author author
+ * @since 2023-09-04
+ */
+public interface SysUserMapper extends BaseMapper<SysUser> {
+
+}

+ 2 - 0
huimv-receive/src/main/java/com/huimv/receive/service/ISysAccountMultilevelService.java

@@ -8,6 +8,7 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -34,4 +35,5 @@ public interface ISysAccountMultilevelService extends IService<SysAccountMultile
     Result listSubordinateByFarm(String farmId, Integer userId);
 
     Result updateUser(HttpServletRequest httpServletRequest, MultipartFile img, String userName, String phone, Integer workPost, String workLocation, String workLocationId, String workName, String papersType, String papersCode) throws IOException;
+
 }

+ 25 - 0
huimv-receive/src/main/java/com/huimv/receive/service/ISysUserService.java

@@ -0,0 +1,25 @@
+package com.huimv.receive.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.huimv.receive.common.utils.Result;
+import com.huimv.receive.entity.SysUser;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.Map;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author author
+ * @since 2023-09-04
+ */
+public interface ISysUserService extends IService<SysUser> {
+
+    Result pageAll(Map map);
+
+    Result listWorkLocation(Map map);
+
+    Result pageAccount(Map<String, Object> map);
+}

+ 115 - 0
huimv-receive/src/main/java/com/huimv/receive/service/impl/SysUserServiceImpl.java

@@ -0,0 +1,115 @@
+package com.huimv.receive.service.impl;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.huimv.receive.common.utils.Result;
+import com.huimv.receive.common.utils.ResultCode;
+import com.huimv.receive.entity.BaseLocation;
+import com.huimv.receive.entity.Farm;
+import com.huimv.receive.entity.SysUser;
+import com.huimv.receive.mapper.SysUserMapper;
+import com.huimv.receive.service.IBaseLocationService;
+import com.huimv.receive.service.IFarmService;
+import com.huimv.receive.service.ISysUserService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.aspectj.weaver.ast.Var;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Map;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author author
+ * @since 2023-09-04
+ */
+@Service
+public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {
+
+    @Autowired
+    private IBaseLocationService baseLocationService;
+    @Autowired
+    private IFarmService farmService;
+
+    @Override
+    public Result pageAll(Map map) {
+        int pageNum = (Integer)map.get("pageNum");
+        int pageSize = (Integer)map.get("pageSize");
+        String searchStr = (String)map.get("searchStr");
+        Integer job = (Integer)map.get("job");
+        Integer workLocation = (Integer)map.get("workLocation");
+        String workLocationType = (String)map.get("workLocationType");
+        String farmId = (String) map.get("farmId");
+        if (checkFarm(farmId))
+           return new Result(10001,"牧场信息为空",false);
+
+        QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
+        if (ObjectUtil.isEmpty(pageNum) || pageNum<1)
+            pageNum = 1;
+        if (ObjectUtil.isEmpty(pageSize) || pageSize<1 )
+            pageNum = 10;
+        wrapper.eq("farm_id",farmId);
+        wrapper.eq(ObjectUtil.isNotEmpty(job),"job",job);
+        wrapper.eq(ObjectUtil.isNotEmpty(workLocation),"work_location",workLocation);
+        wrapper.eq(StringUtils.isNotBlank(workLocationType),"work_location_type",workLocationType);
+        if (StringUtils.isNotBlank(searchStr))
+            wrapper.and(i -> i.like("user_name",searchStr).or().like("user_phone",searchStr));
+        wrapper.orderByDesc("id");
+        IPage<SysUser> page = this.page(new Page<>(pageNum, pageSize), wrapper);
+        return new Result(ResultCode.SUCCESS,page);
+
+    }
+
+    @Override
+    public Result listWorkLocation(Map map) {
+        String farmId = (String)map.get("farmId");
+        if (checkFarm(farmId))
+            return new Result(10001,"牧场信息为空",false);
+        return new Result(ResultCode.SUCCESS,baseLocationService.list(new QueryWrapper<BaseLocation>().eq("farm_id",farmId).groupBy("location_type").orderByAsc("location_type")));
+    }
+
+    @Override
+    public Result pageAccount(Map<String, Object> map) {
+        int pageNum = (Integer)map.get("pageNum");
+        int pageSize = (Integer)map.get("pageSize");
+        String searchStr = (String)map.get("searchStr");
+        Integer job = (Integer)map.get("job");
+        Integer workLocation = (Integer)map.get("workLocation");
+        String workLocationType = (String)map.get("workLocationType");
+        String farmId = (String) map.get("farmId");
+        if (checkFarm(farmId))
+            return new Result(10001,"牧场信息为空",false);
+
+        QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
+        if (ObjectUtil.isEmpty(pageNum) || pageNum<1)
+            pageNum = 1;
+        if (ObjectUtil.isEmpty(pageSize) || pageSize<1 )
+            pageNum = 10;
+        wrapper.eq("farm_id",farmId);
+        wrapper.eq(ObjectUtil.isNotEmpty(job),"job",job);
+        wrapper.eq(ObjectUtil.isNotEmpty(workLocation),"work_location",workLocation);
+        wrapper.eq(StringUtils.isNotBlank(workLocationType),"work_location_type",workLocationType);
+        if (StringUtils.isNotBlank(searchStr))
+            wrapper.and(i -> i.like("user_name",searchStr).or().like("user_phone",searchStr));
+        wrapper.orderByDesc("id");
+        IPage<SysUser> page = this.page(new Page<>(pageNum, pageSize), wrapper);
+        return new Result(ResultCode.SUCCESS,page);
+    }
+
+    private boolean checkFarm(String farmId){
+        if (StringUtils.isBlank(farmId) )
+            return true;
+        Farm byId = farmService.getById(farmId);
+        if (ObjectUtil.isEmpty(byId))
+            return true;
+        return false;
+    }
+}

+ 1 - 77
huimv-receive/src/main/java/com/huimv/receive/service/impl/UserServiceImpl.java

@@ -106,82 +106,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         }
         return dataJo;
     }
-//
-//    @Override
-//    public Result addUser(User user) {
-//        try {
-//            int count = 0;
-//            count = this.count(new QueryWrapper<User>().eq("user_name", user.getUserName()));
-//            if (count > 0){
-//                return new Result(10001,"该用户名已存在",false);
-//            }
-//
-//            count = this.count(new QueryWrapper<User>().eq("mobile", user.getMobile()));
-//            if (count > 0){
-//                return new Result(10001,"该手机号已注册",false);
-//            }
-//            SnowflakeSequence idWorker = new SnowflakeSequence();
-//            long userId = idWorker.nextId();
-//            // 添加用户信息
-//            user.setUserId(userId+"");
-//            userMapper.insert(user);
-//
-//            // 添加账号信息
-//            String mobile = user.getMobile();
-//            String userName = user.getUserName();
-//            Account Account = new Account();
-//            if (mobile != null && !"".equals(mobile) ){
-//                Account.setAccountName(mobile);
-//            }else if (userName != null && !"".equals(userName)){
-//                Account.setAccountName(userName);
-//            }
-//            Account.setAccountStatus(0);
-//            Account.setRemark("");
-//            Account.setPassword("123456");
-//            Account.setUserId(userId+"");
-//            Account.setMobile(mobile);
-//            accountMapper.insert(Account);
-//            return new Result(10000,"添加成功",true);
-//        }catch (Exception e){
-//            return new Result(10001,"添加失败",false);
-//        }
-//    }
-//
-//    @Override
-//    public Result updateUser(User user) {
-//            if (user == null) {
-//                return  new Result(ResultCode.FAIL);
-//            }
-//            User byId = this.getById(user);
-//            QueryWrapper<Account> accountQueryWrapper = new QueryWrapper<>();
-//            accountQueryWrapper.eq("user_id",byId.getUserId());
-//            Account account = accountMapper.selectOne(accountQueryWrapper);
-//            out.println(byId);
-//            out.println(account);
-//            account.setMobile(byId.getMobile());
-//            account.setAccountName(byId.getUserName());
-//            accountMapper.updateById(account);
-//
-//            userMapper.updateById(user);
-//            return new Result(10000,"修改成功",true);
-//    }
-//
-//    @Override
-//    public Result removeUser(List<Integer> userIds) {
-//        for (Integer userId : userIds) {
-//            try {
-//                User user = this.userMapper.selectById(userId);
-//                if (user == null) {
-//                    return new Result(10002,"请选择数据",false);
-//                }
-//                this.userMapper.deleteById(userId);
-//                // 删除账号
-//                this.accountMapper.deleteById(userId);
-//            }catch (Exception e){
-//                return new Result(10001,"删除失败",false);
-//            }
-//        }
-//        return new Result(10000,"删除成功",false);
-//    }
+
 
 }

+ 19 - 0
huimv-receive/src/main/java/com/huimv/receive/timer/SafeTimer.java

@@ -1,11 +1,14 @@
 package com.huimv.receive.timer;
 
 
+import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.huimv.receive.entity.BillIsolate;
+import com.huimv.receive.entity.SysUser;
 import com.huimv.receive.entity.BillPcr;
 import com.huimv.receive.service.IBillIsolateService;
 import com.huimv.receive.service.IBillPcrService;
+import com.huimv.receive.service.ISysUserService;
 import com.huimv.receive.service.IConfigurationService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
@@ -31,6 +34,9 @@ public class SafeTimer {
     @Autowired
     private IConfigurationService configurationService;
 
+    @Autowired
+    private ISysUserService sysUserService;
+
 
     @Scheduled(cron = "0 0/1 * * * ? ")
     private void getShenChan() throws Exception {
@@ -67,4 +73,17 @@ public class SafeTimer {
         }
     }
 
+    //计算年龄
+    @Scheduled(cron = "0 0 0 * * ? ")
+    private void getAge()   {
+        List<SysUser> sysUsers = sysUserService.list(null);
+        for (SysUser sysUser : sysUsers) {
+            int i = DateUtil.ageOfNow(sysUser.getBirthday());
+            if (i !=sysUser.getAge() ){
+                sysUser.setAge(i);
+                sysUserService.updateById(sysUser);
+            }
+        }
+    }
+
 }

+ 34 - 0
huimv-receive/src/main/resources/mapper/SysUserMapper.xml

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.huimv.receive.mapper.SysUserMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.huimv.receive.entity.SysUser">
+        <id column="id" property="id" />
+        <result column="user_id" property="userId" />
+        <result column="user_name" property="userName" />
+        <result column="male" property="male" />
+        <result column="nation" property="nation" />
+        <result column="nationality" property="nationality" />
+        <result column="native_place" property="nativePlace" />
+        <result column="birthday" property="birthday" />
+        <result column="politics_pace" property="politicsPace" />
+        <result column="people_type" property="peopleType" />
+        <result column="educational_level" property="educationalLevel" />
+        <result column="card_type" property="cardType" />
+        <result column="age" property="age" />
+        <result column="card_num" property="cardNum" />
+        <result column="user_phone" property="userPhone" />
+        <result column="public_phone" property="publicPhone" />
+        <result column="user_mali" property="userMali" />
+        <result column="public_mali" property="publicMali" />
+        <result column="entry_time" property="entryTime" />
+        <result column="probation" property="probation" />
+        <result column="department" property="department" />
+        <result column="job" property="job" />
+        <result column="job_type" property="jobType" />
+        <result column="work_location" property="workLocation" />
+        <result column="work_location_type" property="workLocationType" />
+    </resultMap>
+
+</mapper>