Commit e607e864 by 吴迪

Merge remote-tracking branch 'origin/master'

parents 69c8b18b 6a487d37
......@@ -12,7 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
/**
* ${条码生成}
......
......@@ -2,8 +2,6 @@ package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Map;
import cn.hutool.crypto.symmetric.DES;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.vo.request.DomesticCodeVo;
import io.office.modules.sys.service.SysCaptchaService;
......@@ -13,13 +11,10 @@ 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.LogLoginEntity;
import io.office.modules.manage.service.LogLoginService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......
......@@ -2,15 +2,12 @@ package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
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.LogMessageEntity;
import io.office.modules.manage.service.LogMessageService;
import io.office.common.utils.PageUtils;
......
......@@ -2,22 +2,17 @@ package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Map;
import io.office.modules.app.annotation.Login;
import io.office.modules.sys.controller.AbstractController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
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.MemberEntity;
import io.office.modules.manage.service.MemberService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......@@ -69,8 +64,9 @@ public class MemberController extends AbstractController {
/**
* 获取验证码
*/
@RequestMapping("/authApi/getVerificationCode")
@RequestMapping("/api/getVerificationCode")
// @RequiresPermissions("manage:timescoderegi:list")
@Login
public R getVerificationCode(@RequestBody Map<String, Object> params, HttpServletRequest request, HttpServletResponse response){
String msg = memberService.getVerificationCode(params,request,response);
return R.ok();
......
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.utils.RedisKeys;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.sys.controller.AbstractController;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.office.modules.manage.entity.ProductEntity;
import io.office.modules.manage.service.ProductService;
import io.office.common.utils.PageUtils;
......
......@@ -2,18 +2,14 @@ package io.office.modules.manage.controller;
import io.office.common.utils.R;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.vo.request.DomesticCodeDetailRequest;
import io.office.modules.manage.vo.request.ProductionVo;
import io.office.modules.sys.service.SysCaptchaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
/**
*
* 
 @description:
......
......@@ -4,7 +4,6 @@ import java.util.Arrays;
import java.util.Map;
import io.office.modules.app.annotation.Login;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
......
......@@ -3,7 +3,6 @@ package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
......
......@@ -5,15 +5,12 @@ import java.util.Map;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.TycpdmFirmEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
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.TycpdmFirmChangeEntity;
import io.office.modules.manage.service.TycpdmFirmChangeService;
import io.office.common.utils.PageUtils;
......
package io.office.modules.manage.controller;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.exception.RRException;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.dao.MemberDao;
import io.office.modules.manage.dao.TycpdmFirmDao;
import io.office.modules.manage.entity.MemberEntity;
import io.office.modules.manage.entity.ProductEntity;
import io.office.modules.manage.entity.TycpdmFirmChangeEntity;
import io.office.modules.manage.service.TycpdmFirmChangeService;
import io.office.modules.sys.controller.AbstractController;
import io.office.modules.sys.entity.SysUserEntity;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
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.TycpdmFirmEntity;
import io.office.modules.manage.service.TycpdmFirmService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import static com.baomidou.mybatisplus.core.toolkit.IdWorker.getId;
import javax.servlet.http.HttpSession;
/**
......@@ -76,6 +67,11 @@ public class TycpdmFirmController extends AbstractController {
}*/
@RequestMapping("/api/test")
@Login
public void testRed(HttpServletResponse response) throws Exception{
response.sendRedirect("http://v3.gds.org.cn/registerOrLoginFromAncc.aspx?uname=test_tru&pwd=88DA15B9F9F602F0D32D46808652B06DC6E939D1424CE39F69A2AC39743F7ED7591975685B543E1D&regist_or_login_from_ancc=d67626ce2c09cbb4c6867eb65c945b53&dept=-2");
}
/**
* 列表
*/
......@@ -101,9 +97,9 @@ public class TycpdmFirmController extends AbstractController {
}
/**
* 保存(保存企业信息)
* 保存(保存企业信息) status 申请状态 1.新增 2.修改
* @param
* @param
* @param status 申请状态 1.新增 2.修改
* @return
*/
@RequestMapping("/authApi/save")
......@@ -116,6 +112,8 @@ public class TycpdmFirmController extends AbstractController {
return R.ok().put("data",id);
}
public static void main(String[] args) throws InvocationTargetException, IllegalAccessException {
MemberEntity memberEntity = new MemberEntity();
Map<String, Object> body = new HashMap<>();
......@@ -222,9 +220,10 @@ public class TycpdmFirmController extends AbstractController {
@RequestMapping("/authApi/audit")
// @RequiresPermissions("manage:tycpdmfirm:delete")
public R audit(@RequestBody Map map){
MemberEntity memberUser = getMemberUser();
Integer memberUserId = getMemberUserId();
try {
tycpdmFirmService.audit(map,memberUserId);
tycpdmFirmService.audit(map,memberUserId,memberUser.getUsername());
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
......@@ -238,8 +237,9 @@ public class TycpdmFirmController extends AbstractController {
/**
* 根据文件地址返回文件
*/
@RequestMapping("/authApi/returnFile")
public R returnFile(@RequestBody Map<String, Object> params, HttpServletResponse response){
@RequestMapping("/api/returnFile")
@Login
public R returnFile(@RequestParam Map<String, Object> params, HttpServletResponse response){
tycpdmFirmService.returnFile(params,response);
return R.ok();
}
......
......@@ -2,15 +2,12 @@ package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
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.TycpdmVipUserEntity;
import io.office.modules.manage.service.TycpdmVipUserService;
import io.office.common.utils.PageUtils;
......
......@@ -10,7 +10,6 @@ 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.UserFunctionBindingEntity;
import io.office.modules.manage.service.UserFunctionBindingService;
import io.office.common.utils.PageUtils;
......
......@@ -5,7 +5,6 @@ import io.office.modules.manage.entity.ProductEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
......
......@@ -3,7 +3,6 @@ package io.office.modules.manage.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.office.modules.manage.entity.GS1CodeListEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface QRcodeDao extends BaseMapper<GS1CodeListEntity> {
......
......@@ -21,11 +21,11 @@ import java.util.Map;
*/
@Mapper
public interface TycpdmFirmChangeDao extends BaseMapper<TycpdmFirmChangeEntity> {
@Update("UPDATE tycpdm_firm_change SET firm_archivesFile = #{firm_archivesFile} , logout_flag=#{logout_flag} WHERE id = #{id}")
void updateByIdfirmArchivesFile(@Param("firm_archivesFile")String firm_archivesFile, @Param("id") Integer id, @Param("logout_flag")int logout_flag);
@Update("UPDATE tycpdm_firm_change SET firm_archivesFile = #{firm_archivesFile} , logout_flag=#{logout_flag} , login_date=#{date} WHERE id = #{id}")
void updateByIdfirmArchivesFile(@Param("firm_archivesFile")String firm_archivesFile, @Param("id") Integer id, @Param("logout_flag")int logout_flag,@Param("date")String date);
@Update("UPDATE tycpdm_firm_change SET logout_flag = #{logout_flag} WHERE id = #{id}")
void updateBYIdLogoutFlag(@Param("logout_flag") String logout_flag, @Param("id") String id);
@Update("UPDATE tycpdm_firm_change SET logout_flag = #{logout_flag}, approve_date = #{date} ,approve_content=#{approve_content} , auditor =#{username} WHERE id = #{id}")
void updateBYIdLogoutFlag(@Param("logout_flag") String logout_flag, @Param("id") String id,@Param("date") String date,@Param("username")String username,@Param("approve_content") String approve_content);
Integer findTycpdmFirmLogoutFlagCountALL(@Param("levels")Integer levels,@Param("logout_flag")Integer logout_flag);
......
......@@ -28,16 +28,16 @@ public interface TycpdmFirmDao extends BaseMapper<TycpdmFirmEntity> {
/* @Update("UPDATE tycpdm_firm SET firmBusinessLicenseFile = #{firmBusinessLicenseFile} , logout_flag=#{logout_flag} WHERE f_id = #{id}")
void updateByIdFirmBusinessLicenseFile(@Param("firmBusinessLicenseFile")String firmBusinessLicenseFile,@Param("id") Integer id,@Param("logout_flag")int logout_flag );
*/
@Update("UPDATE tycpdm_firm SET firm_archivesFile = #{firm_archivesFile} , logout_flag=#{logout_flag} WHERE f_id = #{id}")
void updateByIdfirmArchivesFile(@Param("firm_archivesFile")String firm_archivesFile, @Param("id") Integer id, @Param("logout_flag")int logout_flag);
@Update("UPDATE tycpdm_firm SET firm_archivesFile = #{firm_archivesFile} , logout_flag=#{logout_flag} ,login_date=#{date} WHERE f_id = #{id}")
void updateByIdfirmArchivesFile(@Param("firm_archivesFile")String firm_archivesFile, @Param("id") Integer id, @Param("logout_flag")int logout_flag,@Param("date")String date);
List<TycpdmFirmEntity> selectTycpdmFirmList(@org.apache.ibatis.annotations.Param("params")Map<String, Object> params, Page page);
@Update("UPDATE tycpdm_firm SET logout_flag = #{logout_flag} WHERE f_id = #{id}")
void updateBYIdLogoutFlag(@Param("logout_flag") String logout_flag, @Param("id") String id);
@Update("UPDATE tycpdm_firm SET logout_flag = #{logout_flag} , approve_date = #{date} ,approve_content=#{approve_content} , auditor =#{username} WHERE f_id = #{id}")
void updateBYIdLogoutFlag(@Param("logout_flag") String logout_flag, @Param("id") String id,@Param("date") String date,@Param("username")String username,@Param("approve_content") String approve_content);
@Select("select count(1) from tycpdm_firm where firmName=#{firmname} and logout_flag=#{logout_flag}")
int selectByIdFirmName(@Param("firmname")String firmname, @Param("logout_flag")int logout_flag);
@Select("select count(1) from tycpdm_firm where firmName=#{firmname} and logout_flag=#{logout_flag} and base_user<>#{userName}")
int selectByIdFirmName(@Param("firmname")String firmname, @Param("logout_flag")int logout_flag,@Param("userName")String userName);
@Update("UPDATE tycpdm_firm SET branchCode = #{branchCode} WHERE f_id = #{id}")
void updateByIdBranchCode(@Param("id") Integer id,@Param("branchCode") Integer branchCode);
......
......@@ -4,7 +4,6 @@ import io.office.modules.manage.entity.UserFunctionBindingEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
import java.util.List;
/**
......
......@@ -3,10 +3,7 @@ package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
......
......@@ -3,14 +3,9 @@ package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
/**
* ${comments}
......
......@@ -2,7 +2,6 @@ package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;
......
......@@ -4,10 +4,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.ProductEntity;
import io.office.modules.sys.entity.SysUserEntity;
import java.util.List;
import java.util.Map;
......
......@@ -38,7 +38,7 @@ public interface TycpdmFirmService extends IService<TycpdmFirmEntity> {
Page<TycpdmFirmEntity> findlist(Map<String, Object> params, Page page);
void audit(Map map,Integer memberUserId) throws InvocationTargetException, IllegalAccessException;
void audit(Map map,Integer memberUserId,String username) throws InvocationTargetException, IllegalAccessException;
int findLogoutFlag(String userName);
......
......@@ -4,8 +4,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.modules.manage.entity.UserFunctionBindingEntity;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
......
package io.office.modules.manage.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.office.common.exception.RRException;
import io.office.common.utils.IPUtils;
import io.office.common.utils.R;
import io.office.modules.manage.dao.MemberDao;
import io.office.modules.manage.entity.MemberEntity;
import io.office.modules.manage.utils.DESUtils;
import io.office.modules.manage.utils.HttpUtlis;
import io.office.modules.manage.utils.MD5Util;
import io.office.modules.manage.vo.request.DomesticCodeVo;
import io.office.modules.sys.service.SysCaptchaService;
import io.office.modules.sys.service.SysUserTokenService;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.security.SecureRandom;
import java.util.Date;
import java.util.Map;
import java.util.regex.Pattern;
......@@ -68,18 +73,42 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
Integer levels = null; //用户权限 空.代表普通用户 0.代表中心管理员,1.代表校验管理员 其他4位.代表分中心管理员
Integer isQY=2; //是否开通企业认证 1.开通 2.未开通
Integer isXT=2; //是否是业务大厅系统成员 1.是 2.否
Integer id=0; //用户ID
String search="ws2";// 用户来源 manager:业务大厅手机号用户 ws2:member表用户
String carno=null;// 条码卡号
String phone=null;//手机号码
//判断用户是否是手机号 是手机号调用 第三方接口登录 不是继续
if (matchPhoneNumber(userName)){
//TODO tgl 调用第三方登录接口
//用第三方登录接口
userType=1;
//对 用户名密码进行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()));
String url="http://wsdt.gs1cn.org/anccoh/login?method=loginValidate&phone="+phoen_M+"&password="+passwrod_M;
String s = doGet(url);
if (s==null){
throw new RRException("服务器繁忙,登录失败");
}else {
JSONObject jsonObject = JSON.parseObject(s);
String status = jsonObject.getString("status");
if (!status.equals("1")){
throw new RRException("登录失败"+jsonObject.getString("msg"));
}else {
//登录成功
search="manager";
phone=userName;
//TODO tgl 需要中国编码官网提供 条码卡数据 来判断是否是系统用户
}
}
}else {
//查询Member表
MemberEntity memberEntity = memberDao.selectByName(userName);
id=memberEntity.getId();
if (memberEntity==null){
throw new RRException("用户不存在!");
}
id=memberEntity.getId();
//用户类型 www:为官网用户 条码卡:为条码卡用户
String source = memberEntity.getSource();
String applystate = memberEntity.getApplystate();// 未申请:普通用户 通过审核:完成厂商实名认证
......@@ -87,6 +116,7 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
userType=3;
}else {//条码卡用户
userType=2;
carno=userName;
}
//获取权限
levels=memberDao.selectCode_agen(userName);
......@@ -105,7 +135,7 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
if (user==null){
throw new RRException("用户不存在!");
}
String phone = user.getPhone();
phone = user.getPhone();
String password = user.getPass();
String passwordMD5 = MD5Util.md5Encrypt32Upper(passWord);
//判断密码是否正确
......@@ -114,10 +144,10 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
}
//TODO tgl 参数不正确添加登录日志 log_login
logLoginDao.insert(new LogLoginEntity(1,userName,"用户来源","条码卡号",phone,new Date(), IPUtils.getIpAddr(request),request.getRequestURL().toString()));
//添加登录日志 log_login
}
logLoginDao.insert(new LogLoginEntity(1,userName,search,carno,phone,new Date(), IPUtils.getIpAddr(request),request.getRequestURL().toString()));
JSONObject jsonObject = new JSONObject();
......@@ -144,4 +174,24 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
}
return Pattern.matches(regex, phoneNumber);
}
private static String doGet(String url) {
HttpClient client = new HttpClient();
GetMethod getMethod = new GetMethod(url);
int code = 0;
try {
code = client.executeMethod(getMethod);
if (code == 200) {
String res = getMethod.getResponseBodyAsString();
return res;
}
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
\ No newline at end of file
......@@ -11,9 +11,12 @@ import org.apache.commons.httpclient.methods.PostMethod;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -28,7 +31,7 @@ import javax.servlet.http.HttpSession;
@Service("memberService")
@Transactional
public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> implements MemberService {
@Autowired
......@@ -46,6 +49,11 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
@Autowired
private LogMessageDao logMessageDao;
@Autowired
private RedisTemplate<String,String> redisTemplate;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<MemberEntity> page = this.page(
......@@ -86,14 +94,9 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
throw new RRException("手机格式不正确,请重新填写");
}
//利用获取验证码时保存的session,判断手机验证码非空,和发送的短信内容是否一致,提交时的手机号与接收验证码的手机号是否相同,验证码是否已失效
String subjoinReq = request.getSession().getAttribute("subjoin") == null ? "" : String.valueOf(request.getSession().getAttribute("subjoin"));
String telReq = request.getSession().getAttribute("tel") == null ? "" : String.valueOf(request.getSession().getAttribute("tel"));
Long dateReq = request.getSession().getAttribute("date") == null ? 0 : Long.valueOf(String.valueOf(request.getSession().getAttribute("date")));//毫秒值
subjoinReq = "344942";
telReq = "13159872863";
long l = System.currentTimeMillis();
//dateReq=(l-dateReq)/1000;
dateReq = 30L;
ValueOperations forValue = redisTemplate.opsForValue();
Object o = forValue.get(phone);
//获取验证码验证次数
TimescodeRegiEntity timescodeRegiEntity = timescodeRegiDao.selectById(phone);
if (timescodeRegiEntity == null) {
......@@ -102,7 +105,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
Integer timesValidate = timescodeRegiEntity.getTimesValidate();//验证码输入错误次数;
//校验验证码
checkSubjoinRegi(subjoin, subjoinReq, phone, telReq, dateReq, timesValidate);
checkSubjoinRegi(subjoin, o, phone, timesValidate);
//存入数据库 密码加密
MemberEntity memberEntity = new MemberEntity();
memberEntity.setUsername(userName);
......@@ -231,24 +234,19 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
if (verification.equals("")) {
throw new RRException("请输入验证码");
}
String verUpdatephone = request.getSession().getAttribute("verification").toString();//获取手机验证码
long verUpdateData = Long.valueOf(request.getSession().getAttribute("verUpdateData").toString());//获取手机有效时间
if (!verUpdatephone.equals(verification)) {
throw new RRException("验证码输入错误");
}
long l = System.currentTimeMillis();
if (l - verUpdateData > 300) {
ValueOperations operations = redisTemplate.opsForValue();
Object o = operations.get(phone);
if (o==null){
throw new RRException("验证码已超时");
}
if (!o.toString().equals(verification)) {
throw new RRException("验证码输入错误");
}
memberDao.updateByIDPhone(Integer.valueOf(id), phone);
}
public static void main(String[] args) {
String t123456 = MD5Util.md5Encrypt32Upper("t123456");
System.out.println(t123456);
}
/**
* 以下为短信验证码验证次数判断
......@@ -256,15 +254,13 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
* @param sub 验证码
* @param reSub session存储的验证码
* @param tel 手机号
* @param reTel session存储的手机号
* @param time_diff session存储的毫秒值
* @param times_validate 验证码失败次数
* @return
*/
public boolean checkSubjoinRegi(String sub, String reSub, String tel, String reTel, long time_diff, int times_validate) {
public boolean checkSubjoinRegi(String sub, Object reSub, String tel, int times_validate) {
if (sub.equals("")) {
throw new RRException("手机验证码不能为空!");
} else if (time_diff >= 300) {
} else if (reSub ==null) {
throw new RRException("验证码已超时!");
} else if (times_validate >= 3) {
throw new RRException("该验证码输入错误满3次,已失效,请重新获取!");
......@@ -272,13 +268,11 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
if (!sub.equals(reSub)) {
if (times_validate <= 3) {
times_validate += 1;
timescodeRegiDao.updateByIdTimes_validate(reTel, times_validate);
timescodeRegiDao.updateByIdTimes_validate(tel, times_validate);
throw new RRException("验证码已输入错误" + times_validate + "次(输入错误满3次时,该验证码失效)!");
}
}
if (!tel.equals(reTel)) {
throw new RRException("手机号码错误!");
}
}
return false;
}
......@@ -287,7 +281,8 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
//用户名校验
public boolean checkUserName(String logname) {
String t1 = "^[0-9A-Za-z]{2,8}$"; //判断密码用户名和密码是否为数字,字母(数字或字母)
String t2 = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{2,10}$";//(数字和字母)
//String t2 = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{2,10}$";//(数字和字母)
String t2 = "^(?!\\d+$)[\\da-zA-Z]{2,8}$";//(数字和字母 不能是纯数字)
if (logname.matches(t2)) {
return logname.matches(t2);
} else {
......@@ -346,10 +341,11 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
}
//TODO tgl 判断手机号码是否在黑名单内
//写入session
HttpSession session = request.getSession();
session.setAttribute("verification", pass);//验证码
session.setAttribute("tel", phone);//手机号
session.setAttribute("date", System.currentTimeMillis());//毫秒值
//手机验证码写入redis
ValueOperations forValue = redisTemplate.opsForValue();
forValue.set(phone, pass);
redisTemplate.expire(phone, 60*5, TimeUnit.SECONDS);//过期时间5分钟
//发送状态
String state = "";
// 以下添加同一个手机号短信发送次数验证
......
......@@ -2,8 +2,6 @@ package io.office.modules.manage.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.utils.R;
import io.office.modules.manage.controller.ProductController;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.sys.entity.SysUserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......
......@@ -16,10 +16,13 @@ import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Node;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -49,6 +52,9 @@ public class TimescodeRegiServiceImpl extends ServiceImpl<TimescodeRegiDao, Time
@Autowired
private LogMessageDao logMessageDao;
@Autowired
private RedisTemplate<String,String> redisTemplate;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<TimescodeRegiEntity> page = this.page(
......@@ -99,13 +105,10 @@ public class TimescodeRegiServiceImpl extends ServiceImpl<TimescodeRegiDao, Time
throw new RRException("手机格式不正确,请重新填写");
}
//TODO tgl 判断手机号码是否在黑名单内
//写入session
HttpSession session = request.getSession();
session.setAttribute("subjoin",pass);//验证码
session.setAttribute("tel",phone);//手机号
session.setAttribute("date",System.currentTimeMillis());//毫秒值
//手机验证码写入redis
ValueOperations forValue = redisTemplate.opsForValue();
forValue.set(phone, pass);
Boolean expire = redisTemplate.expire(phone, 60*5, TimeUnit.SECONDS);//过期时间5分钟
//发送状态
String state = "";
// 以下添加同一个手机号短信发送次数验证
......@@ -207,6 +210,8 @@ public class TimescodeRegiServiceImpl extends ServiceImpl<TimescodeRegiDao, Time
if (returnstatus.equals("Success")){
//保存验证码信息log_message表
state="发送成功";
//初始化验证码失效次数
timescodeRegiDao.updateByIdTimes_validate(phone,0);
return "Success";
}else if (returnstatus.equals("Faild")){
state="发送失败";
......
......@@ -3,6 +3,7 @@ package io.office.modules.manage.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.exception.RRException;
import io.office.modules.manage.entity.TycpdmFirmEntity;
import io.office.modules.manage.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
......@@ -70,7 +71,7 @@ public class TycpdmFirmChangeServiceImpl extends ServiceImpl<TycpdmFirmChangeDao
try {
file.transferTo(dest);
//保存路径 firm_archivesFile
tycpdmFirmChangeDao.updateByIdfirmArchivesFile(uploadFileQY + uuid+substring,id,0);
tycpdmFirmChangeDao.updateByIdfirmArchivesFile(uploadFileQY + uuid+substring,id,0, DateUtils.getTime());
//删除原来的照片
if (firmArchivesfile!=null){
File file1 = new File(firmArchivesfile);
......
......@@ -8,6 +8,7 @@ import io.office.modules.manage.dao.TycpdmFirmChangeDao;
import io.office.modules.manage.dao.TycpdmVipUserDao;
import io.office.modules.manage.entity.*;
import io.office.modules.manage.service.TycpdmFirmChangeService;
import io.office.modules.manage.utils.DateUtils;
import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -18,10 +19,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -170,7 +168,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
file.transferTo(dest);
//保存路径 firm_archivesFile
tycpdmFirmDao.updateByIdfirmArchivesFile(uploadFileQY + uuid+substring,id,0);
tycpdmFirmDao.updateByIdfirmArchivesFile(uploadFileQY + uuid+substring,id,0,DateUtils.getTime());
//tycpdm_vip_user表中新增数据
/*TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id);
String baseUser = tycpdmFirmEntity.getBaseUser();
......@@ -227,15 +225,17 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
@Override
@Transactional
public void audit(Map map,Integer memberUserId) throws InvocationTargetException, IllegalAccessException {
public void audit(Map map,Integer memberUserId,String username) throws InvocationTargetException, IllegalAccessException {
Integer status= map.get("status")==null?0: Integer.valueOf(String.valueOf(map.get("status")));//1.新增(新增时id为fId) 2.变更(id为fId)
String id= map.get("id")==null?"": String.valueOf(map.get("id"));//id
String auditStatus= map.get("auditStatus")==null?"": String.valueOf(map.get("auditStatus"));//审核状态 1.通过 2.不通过
String approve_content= map.get("approve_content")==null?"": String.valueOf(map.get("approve_content"));//拒绝理由
//logout_flag
if (status==1){
//新增
//直接修改tycpmFirm表 状态
tycpdmFirmDao.updateBYIdLogoutFlag(auditStatus,id);
tycpdmFirmDao.updateBYIdLogoutFlag(auditStatus,id,DateUtils.getTime(),username,approve_content);
//在tycpdm_vip_user表中记录
if ("1".equals(auditStatus)){
TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id);
......@@ -252,7 +252,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
}else if (status==2){
//变更
tycpdmFirmChangeDao.updateBYIdLogoutFlag(auditStatus,id);
tycpdmFirmChangeDao.updateBYIdLogoutFlag(auditStatus,id,DateUtils.getTime(),username,approve_content);
if ("1".equals(auditStatus)){
//通过将变更表的数据同步到tycpdmFirm表
TycpdmFirmChangeEntity tycpdmFirmChangeEntity = tycpdmFirmChangeDao.selectById(id);
......@@ -299,6 +299,11 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
TycpdmFirmChangeEntity tycpdmFirmChangeEntity = new TycpdmFirmChangeEntity();
Integer status = body.get("status")==null?0:Integer.valueOf(String.valueOf(body.get("status")));
//写入死值
body.put("useddesc","企业产品描述信息");
body.put("wishusednum",100);
body.put("receiveflag",1);
body.put("memo","注册备注信息");
Integer id=0;
if (status==1){ //首次
BeanUtils.populate(tycpdmFirm, body);
......@@ -310,7 +315,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
if (firmname==null||"".equals(tycpdmFirm)){
throw new RRException("企业名称不能为空");
}
int count=tycpdmFirmDao.selectByIdFirmName(firmname,1);
int count=tycpdmFirmDao.selectByIdFirmName(firmname,1,userName);
if (count>0){
throw new RRException("企业名称已经存在");
}
......@@ -359,7 +364,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
if (firmname==null||"".equals(tycpdmFirm)){
throw new RRException("企业名称不能为空");
}
int count=tycpdmFirmDao.selectByIdFirmName(firmname,1);
int count=tycpdmFirmDao.selectByIdFirmName(firmname,1,userName);
if (count>0){
throw new RRException("企业名称已经存在");
}
......
package io.office.modules.manage.utils;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import javax.crypto.spec.IvParameterSpec;
public class DESUtils {
public static final String Key="loginkey";
public static byte[] DES_CBC_Encrypt(byte[] content, byte[] keyBytes){
try {
DESKeySpec keySpec=new DESKeySpec(keyBytes);
SecretKeyFactory keyFactory=SecretKeyFactory.getInstance("DES");
SecretKey key=keyFactory.generateSecret(keySpec);
Cipher cipher=Cipher.getInstance("DES/CBC/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, key, new IvParameterSpec(keySpec.getKey()));
byte[] result=cipher.doFinal(content);
return result;
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println("exception:"+e.toString());
}
return null;
}
public static String byteToHexString(byte[] bytes) {
StringBuffer sb = new StringBuffer(bytes.length);
String sTemp;
for (int i = 0; i < bytes.length; i++) {
sTemp = Integer.toHexString(0xFF & bytes[i]);
if (sTemp.length() < 2)
sb.append(0);
sb.append(sTemp.toUpperCase());
}
return sb.toString();
}
}
package io.office.modules.manage.vo.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
......
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