Ver Fonte

扫码签到,增加用户查询

wy há 2 anos atrás
pai
commit
fdd0e8b0a2

+ 11 - 0
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/wx/dao/EmployeeMapper.java

@@ -0,0 +1,11 @@
+package com.lc.ibps.wx.dao;
+
+import com.lc.ibps.wx.entity.Employee;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+
+@Mapper
+public interface EmployeeMapper {
+    Employee findByName(@Param("mobile")String mobile, @Param("name")String name);
+}

+ 49 - 0
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/wx/entity/Employee.java

@@ -0,0 +1,49 @@
+package com.lc.ibps.wx.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+
+@TableName("ibps_party_employee")
+public class Employee {
+    private static final long serialVersionUID = 1L;
+    @ApiModelProperty(value = "主键")
+    protected String  id; 		/*主键*/
+    @ApiModelProperty(value = "名称")
+    protected String  name; 		/*名称*/
+    @ApiModelProperty(value = "电话")
+    protected String  mobile; 		/*名称*/
+    @ApiModelProperty(value = "部门")
+    protected String positions;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getPositions() {
+        return positions;
+    }
+
+    public void setPositions(String positions) {
+        this.positions = positions;
+    }
+}

+ 7 - 0
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/wx/services/EmployeeService.java

@@ -0,0 +1,7 @@
+package com.lc.ibps.wx.services;
+
+import com.lc.ibps.wx.entity.Employee;
+
+public interface EmployeeService {
+    Employee findByName(String mobile, String name);
+}

+ 19 - 0
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/wx/services/impl/EmployeeServiceImpl.java

@@ -0,0 +1,19 @@
+package com.lc.ibps.wx.services.impl;
+
+import com.lc.ibps.wx.dao.EmployeeMapper;
+import com.lc.ibps.wx.entity.Employee;
+import com.lc.ibps.wx.services.EmployeeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class EmployeeServiceImpl implements EmployeeService {
+    @Autowired
+    private EmployeeMapper employeeMapper;
+
+    @Override
+    public Employee findByName(String mobile, String name) {
+
+        return employeeMapper.findByName(mobile,name);
+    }
+}

+ 14 - 15
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/wx/services/impl/wxServicesImpl.java

@@ -5,17 +5,20 @@ import cn.hutool.core.util.IdUtil;
 import cn.hutool.http.HttpUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.lc.ibps.base.core.util.AppUtil;
 import com.lc.ibps.cloud.entity.APIPageList;
 import com.lc.ibps.cloud.entity.APIRequest;
 import com.lc.ibps.cloud.entity.APIResult;
 import com.lc.ibps.cloud.redis.utils.RedisUtil;
 import com.lc.ibps.config.JcjdConfig;
+import com.lc.ibps.org.api.IPartyPositionService;
 import com.lc.ibps.org.party.persistence.entity.PartyEmployeePo;
 import com.lc.ibps.sysdata.dao.UpdateDataTableDao;
 import com.lc.ibps.wx.dao.FileAttachmentMapper;
 import com.lc.ibps.wx.dao.HyqdDao;
 import com.lc.ibps.wx.dao.WxyhDao;
 import com.lc.ibps.wx.entity.*;
+import com.lc.ibps.wx.services.EmployeeService;
 import com.lc.ibps.wx.services.UserRoleService;
 import com.lc.ibps.wx.services.UserSituationService;
 import com.lc.ibps.wx.services.wxServices;
