| | |
| | | // 用ApiInfoBuilder进行定制 |
| | | return new ApiInfoBuilder() |
| | | // 设置标题 |
| | | .title("标题:wumei-smart接口文档") |
| | | .title("标题:普悦物联接口文档") |
| | | // 描述 |
| | | .description("描述:开源生活物联网平台") |
| | | // 作者信息 |
| | |
| | | .version("版本号:" + ruoyiConfig.getVersion()) |
| | | .build(); |
| | | } |
| | | |
| | | } |
| | |
| | | # 是否开启swagger |
| | | enabled: true |
| | | # 请求前缀 |
| | | pathMapping: /dev-api |
| | | pathMapping: /prod-api |
| | | |
| | | # 防止XSS攻击 |
| | | xss: |
| | |
| | | private String company; |
| | | |
| | | /** |
| | | * 推荐码 |
| | | */ |
| | | private String advisecode; |
| | | |
| | | /** |
| | | * 部门对象 |
| | | */ |
| | | @Excels({ |
| | |
| | | this.superiorName = superiorName; |
| | | } |
| | | |
| | | public String getAdvisecode() { |
| | | return advisecode; |
| | | } |
| | | |
| | | public void setAdvisecode(String advisecode) { |
| | | this.advisecode = advisecode; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) |
| | |
| | | .append("superiorName", getSuperiorName()) |
| | | .append("level", getLevel()) |
| | | .append("company", getCompany()) |
| | | .append("advisecode", getAdvisecode()) |
| | | .toString(); |
| | | } |
| | | } |
| | |
| | | public void setBindId(String bindId) { |
| | | this.bindId = bindId; |
| | | } |
| | | |
| | | } |
| | |
| | | return username; |
| | | } |
| | | |
| | | private String address; |
| | | |
| | | public void setUsername(String username) |
| | | { |
| | | this.username = username; |
| | |
| | | { |
| | | this.uuid = uuid; |
| | | } |
| | | |
| | | public String getAddress() { |
| | | return address; |
| | | } |
| | | |
| | | public void setAddress(String address) { |
| | | this.address = address; |
| | | } |
| | | } |
| | |
| | | public class RegisterBody extends LoginBody |
| | | { |
| | | |
| | | public String advisecode; |
| | | |
| | | public String getAdvisecode() { |
| | | return advisecode; |
| | | } |
| | | |
| | | public void setAdvisecode(String advisecode) { |
| | | this.advisecode = advisecode; |
| | | } |
| | | } |
| | |
| | | */ |
| | | public String register(RegisterBody registerBody) |
| | | { |
| | | String msg = "", username = registerBody.getUsername(), password = registerBody.getPassword(); |
| | | String msg = "", username = registerBody.getUsername(), password = registerBody.getPassword(),address=registerBody.getAddress(), advisecode=registerBody.getAdvisecode(); |
| | | |
| | | boolean captchaOnOff = configService.selectCaptchaOnOff(); |
| | | // 验证码开关 |
| | |
| | | sysUser.setUserName(username); |
| | | sysUser.setNickName(username); |
| | | sysUser.setPassword(SecurityUtils.encryptPassword(registerBody.getPassword())); |
| | | sysUser.setAddress(address); |
| | | sysUser.setAdvisecode(advisecode); |
| | | boolean regFlag = userService.registerUser(sysUser); |
| | | if (!regFlag) |
| | | { |
| | |
| | | return toAjax(jointOperatorService.updateDeviceBySN(lines, tenantId)); |
| | | } |
| | | |
| | | @ApiOperation(value = "绑定设备SN为终端用户") |
| | | @PreAuthorize("@ss.hasPermi('*:*:*')") |
| | | @Log(title = "终端用户", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/device/bindUser") |
| | | public AjaxResult bindUser(@RequestParam("serialNumber") String serialNumber, |
| | | @RequestParam("userId") Long userId) throws Exception { |
| | | |
| | | List<String> lines = new ArrayList<>(); |
| | | lines.add(serialNumber); |
| | | return toAjax(jointOperatorService.updateDeviceUserBySN(lines, userId)); |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | public int resetDeviceStatus(String deviceNum); |
| | | |
| | | /** |
| | | * 重置设备状态-出厂分派设备 |
| | | * @return 结果 |
| | | */ |
| | | public int updateDeviceBySN(List<String> snList,Long tenantId); |
| | | |
| | | int updateDeviceBySN(List<String> snList,Long tenantId); |
| | | /** |
| | | * 重置设备状态-用户绑定设备 |
| | | * @return 结果 |
| | | */ |
| | | public int updateDeviceUserBySN(List<String> snList,Long userId); |
| | | } |
| | |
| | | */ |
| | | public int updateDeviceBySN(List<String> content, Long tenantId); |
| | | |
| | | int updateDeviceUserBySN(List<String> snList, Long userId); |
| | | |
| | | /** |
| | | * 批量删除联营商 |
| | | * |
| | |
| | | return i; |
| | | } |
| | | |
| | | @Override |
| | | public int updateDeviceUserBySN(List<String> snList, Long userId) { |
| | | List<Device> deviceList = snList.stream().map(s -> { |
| | | Device device = new Device(); |
| | | device.setUserId(userId); |
| | | device.setSerialNumber(s.trim()); |
| | | device.setAssignTime(DateUtils.getNowDate()); |
| | | return device; |
| | | }).collect(Collectors.toList()); |
| | | int i = 0; |
| | | for (Device device : deviceList) { |
| | | deviceMapper.updateDeviceBySerialNumber(device); |
| | | i++; |
| | | } |
| | | return i; |
| | | } |
| | | |
| | | /** |
| | | * 删除设备 |
| | | * |
| | |
| | | package com.ruoyi.iot.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | import com.ruoyi.system.service.ISysPostService; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.ruoyi.iot.mapper.JointOperatorMapper; |
| | |
| | | return deviceService.updateDeviceBySN(snList, tenantId); |
| | | } |
| | | |
| | | @Override |
| | | public int updateDeviceUserBySN(List<String> snList, Long userId) { |
| | | return deviceService.updateDeviceUserBySN(snList, userId); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除联营商 |
| | | * |
| | |
| | | <result property="superiorId" column="superior_id" /> |
| | | <result property="superiorName" column="superior_name" /> |
| | | <result property="company" column="company" /> |
| | | <result property="advisecode" column="advisecode" /> |
| | | <association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult" /> |
| | | <collection property="roles" javaType="java.util.List" resultMap="RoleResult" /> |
| | | </resultMap> |
| | |
| | | <if test="address != null">address,</if> |
| | | <if test="superiorId != null">superior_id,</if> |
| | | <if test="company != null">company,</if> |
| | | <if test="advisecode != null">advisecode,</if> |
| | | create_time |
| | | )values( |
| | | <if test="userId != null and userId != ''">#{userId},</if> |
| | |
| | | <if test="address != null">address = #{address},</if> |
| | | <if test="superiorId != null">superior_id = #{superiorId},</if> |
| | | <if test="company != null">company = #{company},</if> |
| | | <if test="advisecode != null">advisecode = #{advisecode},</if> |
| | | sysdate() |
| | | ) |
| | | </insert> |