Commit 52c10a6a by 吴迪

【修改】去掉swag

parent 3af55e8d
......@@ -38,7 +38,7 @@
<qiniu.version>7.2.23</qiniu.version>
<aliyun.oss.version>2.8.3</aliyun.oss.version>
<qcloud.cos.version>4.4</qcloud.cos.version>
<swagger.version>2.7.0</swagger.version>
<!--<swagger.version>2.7.0</swagger.version>-->
<joda.time.version>2.9.9</joda.time.version>
<gson.version>2.8.5</gson.version>
<fastjson.version>1.2.83</fastjson.version>
......@@ -179,7 +179,7 @@
<artifactId>kaptcha</artifactId>
<version>${kaptcha.version}</version>
</dependency>
<dependency>
<!--<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger.version}</version>
......@@ -188,7 +188,7 @@
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.version}</version>
</dependency>
</dependency>-->
<dependency>
<groupId>com.qiniu</groupId>
<artifactId>qiniu-java-sdk</artifactId>
......
/*
package io.office.common.aspect;
import cn.hutool.json.JSONUtil;
import com.google.gson.Gson;
import io.office.common.annotation.SysLog;
import io.office.common.utils.HttpContextUtils;
import io.office.common.utils.IPUtils;
import io.office.modules.sys.entity.SysLogEntity;
import io.office.modules.sys.entity.SysUserEntity;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
import java.util.Date;
@Aspect
@Component
@Slf4j
public class LogAspect {
@Pointcut("execution(* io.office.modules.manage.controller.*(..))")
public void logPointCut() {
}
@Around("logPointCut()")
public Object around(ProceedingJoinPoint point) throws Throwable {
long beginTime = System.currentTimeMillis();
//执行方法
Object result = point.proceed();
//执行时长(毫秒)
long time = System.currentTimeMillis() - beginTime;
//保存日志
saveSysLog(point, time);
return result;
}
private void saveSysLog(ProceedingJoinPoint joinPoint, long time) {
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = signature.getMethod();
SysLogEntity sysLog = new SysLogEntity();
SysLog syslog = method.getAnnotation(SysLog.class);
if (syslog != null) {
//注解上的描述
sysLog.setOperation(syslog.value());
}
//请求的方法名
String className = joinPoint.getTarget().getClass().getName();
String methodName = signature.getName();
sysLog.setMethod(className + "." + methodName + "()");
//请求的参数
Object[] args = joinPoint.getArgs();
try {
String params = new Gson().toJson(args);
sysLog.setParams(params);
} catch (Exception e) {
}
//获取request
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
//设置IP地址
sysLog.setIp(IPUtils.getIpAddr(request));
//用户名
String username = ((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUsername();
sysLog.setUsername(username);
sysLog.setTime(time);
sysLog.setCreateDate(new Date());
//保存系统日志
log.info(JSONUtil.toJsonStr(sysLog));
}
}
*/
/**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
* <p>
* https://www.renren.io
*
* <p>
* 版权所有,侵权必究!
*/
......@@ -14,8 +14,6 @@ import io.office.common.validator.ValidatorUtils;
import io.office.modules.app.form.LoginForm;
import io.office.modules.app.service.UserService;
import io.office.modules.app.utils.JwtUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -32,7 +30,7 @@ import java.util.Map;
*/
@RestController
@RequestMapping("/app")
@Api("APP登录接口")
public class AppLoginController {
@Autowired
private UserService userService;
......@@ -43,8 +41,7 @@ public class AppLoginController {
* 登录
*/
@PostMapping("login")
@ApiOperation("登录")
public R login(@RequestBody LoginForm form){
public R login(@RequestBody LoginForm form) {
//表单校验
ValidatorUtils.validateEntity(form);
......
/**
*GS1OfficeWebSit
* GS1OfficeWebSit
*/
package io.office.modules.app.controller;
......@@ -10,8 +10,6 @@ import io.office.common.validator.ValidatorUtils;
import io.office.modules.app.entity.UserEntity;
import io.office.modules.app.form.RegisterForm;
import io.office.modules.app.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -28,14 +26,14 @@ import java.util.Date;
*/
@RestController
@RequestMapping("/app")
@Api("APP注册接口")
//@Api("APP注册接口")
public class AppRegisterController {
@Autowired
private UserService userService;
@PostMapping("register")
@ApiOperation("注册")
public R register(@RequestBody RegisterForm form){
public R register(@RequestBody RegisterForm form) {
//表单校验
ValidatorUtils.validateEntity(form);
......
/**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
* <p>
* https://www.renren.io
*
* <p>
* 版权所有,侵权必究!
*/
......@@ -13,8 +13,6 @@ import io.office.common.utils.R;
import io.office.modules.app.annotation.Login;
import io.office.modules.app.annotation.LoginUser;
import io.office.modules.app.entity.UserEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -27,26 +25,26 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("/app")
@Api("APP测试接口")
//@Api("APP测试接口")
public class AppTestController {
@Login
@GetMapping("userInfo")
@ApiOperation("获取用户信息")
public R userInfo(@LoginUser UserEntity user){
//@ApiOperation("获取用户信息")
public R userInfo(@LoginUser UserEntity user) {
return R.ok().put("user", user);
}
@Login
@GetMapping("userId")
@ApiOperation("获取用户ID")
public R userInfo(@RequestAttribute("userId") Integer userId){
//@ApiOperation("获取用户ID")
public R userInfo(@RequestAttribute("userId") Integer userId) {
return R.ok().put("userId", userId);
}
@GetMapping("notToken")
@ApiOperation("忽略Token验证测试")
public R notToken(){
//@ApiOperation("忽略Token验证测试")
public R notToken() {
return R.ok().put("msg", "无需token也能访问。。。");
}
......
/**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
* <p>
* https://www.renren.io
*
* <p>
* 版权所有,侵权必究!
*/
package io.office.modules.app.form;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
......@@ -20,14 +18,14 @@ import javax.validation.constraints.NotBlank;
* @author Mark sunlightcs@gmail.com
*/
@Data
@ApiModel(value = "登录表单")
public class LoginForm {
@ApiModelProperty(value = "手机号")
@NotBlank(message="手机号不能为空")
@NotBlank(message = "手机号不能为空")
private String mobile;
@ApiModelProperty(value = "密码")
@NotBlank(message="密码不能为空")
@NotBlank(message = "密码不能为空")
private String password;
}
......@@ -8,8 +8,6 @@
package io.office.modules.app.form;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
......@@ -20,13 +18,13 @@ import javax.validation.constraints.NotBlank;
* @author Mark sunlightcs@gmail.com
*/
@Data
@ApiModel(value = "注册表单")
//@ApiModel(value = "注册表单")
public class RegisterForm {
@ApiModelProperty(value = "手机号")
//ApiModelProperty(value = "手机号")
@NotBlank(message="手机号不能为空")
private String mobile;
@ApiModelProperty(value = "密码")
//ApiModelProperty(value = "密码")
@NotBlank(message="密码不能为空")
private String password;
......
......@@ -7,10 +7,12 @@ import io.office.modules.manage.entity.dto.CreateQRcodeVo;
import io.office.modules.manage.service.BarcodeGenerationService;
import io.office.modules.manage.utils.CheckAICodeUtil;
import io.office.modules.manage.vo.request.CheckAIVo;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.List;
......@@ -29,38 +31,41 @@ public class BarcodeGenerationController {
/**
* 条码生成
* @param param 条码内容
*
* @param
* @return pictureUrl 获取条形码地址
*/
@Login
@PostMapping("/api/createQRcode")
public R createQRcode(@RequestBody CreateQRcodeVo createQRcodeVo ) {
if(createQRcodeVo.getParam().size()==0){
public R createQRcode(@RequestBody CreateQRcodeVo createQRcodeVo) {
if (createQRcodeVo.getParam().size() == 0) {
return R.error("参数有误");
}
String url = this.barcodeGenerationService.createPicture(createQRcodeVo.getParam().toArray());
return R.ok().put("data", url);
}
@Login
@ApiOperation(value = "SSCC方式获取GS1 AI标识符列表", response = GS1CodeListEntity.class)
@PostMapping("/api/getGS1CodeListSSCC")
public R getGS1CodeListSSCC() {
List<GS1CodeListEntity> ais = barcodeGenerationService.getGS1CodeListSSCC();
return R.ok().put("data",ais);
return R.ok().put("data", ais);
}
@Login
@ApiOperation(value = "GRAI方式获取GS1 AI标识符", response = GS1CodeListEntity.class)
@PostMapping("/api/getGS1CodeListGRAI")
public R getGS1CodeListGRAI() {
GS1CodeListEntity ai = barcodeGenerationService.getGS1CodeListGRAI();
return R.ok().put("data",ai);
return R.ok().put("data", ai);
}
@Login
@ApiOperation(value = "校验GS1 AI标识符")
@PostMapping("/api/checkGS1Code")
public R checkGS1Code(@ApiParam(required = true)@Valid @RequestBody CheckAIVo body) {
String result = CheckAICodeUtil.ckeckCode(body.getCode(),body.getContent());
return R.ok().put("data",result);
public R checkGS1Code(@Valid @RequestBody CheckAIVo body) {
String result = CheckAICodeUtil.ckeckCode(body.getCode(), body.getContent());
return R.ok().put("data", result);
}
}
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.annotation.SysLog;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.NewtopicEntity;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.NewsMovieEntity;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.manage.service.NewsMovieService;
import io.office.modules.manage.vo.request.NewsMovieEntityVo;
import io.office.modules.manage.vo.request.NewtopicEntityVo;
import io.office.modules.sys.controller.AbstractController;
import io.office.modules.sys.entity.SysUserEntity;
import io.swagger.models.auth.In;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
......@@ -23,14 +19,9 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.office.modules.manage.entity.NewsMovieEntity;
import io.office.modules.manage.service.NewsMovieService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import java.util.Arrays;
/**
......@@ -51,7 +42,7 @@ public class NewsMovieController extends AbstractController {
*/
@RequestMapping("/list")
@RequiresPermissions("manage:newsmovie:list")
public R list(@RequestBody NewsParams params){
public R list(@RequestBody NewsParams params) {
Page<NewsMovieEntity> page = this.newsMovieService.selectMoveList(params,
new Page(params.getPage(), params.getLimit()));
PageUtils pageUtils = new PageUtils(page);
......@@ -64,7 +55,7 @@ public class NewsMovieController extends AbstractController {
*/
@RequestMapping("/info/{id}")
@RequiresPermissions("manage:newsmovie:info")
public R info(@PathVariable("id") Integer id){
public R info(@PathVariable("id") Integer id) {
NewsMovieEntity newsMovie = newsMovieService.getById(id);
return R.ok().put("newsMovie", newsMovie);
......@@ -77,9 +68,9 @@ public class NewsMovieController extends AbstractController {
@Transactional
@RequestMapping("/save")
@RequiresPermissions("manage:newsmovie:save")
public R save(@RequestBody NewsMovieEntityVo newsMovieEntityVo){
public R save(@RequestBody NewsMovieEntityVo newsMovieEntityVo) {
SysUserEntity user = getUser();
newsMovieService.insert(newsMovieEntityVo,user);
newsMovieService.insert(newsMovieEntityVo, user);
return R.ok();
}
......@@ -90,16 +81,16 @@ public class NewsMovieController extends AbstractController {
@Transactional
@RequestMapping("/update")
@RequiresPermissions("manage:newsmovie:update")
public R update(@RequestBody NewsMovieEntity newsMovieEntity){
public R update(@RequestBody NewsMovieEntity newsMovieEntity) {
SysUserEntity user = getUser();
newsMovieEntity.setLasteditor(user.getUsername());
QueryWrapper<NewsMovieEntity> newsMovieEntityQueryWrapper = new QueryWrapper<>();
newsMovieEntityQueryWrapper.eq("id",newsMovieEntity.getId());
if(StringUtils.isNotBlank(newsMovieEntity.getPic())) {
newsMovieEntityQueryWrapper.eq("id", newsMovieEntity.getId());
if (StringUtils.isNotBlank(newsMovieEntity.getPic())) {
newsMovieEntity.setLittlepic(newsMovieEntity.getPic());
newsMovieEntity.setBigpic(newsMovieEntity.getPic());
}
newsMovieService.update(newsMovieEntity,newsMovieEntityQueryWrapper);
newsMovieService.update(newsMovieEntity, newsMovieEntityQueryWrapper);
return R.ok();
}
......@@ -110,14 +101,14 @@ public class NewsMovieController extends AbstractController {
@Transactional
@RequestMapping("/delete")
@RequiresPermissions("manage:newsmovie:delete")
public R delete(@RequestBody Integer[] ids){
public R delete(@RequestBody Integer[] ids) {
SysUserEntity user = getUser();
NewsMovieEntity newsMovieEntity = new NewsMovieEntity();
newsMovieEntity.setLasteditor(user.getUsername());
newsMovieEntity.setLevels(0);
QueryWrapper<NewsMovieEntity> newsMovieEntityQueryWrapper = new QueryWrapper<>();
newsMovieEntityQueryWrapper.in("id",Arrays.asList(ids));
newsMovieService.update(newsMovieEntity,newsMovieEntityQueryWrapper);
newsMovieEntityQueryWrapper.in("id", Arrays.asList(ids));
newsMovieService.update(newsMovieEntity, newsMovieEntityQueryWrapper);
return R.ok();
}
......@@ -131,14 +122,12 @@ public class NewsMovieController extends AbstractController {
SysUserEntity user = getUser();
NewsMovieEntity newsMovieEntity = new NewsMovieEntity();
newsMovieEntity.setAuditor(user.getUsername());
BeanUtils.copyProperties(newsMovieEntityVo,newsMovieEntity);
BeanUtils.copyProperties(newsMovieEntityVo, newsMovieEntity);
QueryWrapper<NewsMovieEntity> newsMovieEntityQueryWrapper = new QueryWrapper<>();
newsMovieEntityQueryWrapper.eq("id",newsMovieEntityVo.getId());
newsMovieService.update(newsMovieEntity,newsMovieEntityQueryWrapper);
newsMovieEntityQueryWrapper.eq("id", newsMovieEntityVo.getId());
newsMovieService.update(newsMovieEntity, newsMovieEntityQueryWrapper);
return R.ok();
}
}
......@@ -3,6 +3,7 @@ package io.office.modules.manage.controller;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.annotation.SysLog;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.app.annotation.Login;
......@@ -285,20 +286,8 @@ public class TycpdmFirmController extends AbstractController {
@RequestMapping("/authApi/redirectGDS")
public R redirectGDS(@RequestBody Map<String, Object> params, HttpServletResponse response) {
//由于member表中没有手机用户的信息 通过memberDao获取
Object id = params.get("id");
MemberEntity memberEntity = null;
if (id != null) {
memberEntity = memberDao.selectById(Long.valueOf(id + ""));
}
String url = tycpdmFirmService.redirectGDSURL(memberEntity, params);
try {
response.sendRedirect(url);
String url = tycpdmFirmService.redirectGDSURLNew();
return R.ok().put("data", url);
} catch (Exception e) {
e.printStackTrace();
return R.error("跳转失败");
}
}
......@@ -309,12 +298,8 @@ public class TycpdmFirmController extends AbstractController {
public R redirectGLN(HttpServletResponse response) {
MemberEntity memberUser = getMemberUser();
String url = tycpdmFirmService.redirectGDSGLN(memberUser);
try {
return R.ok().put("data", url);
} catch (Exception e) {
e.printStackTrace();
return R.error("跳转失败");
}
}
......
package io.office.modules.manage.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
......@@ -10,60 +8,82 @@ import lombok.Setter;
*/
@Setter
@Getter
@ApiModel(value = "GS1CodeList")
//@ApiModel(value = "GS1CodeList")
public class GS1CodeListEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "标识符ID")
//ApiModelProperty(value = "标识符ID")
public String id;
@ApiModelProperty(value = "AI标识符名称")
//ApiModelProperty(value = "AI标识符名称")
public String codeName;
@ApiModelProperty(value = "AI标识符编号")
//ApiModelProperty(value = "AI标识符编号")
public String codeValue;
/** 是否可变长度(0 不可变 1 可变) */
@ApiModelProperty(value = "是否可变长度(0 不可变 1 可变)")
/**
* 是否可变长度(0 不可变 1 可变)
*/
//ApiModelProperty(value = "是否可变长度(0 不可变 1 可变)")
private Integer isVariable; //
/** 最后一位是否是校验位(0 否 1是) */
@ApiModelProperty(value = "最后一位是否是校验位(0 否 1是)")
/**
* 最后一位是否是校验位(0 否 1是)
*/
//ApiModelProperty(value = "最后一位是否是校验位(0 否 1是)")
private Integer isCheck;
/** 最小长度 */
@ApiModelProperty(value = "最小长度")
/**
* 最小长度
*/
//ApiModelProperty(value = "最小长度")
private Integer minLength;
/** 最大长度 */
@ApiModelProperty(value = "用户允许输入的最大长度")
/**
* 最大长度
*/
//ApiModelProperty(value = "用户允许输入的最大长度")
private Integer maxLength;
/** 是否是日期(0 否 1是) */
@ApiModelProperty(value = "是否是日期(0 否 1是)")
/**
* 是否是日期(0 否 1是)
*/
//ApiModelProperty(value = "是否是日期(0 否 1是)")
private Integer isDate;
/** 是否包含小数位(0 不包含 1 包含) */
@ApiModelProperty(value = "是否包含小数位(0 不包含 1 包含)")
/**
* 是否包含小数位(0 不包含 1 包含)
*/
//ApiModelProperty(value = "是否包含小数位(0 不包含 1 包含)")
private Integer isDecimal;
/** 是否全是数字(0 否 1 是) */
@ApiModelProperty(value = "是否全是数字(0 否 1 是)")
/**
* 是否全是数字(0 否 1 是)
*/
//ApiModelProperty(value = "是否全是数字(0 否 1 是)")
private Integer isNum;
/** 格式 */
@ApiModelProperty(value = "格式")
/**
* 格式
*/
//ApiModelProperty(value = "格式")
private String format;
/** 是否需要特殊符号 */
@ApiModelProperty(value = "是否需要特殊符号(0:否 1:是)")
/**
* 是否需要特殊符号
*/
//ApiModelProperty(value = "是否需要特殊符号(0:否 1:是)")
private Integer isFnc1;
/** 数据名称 */
@ApiModelProperty(value = "数据名称")
/**
* 数据名称
*/
//ApiModelProperty(value = "数据名称")
private String dataName;
/** 输入提示 */
@ApiModelProperty(value = "输入提示")
/**
* 输入提示
*/
//ApiModelProperty(value = "输入提示")
private String prompt;
}
......@@ -53,6 +53,10 @@ public interface TycpdmFirmService extends IService<TycpdmFirmEntity> {
String redirectGDSURLNew(Map<String, Object> params);
String redirectGDSURLNew();
String redirectGDSGLN(MemberEntity memberUser);
String redirectBusinessHall(Map map,MemberEntity memberUser);
......
......@@ -5,6 +5,7 @@ import io.office.modules.manage.dao.QRcodeDao;
import io.office.modules.manage.entity.GS1CodeListEntity;
import io.office.modules.manage.service.BarcodeGenerationService;
import io.office.modules.manage.utils.CheckAICodeUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -13,12 +14,12 @@ import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service("barcodegenerationservice")
public class BarcodeGenerationServiceImpl implements BarcodeGenerationService {
@Autowired
private QRcodeDao qRcodeDao;
private final Log logger = LogFactory.getLog(getClass());
public static final String SEPERATOR = "ñ";
@Value("${prefix_host}")
public String prefix_host;
......
......@@ -17,6 +17,7 @@ import io.office.modules.manage.entity.MemberEntity;
import io.office.modules.manage.service.LogLoginService;
import io.office.modules.manage.utils.DESUtils;
import io.office.modules.manage.utils.MD5Util;
import io.office.modules.manage.utils.PhoneNumberUtils;
import io.office.modules.sys.service.SysUserTokenService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.httpclient.HttpClient;
......@@ -75,7 +76,7 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
String carno = null;// 条码卡号
String phone = null;//手机号码
//判断用户是否是手机号 是手机号调用 第三方接口登录 不是继续
if (matchPhoneNumber(userName)) {
if (PhoneNumberUtils.matchPhoneNumber(userName)) {
//用第三方登录接口
userType = 1;
System.out.println("用户名称:" + userName);
......@@ -145,7 +146,6 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
throw new RRException("密码不正确!");
}
//添加登录日志 log_login
}
......@@ -183,7 +183,7 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
//如果是条码卡成员 id为手机号,如果是官网用户id就是id
String id ;
//先判断是否为手机号,如果是手机号,只有可能是系统成员或者手机用户
if (matchPhoneNumber(userName)) {
if (PhoneNumberUtils.matchPhoneNumber(userName)) {
//对 用户名密码进行DES加密
String phoen_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(userName.getBytes(), DESUtils.Key.getBytes()));
String passwrod_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(passWord.getBytes(), DESUtils.Key.getBytes()));
......@@ -276,19 +276,7 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
return jsonObject;
}
/**
* 验证手机号 由于号码段不断的更新,只需要判断手机号有11位,并且全是数字以及1开头等
*
* @param phoneNumber 手机号码
* @return
*/
private static boolean matchPhoneNumber(String phoneNumber) {
String regex = "1[345789][0-9]{9}";
if (phoneNumber == null || phoneNumber.length() <= 0) {
return false;
}
return Pattern.matches(regex, phoneNumber);
}
private static String doGet(String url) {
......@@ -303,6 +291,8 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
}
} catch (IOException e) {
e.printStackTrace();
} finally {
}
return null;
}
......
......@@ -7,6 +7,7 @@ import io.office.modules.manage.dao.*;
import io.office.modules.manage.entity.*;
import io.office.modules.manage.utils.DateUtils;
import io.office.modules.manage.utils.MD5Util;
import io.office.modules.manage.utils.PhoneNumberUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.PostMethod;
......@@ -91,7 +92,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
throw new RRException("e-miail格式错误");
}
//判断联系电话非空,且为11位数字
if (!matchPhoneNumber(phone)) {
if (!PhoneNumberUtils.matchPhoneNumber(phone)) {
throw new RRException("手机格式不正确,请重新填写");
}
//判断用户名是否存在
......@@ -341,24 +342,6 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
}
}
/**
* 验证手机号 由于号码段不断的更新,只需要判断手机号有11位,并且全是数字以及1开头等
*
* @param phoneNumber 手机号码
* @return
*/
private static boolean matchPhoneNumber(String phoneNumber) {
String regex = "1[3456789][0-9]{9}";
if (phoneNumber == null || phoneNumber.length() <= 0) {
return false;
}
return Pattern.matches(regex, phoneNumber);
}
public static void main(String[] args) {
System.out.println(matchPhoneNumber("17368588652"));
}
@Override
public String getVerificationCode(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) {
......@@ -370,7 +353,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
String phone = String.valueOf(params.get("phone") == null ? "" : params.get("phone"));
String userName = String.valueOf(params.get("userName") == null ? "" : params.get("userName"));
//判断手机号码格式
if (!matchPhoneNumber(phone)) {
if (!PhoneNumberUtils.matchPhoneNumber(phone)) {
throw new RRException("手机格式不正确,请重新填写");
}
//判断手机号是否存在
......
......@@ -11,6 +11,7 @@ import io.office.modules.manage.entity.LogMessageEntity;
import io.office.modules.manage.entity.TimescodeRegiIpEntity;
import io.office.modules.manage.service.LogMessageService;
import io.office.modules.manage.utils.DateUtils;
import io.office.modules.manage.utils.PhoneNumberUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.PostMethod;
......@@ -70,22 +71,7 @@ public class TimescodeRegiServiceImpl extends ServiceImpl<TimescodeRegiDao, Time
return new PageUtils(page);
}
/**
* 验证手机号 由于号码段不断的更新,只需要判断手机号有11位,并且全是数字以及1开头等
* @param phoneNumber 手机号码
* @return
*/
private static boolean matchPhoneNumber(String phoneNumber) {
String regex = "1[3456789][0-9]{9}";
if(phoneNumber==null||phoneNumber.length()<=0){
return false;
}
return Pattern.matches(regex, phoneNumber);
}
public static void main(String[] args) {
System.out.println(matchPhoneNumber("17368588652"));
}
@Override
public String getVerificationCode(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) {
......@@ -99,7 +85,7 @@ public class TimescodeRegiServiceImpl extends ServiceImpl<TimescodeRegiDao, Time
String phone = String.valueOf(params.get("phone")==null?"":params.get("phone"));
String userName = String.valueOf(params.get("userName")==null?"":params.get("userName"));
//判断手机号码格式
if (!matchPhoneNumber(phone)){
if (!PhoneNumberUtils.matchPhoneNumber(phone)){
throw new RRException("手机格式不正确,请重新填写");
}
//判断手机号是否存在
......
......@@ -15,13 +15,11 @@ import io.office.modules.manage.dao.*;
import io.office.modules.manage.entity.*;
import io.office.modules.manage.service.TycpdmFirmChangeService;
import io.office.modules.manage.service.TycpdmFirmService;
import io.office.modules.manage.utils.AlgorithmUtils;
import io.office.modules.manage.utils.DESUtils;
import io.office.modules.manage.utils.DateUtils;
import io.office.modules.manage.utils.MD5Util;
import io.office.modules.manage.utils.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
......@@ -608,13 +606,55 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
return url;
}
public static void main(String[] args) {
// DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(pass.getBytes(), "appsGdsn".getBytes()));
}
@Override
public String redirectGDSURLNew(Map<String, Object> params) {
//用户类型 1.业务大厅(手机号用户) 2.业务大厅(条码卡成员) 3.官网用户
Integer userType = Integer.valueOf(String.valueOf(params.get("userType")));
//用户类型 1.业务大厅(手机号用户) 2.业务大厅(条码卡成员) 3.官网用户
//Integer userType = Integer.valueOf(String.valueOf(params.get("userType")));
Integer levels = null;//用户权限 空.代表普通用户 0.代表中心管理员,1.代表校验管理员 其他4位.代表分中心管理员
int dept = -2; //0表示中心管理员;-2表示普通成员。-100表示没有任何值时
String regist_or_login_from_ancc = "";
String username = null;
String pass = null;
if (userType == 1) {
//系统成员,如果是手机号需要根据手机号获取条码卡号
if (!PhoneNumberUtils.matchPhoneNumber(String.valueOf(params.get("id")))) {
String cardNo = String.valueOf(params.get("id"));
//如果不是手机号,必定是条码卡号
MemberEntity memberEntity = memberDao.selectByName(cardNo);
if (memberEntity != null) {
//获取密码MD5加密后的密码
String pass_MD5 = memberEntity.getPassword();
//再进行 DES加密
pass = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(pass_MD5.getBytes(), "appsGdsn".getBytes()));
} else {
throw new RRException("无对应成员系统条码卡号,请联系管理员!");
}
}
} else{
//根据id对应的username
MemberEntity memberEntity = memberDao.selectById(String.valueOf(params.get("id")));
pass = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(memberEntity.getPassword().getBytes(), "appsGdsn".getBytes()));
if(memberEntity==null) {
throw new RRException("无对应用户名,请联系管理员!");
}
username = memberEntity.getUsername();
}
regist_or_login_from_ancc = dept + "{regist_or_login_from_ancc}";
regist_or_login_from_ancc = MD5Util.md5Encrypt32Lower(regist_or_login_from_ancc);
String url = "http://manage.gds.org.cn/Original/WWW/registerOrLoginFromAncc.aspx?uname=" + username + "&pwd=" + pass + "&regist_or_login_from_ancc=" + regist_or_login_from_ancc + "&dept=" + dept;
return url;
}
return null;
@Override
public String redirectGDSURLNew() {
return "https://www.gds.org.cn/#/home/index";
}
/**
......@@ -658,14 +698,17 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
String url = "http://wsdt.gs1cn.org/anccoh/login?method=gdsLoginSSO&gdsCode=" + phone_M + "&password=" + password_M;
log.info(url);
return url;
} else if (userType == 3) {
MemberEntity memberEntity = memberDao.selectById(memberUser.getId());
phone = memberEntity.getPhone();//手机号
} else if (userType == 4) {
} else {
MemberEntity memberEntity = memberDao.selectById(memberUser.getId());
if(StringUtils.isNoneBlank(memberEntity.getPhone())) {
if(PhoneNumberUtils.matchPhoneNumber(memberEntity.getPhone())) {
phone = memberEntity.getPhone();//手机号
} else {
throw new RRException("用户类型错误");
}else{
throw new RRException("手机号不正确,请修改绑定的手机号!");
}
} else{
throw new RRException("你还没有绑定手机号!");
}
}
String phone_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(phone.getBytes(), "loginkey".getBytes()));
String url = "http://wsdt.gs1cn.org/anccoh/login?method=phoneSSO&phone=" + phone_M;
......@@ -673,10 +716,10 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
JSONObject jsonObject = JSON.parseObject(token);
String status = jsonObject.getString("status");
String msg = jsonObject.getString("msg");
if (!"200".equals(status)) {
throw new RRException("获取token失败" + msg);
}
log.info("http://wsdt.gs1cn.org/anccoh/login?method=redirect&token=" + msg);
return "http://wsdt.gs1cn.org/anccoh/login?method=redirect&token=" + msg;
}
......@@ -698,18 +741,5 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
}
/**
* 验证手机号 由于号码段不断的更新,只需要判断手机号有11位,并且全是数字以及1开头等
*
* @param phoneNumber 手机号码
* @return
*/
private static boolean matchPhoneNumber(String phoneNumber) {
String regex = "1[358][0-9]{9}";
if (phoneNumber == null || phoneNumber.length() <= 0) {
return false;
}
return Pattern.matches(regex, phoneNumber);
}
}
\ No newline at end of file
package io.office.modules.manage.utils;
import java.util.regex.Pattern;
/**
* @author 63213
*/
public class PhoneNumberUtils {
/**
* 验证手机号 由于号码段不断的更新,只需要判断手机号有11位,并且全是数字以及1开头等
*
* @param phoneNumber 手机号码
* @return
*/
public static boolean matchPhoneNumber(String phoneNumber) {
String regex = "1[345789][0-9]{9}";
if (phoneNumber == null || phoneNumber.length() <= 0) {
return false;
}
return Pattern.matches(regex, phoneNumber);
}
}
package io.office.modules.manage.vo.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.NotBlank;
......@@ -15,11 +14,11 @@ import java.io.Serializable;
public class CheckAIVo implements Serializable {
@NotBlank(message = "AI标识符不能为空!!!")
@ApiModelProperty(value = "AI标识符")
public String code;
@NotBlank(message = "输入的内容不能为空!!!")
@ApiModelProperty(value = "输入的内容")
public String content;
}
......@@ -14,7 +14,7 @@ spring:
name: GS1OfficeWebSit
# 环境 dev|test|prod
profiles:
active: dev
active: test
# jackson时间格式化
jackson:
time-zone: GMT+8
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment