Commit c8443882 by rongkailun

Merge remote-tracking branch 'origin/master'

parents b171870a 20964509
......@@ -252,6 +252,19 @@
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>
<build>
......
package io.office.common.enumpack.manage;
/**
* @author ZYF
* @description
* @date 2021/12/7
*/
public enum FunctionEnum {
Business_Information_Service_Platform("0", "商务信息服务平台"),
Import_Commodity_Data_Dulletin("1", "进口商品数据通报"),
Bar_Code_MicroStation("2","条码微站"),
Traceability_Platform("3","追溯平台"),
Bar_Code_Commercial_Bridge("4","条码商桥"),
Commodity_QR_Code("5","商品二维码"),
GDSN("6","GDSN"),
Barcode_RF_Software_Detection_Service("7","条码/射频/软件检测服务"),
ECODE("8","ECODE"),
Educational_Knowledge_Management_Platform("9","教育知识管理平台"),
Barcode_Information_Query("10","条码信息查询"),
Product_Service("11","产品服务"),
Platform_Service("12","平台服务"),
More_Customization("13","更多定制");
private String code;
private String msg;
FunctionEnum(String code) {
this.code = code;
}
FunctionEnum(String code, String message) {
this.code = code;
this.msg = message;
}
}
......@@ -87,17 +87,16 @@ public class BranchController {
public R delete(@RequestBody String[] branchCodes){
branchService.removeByIds(Arrays.asList(branchCodes));
return R.ok();
}
@Login
@RequestMapping("/api/getList")
@RequestMapping("/api/getBranchDetail")
// @RequiresPermissions("manage:shortcode:delete")
public R getList(){
return R.ok().put("data",branchService.list());
public R getBranchDetail(@RequestBody Map<String,String> params){
return R.ok().put("data",branchService.getBranchDetail(params.get("branchCode")));
}
}
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;
import io.office.common.utils.R;
/**
* ${comments}
*
* @author tgl
* @email
* @date 2021-12-08 11:04:42
*/
@RestController
@RequestMapping("/logmessage")
public class LogMessageController {
@Autowired
private LogMessageService logMessageService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("manage:logmessage:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = logMessageService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("manage:logmessage:info")
public R info(@PathVariable("id") Integer id){
LogMessageEntity logMessage = logMessageService.getById(id);
return R.ok().put("logMessage", logMessage);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("manage:logmessage:save")
public R save(@RequestBody LogMessageEntity logMessage){
logMessageService.save(logMessage);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("manage:logmessage:update")
public R update(@RequestBody LogMessageEntity logMessage){
logMessageService.updateById(logMessage);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:logmessage:delete")
public R delete(@RequestBody Integer[] ids){
logMessageService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
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.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;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-08 13:54:50
*/
@RestController
@RequestMapping("/member")
public class MemberController {
@Autowired
private MemberService memberService;
/**
* 用户注册
*/
@RequestMapping("/api/userRegistered")
// @RequiresPermissions("manage:member:list")
public R userRegistered(@RequestBody Map<String, Object> params, HttpServletRequest request, HttpServletResponse response){
memberService.userRegistered(params,request,response);
return R.ok();
}
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("manage:member:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = memberService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("manage:member:info")
public R info(@PathVariable("id") Integer id){
MemberEntity member = memberService.getById(id);
return R.ok().put("member", member);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("manage:member:save")
public R save(@RequestBody MemberEntity member){
memberService.save(member);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("manage:member:update")
public R update(@RequestBody MemberEntity member){
memberService.updateById(member);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:member:delete")
public R delete(@RequestBody Integer[] ids){
memberService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
......@@ -114,4 +114,19 @@ public class ProductController extends AbstractController {
}
}
/**
* 分页查图书
* @param param:分页参数
* @return
*/
@RequestMapping("/api/findPage")
// @RequiresPermissions("manage:product:findPage")
public R findPage(@RequestBody Map<String,String> param){
Page<ProductEntity> pag = this.productService.findPage(
new Page(Integer.valueOf(param.get("page")),
Integer.valueOf(param.get("size"))));
PageUtils pageUtils = new PageUtils(pag);
return R.ok().put("page", pageUtils);
}
}
package io.office.modules.manage.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
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.Value;
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.UserFunctionBindingEntity;
import io.office.modules.manage.service.UserFunctionBindingService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
/**
* ${comments}
*
* @author zyf
* @email
* @date 2021-12-07 15:22:24
*/
@RestController
@RequestMapping("/userfunctionbinding")
public class UserFunctionBindingController extends AbstractController {
@Autowired
private UserFunctionBindingService userFunctionBindingService;
/**
* 查询
*/
@RequestMapping("/api/find")
public R find(){
Integer id=getUserId().intValue();
if(id==null){
return R.error("用户信息有误");
}
Object[] functionids = userFunctionBindingService.queryList(id);
return R.ok().put("functionids", functionids);
}
/**
* 修改
*/
@RequestMapping("/api/update")
// @RequiresPermissions("manage:userfunctionbinding:update")
public R update(@RequestBody Integer[] functionids){
Integer id=getUserId().intValue();
if(id==null){
return R.error("用户信息有误");
}
userFunctionBindingService.Modify(functionids,id);
return R.ok();
}
/**
* 保存
*/
@RequestMapping("/api/save")
// @RequiresPermissions("manage:userfunctionbinding:save")
public R save(@RequestBody Integer[] functionids){
//遍历插入数据
for (int functionid : functionids) {
UserFunctionBindingEntity ufb=new UserFunctionBindingEntity();
ufb.setUserId(getUserId().intValue());
ufb.setFuncId(functionid);
userFunctionBindingService.save(ufb);
}
return R.ok();
}
/**
* 列表
*/
@RequestMapping("/api/list")
// @RequiresPermissions("manage:userfunctionbinding:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = userFunctionBindingService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/api/info/{id}")
// @RequiresPermissions("manage:userfunctionbinding:info")
public R info(@PathVariable("id") Integer id){
UserFunctionBindingEntity userFunctionBinding = userFunctionBindingService.getById(id);
return R.ok().put("userFunctionBinding", userFunctionBinding);
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:userfunctionbinding:delete")
public R delete(@RequestBody Integer[] ids){
userFunctionBindingService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
......@@ -2,7 +2,9 @@ package io.office.modules.manage.dao;
import io.office.modules.manage.entity.BranchEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.office.modules.manage.vo.response.BranchEntityVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* ${comments}
......@@ -14,4 +16,8 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface BranchDao extends BaseMapper<BranchEntity> {
BranchEntityVo getBranchDetail (@Param("branchCode") String branchCode);
}
package io.office.modules.manage.dao;
import io.office.modules.manage.entity.LogMessageEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-08 11:04:42
*/
@Mapper
public interface LogMessageDao extends BaseMapper<LogMessageEntity> {
}
package io.office.modules.manage.dao;
import io.office.modules.manage.entity.MemberEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-08 13:54:50
*/
@Mapper
public interface MemberDao extends BaseMapper<MemberEntity> {
}
......@@ -20,4 +20,5 @@ import java.util.Map;
public interface ProductDao extends BaseMapper<ProductEntity> {
List<ProductEntity> selectProductList(@Param("params") Map<String, Object> params, Page page);
List<ProductEntity> findPage(Page page);
}
......@@ -2,7 +2,7 @@ package io.office.modules.manage.dao;
import io.office.modules.manage.entity.TimescodeRegiEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.*;
/**
* ${comments}
......@@ -14,4 +14,10 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TimescodeRegiDao extends BaseMapper<TimescodeRegiEntity> {
@Select("select * from timescode_regi where phone=#{phone} ")
TimescodeRegiEntity findByPhone(@Param("phone") String phone);
@Update("UPDATE timescode_regi SET times_validate = #{times_validate} WHERE phone=#{phone}")
int updateById(@Param("phone") String phone,@Param("times_validate") Integer times_validate);
}
......@@ -3,6 +3,8 @@ package io.office.modules.manage.dao;
import io.office.modules.manage.entity.TimescodeRegiIpEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
* ${comments}
......@@ -14,4 +16,6 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TimescodeRegiIpDao extends BaseMapper<TimescodeRegiIpEntity> {
@Select("select * form timescode_regi_ip where ip = #{ip} ")
public TimescodeRegiIpEntity findByIp(@Param("ip") String ip);
}
package io.office.modules.manage.dao;
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;
/**
* ${comments}
*
* @author zyf
* @email
* @date 2021-12-07 15:22:24
*/
@Mapper
@Component
public interface UserFunctionBindingDao extends BaseMapper<UserFunctionBindingEntity> {
List<UserFunctionBindingEntity> queryListById(int id);
void deleteUserFunctionBindingById(int id);
}
package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-08 11:04:42
*/
@Data
@TableName("log_message")
public class LogMessageEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId
private Integer id;
/**
* 用户名
*/
private String username;
/**
* 手机号
*/
private String phone;
/**
*时间
*/
private Date time;
/**
* 短信内容
*/
private String pass;
/**
* ip
*/
private String ip;
/**
* 服务器IP
*/
private String url;
/**
* 分类
*/
private String type;
/**
* 发送状态
*/
private String state;
public LogMessageEntity(String username, String phone, Date time, String pass, String ip, String url, String type, String state) {
this.username = username;
this.phone = phone;
this.time = time;
this.pass = pass;
this.ip = ip;
this.url = url;
this.type = type;
this.state = state;
}
}
package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-08 13:54:50
*/
@Data
@TableName("Member")
public class MemberEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId
private Integer id;
/**
* $column.comments
*/
private String username;
/**
* $column.comments
*/
private String password;
/**
* $column.comments
*/
private String email;
/**
* $column.comments
*/
private String email1;
/**
* $column.comments
*/
private String realname;
/**
* $column.comments
*/
private String realname1;
/**
* $column.comments
*/
private String area;
/**
* $column.comments
*/
private String birth;
/**
* $column.comments
*/
private String idcard;
/**
* $column.comments
*/
private String idcard1;
/**
* $column.comments
*/
private String phone;
/**
* $column.comments
*/
private String phone1;
/**
* $column.comments
*/
private String address;
/**
* $column.comments
*/
private String address1;
/**
* $column.comments
*/
private String gender;
/**
* $column.comments
*/
private String sign1;
/**
* $column.comments
*/
private String sign;
/**
* $column.comments
*/
private Date registerdate;
/**
* $column.comments
*/
private Date updatedate;
/**
* $column.comments
*/
private String registerip;
/**
* $column.comments
*/
private Integer levels;
/**
* $column.comments
*/
private Date lasttime;
/**
* $column.comments
*/
private Integer perid;
/**
* $column.comments
*/
private String qustion;
/**
* $column.comments
*/
private String answer;
/**
* $column.comments
*/
private String oicq;
/**
* $column.comments
*/
private String homepage;
/**
* $column.comments
*/
private String company1;
/**
* $column.comments
*/
private String company;
/**
* $column.comments
*/
private String depart1;
/**
* $column.comments
*/
private String depart;
/**
* $column.comments
*/
private String postalcode;
/**
* $column.comments
*/
private Integer vocation;
/**
* $column.comments
*/
private Integer playat;
/**
* $column.comments
*/
private String firmcode;
/**
* $column.comments
*/
private String rights;
/**
* $column.comments
*/
private String mobilenum;
/**
* $column.comments
*/
private Integer atype;
/**
* $column.comments
*/
private String applystate;
/**
* $column.comments
*/
private String alias;
/**
* $column.comments
*/
private String source;
/**
* $column.comments
*/
private String pass;
}
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.Data;
import org.springframework.data.annotation.Id;
/**
* 验证码实体
......@@ -22,7 +24,7 @@ public class TimescodeRegiEntity implements Serializable {
/**
* 手机号
*/
@TableId(type = IdType.NONE)
private String phone;
/**
* 时间
......
package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
......@@ -22,7 +23,7 @@ public class TimescodeRegiIpEntity implements Serializable {
/**
* $column.comments
*/
@TableId
@TableId(type = IdType.INPUT)
private String ip;
/**
* $column.comments
......
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;
/**
* ${comments}
*
* @author zyf
* @email
* @date 2021-12-07 15:22:24
*/
@Data
@TableName("user_function_binding")
public class UserFunctionBindingEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId
private Integer id;
/**
* $column.comments
*/
private Integer userId;
/**
* $column.comments
*/
private Integer funcId;
}
......@@ -3,6 +3,8 @@ package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.modules.manage.entity.BranchEntity;
import io.office.modules.manage.vo.response.BranchEntityVo;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
......@@ -16,5 +18,8 @@ import java.util.Map;
public interface BranchService extends IService<BranchEntity> {
PageUtils queryPage(Map<String, Object> params);
BranchEntityVo getBranchDetail (String branchCode);
}
package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.modules.manage.entity.LogMessageEntity;
import java.util.Map;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-08 11:04:42
*/
public interface LogMessageService extends IService<LogMessageEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.modules.manage.entity.MemberEntity;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-08 13:54:50
*/
public interface MemberService extends IService<MemberEntity> {
PageUtils queryPage(Map<String, Object> params);
void userRegistered(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response);
}
......@@ -29,5 +29,7 @@ public interface ProductService extends IService<ProductEntity> {
R verifyProduct(ProductEntity product, SysUserEntity user);
Page<ProductEntity> selectProductList(Map<String, Object> params, Page page);
Page<ProductEntity> findPage(Page page);
}
package io.office.modules.manage.service;
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;
/**
* ${comments}
*
* @author zyf
* @email
* @date 2021-12-07 15:22:24
*/
@Service
public interface UserFunctionBindingService extends IService<UserFunctionBindingEntity> {
PageUtils queryPage(Map<String, Object> params);
Object[] queryList(Integer id);
void Modify(Integer[] functionids, int id);
}
package io.office.modules.manage.service.impl;
import io.office.modules.manage.vo.response.BranchEntityVo;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -26,4 +27,9 @@ public class BranchServiceImpl extends ServiceImpl<BranchDao, BranchEntity> impl
return new PageUtils(page);
}
@Override
public BranchEntityVo getBranchDetail(String branchCode) {
return baseMapper.getBranchDetail(branchCode);
}
}
\ No newline at end of file
package io.office.modules.manage.service.impl;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.modules.manage.dao.LogMessageDao;
import io.office.modules.manage.entity.LogMessageEntity;
import io.office.modules.manage.service.LogMessageService;
@Service("logMessageService")
public class LogMessageServiceImpl extends ServiceImpl<LogMessageDao, LogMessageEntity> implements LogMessageService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<LogMessageEntity> page = this.page(
new Query<LogMessageEntity>().getPage(params),
new QueryWrapper<LogMessageEntity>()
);
return new PageUtils(page);
}
}
\ No newline at end of file
package io.office.modules.manage.service.impl;
import io.office.common.exception.RRException;
import io.office.common.utils.IPUtils;
import io.office.modules.manage.dao.TimescodeRegiDao;
import io.office.modules.manage.entity.TimescodeRegiEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.regex.Pattern;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.common.utils.PageUtils;
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 javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Service("memberService")
public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> implements MemberService {
@Autowired
private TimescodeRegiDao timescodeRegiDao;
@Autowired
private MemberDao memberDao;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<MemberEntity> page = this.page(
new Query<MemberEntity>().getPage(params),
new QueryWrapper<MemberEntity>()
);
return new PageUtils(page);
}
@Override
public void userRegistered(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) {
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 phone = params.get("phone") == null ? "" : String.valueOf( params.get("phone"));
String subjoin = params.get("subjoin") == null ? "" : String.valueOf( params.get("subjoin")); //验证码
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")); //重复密码
//判断用户名合法性
if (!checkUserName(userName)){
throw new RRException("用户名只能是数字加字母,长度2-8位");
}
//判断密码合法性
if (!checkPassWord(passWord)){
throw new RRException("密码只能是数字加字母,长度5-12位");
}
//判断重复密码
if (!passWord.equals(passWord_repeat)){
throw new RRException("两次密码不一致");
}
//判断email
if (!isValidEmail(emiail)){
throw new RRException("e-miail格式错误");
}
//判断联系电话非空,且为11位数字
if (!matchPhoneNumber(phone)){
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")));//毫秒值
//获取验证码验证次数
TimescodeRegiEntity timescodeRegiEntity = timescodeRegiDao.selectById(phone);
Integer timesValidate = timescodeRegiEntity.getTimesValidate();//验证码输入错误次数;
//校验验证码
checkSubjoinRegi(subjoin,subjoinReq,phone,telReq,dateReq,timesValidate);
//存入数据库 密码加密
MemberEntity memberEntity = new MemberEntity();
memberEntity.setUsername(userName);
//TODO tgl MD5加密密码
memberEntity.setPassword("MD5加密");
memberEntity.setEmail(emiail);
memberEntity.setPhone(phone);
memberEntity.setOicq("");
memberEntity.setRegisterip(IPUtils.getIpAddr(request));
memberDao.insert(memberEntity);
}
/**
* 以下为短信验证码验证次数判断
* @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){
if (sub.equals("")){
throw new RRException("手机验证码不能为空!");
}else if (time_diff>=300){
throw new RRException("验证码已超时!");
}else if (times_validate>=3){
throw new RRException("该验证码输入错误满3次,已失效,请重新获取!");
}else {
if (!sub.equals(reSub)){
if (times_validate<=3){
times_validate+=1;
timescodeRegiDao.updateById(reTel,times_validate);
throw new RRException("验证码已输入错误" + times_validate + "次(输入错误满3次时,该验证码失效)!");
}
}
if (!tel.equals(reTel)){
throw new RRException("手机号码错误!");
}
}
return false;
}
public static void main(String[] args) {
boolean validEmail = isValidEmail("123");
System.out.println(validEmail);
}
//用户名校验
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,8}$";//(数字和字母)
if(logname.matches(t2)) {
return logname.matches(t2);
}else {
//System.out.println("用户名只能是数字加字母,长度2-8位");
return false;
}
}
public static boolean isValidEmail(String email) {
if ((email != null) && (!email.isEmpty())) {
return Pattern.matches("^(\\w+([-.][A-Za-z0-9]+)*){3,18}@\\w+([-.][A-Za-z0-9]+)*\\.\\w+([-.][A-Za-z0-9]+)*$", email);
}
return false;
}
public boolean checkPassWord(String passWord){
String t1 = "^[0-9A-Za-z]{2,8}$"; //判断密码用户名和密码是否为数字,字母(数字或字母)
String t2="^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{5,12}$";//(数字和字母)
if(passWord.matches(t2)) {
return passWord.matches(t2);
}else {
//System.out.println("用户名只能是数字加字母,长度2-8位");
return false;
}
}
/**
* 验证手机号 由于号码段不断的更新,只需要判断手机号有11位,并且全是数字以及1开头等
* @param phoneNumber 手机号码
* @return
*/
private static boolean matchPhoneNumber(String phoneNumber) {
String regex = "1[358][0-9]{9}";
if(phoneNumber==null||phoneNumber.length()<=0){
return false;
}
return Pattern.matches(regex, phoneNumber);
}
}
\ No newline at end of file
......@@ -82,4 +82,11 @@ public class ProductServiceImpl extends ServiceImpl<ProductDao, ProductEntity> i
return page;
}
@Override
public Page<ProductEntity> findPage(Page page) {
List<ProductEntity> list =this.productDao.findPage(page);
page.setRecords(list);
return page;
}
}
\ No newline at end of file
package io.office.modules.manage.service.impl;
import cn.hutool.log.Log;
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.modules.manage.dao.LogMessageDao;
import io.office.modules.manage.dao.TimescodeRegiIpDao;
import io.office.modules.manage.entity.LogMessageEntity;
import io.office.modules.manage.entity.TimescodeRegiIpEntity;
import io.office.modules.manage.service.LogMessageService;
import io.office.modules.manage.utils.DateUtils;
import org.joda.time.DateTime;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.PostMethod;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Node;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Date;
import java.util.Map;
import java.util.regex.Pattern;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -26,11 +31,10 @@ import io.office.common.utils.Query;
import io.office.modules.manage.dao.TimescodeRegiDao;
import io.office.modules.manage.entity.TimescodeRegiEntity;
import io.office.modules.manage.service.TimescodeRegiService;
import org.springframework.util.StringUtils;
import javax.net.ssl.HttpsURLConnection;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@Service("timescodeRegiService")
......@@ -41,6 +45,10 @@ public class TimescodeRegiServiceImpl extends ServiceImpl<TimescodeRegiDao, Time
@Autowired
private TimescodeRegiIpDao timescodeRegiIpDao;
@Autowired
private LogMessageDao logMessageDao;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<TimescodeRegiEntity> page = this.page(
......@@ -51,26 +59,62 @@ public class TimescodeRegiServiceImpl extends ServiceImpl<TimescodeRegiDao, Time
return new PageUtils(page);
}
/**
* 验证手机号 由于号码段不断的更新,只需要判断手机号有11位,并且全是数字以及1开头等
* @param phoneNumber 手机号码
* @return
*/
private static boolean matchPhoneNumber(String phoneNumber) {
String regex = "1[358][0-9]{9}";
if(phoneNumber==null||phoneNumber.length()<=0){
return false;
}
return Pattern.matches(regex, phoneNumber);
}
public static void main(String[] args) {
System.out.println((int)((Math.random()*9+1)*100000)+"");
long l = System.currentTimeMillis();
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
long l2 = System.currentTimeMillis();
System.out.println((l2-l)/1000+"秒");
}
@Override
public String getVerificationCode(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) {
//判断手机号码格式
//判断手机号码是否在黑名单内
//TODO tgl 验证码随机6位数字(验证码)
//验证码随机6位数字(验证码)
String pass=(int)((Math.random()*9+1)*100000)+"";
//获取IP(可能不是真实IP)
String ip = request.getRemoteAddr();
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("subjoin",pass);//验证码
session.setAttribute("tel",pass);//手机号
session.setAttribute("date",System.currentTimeMillis());//毫秒值
//发送状态
String state = "";
// 以下添加同一个手机号短信发送次数验证
int flag = 1;
TimescodeRegiEntity timescodeRegiEntity = timescodeRegiDao.selectById(phone);
if (timescodeRegiEntity!=null){ // 该手机号码是否发送过短信
Integer times = timescodeRegiEntity.getTimes();
Integer times_validate = timescodeRegiEntity.getTimesValidate();
String date = String.valueOf(params.get("date"));
String date = timescodeRegiEntity.getDate();
String date_1 = DateUtils.getDay();
if (date_1.equals(date)){
times = times + 1;
......@@ -95,12 +139,7 @@ public class TimescodeRegiServiceImpl extends ServiceImpl<TimescodeRegiDao, Time
int times = 1;
int times_validate = 0;
//新增数据
TimescodeRegiEntity timescodeRegiEntity1 = new TimescodeRegiEntity();
timescodeRegiEntity1.setPhone("phone");
timescodeRegiEntity1.setDate("date");
timescodeRegiEntity1.setTimes(times);
timescodeRegiEntity1.setTimesValidate(times_validate);
timescodeRegiDao.insert(timescodeRegiEntity1);
timescodeRegiDao.insert(new TimescodeRegiEntity(phone,date,times,times_validate));
flag = 1;
}
......@@ -126,6 +165,7 @@ public class TimescodeRegiServiceImpl extends ServiceImpl<TimescodeRegiDao, Time
}else {
times_ip = 1;
date = date_1;
timescodeRegiIpDao.updateById(new TimescodeRegiIpEntity(ip,date,times_ip));
flag_ip = 1;
}
}else {
......@@ -147,29 +187,40 @@ public class TimescodeRegiServiceImpl extends ServiceImpl<TimescodeRegiDao, Time
String userid = "9220"; // 此处按接口文档填写
String content = "您在中国物品编码中心网站注册的手机验证码为:" + pass + ",五分钟内有效,请正确输入!同一手机号每日最多操作三次!同一个ip每日最多操作十次!【中国物品编码中心】";
try{
Map<String, String> params_aspx = new HashMap<>();
params.put("action", "send");
params.put("userid", userid);
params.put("account",account);
params.put("password",password);
params.put("mobile",phone);
params.put("content",content);
params.put("sendTime",DateUtils.getDay());
params.put("mobilenumber","2");
params.put("countnumber","2");
params.put("telephonenumber","0");
String post = sendPost("http://39.106.204.178:8888/sms.aspx", map2Url(params_aspx), "application/x-www-form-urlencoded;charset=UTF-8", "POST");
JSONObject jsonObject = JSON.parseObject(post);
String returnstatus = jsonObject.getString("returnstatus");
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")){
throw new RRException("验证码发送失败:"+ jsonObject.getString("message"));
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));
}
}
......@@ -180,101 +231,19 @@ public class TimescodeRegiServiceImpl extends ServiceImpl<TimescodeRegiDao, Time
* @param urls
* @return
*/
public static String sendPost(String urls, String param, String contentType, String method) {
StringBuffer sb=new StringBuffer();
DataOutputStream out = null;
BufferedReader responseReader = null;
InputStream in1 = null;
public static String sendPost(String urls, NameValuePair[] data ) {
try {
// 创建url资源
URL url = new URL(urls);
// 建立http连接
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
// 设置不用缓存
conn.setUseCaches(false);
// 设置允许输出
conn.setDoOutput(true);
// 设置允许输入
conn.setDoInput(true);
// 设置传递方式
conn.setRequestMethod(method);
System.out.println(conn.getRequestMethod());
// 设置维持长连接
conn.setRequestProperty("Connection", "Keep-Alive");
// 设置文件字符集:
conn.setRequestProperty("Charset", "UTF-8");
// 转换为字节数组
// byte[] data = (param).getBytes();
// // 设置文件长度
// conn.setRequestProperty("Content-Length", String.valueOf(data.length));
// 设置文件类型:
conn.setRequestProperty("Content-Type", contentType);
// 开始连接请求
conn.connect();
out = new DataOutputStream(conn.getOutputStream());
// 写入请求的字符串
out.writeBytes(param);
out.flush();
System.out.println(conn.getResponseCode());
// 请求返回的状态
if (HttpURLConnection.HTTP_OK == conn.getResponseCode()) {
System.out.println("连接成功");
// 请求返回的数据
in1 = conn.getInputStream();
String readLine;
responseReader = new BufferedReader(new InputStreamReader(in1,"UTF-8"));
while((readLine=responseReader.readLine()) != null){
sb.append(readLine).append("\n");
}
} else {
System.out.println("error++");
}
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) {
} finally {
try {
if (null != responseReader)
responseReader.close();
if (null != in1)
in1.close();
} catch(Exception e) {}
try {
out.close();
} catch(Exception e) {}
}
return sb.toString();
throw new RuntimeException(e.getMessage());
}
/**
* map转url参数
*/
public static String map2Url(Map<String, String> paramToMap) {
if (null == paramToMap || paramToMap.isEmpty()) {
return null;
}
StringBuffer url = new StringBuffer();
boolean isfist = true;
for (Map.Entry<String, String> entry : paramToMap.entrySet()) {
if (isfist) {
isfist = false;
} else {
url.append("&");
}
url.append(entry.getKey()).append("=");
String value = entry.getValue();
if (!StringUtils.isEmpty(value)) {
try {
url.append(URLEncoder.encode(value, "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
return url.toString();
}
}
\ No newline at end of file
package io.office.modules.manage.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.modules.manage.dao.UserFunctionBindingDao;
import io.office.modules.manage.entity.UserFunctionBindingEntity;
import io.office.modules.manage.service.UserFunctionBindingService;
/**
* ${comments}
*
* @author zyf
* @email
* @date 2021-12-07 15:22:24
*/
@Service("userFunctionBindingService")
public class UserFunctionBindingServiceImpl extends ServiceImpl<UserFunctionBindingDao, UserFunctionBindingEntity> implements UserFunctionBindingService {
@Autowired
UserFunctionBindingDao userFunctionBindingDao;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<UserFunctionBindingEntity> page = this.page(
new Query<UserFunctionBindingEntity>().getPage(params),
new QueryWrapper<UserFunctionBindingEntity>()
);
return new PageUtils(page);
}
@Override
public Object[] queryList(Integer id) {
List<UserFunctionBindingEntity> userFunctionBindingEntities = userFunctionBindingDao.queryListById(id);
//查不到用户关联功能返回空数组
if (userFunctionBindingEntities == null) {
return null;
}
List<Integer> list = new ArrayList<>();
for (UserFunctionBindingEntity userFunctionBindingEntity : userFunctionBindingEntities) {
list.add(userFunctionBindingEntity.getFuncId());
}
Object[] functionids = list.toArray();
return functionids;
}
@Override
public void Modify(Integer[] functionids, int id) {
//先删除原先的用户功能关系
userFunctionBindingDao.deleteUserFunctionBindingById(id);
//遍历插入数据
for (int functionid : functionids) {
UserFunctionBindingEntity ufb = new UserFunctionBindingEntity();
ufb.setUserId(id);
ufb.setFuncId(functionid);
save(ufb);
}
}
}
\ No newline at end of file
package io.office.modules.manage.vo.response;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.io.Serializable;
/**
*
* 
 @description:
*
* @author wudi
* @date 11:39 2021/12/8
*/
@Data
public class BranchEntityVo implements Serializable {
private static final long serialVersionUID = 1L;
private String branchCode;
private String branchName;
private String branchAddress;
private String branchPostcode;
private String branchContact;
private String tel1;
private String tel2;
private String fax;
private String rockkey;
private String branchSimname;
private String description;
private String mail;
private String website;
private String addressDescription;
private String personname;
}
......@@ -18,6 +18,20 @@
</resultMap>
<select id="getBranchDetail" parameterType="string" resultType="io.office.modules.manage.vo.response.BranchEntityVo" >
SELECT
a.*, b.description,
b.mail,
b.website,
b.address_description,
c.personname
FROM
center_outer.dbo.branch a
LEFT JOIN codeagent b ON a.branch_code = b.Id
LEFT JOIN center_outer.dbo.person c ON a.branch_contact = c.personid
WHERE
branch_code = #{branchCode}
</select>
......
......@@ -57,4 +57,7 @@
</if>
order by a.id desc
</select>
<select id="findPage" resultType="io.office.modules.manage.entity.ProductEntity">
select * from product where levels > 0 and categoryid=1 ORDER BY levels DESC, adddate DESC
</select>
</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.TimescodeRegiIpDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.TimescodeRegiIpEntity" id="timescodeRegiIpMap">
<result property="ip" column="ip"/>
<result property="date" column="date"/>
<result property="timesIp" column="times_ip"/>
</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.UserFunctionBindingDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.UserFunctionBindingEntity" id="userFunctionBindingMap">
<result property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="funcId" column="func_id"/>
</resultMap>
<delete id="deleteUserFunctionBindingById">
delete from user_function_binding where user_id=#{id}
</delete>
<select id="queryListById" resultType="io.office.modules.manage.entity.UserFunctionBindingEntity">
select * from user_function_binding where user_id=#{id}
</select>
</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