2 Коммиты c2971f7110 ... 67a8b4677e

Автор SHA1 Сообщение Дата
  LiRong 67a8b4677e 后台数据修改bug месяцев назад: 3
  LiRong 51b84006e1 后台数据修改bug месяцев назад: 3

+ 3 - 2
leromro-admin/src/main/java/com/leromro/web/controller/system/SysUserController.java

@@ -8,6 +8,7 @@ import com.leromro.common.core.domain.R;
 import com.leromro.common.core.domain.entity.SysDept;
 import com.leromro.common.core.domain.entity.SysRole;
 import com.leromro.common.core.domain.entity.SysUser;
+import com.leromro.common.core.domain.entity.SysUserVO;
 import com.leromro.common.core.page.TableDataInfo;
 import com.leromro.common.enums.BusinessType;
 import com.leromro.common.utils.SecurityUtils;
@@ -70,13 +71,13 @@ public class SysUserController extends BaseController {
 
     @ApiOperation("后台客户列表接口")
     @GetMapping("/userList")
-    public TableDataInfo<SysUser> userList(SysUser user) {
+    public TableDataInfo<SysUserVO> userList(SysUser user) {
 
         SysUser sysUser = sysUserServiceImpl.selectUserById(SecurityUtils.getUserId());
         user.setAreaType(sysUser.getAreaType());
         user.setDeptId(SecurityUtils.getDeptId());
         startPage();
-        List<SysUser> list = userService.userList(user);
+        List<SysUserVO> list = userService.userList(user);
         return getDataTable(list);
     }
 

+ 201 - 0
leromro-common/src/main/java/com/leromro/common/core/domain/entity/SysUserVO.java

@@ -0,0 +1,201 @@
+package com.leromro.common.core.domain.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.leromro.common.annotation.Excel;
+import com.leromro.common.annotation.Excels;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class SysUserVO {
+    /** 用户ID */
+    @Excel(name = "用户序号", type = Excel.Type.EXPORT, cellType = Excel.ColumnType.NUMERIC, prompt = "用户编号")
+    @TableId(value = "user_id", type = IdType.AUTO)
+    private Long userId;
+
+    /** 用户OpenID */
+    private String userOpenId;
+    /** 部门ID */
+    @Excel(name = "部门编号", type = Excel.Type.IMPORT)
+    private Long deptId;
+
+    /** 用户账号 */
+    @Excel(name = "登录名称")
+    private String userName;
+
+    /** 用户昵称 */
+    @Excel(name = "用户名称")
+    private String nickName;
+
+    public String getAreaType() {
+        return areaType;
+    }
+
+    public void setAreaType(String areaType) {
+        this.areaType = areaType;
+    }
+
+    @Excel(name = "区域类型")
+    private String areaType;
+
+    /** 用户邮箱 */
+    @Excel(name = "用户邮箱")
+    private String email;
+
+    /** 手机号码 */
+    @Excel(name = "手机号码", cellType = Excel.ColumnType.TEXT)
+    private String phonenumber;
+
+    /** 用户性别 */
+    @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
+    private String sex;
+
+    /** 用户性别 */
+    @Excel(name = "用户年龄")
+    private String age;
+
+
+    /** 用户头像 */
+    private String avatar;
+
+    /** 密码 */
+    private String password;
+
+    /** 帐号状态(0正常 1停用) */
+    @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
+    private String status;
+
+    /** 删除标志(0代表存在 2代表删除) */
+    private String delFlag;
+
+    /** 最后登录IP */
+    @Excel(name = "最后登录IP", type = Excel.Type.EXPORT)
+    private String loginIp;
+
+    /** 最后登录时间 */
+    @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT)
+    private Date loginDate;
+
+    /** 部门对象 */
+    @Excels({
+            @Excel(name = "部门名称", targetAttr = "deptName", type = Excel.Type.EXPORT),
+            @Excel(name = "部门负责人", targetAttr = "leader", type = Excel.Type.EXPORT)
+    })
+    @TableField(exist = false)
+    private SysDept dept;
+
+    /** 角色对象 */
+    @TableField(exist = false)
+    private List<SysRole> roles;
+
+    /** 角色组 */
+    @TableField(exist = false)
+    private Long[] roleIds;
+
+    /** 岗位组 */
+    @TableField(exist = false)
+    private Long[] postIds;
+
+    /** 角色ID */
+    @TableField(exist = false)
+    private Long roleId;
+
+    /** 平台 web:0 小程序:1 **/
+
+    private Integer userPlatform ;
+
+    /** 1 用户  2 志愿者 **/
+    private Integer userOrWorker;
+
+    @TableField("province_code")
+    @ApiModelProperty("省级区划编号")
+    private String provinceCode;
+
+    /** 省级名称 */
+    @TableField("province_name")
+    @ApiModelProperty("省级名称")
+    private String provinceName;
+
+    /** 市级编号 */
+    @TableField("city_code")
+    @ApiModelProperty("市级编号")
+    private String cityCode;
+
+    /** 市级名称 */
+    @TableField("city_name")
+    @ApiModelProperty("市级名称")
+    private String cityName;
+
+    /** 区级区划编号 */
+    @TableField("district_code")
+    @ApiModelProperty("区级区划编号")
+    private String districtCode;
+
+    /** 区级名称 */
+    @TableField("district_name")
+    @ApiModelProperty("区级名称")
+    private String districtName;
+
+    @TableField("longitude")
+    @ApiModelProperty("经度")
+    private String longitude;
+
+    /** 详细地址 */
+    @TableField("latitude")
+    @ApiModelProperty("纬度")
+    private String latitude;
+
+    @TableField("name")
+    @ApiModelProperty("真实姓名")
+    private String name;
+
+    @TableField("id_card")
+    @ApiModelProperty("身份证号")
+    private String idCard;
+
+    @TableField("face_picture")
+    @ApiModelProperty("志愿者人脸照片")
+    private String facePicture;
+
+    @TableField("id_card_picture_front")
+    @ApiModelProperty("身份证正面照片")
+    private String idCardPictureFront;
+
+    @TableField("id_card_picture_back")
+    @ApiModelProperty("身份证背面照片")
+    private String idCardPictureBack;
+
+    @TableField("is_face_approve")
+    @ApiModelProperty("是否人脸核身0否1是")
+    private String isFaceApprove;
+
+    // 当前积分
+    private Long point;
+
+    // 冻结积分
+    private Long freezePoint;
+
+
+    // 推荐用户id
+    private Long referrerUserId;
+
+    // 推荐服务中心id
+    private Long referrerServiceCentreId;
+
+    // 归属服务中心id
+    private Long serviceCentreId;
+
+    // 推荐区域公司id
+    private Long referrerAreaId;
+
+    // 推荐区域公司id
+    private Long areaId;
+
+    // 推荐人姓名
+    private String referrerUserName;
+}

+ 1 - 0
leromro-core/src/main/java/com/leromro/core/controller/OrgStatDataController.java

@@ -164,6 +164,7 @@ public class OrgStatDataController extends BaseController {
         SysDept sysDept = deptService.selectDeptById(SecurityUtils.getDeptId());
         if (sysDept.getAreaType().equals("4")) {
             sysUser.setDeptId(SecurityUtils.getDeptId());
+            sysUser.setAreaType("4");
         }
         // 获取今天、昨天、本月第一天/最后一天(时间部分为 00:00:00)
         Date today = DateUtil.beginOfDay(DateUtils.getNowDate());

+ 1 - 7
leromro-core/src/main/java/com/leromro/core/controller/VolunteerInfoController.java

@@ -51,8 +51,6 @@ import java.util.Objects;
 public class VolunteerInfoController extends BaseController {
     @Autowired
     private IVolunteerInfoService volunteerInfoService;
-    @Autowired
-    private SysUserMapper sysUserMapper;
 
     @Autowired
     private IVolunteerFaceRecordService volunteerFaceRecordService;
@@ -116,11 +114,7 @@ public class VolunteerInfoController extends BaseController {
     })*/
     @GetMapping("/web/list")
     public TableDataInfo<VolunteerInfoWebVO> webList(VolunteerInfoDTO dto) {
-        SysUser sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId());
-        if (Objects.equals(sysUser.getAreaType(), "4")) {
-            //如果是服务中心,那就把服务中心id传进去,查的时候联查
-            dto.setServiceCenterId(SecurityUtils.getDeptId());
-        }
+
         startPage();
         List<VolunteerInfoWebVO> list = volunteerInfoService.webList(dto);
         return getDataTable(list);

+ 5 - 0
leromro-core/src/main/java/com/leromro/core/domain/vo/VolunteerInfoWebVO.java

@@ -138,6 +138,11 @@ public class VolunteerInfoWebVO {
     @ApiModelProperty("区级名称")
     private String districtName;
 
+    @ApiModelProperty("邀请人")
+    private String referrerUserName;
+    @ApiModelProperty("邀请人id")
+    private Long referrerUserId;
+
     /** 创建时间 */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @TableField(fill = FieldFill.INSERT)

+ 33 - 3
leromro-core/src/main/java/com/leromro/core/service/impl/VolunteerInfoServiceImpl.java

@@ -34,6 +34,7 @@ import com.leromro.core.utils.DateTimeUtil;
 import com.leromro.core.utils.ForestNodeMerger;
 import com.leromro.core.utils.SendSmsUtil;
 import com.leromro.framework.config.ConstantsConfig;
+import com.leromro.system.mapper.SysUserMapper;
 import com.leromro.system.service.ISysConfigService;
 import com.leromro.system.service.ISysUserService;
 import com.leromro.system.service.impl.SysUserServiceImpl;
@@ -99,6 +100,9 @@ public class VolunteerInfoServiceImpl extends ServiceImpl<VolunteerInfoMapper, V
 
     @Autowired
     private SendSmsUtil sendSmsUtil;
+    @Autowired
+    private SysUserMapper sysUserMapper;
+
 
     /**
      * 新增志愿者信息
@@ -177,8 +181,29 @@ public class VolunteerInfoServiceImpl extends ServiceImpl<VolunteerInfoMapper, V
      */
     @Override
     public List<VolunteerInfoWebVO> webList(VolunteerInfoDTO dto) {
-        List<VolunteerInfoWebVO> infos = volunteerInfoMapper.webList(new ListPermission(VolunteerInfo.class, CommonConstants.CHECK_PROVINCE_CITY_DISTRICT),dto);
-        return infos;
+        SysUser sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId());
+        if (Objects.equals(sysUser.getAreaType(), "4")) {
+            //如果是服务中心,那就把服务中心id传进去,查的时候联查
+            dto.setServiceCenterId(SecurityUtils.getDeptId());
+            List<VolunteerInfoWebVO> volunteerInfoWebVOS = volunteerInfoMapper.webList(null, dto);
+            volunteerInfoWebVOS.forEach(volunteerInfoWebVO -> {
+                if (("微信用户").equals(volunteerInfoWebVO.getReferrerUserName())){
+                    volunteerInfoWebVO.setReferrerUserName("微信用户"+volunteerInfoWebVO.getReferrerUserId());
+                }
+            });
+            return  volunteerInfoWebVOS;
+        }else {
+
+            List<VolunteerInfoWebVO> volunteerInfoWebVOS =   volunteerInfoMapper.webList(new ListPermission(VolunteerInfo.class, CommonConstants.CHECK_PROVINCE_CITY_DISTRICT),dto);
+            volunteerInfoWebVOS.forEach(volunteerInfoWebVO -> {
+                if (("微信用户").equals(volunteerInfoWebVO.getReferrerUserName())){
+                    volunteerInfoWebVO.setReferrerUserName("微信用户"+volunteerInfoWebVO.getReferrerUserId());
+                }
+            });
+            return  volunteerInfoWebVOS;
+        }
+
+
     }
 
     /**     小程序用户志愿者列表
@@ -247,7 +272,12 @@ public class VolunteerInfoServiceImpl extends ServiceImpl<VolunteerInfoMapper, V
      */
     @Override
     public List<VolunteerInfo> selectVolunteerGroupByUserId(SysUser sysUser) {
-        return volunteerInfoMapper.selectVolunteerGroupByUserId(new ListPermission(VolunteerInfo.class, CommonConstants.CHECK_PROVINCE_CITY_DISTRICT),sysUser);
+        if (("4").equals(sysUser.getAreaType())){
+            return volunteerInfoMapper.selectVolunteerGroupByUserId(null,sysUser);
+        }else {
+            return volunteerInfoMapper.selectVolunteerGroupByUserId(new ListPermission(VolunteerInfo.class, CommonConstants.CHECK_PROVINCE_CITY_DISTRICT),sysUser);
+        }
+
     }
 
     /**

+ 3 - 1
leromro-core/src/main/resources/mapper/core/VolunteerInfoMapper.xml

@@ -37,7 +37,9 @@
 
     <select id="webList" resultType="com.leromro.core.domain.vo.VolunteerInfoWebVO"
             parameterType="com.leromro.core.domain.vo.VolunteerInfoWebVO">
-        select * from l_volunteer_info lvi left join sys_user su on lvi.volunteer_id = su.user_id
+        select *,(select s.nick_name from sys_user s where su.referrer_user_id = s.user_id ) as referrerUserName ,
+        (select s.user_id from sys_user s where su.referrer_user_id = s.user_id ) as referrerUserId
+        from l_volunteer_info lvi left join sys_user su on lvi.volunteer_id = su.user_id
         <where>
             <if test="dto.serviceCategory != null "> and lvi.service_category = #{dto.serviceCategory}</if>
             <if test="dto.phonenumber != null">and lvi.phonenumber = #{dto.phonenumber}</if>

+ 2 - 1
leromro-system/src/main/java/com/leromro/system/mapper/SysUserMapper.java

@@ -3,6 +3,7 @@ package com.leromro.system.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.leromro.common.core.domain.ListPermission;
 import com.leromro.common.core.domain.entity.SysUser;
+import com.leromro.common.core.domain.entity.SysUserVO;
 import com.leromro.system.domain.dto.UserUnfreezePointDTO;
 import com.leromro.system.domain.vo.UserPointInfoVO;
 import org.apache.ibatis.annotations.Param;
@@ -130,7 +131,7 @@ public interface SysUserMapper extends BaseMapper<SysUser>
      */
     public SysUser checkEmailUnique(String email);
 
-    List<SysUser> userList(ListPermission listPermission,@Param("user") SysUser user);
+    List<SysUserVO> userList(ListPermission listPermission,@Param("user") SysUser user);
 
     void addPoint(SysUser user);
 

+ 2 - 1
leromro-system/src/main/java/com/leromro/system/service/ISysUserService.java

@@ -2,6 +2,7 @@ package com.leromro.system.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.leromro.common.core.domain.entity.SysUser;
+import com.leromro.common.core.domain.entity.SysUserVO;
 import com.leromro.system.domain.dto.UserUnfreezePointDTO;
 import com.leromro.system.domain.vo.UserPointInfoVO;
 
@@ -208,7 +209,7 @@ public interface ISysUserService extends IService<SysUser>
      */
     public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
 
-    List<SysUser> userList(SysUser user);
+    List<SysUserVO> userList(SysUser user);
 
     /**
      * 添加积分

+ 26 - 4
leromro-system/src/main/java/com/leromro/system/service/impl/SysUserServiceImpl.java

@@ -8,6 +8,7 @@ import com.leromro.common.constant.UserConstants;
 import com.leromro.common.core.domain.ListPermission;
 import com.leromro.common.core.domain.entity.SysRole;
 import com.leromro.common.core.domain.entity.SysUser;
+import com.leromro.common.core.domain.entity.SysUserVO;
 import com.leromro.common.exception.ServiceException;
 import com.leromro.common.utils.SecurityUtils;
 import com.leromro.common.utils.StringUtils;
@@ -560,9 +561,25 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     }
 
     @Override
-    public List<SysUser> userList(SysUser user) {
-
-        return baseMapper.userList(new ListPermission(SysUser.class, CommonConstants.CHECK_PROVINCE_CITY_DISTRICT) ,user);
+    public List<SysUserVO> userList(SysUser user) {
+        if (user.getAreaType().equals("4")){
+            List<SysUserVO> sysUserVOS = baseMapper.userList(null, user);
+            sysUserVOS.forEach(sysUserVO -> {
+                if (("微信用户").equals(sysUserVO.getReferrerUserName())){
+                    sysUserVO.setReferrerUserName("微信用户"+sysUserVO.getUserId());
+                }
+            });
+            return sysUserVOS;
+        }else {
+
+            List<SysUserVO> sysUserVOS =  baseMapper.userList(new ListPermission(SysUser.class, CommonConstants.CHECK_PROVINCE_CITY_DISTRICT) ,user);
+            sysUserVOS.forEach(sysUserVO -> {
+                if (("微信用户").equals(sysUserVO.getReferrerUserName())){
+                    sysUserVO.setReferrerUserName("微信用户"+sysUserVO.getUserId());
+                }
+            });
+            return sysUserVOS;
+        }
     }
 
     @Override
@@ -595,6 +612,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     }
 
     public List<SysUser> selectClientList(SysUser sysUser) {
-       return sysUserMapper.selectClientList(new ListPermission(SysUser.class, CommonConstants.CHECK_PROVINCE_CITY_DISTRICT), sysUser);
+        if (("4").equals(sysUser.getAreaType())){
+            return sysUserMapper.selectClientList(null, sysUser);
+        }else {
+            return sysUserMapper.selectClientList(new ListPermission(SysUser.class, CommonConstants.CHECK_PROVINCE_CITY_DISTRICT), sysUser);
+        }
+
     }
 }

+ 8 - 4
leromro-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -171,17 +171,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
 		select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
 	</select>
-	<select id="userList" resultType="com.leromro.common.core.domain.entity.SysUser">
-		select * from sys_user
+	<select id="userList" resultType="com.leromro.common.core.domain.entity.SysUserVO">
+		select * ,(select  sr.nick_name  from sys_user sr where sr.user_id = su.referrer_user_id)  as referrerUserName
+		from sys_user su
 		<where>
-			del_flag = '0' and  user_open_id IS NOT NULL and user_platform = 0
+			su.del_flag = '0' and  su.user_open_id IS NOT NULL and su.user_platform = 0
 			<choose>
 				<when test="user != null and user.deptId != null and user.areaType != null">
 					<choose>
-						<when test='user.areaType == "4"'>and service_centre_id = #{user.deptId}</when>
+						<when test='user.areaType == "4"'>and su.service_centre_id = #{user.deptId}</when>
 					</choose>
 				</when>
 			</choose>
+		<if test="user.nickName != null and user.nickName != ''">and su.nick_name like concat('%', #{user.nickName}, '%')</if>
+		<if test="user.phonenumber != null and user.phonenumber != ''">and su.phonenumber like concat('%', #{user.phonenumber}, '%')</if>
 		</where>
 		order by create_time desc
     </select>
@@ -201,6 +204,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		</where>
 	</select>
 
+
 	<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
  		insert into sys_user(
  			<if test="userId != null and userId != 0">user_id,</if>