caojianbin
8 months ago
11 changed files with 438 additions and 0 deletions
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
package com.ecell.internationalize.system.api; |
||||
import com.ecell.internationalize.common.system.entity.SysUser; |
||||
import org.springframework.cloud.openfeign.FeignClient; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
||||
@FeignClient(name = "ecell-internationalize-security",path="/sys_user",contextId ="ecell-internationalize-security01") |
||||
public interface UserFirmApi { |
||||
|
||||
/** |
||||
* 根据用户名查询 |
||||
* @Author: liy |
||||
* @Date: 2022/7/18 16:34 |
||||
*/ |
||||
@GetMapping("user/queryByUserName") |
||||
SysUser queryByUserName(@RequestParam("userName") String userName); |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,110 @@
@@ -0,0 +1,110 @@
|
||||
package com.ecell.internationalize.system.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.ecell.internationalize.common.core.utils.locale.LocaleUtil; |
||||
import com.ecell.internationalize.common.core.web.domain.AjaxResult; |
||||
import com.ecell.internationalize.common.system.annotation.SystemLog; |
||||
import com.ecell.internationalize.common.system.constant.FieldConstant; |
||||
import com.ecell.internationalize.common.system.entity.User; |
||||
import com.ecell.internationalize.system.service.UserService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.ApiParam; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.validation.Valid; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* <p> |
||||
* 用户表 前端控制器 |
||||
* </p> |
||||
* @author liy |
||||
* @since 2022-07-07 |
||||
*/ |
||||
@Api(value="用户信息",tags={"用户信息接口"}) |
||||
@RestController |
||||
@RequestMapping("/user") |
||||
public class UserController { |
||||
@Autowired |
||||
private UserService userService; |
||||
/** |
||||
* 用户信息条件分页查询 |
||||
* @Author liy |
||||
* @Date 2022/7/7 16:38 |
||||
* @param map 分页条件查询体 |
||||
* @Return IPage |
||||
*/ |
||||
@ApiOperation("条件分页查询用户信息") |
||||
@PostMapping("/page/queryList") |
||||
public AjaxResult queryList(@RequestBody Map<String,Object> map){ |
||||
return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS),userService.queryList(map)); |
||||
|
||||
} |
||||
/** |
||||
* 用户操作条件分页查询 |
||||
* @Author liy |
||||
* @Date 2022/7/8 16:38 |
||||
* @param map 分页条件查询体 |
||||
* @Return IPage |
||||
*/ |
||||
@ApiOperation("条件分页查询用户操作") |
||||
@PostMapping("/page/operatorList") |
||||
public AjaxResult queryOperatorList(@RequestBody Map<String,Object> map){ |
||||
return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS),userService.queryOperatorList(map)); |
||||
} |
||||
/** |
||||
* 用户操作修改密码 |
||||
* @Author liy |
||||
* @Date 2022/7/8 16:38 |
||||
* @param user 用户 |
||||
* @Return AjaxResult |
||||
*/ |
||||
@ApiOperation("用户操作修改密码") |
||||
@SystemLog(msg =FieldConstant.USER_OPERATOR,operation = FieldConstant.UPDATE_OPERATOR) |
||||
@PostMapping("operator/update") |
||||
public AjaxResult updateUser(@RequestBody @Valid User user){ |
||||
return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS),userService.updateById(user)); |
||||
} |
||||
/** |
||||
* 用户操作启用/停用账号 |
||||
* @Author liy |
||||
* @Date 2022/7/8 16:38 |
||||
* @param user 用户 |
||||
* @Return AjaxResult |
||||
*/ |
||||
@ApiOperation("用户操作启用/停用账号") |
||||
@SystemLog(msg =FieldConstant.USER_OPERATOR,operation = FieldConstant.USER_CHANGE_ACCOUNT) |
||||
@PostMapping("operator/changeStatus") |
||||
public AjaxResult changeStatus(@RequestBody @ApiParam(value="传整个对象,修改其中status字段,(0:启用,1:停用)",required=true) User user){ |
||||
return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS),userService.updateById(user)); |
||||
} |
||||
/** |
||||
* 用户操作删除 |
||||
* @Author liy |
||||
* @Date 2022/7/8 16:38 |
||||
* @param user 用户 |
||||
* @Return AjaxResult |
||||
*/ |
||||
@ApiOperation("用户操作删除") |
||||
@SystemLog(msg =FieldConstant.USER_OPERATOR,operation = FieldConstant.DELETE_OPERATOR) |
||||
@PostMapping("operator/del") |
||||
public AjaxResult del(@RequestBody User user){ |
||||
LambdaQueryWrapper<User> lambdaQueryWrapper=new LambdaQueryWrapper<>(); |
||||
lambdaQueryWrapper.eq(User::getUserId,user.getUserId()); |
||||
return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS),userService.getBaseMapper().delete(lambdaQueryWrapper)); |
||||
} |
||||
/** |
||||
* 渠道查询条件 |
||||
* @Author liy |
||||
* @Date 2022/7/8 16:38 |
||||
* @Return AjaxResult |
||||
*/ |
||||
@ApiOperation("渠道查询") |
||||
@GetMapping("operator/queryChannel") |
||||
public AjaxResult queryChannel(){ |
||||
return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS),userService.queryChannel()); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
package com.ecell.internationalize.system.controller; |
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
/** |
||||
* <p> |
||||
* 用户设备绑定表 前端控制器 |
||||
* </p> |
||||
* @author liy |
||||
* @since 2022-07-07 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/user_device_bind_app") |
||||
public class UserDeviceBindAppController { |
||||
|
||||
} |
||||
|
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
package com.ecell.internationalize.system.entity.api.dto; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* <p> |
||||
* 上课禁用(免打扰设置)表 |
||||
* </p> |
||||
* |
||||
* @author ${author} |
||||
* @since 2022-09-13 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@Accessors(chain = true) |
||||
public class UpdateDeviceDisable implements Serializable { |
||||
|
||||
private static final long serialVersionUID=1L; |
||||
|
||||
@ApiModelProperty(example = "主键Id") |
||||
private String id; |
||||
|
||||
@ApiModelProperty(example = "开始响铃时间") |
||||
private String alarmStartTime; |
||||
|
||||
@ApiModelProperty(example = "重复星期数为'0', '1'组成的 7 位长度字符串, 表示周一至周日是否有效 eg: '0000011' 周六日有效, '1110000' 为周一二三有效") |
||||
private String alarmWeek; |
||||
|
||||
@ApiModelProperty(example = "设备imei") |
||||
private String imei; |
||||
|
||||
@ApiModelProperty(example = "结束响铃时间") |
||||
private String alarmEndTime; |
||||
|
||||
|
||||
} |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
package com.ecell.internationalize.system.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.ecell.internationalize.common.system.entity.UserDeviceBindApp; |
||||
|
||||
/** |
||||
* <p> |
||||
* 用户设备绑定 Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author liy |
||||
* @since 2022-07-07 |
||||
*/ |
||||
public interface UserDeviceBindAppMapper extends BaseMapper<UserDeviceBindApp> { |
||||
|
||||
} |
@ -0,0 +1,33 @@
@@ -0,0 +1,33 @@
|
||||
package com.ecell.internationalize.system.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import com.ecell.internationalize.common.system.entity.User; |
||||
import com.ecell.internationalize.common.system.entity.VersionRatioHistory; |
||||
import com.ecell.internationalize.system.entity.dto.RegisterDto; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* <p> |
||||
* 用户 Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author liy |
||||
* @since 2022-07-07 |
||||
*/ |
||||
public interface UserMapper extends BaseMapper<User> { |
||||
|
||||
Page<User> getList(@Param("page") Page<User> page, @Param("map") Map<String, Object> map); |
||||
|
||||
List<String> queryChannel(); |
||||
|
||||
int activeCount(@Param("startTime") Date startTime, @Param("endTime") Date endTime); |
||||
|
||||
List<VersionRatioHistory> monthActiveCount(@Param("currentDate") String currentDate, @Param("preMonthDate") String preMonthDate); |
||||
|
||||
List<RegisterDto> monthRegisterCount(@Param("currentDate") String currentDate, @Param("preMonthDate") String preMonthDate); |
||||
} |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
package com.ecell.internationalize.system.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.ecell.internationalize.common.system.entity.UserDeviceBindApp; |
||||
|
||||
/** |
||||
* <p> |
||||
* 用户设备绑定 服务类 |
||||
* </p> |
||||
* @author liy |
||||
* @since 2022-07-07 |
||||
*/ |
||||
public interface UserDeviceBindAppService extends IService<UserDeviceBindApp> { |
||||
|
||||
} |
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
package com.ecell.internationalize.system.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.ecell.internationalize.common.system.entity.UserDeviceBindApp; |
||||
import com.ecell.internationalize.system.mapper.UserDeviceBindAppMapper; |
||||
import com.ecell.internationalize.system.service.UserDeviceBindAppService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* <p> |
||||
* 用户设备绑定 服务实现类 |
||||
* </p> |
||||
* |
||||
* @author liy |
||||
* @since 2022-07-07 |
||||
*/ |
||||
@Service |
||||
public class UserDeviceBindServiceAppImpl extends ServiceImpl<UserDeviceBindAppMapper, UserDeviceBindApp> implements UserDeviceBindAppService { |
||||
|
||||
} |
@ -0,0 +1,54 @@
@@ -0,0 +1,54 @@
|
||||
package com.ecell.internationalize.system.utils; |
||||
import com.ecell.internationalize.common.system.constant.FieldConstant; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
import java.io.File; |
||||
import java.io.IOException; |
||||
import java.text.SimpleDateFormat; |
||||
import java.util.Date; |
||||
import java.util.Random; |
||||
|
||||
/** |
||||
* @Title: UploadFileUtil |
||||
* @Author: liy |
||||
* @Date: 2022/7/13 17:35 |
||||
* @Description: |
||||
* @Version:1.0 |
||||
*/ |
||||
public class UploadFileUtil { |
||||
public static String upload(MultipartFile file) throws IOException { |
||||
//获取文件名+后缀
|
||||
String fileName = file.getOriginalFilename(); |
||||
File targetFile = null; |
||||
if (null != fileName && !"".equals(fileName)) { |
||||
//获取后缀
|
||||
String fileF = fileName.substring(fileName.lastIndexOf(".")); |
||||
// if (!(FieldConstant.JPG.equals(fileF) || FieldConstant.PNG.equals(fileF))) {
|
||||
// return AjaxResult.error(I18nUtil.getMessage(FieldConstant.UPLOAD_FAIL));
|
||||
// }
|
||||
String curTime = new SimpleDateFormat(FieldConstant.DATE_FORMAT).format(new Date()); |
||||
//新的文件名
|
||||
fileName = curTime + FieldConstant.CONN_CHAR + new Random().nextInt(1000) + fileF; |
||||
//File只会找到项目最外层地址;
|
||||
File directory = new File(FieldConstant.PATH); |
||||
String reportPath = directory.getCanonicalPath(); |
||||
//获取根目录
|
||||
File path = new File(reportPath); |
||||
//获取文件夹路径
|
||||
File file1 = new File(path.getAbsolutePath(), FieldConstant.STATIC_IMAGE); |
||||
//如果文件夹不存在则创建
|
||||
if (!file1.exists() && !file1.isDirectory()) { |
||||
file1.mkdirs(); |
||||
} |
||||
//将图片存入文件夹
|
||||
targetFile = new File(file1, fileName); |
||||
} |
||||
try { |
||||
assert targetFile != null; |
||||
file.transferTo(targetFile); |
||||
} catch (IOException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
return fileName; |
||||
} |
||||
} |
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
<?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.ecell.internationalize.system.mapper.UserDeviceBindAppMapper"> |
||||
<!-- 通用查询映射结果 --> |
||||
<resultMap id="BaseResultMap" type="com.ecell.internationalize.common.system.entity.UserDeviceBindApp"> |
||||
<id column="id" property="id" /> |
||||
<result column="user_id" property="userId" /> |
||||
<result column="i_mei" property="imei" /> |
||||
<result column="identity" property="identity" /> |
||||
<result column="relation" property="relation" /> |
||||
<result column="relation_image_id" property="relationImageId" /> |
||||
<result column="create_user" property="createUser" /> |
||||
<result column="create_time" property="createTime" /> |
||||
<result column="update_user" property="updateUser" /> |
||||
<result column="update_time" property="updateTime" /> |
||||
<result column="bind_status" property="bindStatus" /> |
||||
<result column="approve_status" property="approveStatus" /> |
||||
</resultMap> |
||||
|
||||
<!-- 通用查询结果列 --> |
||||
<sql id="Base_Column_List"> |
||||
id, user_id, i_mei, identity, relation, relation_image_id, create_user, create_time, update_user, update_time,bind_status,approve_status |
||||
</sql> |
||||
|
||||
</mapper> |
@ -0,0 +1,85 @@
@@ -0,0 +1,85 @@
|
||||
<?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.ecell.internationalize.system.mapper.UserMapper"> |
||||
<!-- 通用查询映射结果 --> |
||||
<resultMap id="BaseResultMap" type="com.ecell.internationalize.common.system.entity.User"> |
||||
<id column="user_id" property="userId" /> |
||||
<result column="access_token" property="accessToken" /> |
||||
<result column="access_token_time" property="accessTokenTime" /> |
||||
<result column="password" property="password" /> |
||||
<result column="name" property="name" /> |
||||
<result column="status" property="status" /> |
||||
<result column="sex" property="sex" /> |
||||
<result column="phone" property="phone" /> |
||||
<result column="monitor_watch_phone" property="monitorWatchPhone" /> |
||||
<result column="image" property="image" /> |
||||
<result column="chat_flag" property="chatFlag" /> |
||||
<result column="group_id" property="groupId" /> |
||||
<result column="unread_msg_total" property="unreadMsgTotal" /> |
||||
<result column="del_msg_time" property="delMsgTime" /> |
||||
<result column="del_location_time" property="delLocationTime" /> |
||||
<result column="del_cost_time" property="delCostTime" /> |
||||
<result column="country" property="country" /> |
||||
<result column="country_code" property="countryCode" /> |
||||
<result column="last_use_time" property="lastUseTime" /> |
||||
<result column="register_time" property="registerTime" /> |
||||
<result column="last_login_time" property="lastLoginTime" /> |
||||
<result column="mobile_type" property="mobileType" /> |
||||
<result column="channel" property="channel" /> |
||||
<result column="create_user" property="createUser" /> |
||||
<result column="create_time" property="createTime" /> |
||||
<result column="update_user" property="updateUser" /> |
||||
<result column="update_time" property="updateTime" /> |
||||
<result column="imei" property="imei" /> |
||||
<result column="user_email" property="userEmail" /> |
||||
<result column="user_agent" property="userAgent" /> |
||||
|
||||
<result column="user_last_time" property="userLastTime" /> |
||||
<result column="version" property="version" /> |
||||
<result column="channel_name" property="channelName" /> |
||||
<result column="relation" property="relation" /> |
||||
</resultMap> |
||||
|
||||
<!-- 通用查询结果列 --> |
||||
<sql id="Base_Column_List"> |
||||
user_id, user_email,user_agent,access_token, access_token_time, password, name, status, sex, phone, monitor_watch_phone, image, chat_flag, group_id, unread_msg_total, del_msg_time, del_location_time, del_cost_time, country, country_code, last_use_time, register_time, last_login_time, mobile_type, channel, create_user, create_time, update_user, update_time |
||||
</sql> |
||||
<select id="getList" resultMap="BaseResultMap"> |
||||
select A.user_id,A.name,A.status,A.sex,A.phone,A.image,A.last_login_time,A.channel,A.create_time,A.user_email,A.user_agent, |
||||
B.imei,B.relation,C.channel_name,C.version,C.create_time as user_last_time from user A left join user_device_bind_app B ON A.user_id=B.user_id left join version_ratio C ON A.user_id=C.user_id |
||||
where 1=1 |
||||
<if test="map.phone!=null and map.phone!=''"> |
||||
and A.user_email=#{map.phone} |
||||
</if> |
||||
<if test="map.imei!=null and map.imei!=''"> |
||||
and B.imei=#{map.imei} |
||||
</if> |
||||
<if test="map.channel!=null and map.channel!=''"> |
||||
and C.channel_name=#{map.channel} |
||||
</if> |
||||
<if test="map.status!=null and map.status!=''"> |
||||
and A.status=#{map.status} |
||||
</if> |
||||
order by A.create_time DESC |
||||
</select> |
||||
<select id="queryChannel" resultType="java.lang.String"> |
||||
select DISTINCT channel_name from version_ratio |
||||
</select> |
||||
<select id="activeCount" resultType="java.lang.Integer"> |
||||
select count(1) from version_ratio where 1=1 |
||||
and create_time >=#{startTime} |
||||
and create_time <=#{endTime} |
||||
</select> |
||||
<select id="monthActiveCount" resultType="com.ecell.internationalize.common.system.entity.VersionRatioHistory"> |
||||
select * from version_ratio_history where 1=1 |
||||
and history_time <#{currentDate} |
||||
and history_time >=#{preMonthDate} |
||||
</select> |
||||
<select id="monthRegisterCount" resultType="com.ecell.internationalize.system.entity.dto.RegisterDto"> |
||||
select count(1) as total,convert(create_time,date) as date FROM user |
||||
where 1=1 |
||||
and create_time <#{currentDate} |
||||
and create_time >=#{preMonthDate} |
||||
GROUP BY create_time |
||||
</select> |
||||
</mapper> |
Loading…
Reference in new issue