Commit bf5f63c8 by 吴迪

Merge remote-tracking branch 'origin/master'

parents de43edbd e391e734
...@@ -50,8 +50,7 @@ public class MemberController extends AbstractController { ...@@ -50,8 +50,7 @@ public class MemberController extends AbstractController {
/** /**
* 用户信息管理-修改登录密码 * 用户信息管理-修改登录密码
*/ */
@Login @RequestMapping("/authApi/updatePass")
@RequestMapping("/api/updatePass")
// @RequiresPermissions("manage:member:list") // @RequiresPermissions("manage:member:list")
public R updatePass(@RequestBody Map<String, Object> params){ public R updatePass(@RequestBody Map<String, Object> params){
memberService.updatePass(params); memberService.updatePass(params);
...@@ -61,13 +60,21 @@ public class MemberController extends AbstractController { ...@@ -61,13 +60,21 @@ public class MemberController extends AbstractController {
/** /**
* 用户信息管理-修改手机号码 * 用户信息管理-修改手机号码
*/ */
@Login @RequestMapping("/authApi/updatephone")
@RequestMapping("/api/updatephone")
// @RequiresPermissions("manage:member:list") // @RequiresPermissions("manage:member:list")
public R updatephone(@RequestBody Map<String, Object> params, HttpServletRequest request, HttpServletResponse response){ public R updatephone(@RequestBody Map<String, Object> params, HttpServletRequest request, HttpServletResponse response){
memberService.updatephone(params,request,response); memberService.updatephone(params,request,response);
return R.ok(); return R.ok();
} }
/**
* 获取验证码
*/
@RequestMapping("/authApi/getVerificationCode")
// @RequiresPermissions("manage:timescoderegi:list")
public R getVerificationCode(@RequestBody Map<String, Object> params, HttpServletRequest request, HttpServletResponse response){
String msg = memberService.getVerificationCode(params,request,response);
return R.ok();
}
/** /**
* 列表 * 列表
...@@ -84,7 +91,7 @@ public class MemberController extends AbstractController { ...@@ -84,7 +91,7 @@ public class MemberController extends AbstractController {
/** /**
* 信息 * 信息
*/ */
@RequestMapping("/api/info/") @RequestMapping("/authApi/info")
// @RequiresPermissions("manage:member:info") // @RequiresPermissions("manage:member:info")
public R info(){ public R info(){
Integer memberUserId = getMemberUserId(); Integer memberUserId = getMemberUserId();
...@@ -107,7 +114,7 @@ public class MemberController extends AbstractController { ...@@ -107,7 +114,7 @@ public class MemberController extends AbstractController {
/** /**
* 修改 * 修改
*/ */
@RequestMapping("/api/update") @RequestMapping("/authApi/update")
// @RequiresPermissions("manage:member:update") // @RequiresPermissions("manage:member:update")
public R update(@RequestBody MemberEntity member){ public R update(@RequestBody MemberEntity member){
......
package io.office.modules.manage.controller; package io.office.modules.manage.controller;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -12,8 +14,11 @@ import io.office.modules.app.annotation.Login; ...@@ -12,8 +14,11 @@ import io.office.modules.app.annotation.Login;
import io.office.modules.manage.dao.MemberDao; import io.office.modules.manage.dao.MemberDao;
import io.office.modules.manage.entity.MemberEntity; import io.office.modules.manage.entity.MemberEntity;
import io.office.modules.manage.entity.ProductEntity; 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.controller.AbstractController;
import io.office.modules.sys.entity.SysUserEntity; import io.office.modules.sys.entity.SysUserEntity;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
...@@ -28,6 +33,8 @@ import io.office.common.utils.PageUtils; ...@@ -28,6 +33,8 @@ import io.office.common.utils.PageUtils;
import io.office.common.utils.R; import io.office.common.utils.R;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import static com.baomidou.mybatisplus.core.toolkit.IdWorker.getId;
/** /**
* ${comments} * ${comments}
...@@ -43,10 +50,12 @@ public class TycpdmFirmController extends AbstractController { ...@@ -43,10 +50,12 @@ public class TycpdmFirmController extends AbstractController {
private TycpdmFirmService tycpdmFirmService; private TycpdmFirmService tycpdmFirmService;
@Autowired @Autowired
private TycpdmFirmChangeService tycpdmFirmChangeService;
@Autowired
private MemberDao memberDao; private MemberDao memberDao;
/** /* *//**
* 列表 * 列表
*/ *//*
@RequestMapping("/api/list") @RequestMapping("/api/list")
// @RequiresPermissions("manage:tycpdmfirm:list") // @RequiresPermissions("manage:tycpdmfirm:list")
@Login @Login
...@@ -59,14 +68,13 @@ public class TycpdmFirmController extends AbstractController { ...@@ -59,14 +68,13 @@ public class TycpdmFirmController extends AbstractController {
PageUtils page = tycpdmFirmService.queryPage(params); PageUtils page = tycpdmFirmService.queryPage(params);
return R.ok().put("data", page); return R.ok().put("data", page);
} }*/
/** /**
* 列表 * 列表
*/ */
@RequestMapping("/api/findlist") @RequestMapping("/authApi/findlist")
@Login
public R findlist(@RequestBody Map<String, Object> params){ public R findlist(@RequestBody Map<String, Object> params){
Page<TycpdmFirmEntity> findlist = tycpdmFirmService.findlist(params, Page<TycpdmFirmEntity> findlist = tycpdmFirmService.findlist(params,
new Page(Integer.valueOf(params.get("page").toString()), new Page(Integer.valueOf(params.get("page").toString()),
...@@ -89,27 +97,56 @@ public class TycpdmFirmController extends AbstractController { ...@@ -89,27 +97,56 @@ public class TycpdmFirmController extends AbstractController {
/** /**
* 保存(保存企业信息) * 保存(保存企业信息)
* @param
* @param status 申请状态 1.新增 2.修改
* @return
*/ */
@RequestMapping("/api/save") @RequestMapping("/authApi/save")
// @RequiresPermissions("manage:tycpdmfirm:save") // @RequiresPermissions("manage:tycpdmfirm:save")
public R save(@RequestBody TycpdmFirmEntity tycpdmFirm,@RequestParam("file")MultipartFile file){ public R save(@RequestBody Map body,@RequestParam("status")int status ) throws InvocationTargetException, IllegalAccessException {
String baseUser = tycpdmFirm.getBaseUser(); TycpdmFirmEntity tycpdmFirm = new TycpdmFirmEntity();
if (baseUser==null){ TycpdmFirmChangeEntity tycpdmFirmChangeEntity = new TycpdmFirmChangeEntity();
throw new RRException("用户名不能为空");
Integer id=0;
if (status==1){
BeanUtils.populate(tycpdmFirm, body);
String baseUser = tycpdmFirm.getBaseUser();
if (baseUser==null){
throw new RRException("用户名不能为空");
}
//第一步不存储状态 第二部存储
//tycpdmFirm.setLogoutFlag(0); //审核状态 0待审核 1审核成功 2审核失败
tycpdmFirmService.save(tycpdmFirm);
id = tycpdmFirm.getFId();
}else if (status==2){
Integer fId = Integer.valueOf(String.valueOf(body.get("fId")));
BeanUtils.populate(tycpdmFirmChangeEntity, body);
String baseUser = tycpdmFirmChangeEntity.getBaseUser();
if (baseUser==null){
throw new RRException("用户名不能为空");
}
tycpdmFirmChangeEntity.setFId(fId);
tycpdmFirmChangeService.save(tycpdmFirmChangeEntity);
id = tycpdmFirmChangeEntity.getId();
}else {
return R.error("请选择业务类型");
} }
//第一步不存储状态 第二部存储
//tycpdmFirm.setLogoutFlag(0); //审核状态 0待审核 1审核成功 2审核失败
tycpdmFirmService.save(tycpdmFirm);
return R.ok(); 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<>();
body.put("username","xiaoz");
BeanUtils.populate(memberEntity, body);
System.out.println(memberEntity.getUsername());
}
/** /**
* 根据用户名获取企业认证信息 * 根据用户名获取企业认证信息
*/ */
@RequestMapping("/api/findUserName") @RequestMapping("/authApi/findUserName")
@Login
// @RequiresPermissions("manage:tycpdmfirm:save") // @RequiresPermissions("manage:tycpdmfirm:save")
public R findUserName(@RequestParam("userName") String userName){ public R findUserName(@RequestParam("userName") String userName){
...@@ -144,7 +181,7 @@ public class TycpdmFirmController extends AbstractController { ...@@ -144,7 +181,7 @@ public class TycpdmFirmController extends AbstractController {
/** /**
* 查询企业实名认证各个状态的数量(中心管理员查询所有,分中心查询) * 查询企业实名认证各个状态的数量(中心管理员查询所有,分中心查询)
*/ */
@RequestMapping("/api/findTycpdmFirmLogoutFlagCount") @RequestMapping("/authApi/findTycpdmFirmLogoutFlagCount")
// @RequiresPermissions("manage:tycpdmfirm:delete") // @RequiresPermissions("manage:tycpdmfirm:delete")
public R findTycpdmFirmLogoutFlagCount(){ public R findTycpdmFirmLogoutFlagCount(){
/*Integer id=getMemberUserId().intValue(); /*Integer id=getMemberUserId().intValue();
...@@ -161,13 +198,20 @@ public class TycpdmFirmController extends AbstractController { ...@@ -161,13 +198,20 @@ public class TycpdmFirmController extends AbstractController {
/** /**
* 上传文件(第二步) * 上传文件(第二步)
*/ */
@RequestMapping("/api/uploadFile") @RequestMapping("/authApi/uploadFile")
// @RequiresPermissions("manage:tycpdmfirm:delete") // @RequiresPermissions("manage:tycpdmfirm:delete")
@Login public R uploadFile(@RequestParam("file") MultipartFile file,@RequestParam("id") Integer id,@RequestParam("status") Integer status){
public R uploadFile(@RequestParam("file") MultipartFile file,@RequestParam("id") Integer id){
try { try {
tycpdmFirmService.uploadFile(file,id); if (status==1){
return R.ok(); tycpdmFirmService.uploadFile(file,id);
return R.ok();
}else if (status==2){
tycpdmFirmChangeService.uploadFile(file,id);
return R.ok();
}else {
return R.error("请前端人员传递业务类型 变更过新增");
}
} catch (Exception e) { } catch (Exception e) {
return R.error(e.getLocalizedMessage()); return R.error(e.getLocalizedMessage());
} }
...@@ -176,7 +220,7 @@ public class TycpdmFirmController extends AbstractController { ...@@ -176,7 +220,7 @@ public class TycpdmFirmController extends AbstractController {
/** /**
* 上传文件(第一步) * 上传文件(第一步)
*/ */
@RequestMapping("/api/uploadFileOne") @RequestMapping("/authApi/uploadFileOne")
// @RequiresPermissions("manage:tycpdmfirm:delete") // @RequiresPermissions("manage:tycpdmfirm:delete")
@Login @Login
public R uploadFileOne(@RequestParam("file") MultipartFile file){ public R uploadFileOne(@RequestParam("file") MultipartFile file){
...@@ -187,4 +231,22 @@ public class TycpdmFirmController extends AbstractController { ...@@ -187,4 +231,22 @@ public class TycpdmFirmController extends AbstractController {
return R.error(e.getLocalizedMessage()); return R.error(e.getLocalizedMessage());
} }
} }
/**
* 审批
*/
@RequestMapping("/authApi/audit")
// @RequiresPermissions("manage:tycpdmfirm:delete")
public R audit(@RequestBody Map map){
try {
tycpdmFirmService.audit(map);
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return R.ok();
}
} }
package io.office.modules.manage.controller; package io.office.modules.manage.controller;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Map; import java.util.Map;
import io.office.modules.app.annotation.Login; import io.office.modules.app.annotation.Login;
import io.office.modules.sys.controller.AbstractController; import io.office.modules.sys.controller.AbstractController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -39,8 +34,7 @@ public class UserFunctionBindingController extends AbstractController { ...@@ -39,8 +34,7 @@ public class UserFunctionBindingController extends AbstractController {
/** /**
* 查询 * 查询
*/ */
@Login @RequestMapping("/authApi/find")
@RequestMapping("/api/find")
public R find(){ public R find(){
Integer id=getUserId().intValue(); Integer id=getUserId().intValue();
if(id==null){ if(id==null){
...@@ -52,8 +46,7 @@ public class UserFunctionBindingController extends AbstractController { ...@@ -52,8 +46,7 @@ public class UserFunctionBindingController extends AbstractController {
/** /**
* 修改 * 修改
*/ */
@Login @RequestMapping("/authApi/update")
@RequestMapping("/api/update")
// @RequiresPermissions("manage:userfunctionbinding:update") // @RequiresPermissions("manage:userfunctionbinding:update")
public R update(@RequestBody Integer[] functionids){ public R update(@RequestBody Integer[] functionids){
Integer id=getUserId().intValue(); Integer id=getUserId().intValue();
...@@ -66,8 +59,7 @@ public class UserFunctionBindingController extends AbstractController { ...@@ -66,8 +59,7 @@ public class UserFunctionBindingController extends AbstractController {
/** /**
* 保存 * 保存
*/ */
@Login @RequestMapping("/authApi/save")
@RequestMapping("/api/save")
// @RequiresPermissions("manage:userfunctionbinding:save") // @RequiresPermissions("manage:userfunctionbinding:save")
public R save(@RequestBody Integer[] functionids){ public R save(@RequestBody Integer[] functionids){
//遍历插入数据 //遍历插入数据
......
package io.office.modules.manage.dao;
import io.office.modules.manage.entity.TimescodeChphoneEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-13 17:24:17
*/
@Mapper
@Component
public interface TimescodeChphoneDao extends BaseMapper<TimescodeChphoneEntity> {
}
package io.office.modules.manage.dao;
import io.office.modules.manage.entity.TimescodeChphoneIpEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-13 17:24:17
*/
@Mapper
@Component
public interface TimescodeChphoneIpDao extends BaseMapper<TimescodeChphoneIpEntity> {
}
...@@ -3,6 +3,8 @@ package io.office.modules.manage.dao; ...@@ -3,6 +3,8 @@ package io.office.modules.manage.dao;
import io.office.modules.manage.entity.TycpdmFirmChangeEntity; import io.office.modules.manage.entity.TycpdmFirmChangeEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import org.springframework.data.repository.query.Param;
/** /**
* ${comments} * ${comments}
...@@ -13,5 +15,9 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -13,5 +15,9 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface TycpdmFirmChangeDao extends BaseMapper<TycpdmFirmChangeEntity> { 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 logout_flag = #{logout_flag} WHERE id = #{id}")
void updateBYIdLogoutFlag(@Param("logout_flag") String logout_flag, @Param("id") String id);
} }
...@@ -32,4 +32,7 @@ public interface TycpdmFirmDao extends BaseMapper<TycpdmFirmEntity> { ...@@ -32,4 +32,7 @@ public interface TycpdmFirmDao extends BaseMapper<TycpdmFirmEntity> {
void updateByIdfirmArchivesFile(@Param("firm_archivesFile")String firm_archivesFile, @Param("id") Integer id, @Param("logout_flag")int logout_flag); void updateByIdfirmArchivesFile(@Param("firm_archivesFile")String firm_archivesFile, @Param("id") Integer id, @Param("logout_flag")int logout_flag);
List<TycpdmFirmEntity> selectTycpdmFirmList(@org.apache.ibatis.annotations.Param("params")Map<String, Object> params, Page page); 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);
} }
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;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-13 17:24:17
*/
@Data
@AllArgsConstructor
@TableName("timescode_chPhone")
public class TimescodeChphoneEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId(type = IdType.INPUT)
private String phone;
/**
* $column.comments
*/
private String date;
/**
* $column.comments
*/
private Integer times;
/**
* $column.comments
*/
private Integer timesValidate;
}
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}
*
* @author wudi
* @email
* @date 2021-12-13 17:24:17
*/
@Data
@AllArgsConstructor
@TableName("timescode_chPhone_ip")
public class TimescodeChphoneIpEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId(type = IdType.INPUT)
private String ip;
/**
* $column.comments
*/
private String date;
/**
* $column.comments
*/
private Integer timesIp;
}
...@@ -25,5 +25,7 @@ public interface MemberService extends IService<MemberEntity> { ...@@ -25,5 +25,7 @@ public interface MemberService extends IService<MemberEntity> {
void updatephone(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response); void updatephone(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response);
String getVerificationCode(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response);
} }
...@@ -3,6 +3,7 @@ package io.office.modules.manage.service; ...@@ -3,6 +3,7 @@ package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils; import io.office.common.utils.PageUtils;
import io.office.modules.manage.entity.TycpdmFirmChangeEntity; import io.office.modules.manage.entity.TycpdmFirmChangeEntity;
import org.springframework.web.multipart.MultipartFile;
import java.util.Map; import java.util.Map;
...@@ -16,5 +17,7 @@ import java.util.Map; ...@@ -16,5 +17,7 @@ import java.util.Map;
public interface TycpdmFirmChangeService extends IService<TycpdmFirmChangeEntity> { public interface TycpdmFirmChangeService extends IService<TycpdmFirmChangeEntity> {
PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Map<String, Object> params);
void uploadFile(MultipartFile file, Integer id);
} }
...@@ -10,6 +10,7 @@ import io.office.modules.sys.entity.SysUserEntity; ...@@ -10,6 +10,7 @@ import io.office.modules.sys.entity.SysUserEntity;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -34,5 +35,6 @@ public interface TycpdmFirmService extends IService<TycpdmFirmEntity> { ...@@ -34,5 +35,6 @@ public interface TycpdmFirmService extends IService<TycpdmFirmEntity> {
Page<TycpdmFirmEntity> findlist(Map<String, Object> params, Page page); Page<TycpdmFirmEntity> findlist(Map<String, Object> params, Page page);
void audit(Map map) throws InvocationTargetException, IllegalAccessException;
} }
...@@ -2,27 +2,29 @@ package io.office.modules.manage.service.impl; ...@@ -2,27 +2,29 @@ package io.office.modules.manage.service.impl;
import io.office.common.exception.RRException; import io.office.common.exception.RRException;
import io.office.common.utils.IPUtils; import io.office.common.utils.IPUtils;
import io.office.modules.manage.dao.TimescodeRegiDao; import io.office.modules.manage.dao.*;
import io.office.modules.manage.entity.TimescodeRegiEntity; 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.MD5Util;
import org.apache.commons.httpclient.NameValuePair;
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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.Map; import java.util.Map;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.common.utils.PageUtils; import io.office.common.utils.PageUtils;
import io.office.common.utils.Query; import io.office.common.utils.Query;
import io.office.modules.manage.dao.MemberDao;
import io.office.modules.manage.entity.MemberEntity;
import io.office.modules.manage.service.MemberService; import io.office.modules.manage.service.MemberService;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@Service("memberService") @Service("memberService")
...@@ -33,8 +35,17 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl ...@@ -33,8 +35,17 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
private TimescodeRegiDao timescodeRegiDao; private TimescodeRegiDao timescodeRegiDao;
@Autowired @Autowired
private TimescodeChphoneDao timescodeChphoneDao;
@Autowired
private TimescodeChphoneIpDao timescodeChphoneIpDao;
@Autowired
private MemberDao memberDao; private MemberDao memberDao;
@Autowired
private LogMessageDao logMessageDao;
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
IPage<MemberEntity> page = this.page( IPage<MemberEntity> page = this.page(
...@@ -46,53 +57,52 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl ...@@ -46,53 +57,52 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
} }
@Override @Override
public void userRegistered(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) { public void userRegistered(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) {
String userName = params.get("userName") == null ? "" : String.valueOf( params.get("userName")); String userName = params.get("userName") == null ? "" : String.valueOf(params.get("userName"));
String emiail = params.get("e-miail") == null ? "" : String.valueOf( params.get("e-miail")); String emiail = params.get("e-miail") == null ? "" : String.valueOf(params.get("e-miail"));
String phone = params.get("phone") == null ? "" : String.valueOf( params.get("phone")); String phone = params.get("phone") == null ? "" : String.valueOf(params.get("phone"));
String subjoin = params.get("subjoin") == null ? "" : String.valueOf( params.get("subjoin")); //验证码 String subjoin = params.get("subjoin") == null ? "" : String.valueOf(params.get("subjoin")); //验证码
String passWord = params.get("passWord") == null ? "" : String.valueOf( params.get("passWord")); String passWord = params.get("passWord") == null ? "" : String.valueOf(params.get("passWord"));
String passWord_repeat = params.get("passWord_repeat") == null ? "" : String.valueOf( params.get("passWord_repeat")); //重复密码 String passWord_repeat = params.get("passWord_repeat") == null ? "" : String.valueOf(params.get("passWord_repeat")); //重复密码
//判断用户名合法性 //判断用户名合法性
if (!checkUserName(userName)){ if (!checkUserName(userName)) {
throw new RRException("用户名不能是纯数字,长度2-8位"); throw new RRException("用户名不能是纯数字,长度2-8位");
} }
//判断密码合法性 //判断密码合法性
if (!checkPassWord(passWord)){ if (!checkPassWord(passWord)) {
throw new RRException("密码只能是数字加字母,长度5-12位"); throw new RRException("密码只能是数字加字母,长度5-12位");
} }
//判断重复密码 //判断重复密码
if (!passWord.equals(passWord_repeat)){ if (!passWord.equals(passWord_repeat)) {
throw new RRException("两次密码不一致"); throw new RRException("两次密码不一致");
} }
//判断email //判断email
if (!isValidEmail(emiail)){ if (!isValidEmail(emiail)) {
throw new RRException("e-miail格式错误"); throw new RRException("e-miail格式错误");
} }
//判断联系电话非空,且为11位数字 //判断联系电话非空,且为11位数字
if (!matchPhoneNumber(phone)){ if (!matchPhoneNumber(phone)) {
throw new RRException("手机格式不正确,请重新填写"); throw new RRException("手机格式不正确,请重新填写");
} }
//利用获取验证码时保存的session,判断手机验证码非空,和发送的短信内容是否一致,提交时的手机号与接收验证码的手机号是否相同,验证码是否已失效 //利用获取验证码时保存的session,判断手机验证码非空,和发送的短信内容是否一致,提交时的手机号与接收验证码的手机号是否相同,验证码是否已失效
String subjoinReq = request.getSession().getAttribute("subjoin")==null?"":String.valueOf(request.getSession().getAttribute("subjoin")); 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")); 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")));//毫秒值 Long dateReq = request.getSession().getAttribute("date") == null ? 0 : Long.valueOf(String.valueOf(request.getSession().getAttribute("date")));//毫秒值
subjoinReq="344942"; subjoinReq = "344942";
telReq="13159872863"; telReq = "13159872863";
long l = System.currentTimeMillis(); long l = System.currentTimeMillis();
//dateReq=(l-dateReq)/1000; //dateReq=(l-dateReq)/1000;
dateReq=30L; dateReq = 30L;
//获取验证码验证次数 //获取验证码验证次数
TimescodeRegiEntity timescodeRegiEntity = timescodeRegiDao.selectById(phone); TimescodeRegiEntity timescodeRegiEntity = timescodeRegiDao.selectById(phone);
if (timescodeRegiEntity==null){ if (timescodeRegiEntity == null) {
throw new RRException("该手机格未获取过验证码"); throw new RRException("该手机格未获取过验证码");
} }
Integer timesValidate = timescodeRegiEntity.getTimesValidate();//验证码输入错误次数; Integer timesValidate = timescodeRegiEntity.getTimesValidate();//验证码输入错误次数;
//校验验证码 //校验验证码
checkSubjoinRegi(subjoin,subjoinReq,phone,telReq,dateReq,timesValidate); checkSubjoinRegi(subjoin, subjoinReq, phone, telReq, dateReq, timesValidate);
//存入数据库 密码加密 //存入数据库 密码加密
MemberEntity memberEntity = new MemberEntity(); MemberEntity memberEntity = new MemberEntity();
memberEntity.setUsername(userName); memberEntity.setUsername(userName);
...@@ -109,60 +119,128 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl ...@@ -109,60 +119,128 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
@Override @Override
public void updatePass(Map<String, Object> params) { public void updatePass(Map<String, Object> params) {
String id = params.get("id") == null ? "" : String.valueOf( params.get("id"));//用户ID String id = params.get("id") == null ? "" : String.valueOf(params.get("id"));//用户ID
String oldPass = params.get("oldPass") == null ? "" : String.valueOf( params.get("oldPass"));//原始密码 String oldPass = params.get("oldPass") == null ? "" : String.valueOf(params.get("oldPass"));//原始密码
String newPass = params.get("newPass") == null ? "" : String.valueOf( params.get("newPass"));//新密码 String newPass = params.get("newPass") == null ? "" : String.valueOf(params.get("newPass"));//新密码
String affirmPass = params.get("affirmPass") == null ? "" : String.valueOf( params.get("affirmPass"));//确认密码 String affirmPass = params.get("affirmPass") == null ? "" : String.valueOf(params.get("affirmPass"));//确认密码
if (id.equals("")){ if (id.equals("")) {
throw new RRException("请先登录"); throw new RRException("请先登录");
} }
if (oldPass.equals("")){ if (oldPass.equals("")) {
throw new RRException("请输入旧密码"); throw new RRException("请输入旧密码");
} }
if (newPass.equals("")){ if (newPass.equals("")) {
throw new RRException("请输入新密码"); throw new RRException("请输入新密码");
} }
if (affirmPass.equals("")){ if (affirmPass.equals("")) {
throw new RRException("请输入确认密码"); throw new RRException("请输入确认密码");
} }
if (!newPass.equals(affirmPass)){ if (!newPass.equals(affirmPass)) {
throw new RRException("两次密码信息不一致,请重新输入"); throw new RRException("两次密码信息不一致,请重新输入");
} }
MemberEntity memberEntity = memberDao.selectById(id); MemberEntity memberEntity = memberDao.selectById(id);
String passData = memberEntity.getPass(); String passData = memberEntity.getPass();
String passMD5 = MD5Util.md5Encrypt32Upper(oldPass); String passMD5 = MD5Util.md5Encrypt32Upper(oldPass);
if (!passMD5.equals(passData)){ if (!passMD5.equals(passData)) {
throw new RRException("旧密码输入错误"); throw new RRException("旧密码输入错误");
} }
//修改密码 //修改密码
memberDao.updateByIdPassWord(Integer.valueOf(id),MD5Util.md5Encrypt32Upper(newPass)); memberDao.updateByIdPassWord(Integer.valueOf(id), MD5Util.md5Encrypt32Upper(newPass));
} }
@Override @Override
public void updatephone(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) { public void updatephone(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) {
//TODO tgl (接口未完成) 记录表:timescode_chPhone timescode_chPhone_ip 5分钟有效 每天3次 同IP10次 String ip = IPUtils.getIpAddr(request);
String id = params.get("id") == null ? "" : String.valueOf( params.get("id"));//用户ID String id = params.get("id") == null ? "" : String.valueOf(params.get("id"));//用户ID
String phone = params.get("phone") == null ? "" : String.valueOf( params.get("phone"));//手机号码 String phone = params.get("phone") == null ? "" : String.valueOf(params.get("phone"));//手机号码
String verification = params.get("verification") == null ? "" : String.valueOf( params.get("verification"));//验证码 String verification = params.get("verification") == null ? "" : String.valueOf(params.get("verification"));//验证码
if (id.equals("")){ if (id.equals("")) {
throw new RRException("请先登录"); throw new RRException("请先登录");
} }
if (phone.equals("")){ int flag = 1;
TimescodeChphoneEntity timescodeChphoneEntity = timescodeChphoneDao.selectById(phone);
if (timescodeChphoneEntity != null) { // 该手机号码是否发送过短信
Integer times = timescodeChphoneEntity.getTimes();
Integer times_validate = timescodeChphoneEntity.getTimesValidate();
String date = timescodeChphoneEntity.getDate();
String date_1 = DateUtils.getDay();
if (date_1.equals(date)) {
times = times + 1;
date = date_1;
//更新数据
timescodeChphoneDao.updateById(new TimescodeChphoneEntity(phone, date, times, times_validate));
if (times <= 3) {
flag = 1;
} else {
flag = 0;
}
} else {
//不是同一天修改 数据并初始化数据
times = 1;
date = date_1;
timescodeChphoneDao.updateById(new TimescodeChphoneEntity(phone, date, times, times_validate));
flag = 1;
}
} else {
//没有手机号,新增数据
String date = DateUtils.getDay();
int times = 1;
int times_validate = 0;
//新增数据
timescodeChphoneDao.insert(new TimescodeChphoneEntity(phone, date, times, times_validate));
flag = 1;
}
// 以下添加同一个ip短信发送次数验证
int flag_ip = 1;
TimescodeChphoneIpEntity timescodeChphoneIpEntity = timescodeChphoneIpDao.selectById(ip);
if (timescodeChphoneIpEntity != null) {
Integer times_ip = timescodeChphoneIpEntity.getTimesIp();
String date = timescodeChphoneIpEntity.getDate();
String date_1 = DateUtils.getDay();
if (date_1.equals(date)) {
times_ip = times_ip + 1;
date = date_1;
timescodeChphoneIpDao.updateById(new TimescodeChphoneIpEntity(ip, date, times_ip));
if (times_ip <= 10) {
flag_ip = 1;
} else {
flag_ip = 0;
}
} else {
times_ip = 1;
date = date_1;
timescodeChphoneIpDao.updateById(new TimescodeChphoneIpEntity(ip, date, times_ip));
flag_ip = 1;
}
} else {
String date = DateUtils.getDay();
int times_ip = 1;
timescodeChphoneIpDao.insert(new TimescodeChphoneIpEntity(ip, date, times_ip));
flag_ip = 1;
}
// 同一个ip短信发送次数验证end
if (flag == 0) {
throw new RRException("同一手机号每日最多操作三次!");
} else if (flag_ip == 0) {
throw new RRException("同一ip每日最多操作十次!");
}
if (phone.equals("")) {
throw new RRException("请输入手机号码"); throw new RRException("请输入手机号码");
} }
if (verification.equals("")){ if (verification.equals("")) {
throw new RRException("请输入验证码"); throw new RRException("请输入验证码");
} }
String verUpdatephone = request.getSession().getAttribute("verUpdatephone").toString();//获取手机验证码 String verUpdatephone = request.getSession().getAttribute("verification").toString();//获取手机验证码
long verUpdateData = Long.valueOf(request.getSession().getAttribute("verUpdateData").toString());//获取手机有效时间 long verUpdateData = Long.valueOf(request.getSession().getAttribute("verUpdateData").toString());//获取手机有效时间
if (!verUpdatephone.equals(verification)){ if (!verUpdatephone.equals(verification)) {
throw new RRException("验证码输入错误"); throw new RRException("验证码输入错误");
} }
long l = System.currentTimeMillis(); long l = System.currentTimeMillis();
if (l-verUpdateData>300){ if (l - verUpdateData > 300) {
throw new RRException("验证码已超时"); throw new RRException("验证码已超时");
} }
memberDao.updateByIDPhone(Integer.valueOf(id),phone); memberDao.updateByIDPhone(Integer.valueOf(id), phone);
} }
...@@ -171,32 +249,34 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl ...@@ -171,32 +249,34 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
String t123456 = MD5Util.md5Encrypt32Upper("t123456"); String t123456 = MD5Util.md5Encrypt32Upper("t123456");
System.out.println(t123456); System.out.println(t123456);
} }
/** /**
* 以下为短信验证码验证次数判断 * 以下为短信验证码验证次数判断
* @param sub 验证码 *
* @param reSub session存储的验证码 * @param sub 验证码
* @param tel 手机号 * @param reSub session存储的验证码
* @param reTel session存储的手机号 * @param tel 手机号
* @param time_diff session存储的毫秒值 * @param reTel session存储的手机号
* @param times_validate 验证码失败次数 * @param time_diff session存储的毫秒值
* @param times_validate 验证码失败次数
* @return * @return
*/ */
public boolean checkSubjoinRegi(String sub,String reSub,String tel,String reTel,long time_diff,int times_validate){ public boolean checkSubjoinRegi(String sub, String reSub, String tel, String reTel, long time_diff, int times_validate) {
if (sub.equals("")){ if (sub.equals("")) {
throw new RRException("手机验证码不能为空!"); throw new RRException("手机验证码不能为空!");
}else if (time_diff>=300){ } else if (time_diff >= 300) {
throw new RRException("验证码已超时!"); throw new RRException("验证码已超时!");
}else if (times_validate>=3){ } else if (times_validate >= 3) {
throw new RRException("该验证码输入错误满3次,已失效,请重新获取!"); throw new RRException("该验证码输入错误满3次,已失效,请重新获取!");
}else { } else {
if (!sub.equals(reSub)){ if (!sub.equals(reSub)) {
if (times_validate<=3){ if (times_validate <= 3) {
times_validate+=1; times_validate += 1;
timescodeRegiDao.updateByIdTimes_validate(reTel,times_validate); timescodeRegiDao.updateByIdTimes_validate(reTel, times_validate);
throw new RRException("验证码已输入错误" + times_validate + "次(输入错误满3次时,该验证码失效)!"); throw new RRException("验证码已输入错误" + times_validate + "次(输入错误满3次时,该验证码失效)!");
} }
} }
if (!tel.equals(reTel)){ if (!tel.equals(reTel)) {
throw new RRException("手机号码错误!"); throw new RRException("手机号码错误!");
} }
} }
...@@ -204,19 +284,13 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl ...@@ -204,19 +284,13 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
} }
//用户名校验 //用户名校验
public boolean checkUserName(String logname){ public boolean checkUserName(String logname) {
String t1 = "^[0-9A-Za-z]{2,8}$"; //判断密码用户名和密码是否为数字,字母(数字或字母) 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}$";//(数字和字母)
if(logname.matches(t2)) { if (logname.matches(t2)) {
return logname.matches(t2); return logname.matches(t2);
}else { } else {
//System.out.println("用户名只能是数字加字母,长度2-8位"); //System.out.println("用户名只能是数字加字母,长度2-8位");
return false; return false;
...@@ -231,12 +305,12 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl ...@@ -231,12 +305,12 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
} }
public boolean checkPassWord(String passWord){ public boolean checkPassWord(String passWord) {
String t1 = "^[0-9A-Za-z]{2,8}$"; //判断密码用户名和密码是否为数字,字母(数字或字母) String t1 = "^[0-9A-Za-z]{2,8}$"; //判断密码用户名和密码是否为数字,字母(数字或字母)
String t2="^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{5,12}$";//(数字和字母) String t2 = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{5,12}$";//(数字和字母)
if(passWord.matches(t2)) { if (passWord.matches(t2)) {
return passWord.matches(t2); return passWord.matches(t2);
}else { } else {
//System.out.println("用户名只能是数字加字母,长度2-8位"); //System.out.println("用户名只能是数字加字母,长度2-8位");
return false; return false;
...@@ -245,14 +319,175 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl ...@@ -245,14 +319,175 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
/** /**
* 验证手机号 由于号码段不断的更新,只需要判断手机号有11位,并且全是数字以及1开头等 * 验证手机号 由于号码段不断的更新,只需要判断手机号有11位,并且全是数字以及1开头等
*
* @param phoneNumber 手机号码 * @param phoneNumber 手机号码
* @return * @return
*/ */
private static boolean matchPhoneNumber(String phoneNumber) { private static boolean matchPhoneNumber(String phoneNumber) {
String regex = "1[358][0-9]{9}"; String regex = "1[358][0-9]{9}";
if(phoneNumber==null||phoneNumber.length()<=0){ if (phoneNumber == null || phoneNumber.length() <= 0) {
return false; return false;
} }
return Pattern.matches(regex, phoneNumber); return Pattern.matches(regex, phoneNumber);
} }
@Override
public String getVerificationCode(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) {
//验证码随机6位数字(验证码)
String pass = (int) ((Math.random() * 9 + 1) * 100000) + "";
//获取IP(可能不是真实IP)
String ip = IPUtils.getIpAddr(request);
//手机号
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)) {
throw new RRException("手机格式不正确,请重新填写");
}
//TODO tgl 判断手机号码是否在黑名单内
//写入session
HttpSession session = request.getSession();
session.setAttribute("verification", pass);//验证码
session.setAttribute("tel", phone);//手机号
session.setAttribute("date", System.currentTimeMillis());//毫秒值
//发送状态
String state = "";
// 以下添加同一个手机号短信发送次数验证
int flag = 1;
TimescodeChphoneEntity timescodeChphoneEntity = timescodeChphoneDao.selectById(phone);
if (timescodeChphoneEntity != null) { // 该手机号码是否发送过短信
Integer times = timescodeChphoneEntity.getTimes();
Integer times_validate = timescodeChphoneEntity.getTimesValidate();
String date = timescodeChphoneEntity.getDate();
String date_1 = DateUtils.getDay();
if (date_1.equals(date)) {
times = times + 1;
date = date_1;
//更新数据
timescodeChphoneDao.updateById(new TimescodeChphoneEntity(phone, date, times, times_validate));
if (times <= 3) {
flag = 1;
} else {
flag = 0;
}
} else {
//不是同一天修改 数据并初始化数据
times = 1;
date = date_1;
timescodeChphoneDao.updateById(new TimescodeChphoneEntity(phone, date, times, times_validate));
flag = 1;
}
} else {
//没有手机号,新增数据
String date = DateUtils.getDay();
int times = 1;
int times_validate = 0;
//新增数据
timescodeChphoneDao.insert(new TimescodeChphoneEntity(phone, date, times, times_validate));
flag = 1;
}
// 同一个手机号短信发送次数验证end
// 以下添加同一个ip短信发送次数验证
int flag_ip = 1;
TimescodeChphoneIpEntity timescodeChphoneIpEntity = timescodeChphoneIpDao.selectById(ip);
if (timescodeChphoneIpEntity != null) {
Integer times_ip = timescodeChphoneIpEntity.getTimesIp();
String date = timescodeChphoneIpEntity.getDate();
String date_1 = DateUtils.getDay();
if (date_1.equals(date)) {
times_ip = times_ip + 1;
date = date_1;
timescodeChphoneIpDao.updateById(new TimescodeChphoneIpEntity(ip, date, times_ip));
if (times_ip <= 10) {
flag_ip = 1;
} else {
flag_ip = 0;
}
} else {
times_ip = 1;
date = date_1;
timescodeChphoneIpDao.updateById(new TimescodeChphoneIpEntity(ip, date, times_ip));
flag_ip = 1;
}
} else {
String date = DateUtils.getDay();
int times_ip = 1;
timescodeChphoneIpDao.insert(new TimescodeChphoneIpEntity(ip, date, times_ip));
flag_ip = 1;
}
// 同一个ip短信发送次数验证end
if (flag == 0) {
throw new RRException("同一手机号每日最多操作三次!");
} else if (flag_ip == 0) {
throw new RRException("同一ip每日最多操作十次!");
} else { //flag=1时 ,发送短信
// //********* 以下调用手机发短信接口 ********* //
String res = "res";
String account = "gs1cn"; // 此处按接口文档填写
String password = "test@2021"; // 此处按接口文档填写
String userid = "9220"; // 此处按接口文档填写
String content = "您在中国物品编码中心网站修改手机号码的手机验证码为:" + pass + ",五分钟内有效,请正确输入!同一手机号每日最多操作三次!同一个ip每日最多操作十次!【中国物品编码中心】";
try {
NameValuePair[] data = {
new NameValuePair("action", "send"),
new NameValuePair("userid", userid),
new NameValuePair("account", account),
new NameValuePair("password", password),
new NameValuePair("mobile", phone),
new NameValuePair("content", content),
new NameValuePair("sendTime", DateUtils.getDay()),
new NameValuePair("mobilenumber", "2"),
new NameValuePair("countnumber", "2"),
new NameValuePair("telephonenumber", "0"),
};
String post = sendPost("http://39.106.204.178:8888/sms.aspx", data);
Document document = DocumentHelper.parseText(post);
// 获取returnstatus节点对象
String returnstatus = document.selectSingleNode("//returnstatus").getText();
if (returnstatus.equals("Success")) {
//保存验证码信息log_message表
state = "发送成功";
return "Success";
} else if (returnstatus.equals("Faild")) {
state = "发送失败";
throw new RRException("验证码发送失败:" + document.selectSingleNode("//message").getText());
} else {
state = "发送失败";
throw new RRException("验证码发送失败,请稍后再试!");
}
} catch (Exception e) {
e.printStackTrace();
throw new RRException("网络错误,无法连接到服务器!");
} finally {
logMessageDao.insert(new LogMessageEntity(userName, phone, new Date(), pass, ip,
request.getRequestURL().toString(), "注册新用户", state));
}
}
}
/**
* 发送post 数据
* @param urls
* @return
*/
public static String sendPost(String urls, NameValuePair[] data ) {
try {
PostMethod postMethod = null;
postMethod = new PostMethod(urls) ;
postMethod.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8") ;
//参数设置,需要注意的就是里边不能传NULL,要传空字符串
postMethod.setRequestBody(data);
org.apache.commons.httpclient.HttpClient httpClient = new org.apache.commons.httpclient.HttpClient();
int response = httpClient.executeMethod(postMethod); // 执行POST方法
String result = postMethod.getResponseBodyAsString() ;
return result;
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
} }
\ No newline at end of file
...@@ -103,7 +103,7 @@ public class TimescodeRegiServiceImpl extends ServiceImpl<TimescodeRegiDao, Time ...@@ -103,7 +103,7 @@ public class TimescodeRegiServiceImpl extends ServiceImpl<TimescodeRegiDao, Time
//写入session //写入session
HttpSession session = request.getSession(); HttpSession session = request.getSession();
session.setAttribute("subjoin",pass);//验证码 session.setAttribute("subjoin",pass);//验证码
session.setAttribute("tel",pass);//手机号 session.setAttribute("tel",phone);//手机号
session.setAttribute("date",System.currentTimeMillis());//毫秒值 session.setAttribute("date",System.currentTimeMillis());//毫秒值
//发送状态 //发送状态
......
package io.office.modules.manage.service.impl; package io.office.modules.manage.service.impl;
import io.office.common.exception.RRException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.File;
import java.io.IOException;
import java.util.Map; import java.util.Map;
import java.util.UUID;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...@@ -11,11 +19,23 @@ import io.office.common.utils.Query; ...@@ -11,11 +19,23 @@ import io.office.common.utils.Query;
import io.office.modules.manage.dao.TycpdmFirmChangeDao; import io.office.modules.manage.dao.TycpdmFirmChangeDao;
import io.office.modules.manage.entity.TycpdmFirmChangeEntity; import io.office.modules.manage.entity.TycpdmFirmChangeEntity;
import io.office.modules.manage.service.TycpdmFirmChangeService; import io.office.modules.manage.service.TycpdmFirmChangeService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import sun.dc.pr.PRError;
@Service("tycpdmFirmChangeService") @Service("tycpdmFirmChangeService")
public class TycpdmFirmChangeServiceImpl extends ServiceImpl<TycpdmFirmChangeDao, TycpdmFirmChangeEntity> implements TycpdmFirmChangeService { public class TycpdmFirmChangeServiceImpl extends ServiceImpl<TycpdmFirmChangeDao, TycpdmFirmChangeEntity> implements TycpdmFirmChangeService {
@Autowired
private TycpdmFirmChangeDao tycpdmFirmChangeDao;
@Value("${uploadFileQY}")
String uploadFileQY;
@Value("${uploadFileQYOne}")
String uploadFileQYOne;
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
IPage<TycpdmFirmChangeEntity> page = this.page( IPage<TycpdmFirmChangeEntity> page = this.page(
...@@ -26,4 +46,42 @@ public class TycpdmFirmChangeServiceImpl extends ServiceImpl<TycpdmFirmChangeDao ...@@ -26,4 +46,42 @@ public class TycpdmFirmChangeServiceImpl extends ServiceImpl<TycpdmFirmChangeDao
return new PageUtils(page); return new PageUtils(page);
} }
@Override
@Transactional
public void uploadFile(MultipartFile file, Integer id) {
//删除原来的文件
TycpdmFirmChangeEntity tycpdmFirmChangeEntity = tycpdmFirmChangeDao.selectById(id);
String firmArchivesfile = tycpdmFirmChangeEntity.getFirmArchivesfile();
if (file.isEmpty()) {
throw new RRException("上传失败,请选择文件");
}
File dir = new File(uploadFileQY);
if (!dir.exists()){
boolean mkdirs = dir.mkdirs();
System.out.println(mkdirs);
}
String fileName = file.getOriginalFilename();
String substring = fileName.substring(fileName.lastIndexOf("."));//文件后缀
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
File dest = new File(uploadFileQY + uuid+substring);
try {
file.transferTo(dest);
//保存路径 firm_archivesFile
tycpdmFirmChangeDao.updateByIdfirmArchivesFile(uploadFileQY + uuid+substring,id,0);
//删除原来的照片
if (firmArchivesfile!=null){
File file1 = new File(firmArchivesfile);
if (file1.exists()){
file1.delete();
}
}
return ;
} catch (IOException e) {
dir.delete();
e.printStackTrace();
throw new RRException("上传失败");
}
}
} }
\ No newline at end of file
...@@ -3,17 +3,20 @@ package io.office.modules.manage.service.impl; ...@@ -3,17 +3,20 @@ package io.office.modules.manage.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.exception.RRException; import io.office.common.exception.RRException;
import io.office.modules.manage.dao.MemberDao; import io.office.modules.manage.dao.MemberDao;
import io.office.modules.manage.dao.TycpdmFirmChangeDao;
import io.office.modules.manage.dao.TycpdmVipUserDao; import io.office.modules.manage.dao.TycpdmVipUserDao;
import io.office.modules.manage.entity.MemberEntity; import io.office.modules.manage.entity.*;
import io.office.modules.manage.entity.ProductEntity;
import io.office.modules.manage.entity.TycpdmVipUserEntity;
import io.office.modules.sys.entity.SysUserEntity; import io.office.modules.sys.entity.SysUserEntity;
import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.annotation.Id;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -26,8 +29,8 @@ import io.office.common.utils.PageUtils; ...@@ -26,8 +29,8 @@ import io.office.common.utils.PageUtils;
import io.office.common.utils.Query; import io.office.common.utils.Query;
import io.office.modules.manage.dao.TycpdmFirmDao; import io.office.modules.manage.dao.TycpdmFirmDao;
import io.office.modules.manage.entity.TycpdmFirmEntity;
import io.office.modules.manage.service.TycpdmFirmService; import io.office.modules.manage.service.TycpdmFirmService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -39,6 +42,9 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -39,6 +42,9 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
private TycpdmFirmDao tycpdmFirmDao; private TycpdmFirmDao tycpdmFirmDao;
@Autowired @Autowired
private TycpdmFirmChangeDao tycpdmFirmChangeDao;
@Autowired
private TycpdmVipUserDao tycpdmVipUserDao; private TycpdmVipUserDao tycpdmVipUserDao;
@Autowired @Autowired
...@@ -95,6 +101,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -95,6 +101,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
} }
@Override @Override
@Transactional
public void uploadFile(MultipartFile file, Integer id) { public void uploadFile(MultipartFile file, Integer id) {
//要删除原来的文件 //要删除原来的文件
TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id); TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id);
...@@ -132,7 +139,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -132,7 +139,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
} }
return ; return ;
} catch (Exception e) { } catch (IOException e) {
dir.delete(); dir.delete();
e.printStackTrace(); e.printStackTrace();
throw new RRException("上传失败"); throw new RRException("上传失败");
...@@ -171,4 +178,44 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -171,4 +178,44 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
return page; return page;
} }
@Override
@Transactional
public void audit(Map map) 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.不通过
//logout_flag
if (status==1){
//新增
//直接修改tycpmFirm表 状态
tycpdmFirmDao.updateBYIdLogoutFlag(auditStatus,id);
//在tycpdm_vip_user表中记录
if ("1".equals(auditStatus)){
TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id);
String baseUser = tycpdmFirmEntity.getBaseUser();
String firmname = tycpdmFirmEntity.getFirmname();
tycpdmVipUserDao.insert(new TycpdmVipUserEntity(null,id+"",firmname,baseUser));
}
}else if (status==2){
//变更
tycpdmFirmChangeDao.updateBYIdLogoutFlag(auditStatus,id);
if ("1".equals(auditStatus)){
//通过将变更表的数据同步到tycpdmFirm表
TycpdmFirmChangeEntity tycpdmFirmChangeEntity = tycpdmFirmChangeDao.selectById(id);
Integer fId = tycpdmFirmChangeEntity.getFId();
TycpdmFirmEntity tycpdmFirmEntity = new TycpdmFirmEntity();
Map testMap = new BeanMap(tycpdmFirmChangeEntity);
BeanUtils.populate(tycpdmFirmEntity, testMap);
//数据更新到tycpdmFirm表
tycpdmFirmDao.updateById(tycpdmFirmEntity);
tycpdmFirmEntity = tycpdmFirmDao.selectById(fId);
String baseUser = tycpdmFirmEntity.getBaseUser();
String firmname = tycpdmFirmEntity.getFirmname();
tycpdmVipUserDao.insert(new TycpdmVipUserEntity(null,id+"",firmname,baseUser));
}
}
}
} }
\ No newline at end of file
<?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="io.office.modules.manage.dao.TimescodeChphoneDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.TimescodeChphoneEntity" id="timescodeChphoneMap">
<result property="phone" column="phone"/>
<result property="date" column="date"/>
<result property="times" column="times"/>
<result property="timesValidate" column="times_validate"/>
</resultMap>
</mapper>
\ No newline at end of file
<?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="io.office.modules.manage.dao.TimescodeChphoneIpDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.TimescodeChphoneIpEntity" id="timescodeChphoneIpMap">
<result property="ip" column="ip"/>
<result property="date" column="date"/>
<result property="timesIp" column="times_ip"/>
</resultMap>
</mapper>
\ No newline at end of file
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