@@ -59,9 +62,11 @@ public class wxServicesImpl implements wxServices {
     UserSituationService userSituationService;
     @Autowired
     FileAttachmentMapper fileAttachmentMapper;
+    @Autowired
+    EmployeeService employeeService;
 
 
-    //直接签到
+    //直接签到findByParams
     public APIResult<Void> openId(@RequestParam String code, @RequestParam String state) {
         APIResult<Void> apiResult = new APIResult<>();
         log.info("签到:",code+"  "+state);
@@ -97,21 +102,14 @@ public class wxServicesImpl implements wxServices {
             hyqd.setHuiYiChangJing(state);
             hyqd.setShouJi(wxUser.getShouJi());
             hyqd.setQianDaoShiJian(DateUtil.now()); //存放签到时间
-            //获取系统用户添加签到表
-            APIRequest request = new APIRequest(1,10);
-            request.addParameters("Q^NAME_^SL",map.get("name").toString());
-            request.addParameters("Q^MOBILE_^SL",map.get("mobile").toString());
-            APIResult<APIPageList<PartyEmployeePo>> query = employeeServiceClient.query(request);
-            List<PartyEmployeePo> result = query.getData().getDataResult();
-            PartyEmployeePo employeePo = result.get(0);
-            hyqd.setBuMen(employeePo.getPositions());//部门
-            String role = userRoleService.findUserRole(employeePo.getId());
+            Employee employee = employeeService.findByName(wxUser.getShouJi(),wxUser.getXingMing());
+            hyqd.setBuMen(employee.getPositions());//部门
+            String role = userRoleService.findUserRole(employee.getId());
             hyqd.setGangWeiJiaoSe(!role.isEmpty() ? role:""); //角色
-            UserSituation user = userSituationService.findByUserId(hyqd.getId());
+            UserSituation user = userSituationService.findByUserId(employee.getId());
             FileAttachment file = fileAttachmentMapper.findByid(user.getQianZiTuWen());
             hyqd.setQianZiTuWen(!file.getId().isEmpty()?file.getId():"");//签字图文
             hyqd.setTuWenMingCheng(!file.fileName.isEmpty()?file.fileName:"");//图文名称
-
             hyqdDao.add(hyqd);
             apiResult.setMessage("签到成功!");
             apiResult.setState(JcjdConfig.successful);
@@ -221,10 +219,11 @@ public class wxServicesImpl implements wxServices {
             hyqd.setHuiYiChangJing(map.get("state").toString());  //场景id
             hyqd.setQianDaoRenYuan(employeePo.getName());  //用户名
             hyqd.setQianDaoShiJian(DateUtil.now()); //存放签到时间
-            hyqd.setBuMen(employeePo.getPositions());//部门
-            String role = userRoleService.findUserRole(employeePo.getId());
+            Employee employee = employeeService.findByName(wxUser.getShouJi(),wxUser.getXingMing());
+            hyqd.setBuMen(employee.getPositions());//部门
+            String role = userRoleService.findUserRole(employee.getId());
             hyqd.setGangWeiJiaoSe(!role.isEmpty() ? role:""); //角色
-            UserSituation user = userSituationService.findByUserId(hyqd.getId());
+            UserSituation user = userSituationService.findByUserId(employee.getId());
             FileAttachment file = fileAttachmentMapper.findByid(user.getQianZiTuWen());
             hyqd.setQianZiTuWen(!file.getId().isEmpty()?file.getId():"");//签字图文
             hyqd.setTuWenMingCheng(!file.fileName.isEmpty()?file.fileName:"");//图文名称

+ 18 - 0
ibps-provider-root/modules/provider-business/src/main/resources/com/lc/ibps/klimsibps/mapping/Employee.xml

@@ -0,0 +1,18 @@
+<?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.lc.ibps.wx.dao.EmployeeMapper">
+    <!--<cache type="net.oschina.j2cache.mybatis.J2CacheAdapter"/>-->
+    <resultMap id="UserRole" type="com.lc.ibps.wx.entity.Employee">
+        <id property="id" column="ID_" jdbcType="VARCHAR"/>
+        <result property="name" column="NAME_" jdbcType="VARCHAR"/>
+        <result property="mobile" column="MOBILE_" jdbcType="VARCHAR"/>
+        <result property="positions" column="POSITIONS_" jdbcType="VARCHAR"/>
+    </resultMap>
+    <sql id="columns">
+        ID_,NAME_,MOBILE_,POSITIONS_
+    </sql>
+
+    <select id="findByName" resultMap="UserRole">
+        select (<include refid="columns"/>) from ibps_party_employee where NAME_ = #{name,jdbcType=VARCHAR} and MOBILE_ = #{mobile,jdbcType=VARCHAR}
+    </select>
+</mapper>