@@ -1,7 +1,10 @@ | |||
package com.iformall.controller; | |||
import com.iformall.annotation.AuthIgnore; | |||
import com.iformall.common.ErrorCode; | |||
import com.iformall.common.ResultData; | |||
import com.iformall.domain.po.WxCVideoTable; | |||
import com.iformall.service.WxCVideoService; | |||
import com.iformall.video.VideoFactory; | |||
import com.iformall.video.entity.VideUploadResult; | |||
import io.swagger.annotations.ApiImplicitParam; | |||
@@ -29,6 +32,8 @@ public class VideoController extends BaseController { | |||
@Autowired | |||
String videoType; | |||
@Autowired | |||
WxCVideoService wxCVideoService; | |||
/** | |||
* 上传视频 | |||
@@ -119,4 +124,16 @@ public class VideoController extends BaseController { | |||
} | |||
} | |||
/** | |||
* 视频模板列表 | |||
*/ | |||
@AuthIgnore | |||
@PostMapping("/avatarList") | |||
@ApiOperation(value = "视频模板列表", notes = "{\"username\",\"string\",\"code\",\"string\"}") | |||
public WxCVideoTable avatarList(@RequestBody Map<String, String> params){ | |||
String username = params.get("username"); | |||
WxCVideoTable TemplateVideo = wxCVideoService.findByUserName(username); | |||
return null; | |||
} | |||
} |
@@ -36,6 +36,7 @@ import javax.servlet.ServletOutputStream; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.awt.image.BufferedImage; | |||
import java.io.IOException; | |||
import java.util.Date; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
@@ -128,6 +129,83 @@ public class WxUserGrantController extends BaseController { | |||
} | |||
} | |||
@AuthIgnore | |||
@PostMapping("/userlogin") | |||
@ApiOperation(value = "用户登录", notes = "{\"username\":\"string\",\"password\":\"string\",\"code\":\"string\",\"Mcode\":\"string\",\"status\":\"int\"}") | |||
public ResultData userLogin(@RequestBody Map<String, String> map,HttpServletResponse response){ | |||
String ipAddr = getIpAddr(); | |||
logger.debug("[" + ipAddr + "] WxUserGrantController::userlogin"); | |||
String code = map.get("code"); | |||
if(StringUtils.isBlank(code)){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "请输入验证码"); | |||
} | |||
String key = Constant.captchaPrev + ":" + ipAddr; | |||
String code1 = RedisCacheUtils.getCacheString(redisTemplate, key); | |||
if(StringUtils.isBlank(code1)){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "验证码已过期"); | |||
} | |||
if(!code1.equals(code)){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "验证码不正确"); | |||
} | |||
String phone = map.get("username"); | |||
String password = map.get("password"); | |||
if(StringUtils.isBlank(phone) || StringUtils.isBlank(password)){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "手机号或密码为空"); | |||
} | |||
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone); | |||
if(basicInfo == null){ | |||
return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
} | |||
String encryptPassword = new PasswordHelper().encryptPassword(password); | |||
if(!encryptPassword.equals(basicInfo.getPassword())){ | |||
return new ResultData(ErrorCode.USER_PASSWD_ERR.getCode(), "手机号或密码错误"); | |||
} | |||
int status = Integer.parseInt(map.get("status")); | |||
if (status==0){ | |||
basicInfo =wxCUserBasicInfoService.getById1(basicInfo.getId()); | |||
if (basicInfo.getCode()!=null && !map.get("Mcode").equals(basicInfo.getCode())){ | |||
return new ResultData(ErrorCode.USER_ALREADY_LOGIN.getCode(),"用户已在其他设备登录"); | |||
}if (basicInfo.getCode()==null){ | |||
wxCUserBasicInfoService.updateCode(basicInfo.getId(),map.get("Mcode")); | |||
} | |||
} | |||
if (status==-1){ | |||
wxCUserBasicInfoService.updateCode(basicInfo.getId(),null); | |||
basicInfo.setStatus(-2); | |||
return new ResultData(ErrorCode.USER_CANCEL_MCODE.getCode(),"设备已注销"); | |||
} | |||
basicInfo =wxCUserBasicInfoService.getById1(basicInfo.getId()); | |||
wxCUserBasicInfoService.handleLoginUser(basicInfo); | |||
Map<String,Object> resultMap = new HashMap(); | |||
// resultMap.put("phone", basicInfo.getPhone()); | |||
Map<String,Object> data = new HashMap(); | |||
data.put("status",basicInfo.getStatus()); | |||
data.put("version",basicInfo.getVersion()); | |||
data.put("current_time",new Date(System.currentTimeMillis()/1000)); | |||
data.put("expire_time",basicInfo.getExpireTime().getTime()/1000); | |||
Map<String,Object> info = new HashMap(); | |||
info.put("log_id",basicInfo.getId()); | |||
info.put("username",basicInfo.getPhone()); | |||
resultMap.put("data",data); | |||
resultMap.put("info",info); | |||
// resultMap.put("expire_time", basicInfo.getExpireTime()); | |||
return new ResultData(resultMap); | |||
} | |||
/** | |||
* 用户登录 | |||
* | |||
@@ -97,6 +97,8 @@ public enum ErrorCode{ | |||
USER_NAME_IS_FOUND(2008,"用户名已存在"), | |||
USER_PHONE_IS_FOUND(2009,"手机号已存在"), | |||
MEMBER_IS_LOCKED(2010, "当前会员已被锁定"), | |||
USER_ALREADY_LOGIN(2011,"用户已在其他端登入"), | |||
USER_CANCEL_MCODE(2012,"用户已在其他端登入"), | |||
USER_BIRTHDATE_AFTER(2109, "出生日期大于当前日期"), | |||
USER_APPINFO_NOT_EXIST(2110,"当前登录用户APP为空"), | |||
USER_APPINFO_NOFUND_PAYACCOUNT(2111,"当前app找不到payAccount"), | |||
@@ -157,14 +157,18 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId { | |||
@io.swagger.annotations.ApiModelProperty(value = "状态0正常1锁定", name = "status") | |||
private Integer status; | |||
@TableField(exist = false) | |||
@io.swagger.annotations.ApiModelProperty(value = "机器码", name = "code") | |||
private String code; | |||
/*用户登录用token**/ | |||
@TableField(exist = false) | |||
@io.swagger.annotations.ApiModelProperty(value="用户登录用token",name="token") | |||
protected String token; | |||
/*用户过期时间**/ | |||
// @io.swagger.annotations.ApiModelProperty(value="用户过期时间",name="expireTime") | |||
// protected Date expireTime; | |||
@TableField(exist = false) | |||
@io.swagger.annotations.ApiModelProperty(value="用户过期时间",name="expireTime") | |||
protected Date expireTime; | |||
@TableField(exist = false) | |||
@Excel(name="标签",width = 50,orderNum = "15") | |||
@@ -218,6 +222,10 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId { | |||
@TableField(exist = false) | |||
@io.swagger.annotations.ApiModelProperty(value="套餐类型(1、基础版,2、专业版,3、加强版)",name="packageType") | |||
private Integer packageType; | |||
@TableField(exist = false) | |||
@io.swagger.annotations.ApiModelProperty(value="套餐类型(1、基础版,2、专业版,3、加强版)",name="packageType") | |||
private Integer version; | |||
public void protectInfos() { | |||
if(StringUtils.isNotBlank(this.password)) { | |||
@@ -65,5 +65,9 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||
List<Long> findIdByFilter(WxCUserBasicInfoDto wxCUserBasicInfoDto); | |||
long getTotalCreditAmount(@Param("tenantId")String tenantId, @Param("finalTenantId")String finalTenantId); | |||
WxCUserBasicInfo selectById1(Long id); | |||
void updateCode(Long id, String mcode); | |||
} | |||
@@ -200,5 +200,10 @@ public interface WxCUserBasicInfoService { | |||
void sendTicketEmail(WxCUserBasicInfo basicInfo, EnumMsgModel type); | |||
void updUserInfo(WxCUserBasicInfo cUser, Long memberId); | |||
WxCUserBasicInfo getById1(Long id); | |||
void updateCode(Long id, String mcode); | |||
} | |||
@@ -953,6 +953,17 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
update(info); | |||
} | |||
@Override | |||
public WxCUserBasicInfo getById1(Long id) { | |||
return wxCUserBasicInfoMapper.selectById1(id); | |||
} | |||
@Override | |||
public void updateCode(Long id, String mcode) { | |||
wxCUserBasicInfoMapper.updateCode(id,mcode); | |||
} | |||
@Override | |||
public WxCUserBasicInfo getById(Long id,String finalTenantId) { | |||
@@ -28,7 +28,9 @@ | |||
<result column="login_count" jdbcType="INTEGER" property="loginCount"/> | |||
<result column="act_record" jdbcType="INTEGER" property="actRecord"/> | |||
<result column="score_date" jdbcType="TIMESTAMP" property="scoreDate"/> | |||
<result column="status" jdbcType="INTEGER" property="status"/> | |||
<result column="code" jdbcType="VARCHAR" property="code"/> | |||
<result column="version" jdbcType="INTEGER" property="version"/> | |||
<result column="expire_time" jdbcType="VARCHAR" property="expireTime"/> | |||
</resultMap> | |||
<sql id="allColumns"> | |||
@@ -38,6 +40,13 @@ | |||
wcubi.`avatar_url`,wcubi.`credit`,wcubi.`active_time`,wcubi.`login_count`,wcubi.`act_record`, | |||
wcubi.score_date,wcubi.status | |||
</sql> | |||
<sql id="allColumns1"> | |||
wcubi.`id`,wcubi.`phone`,wcubi.`birthdate`,wcubi.`education`,wcubi.`sex`,wcubi.`height`,wcubi.`weight`,wcubi.`id_card`,wcubi.`email`, | |||
wcubi.`address`,wcubi.`poins`,wcubi.`tag_id`,wcubi.`create_date`,wcubi.`update_date`, | |||
wcubi.`final_tenant_id`,wcubi.`tenant_id`,wcubi.`parent_tenant_id`,wcubi.`name`,wcubi.`nick_name`, | |||
wcubi.`avatar_url`,wcubi.`credit`,wcubi.`active_time`,wcubi.`login_count`,wcubi.`act_record`, | |||
wcubi.score_date,wcubi.status,wcubi1.code,wcubi1.version,wcubi1.expire_time | |||
</sql> | |||
<sql id="dynamicWhereConditions"> | |||
where 1=1 | |||
@@ -129,6 +138,11 @@ | |||
from wx_c_user_basic_info wcubi | |||
where wcubi.id =#{id} | |||
</select> | |||
<select id="selectById1" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||
select <include refid="allColumns1"/> | |||
from wx_c_user_basic_info2 wcubi1 join wx_c_user_basic_info wcubi | |||
on wcubi.id =#{id} | |||
</select> | |||
<select id="findList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultMap="BaseResultMap"> | |||
select | |||
@@ -573,4 +587,7 @@ | |||
<update id="cuserOldToNew" statementType="CALLABLE" > | |||
{call cuser_old_to_new(#{oldCuserId},#{newCuserId},#{tableIndex},#{finalTableIndex})} | |||
</update> | |||
<update id="updateCode"> | |||
update wx_c_user_basic_info2 set code = #{mcode} where id = #{id} | |||
</update> | |||
</mapper> |