Commit 3af55e8d by 吴迪

【修改】修改个人中心bug

parent 7a5a4c30
...@@ -50,7 +50,7 @@ public class LogLoginController { ...@@ -50,7 +50,7 @@ public class LogLoginController {
if(!captcha){ if(!captcha){
return R.error("验证码不正确"); return R.error("验证码不正确");
} }
return R.ok().put("data",logLoginService.login(params,request,response)); return R.ok().put("data",logLoginService.loginNew(params,request,response));
} }
/** /**
...@@ -64,7 +64,6 @@ public class LogLoginController { ...@@ -64,7 +64,6 @@ public class LogLoginController {
return R.ok().put("page", page); return R.ok().put("page", page);
} }
/** /**
* 信息 * 信息
*/ */
......
package io.office.modules.manage.controller; package io.office.modules.manage.controller;
import java.lang.reflect.InvocationTargetException; import cn.hutool.json.JSONUtil;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.app.annotation.Login; 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.dao.TycpdmFirmDao; import io.office.modules.manage.dao.TycpdmFirmDao;
import io.office.modules.manage.entity.FirmEntity; import io.office.modules.manage.entity.FirmEntity;
import io.office.modules.manage.entity.MemberEntity; import io.office.modules.manage.entity.MemberEntity;
import io.office.modules.manage.entity.TycpdmFirmEntity;
import io.office.modules.manage.service.TycpdmFirmChangeService; import io.office.modules.manage.service.TycpdmFirmChangeService;
import io.office.modules.manage.service.TycpdmFirmService;
import io.office.modules.manage.utils.DESUtils; import io.office.modules.manage.utils.DESUtils;
import io.office.modules.manage.utils.MD5Util; import io.office.modules.manage.utils.MD5Util;
import io.office.modules.sys.controller.AbstractController; import io.office.modules.sys.controller.AbstractController;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
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.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.office.modules.manage.entity.TycpdmFirmEntity;
import io.office.modules.manage.service.TycpdmFirmService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/** /**
...@@ -38,6 +37,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -38,6 +37,7 @@ import javax.servlet.http.HttpServletResponse;
* @email * @email
* @date 2021-12-11 15:15:19 * @date 2021-12-11 15:15:19
*/ */
@Slf4j
@RestController @RestController
@RequestMapping("/tycpdmfirm") @RequestMapping("/tycpdmfirm")
public class TycpdmFirmController extends AbstractController { public class TycpdmFirmController extends AbstractController {
...@@ -291,7 +291,9 @@ public class TycpdmFirmController extends AbstractController { ...@@ -291,7 +291,9 @@ public class TycpdmFirmController extends AbstractController {
memberEntity = memberDao.selectById(Long.valueOf(id + "")); memberEntity = memberDao.selectById(Long.valueOf(id + ""));
} }
String url = tycpdmFirmService.redirectGDSURL(memberEntity, params); String url = tycpdmFirmService.redirectGDSURL(memberEntity, params);
try { try {
response.sendRedirect(url);
return R.ok().put("data", url); return R.ok().put("data", url);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -322,6 +324,7 @@ public class TycpdmFirmController extends AbstractController { ...@@ -322,6 +324,7 @@ public class TycpdmFirmController extends AbstractController {
*/ */
@RequestMapping("/authApi/redirectBusinessHall") @RequestMapping("/authApi/redirectBusinessHall")
public R redirectBusinessHall(String id, String userType, HttpServletResponse response) { public R redirectBusinessHall(String id, String userType, HttpServletResponse response) {
//由于member表中没有手机用户的信息 通过memberDao获取 //由于member表中没有手机用户的信息 通过memberDao获取
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("id", id); params.put("id", id);
...@@ -330,16 +333,13 @@ public class TycpdmFirmController extends AbstractController { ...@@ -330,16 +333,13 @@ public class TycpdmFirmController extends AbstractController {
if (memberEntity==null){ if (memberEntity==null){
memberEntity=new MemberEntity(); memberEntity=new MemberEntity();
}*/ }*/
try {
MemberEntity memberEntity = getMemberUser(); MemberEntity memberEntity = getMemberUser();
String url = tycpdmFirmService.redirectBusinessHall(params, memberEntity); log.info(JSONUtil.toJsonStr(memberEntity));
//response.sendRedirect(url); String url = tycpdmFirmService.redirectBusinessHall(params, memberEntity);
return R.ok().put("data", url); return R.ok().put("data", url);
} catch (Exception e) {
e.printStackTrace();
return R.error("服务器繁忙!");
}
} }
......
...@@ -35,7 +35,7 @@ public class UserFunctionBindingController extends AbstractController { ...@@ -35,7 +35,7 @@ public class UserFunctionBindingController extends AbstractController {
*/ */
@RequestMapping("/authApi/find") @RequestMapping("/authApi/find")
public R find(){ public R find(){
Integer id=getUserId().intValue(); Integer id=getMemberUserId().intValue();
if(id==null){ if(id==null){
return R.error("用户信息有误"); return R.error("用户信息有误");
} }
...@@ -48,7 +48,7 @@ public class UserFunctionBindingController extends AbstractController { ...@@ -48,7 +48,7 @@ public class UserFunctionBindingController extends AbstractController {
@RequestMapping("/authApi/update") @RequestMapping("/authApi/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=getMemberUserId().intValue();
if(id==null){ if(id==null){
return R.error("用户信息有误"); return R.error("用户信息有误");
} }
...@@ -64,7 +64,7 @@ public class UserFunctionBindingController extends AbstractController { ...@@ -64,7 +64,7 @@ public class UserFunctionBindingController extends AbstractController {
//遍历插入数据 //遍历插入数据
for (int functionid : functionids) { for (int functionid : functionids) {
UserFunctionBindingEntity ufb=new UserFunctionBindingEntity(); UserFunctionBindingEntity ufb=new UserFunctionBindingEntity();
ufb.setUserId(getUserId().intValue()); ufb.setUserId(getMemberUserId().intValue());
ufb.setFuncId(functionid); ufb.setFuncId(functionid);
userFunctionBindingService.save(ufb); userFunctionBindingService.save(ufb);
} }
......
...@@ -23,5 +23,15 @@ public interface LogLoginService extends IService<LogLoginEntity> { ...@@ -23,5 +23,15 @@ public interface LogLoginService extends IService<LogLoginEntity> {
PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Map<String, Object> params);
JSONObject login(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response); JSONObject login(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response);
/**
* 官网登录
* @param params
* @param request
* @param response
* @return
*/
JSONObject loginNew(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response);
} }
...@@ -51,10 +51,15 @@ public interface TycpdmFirmService extends IService<TycpdmFirmEntity> { ...@@ -51,10 +51,15 @@ public interface TycpdmFirmService extends IService<TycpdmFirmEntity> {
String redirectGDSURL(MemberEntity memberUser,Map<String, Object> params); String redirectGDSURL(MemberEntity memberUser,Map<String, Object> params);
String redirectGDSURLNew(Map<String, Object> params);
String redirectGDSGLN(MemberEntity memberUser); String redirectGDSGLN(MemberEntity memberUser);
String redirectBusinessHall(Map map,MemberEntity memberUser); String redirectBusinessHall(Map map,MemberEntity memberUser);
String redirectBusinessHallNew(Map map,MemberEntity memberUser,HttpServletResponse response);
String returnFileUrl(Map name); String returnFileUrl(Map name);
FirmEntity findFirmInfoXT(String carno); FirmEntity findFirmInfoXT(String carno);
......
...@@ -2,41 +2,38 @@ package io.office.modules.manage.service.impl; ...@@ -2,41 +2,38 @@ package io.office.modules.manage.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
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.exception.RRException; import io.office.common.exception.RRException;
import io.office.common.utils.IPUtils; import io.office.common.utils.IPUtils;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.common.utils.R; import io.office.common.utils.R;
import io.office.modules.manage.dao.LogLoginDao;
import io.office.modules.manage.dao.MemberDao; import io.office.modules.manage.dao.MemberDao;
import io.office.modules.manage.entity.LogLoginEntity;
import io.office.modules.manage.entity.MemberEntity; import io.office.modules.manage.entity.MemberEntity;
import io.office.modules.manage.service.LogLoginService;
import io.office.modules.manage.utils.DESUtils; import io.office.modules.manage.utils.DESUtils;
import io.office.modules.manage.utils.HttpUtlis;
import io.office.modules.manage.utils.MD5Util; import io.office.modules.manage.utils.MD5Util;
import io.office.modules.sys.service.SysUserTokenService; import io.office.modules.sys.service.SysUserTokenService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.lang3.StringUtils;
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 javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.security.SecureRandom;
import java.util.Date; 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.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.LogLoginDao;
import io.office.modules.manage.entity.LogLoginEntity;
import io.office.modules.manage.service.LogLoginService;
import sun.misc.REException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Slf4j
@Service("logLoginService") @Service("logLoginService")
public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity> implements LogLoginService { public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity> implements LogLoginService {
...@@ -60,92 +57,91 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity ...@@ -60,92 +57,91 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
} }
@Override @Override
public JSONObject login(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) { public JSONObject login(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) {
String userName = String.valueOf(params.get("userName")==null?"":params.get("userName")); String userName = String.valueOf(params.get("userName") == null ? "" : params.get("userName"));
String passWord = String.valueOf(params.get("passWord")==null?"":params.get("passWord")); String passWord = String.valueOf(params.get("passWord") == null ? "" : params.get("passWord"));
String verification = String.valueOf(params.get("verification")==null?"":params.get("verification"));//验证码 String verification = String.valueOf(params.get("verification") == null ? "" : params.get("verification"));//验证码
//session中获取验证码 //session中获取验证码
//判断 验证码是否正确 //判断 验证码是否正确
int userType; //用户类型 1.业务大厅(手机号用户) 2.业务大厅(条码卡成员) 3.官网用户 int userType; //用户类型 1.业务大厅(手机号用户) 2.业务大厅(条码卡成员) 3.官网用户
Integer levels = null; //用户权限 空.代表普通用户 0.代表中心管理员,1.代表校验管理员 其他4位.代表分中心管理员 Integer levels = null; //用户权限 空.代表普通用户 0.代表中心管理员,1.代表校验管理员 其他4位.代表分中心管理员
Integer isQY=2; //是否开通企业认证 1.开通 2.未开通 Integer isQY = 2; //是否开通企业认证 1.开通 2.未开通
Integer isXT=2; //是否是业务大厅系统成员 1.是 2.否 Integer isXT = 2; //是否是业务大厅系统成员 1.是 2.否
Long id=-99L; //用户ID Long id = -99L; //用户ID
String search="ws2";// 用户来源 manager:业务大厅手机号用户 ws2:member表用户 String search = "ws2";// 用户来源 manager:业务大厅手机号用户 ws2:member表用户
String carno=null;// 条码卡号 String carno = null;// 条码卡号
String phone=null;//手机号码 String phone = null;//手机号码
//判断用户是否是手机号 是手机号调用 第三方接口登录 不是继续 //判断用户是否是手机号 是手机号调用 第三方接口登录 不是继续
if (matchPhoneNumber(userName)){ if (matchPhoneNumber(userName)) {
//用第三方登录接口 //用第三方登录接口
userType=1; userType = 1;
System.out.println("用户名称:"+userName); System.out.println("用户名称:" + userName);
id=Long.valueOf(userName); id = Long.valueOf(userName);
//对 用户名密码进行DES加密 //对 用户名密码进行DES加密
String phoen_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(userName.getBytes(),DESUtils.Key.getBytes())); String phoen_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(userName.getBytes(), DESUtils.Key.getBytes()));
String passwrod_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(passWord.getBytes(),DESUtils.Key.getBytes())); String passwrod_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(passWord.getBytes(), DESUtils.Key.getBytes()));
String url="http://wsdt.gs1cn.org/anccoh/login?method=loginValidate&phone="+phoen_M+"&password="+passwrod_M; String url = "http://wsdt.gs1cn.org/anccoh/login?method=loginValidate&phone=" + phoen_M + "&password=" + passwrod_M;
String s = doGet(url); String s = doGet(url);
if (s==null){ if (s == null) {
throw new RRException("服务器繁忙,登录失败"); throw new RRException("服务器繁忙,登录失败");
}else { } else {
JSONObject jsonObject = JSON.parseObject(s); JSONObject jsonObject = JSON.parseObject(s);
String status = jsonObject.getString("status"); String status = jsonObject.getString("status");
if (!status.equals("1")){ if (!status.equals("1")) {
throw new RRException("登录失败"+jsonObject.getString("msg")); throw new RRException("登录失败" + jsonObject.getString("msg"));
}else { } else {
//登录成功 //登录成功
search="manager"; search = "manager";
phone=userName; phone = userName;
//需要中国编码官网提供 条码卡数据 来判断是否是系统用户 //需要中国编码官网提供 条码卡数据 来判断是否是系统用户
JSONObject data = jsonObject.getJSONObject("data"); JSONObject data = jsonObject.getJSONObject("data");
if (data!=null){ if (data != null) {
carno = data.getString("gdsCode"); carno = data.getString("gdsCode");
isXT=1; isXT = 1;
} }
} }
} }
}else { } else {
//查询Member表 //查询Member表
MemberEntity memberEntity = memberDao.selectByName(userName); MemberEntity memberEntity = memberDao.selectByName(userName);
if (memberEntity==null){ if (memberEntity == null) {
throw new RRException("用户不存在!"); throw new RRException("用户不存在!");
} }
id=Long.valueOf(memberEntity.getId()); id = Long.valueOf(memberEntity.getId());
//用户类型 www:为官网用户 条码卡:为条码卡用户 //用户类型 www:为官网用户 条码卡:为条码卡用户
String source = memberEntity.getSource(); String source = memberEntity.getSource();
String applystate = memberEntity.getApplystate();// 未申请:普通用户 通过审核:完成厂商实名认证 String applystate = memberEntity.getApplystate();// 未申请:普通用户 通过审核:完成厂商实名认证
if (!"条码卡".equals(source)){//官网用户 if (!"条码卡".equals(source)) {//官网用户
userType=3; userType = 3;
}else {//条码卡用户 } else {//条码卡用户
userType=2; userType = 2;
carno=userName; carno = userName;
} }
//获取权限 //获取权限
levels=memberDao.selectCode_agen(userName); levels = memberDao.selectCode_agen(userName);
if (levels==null){ if (levels == null) {
if (userType==3){ if (userType == 3) {
//判断是否通过企业认证 //判断是否通过企业认证
if ("通过审核".equals(applystate.substring(0,4))){ if ("通过审核".equals(applystate.substring(0, 4))) {
isQY=1; isQY = 1;
} }
//判断是否是系统成员 //判断是否是系统成员
}else if (userType==2){ } else if (userType == 2) {
isXT=1; isXT = 1;
} }
} }
MemberEntity user=memberDao.selectByName(userName); MemberEntity user = memberDao.selectByName(userName);
if (user==null){ if (user == null) {
throw new RRException("用户不存在!"); throw new RRException("用户不存在!");
} }
phone = user.getPhone(); phone = user.getPhone();
String password = user.getPass(); String password = user.getPass();
String passwordMD5 = MD5Util.md5Encrypt32Lower(passWord); String passwordMD5 = MD5Util.md5Encrypt32Lower(passWord);
//判断密码是否正确 //判断密码是否正确
if (!passwordMD5.equalsIgnoreCase(password)){ if (!passwordMD5.equalsIgnoreCase(password)) {
throw new RRException("密码不正确!"); throw new RRException("密码不正确!");
} }
...@@ -153,39 +149,148 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity ...@@ -153,39 +149,148 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
//添加登录日志 log_login //添加登录日志 log_login
} }
logLoginDao.insert(new LogLoginEntity(1,userName,search,carno,phone,new Date(), IPUtils.getIpAddr(request),request.getRequestURL().toString())); logLoginDao.insert(new LogLoginEntity(1, userName, search, carno, phone, new Date(), IPUtils.getIpAddr(request), request.getRequestURL().toString()));
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("userType",userType); jsonObject.put("userType", userType);
jsonObject.put("levels",levels); jsonObject.put("levels", levels);
jsonObject.put("isQY",isQY); jsonObject.put("isQY", isQY);
jsonObject.put("isXT",isXT); jsonObject.put("isXT", isXT);
jsonObject.put("id",id); jsonObject.put("id", id);
jsonObject.put("carno",carno); jsonObject.put("carno", carno);
jsonObject.put("username",userName); jsonObject.put("username", userName);
jsonObject.put("phone",phone); jsonObject.put("phone", phone);
R token = sysUserTokenService.createToken("qianduan_",id);//将token信息存入 数据库 R token = sysUserTokenService.createToken("qianduan_", id);//将token信息存入 数据库
Object token1 = token.get("token");
jsonObject.put("token", token1);
return jsonObject;
}
@Override
public JSONObject loginNew(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) {
String userName = String.valueOf(params.get("userName") == null ? "" : params.get("userName"));
String passWord = String.valueOf(params.get("passWord") == null ? "" : params.get("passWord"));
//String verification = String.valueOf(params.get("verification") == null ? "" : params.get("verification"));//验证码
//session中获取验证码
//判断 验证码是否正确
Integer userType = null; //1.系统成员 2.手机用户 3.实名认证企业 4.网站用户
String phone = "";
String carno = "";
//默认为 ws2 官网用户, manager:系统成员
String search = "ws2";
//如果是条码卡成员 id为手机号,如果是官网用户id就是id
String id ;
//先判断是否为手机号,如果是手机号,只有可能是系统成员或者手机用户
if (matchPhoneNumber(userName)) {
//对 用户名密码进行DES加密
String phoen_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(userName.getBytes(), DESUtils.Key.getBytes()));
String passwrod_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(passWord.getBytes(), DESUtils.Key.getBytes()));
String url = "http://wsdt.gs1cn.org/anccoh/login?method=loginValidate&phone=" + phoen_M + "&password=" + passwrod_M;
log.info("请求成员系统的url和参数:{}", url);
String result = doGet(url);
log.info("请求成员系统返回结果:{}", result);
if (result == null) {
throw new RRException("请求成员系统登录接口失败,请联系管理员!");
} else {
search = "manager";
JSONObject jsonObject = JSON.parseObject(result);
String status = jsonObject.getString("status");
if (!status.equals("1")) {
throw new RRException("登录失败" + jsonObject.getString("msg"));
} else {
//登录成功
id = phone;
JSONObject data = jsonObject.getJSONObject("data");
if (data != null) {
if (data.containsKey("gdsCode")) {
//如果包含gdsCode且值不为空说明是系统成员
carno = data.getString("gdsCode");
if (StringUtils.isNotBlank(carno)) {
//系统成员
userType = 1;
id = carno;
} else {
//手机用户
userType = 2;
id = phone;
}
} else {
//手机用户
userType = 2;
phone = userName;
}
}
}
}
} else {
//查询Member表
MemberEntity memberEntity = memberDao.selectByName(userName);
if (memberEntity == null) {
throw new RRException("用户不存在!");
}
if (StringUtils.isNotBlank(memberEntity.getPhone())) {
phone = memberEntity.getPhone();
}
id = memberEntity.getId()+"";
//用户类型 www:为官网用户 条码卡:为条码卡用户
String source = memberEntity.getSource();
String applystate = memberEntity.getApplystate();//
if (StringUtils.isNotBlank(source)) {
if (source.trim().equalsIgnoreCase("条码卡")) {
//系统成员
carno = userName;
userType = 1;
id = userName;
} else {
//网站用户
if ("通过审核".equals(applystate.substring(0, 4))) {
//完成厂商实名认证
userType = 3;
phone = memberEntity.getPhone();
} else {
userType = 4;
phone = memberEntity.getPhone();
}
}
}
String password = memberEntity.getPass();
String passwordMD5 = MD5Util.md5Encrypt32Lower(passWord);
//判断密码是否正确
if (!passwordMD5.equalsIgnoreCase(password)) {
throw new RRException("密码不正确!");
}
//添加登录日志 log_login
}
logLoginDao.insert(new LogLoginEntity(1, userName, search, carno, phone, new Date(), IPUtils.getIpAddr(request), request.getRequestURL().toString()));
JSONObject jsonObject = new JSONObject();
jsonObject.put("userType", userType);
jsonObject.put("id", id);
jsonObject.put("carno", carno);
jsonObject.put("username", userName);
jsonObject.put("phone", phone);
R token = sysUserTokenService.createToken("qianduan_", Long.parseLong(id));//将token信息存入 数据库
Object token1 = token.get("token"); Object token1 = token.get("token");
jsonObject.put("token",token1); jsonObject.put("token", token1);
return jsonObject; return jsonObject;
} }
/** /**
* 验证手机号 由于号码段不断的更新,只需要判断手机号有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[345789][0-9]{9}"; String regex = "1[345789][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);
} }
private static String doGet(String url) { private static String doGet(String url) {
HttpClient client = new HttpClient(); HttpClient client = new HttpClient();
GetMethod getMethod = new GetMethod(url); GetMethod getMethod = new GetMethod(url);
...@@ -203,4 +308,12 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity ...@@ -203,4 +308,12 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
} }
public static void main(String[] args) {
System.out.println(MD5Util.unicodeToString("440220aa487a592881324212d7c9ef6f"));
System.out.println(DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt("1165004".getBytes(), DESUtils.Key.getBytes())));
System.out.println(DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt("GS1_20201013".getBytes(), DESUtils.Key.getBytes())));
}
} }
\ No newline at end of file
package io.office.modules.manage.service.impl; package io.office.modules.manage.service.impl;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.common.exception.RRException; import io.office.common.exception.RRException;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.modules.manage.dao.*; import io.office.modules.manage.dao.*;
import io.office.modules.manage.entity.*; import io.office.modules.manage.entity.*;
import io.office.modules.manage.service.TycpdmFirmChangeService; import io.office.modules.manage.service.TycpdmFirmChangeService;
import io.office.modules.manage.utils.*; import io.office.modules.manage.service.TycpdmFirmService;
import io.office.modules.manage.utils.AlgorithmUtils;
import io.office.modules.manage.utils.DESUtils;
import io.office.modules.manage.utils.DateUtils;
import io.office.modules.manage.utils.MD5Util;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanMap; import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.beanutils.BeanUtils; 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.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.*; import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @Slf4j
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.service.TycpdmFirmService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
@Service("tycpdmFirmService") @Service("tycpdmFirmService")
public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirmEntity> implements TycpdmFirmService { public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirmEntity> implements TycpdmFirmService {
...@@ -65,6 +70,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -65,6 +70,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
@Value("${uploadFileQYOne}") @Value("${uploadFileQYOne}")
String uploadFileQYOne; String uploadFileQYOne;
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
IPage<TycpdmFirmEntity> page = this.page( IPage<TycpdmFirmEntity> page = this.page(
...@@ -78,33 +84,33 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -78,33 +84,33 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
@Override @Override
public JSONObject findUserName(Integer logoutFlag, String userName) { public JSONObject findUserName(Integer logoutFlag, String userName) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
if (logoutFlag==1){ if (logoutFlag == 1) {
//首次 //首次
TycpdmFirmEntity tycpdmFirm = tycpdmFirmDao.findUserName(userName); TycpdmFirmEntity tycpdmFirm = tycpdmFirmDao.findUserName(userName);
jsonObject.put("data",tycpdmFirm); jsonObject.put("data", tycpdmFirm);
}else if (logoutFlag==2){ } else if (logoutFlag == 2) {
//变更 //变更
List<TycpdmFirmChangeEntity> tycpdmFirmChange = tycpdmFirmChangeDao.findUserName(userName); List<TycpdmFirmChangeEntity> tycpdmFirmChange = tycpdmFirmChangeDao.findUserName(userName);
if (tycpdmFirmChange==null||tycpdmFirmChange.size()==0){ if (tycpdmFirmChange == null || tycpdmFirmChange.size() == 0) {
TycpdmFirmEntity tycpdmFirm = tycpdmFirmDao.findUserName(userName); TycpdmFirmEntity tycpdmFirm = tycpdmFirmDao.findUserName(userName);
jsonObject.put("data",tycpdmFirm); jsonObject.put("data", tycpdmFirm);
return jsonObject; return jsonObject;
}else{ } else {
Integer logoutFlag1 = tycpdmFirmChange.get(0).getLogoutFlag(); Integer logoutFlag1 = tycpdmFirmChange.get(0).getLogoutFlag();
if (logoutFlag1==null){ if (logoutFlag1 == null) {
jsonObject.put("data",tycpdmFirmChange.get(0)); jsonObject.put("data", tycpdmFirmChange.get(0));
return jsonObject; return jsonObject;
} }
if (tycpdmFirmChange.get(0).getLogoutFlag()==1){ if (tycpdmFirmChange.get(0).getLogoutFlag() == 1) {
TycpdmFirmEntity tycpdmFirm = tycpdmFirmDao.findUserName(userName); TycpdmFirmEntity tycpdmFirm = tycpdmFirmDao.findUserName(userName);
jsonObject.put("data",tycpdmFirm); jsonObject.put("data", tycpdmFirm);
}else if (tycpdmFirmChange.get(0).getLogoutFlag()==0||tycpdmFirmChange.get(0).getLogoutFlag()==2||tycpdmFirmChange.get(0).getLogoutFlag()==-1){ } else if (tycpdmFirmChange.get(0).getLogoutFlag() == 0 || tycpdmFirmChange.get(0).getLogoutFlag() == 2 || tycpdmFirmChange.get(0).getLogoutFlag() == -1) {
jsonObject.put("data",tycpdmFirmChange.get(0)); jsonObject.put("data", tycpdmFirmChange.get(0));
}else { } else {
throw new RRException("业务类型错误!"); throw new RRException("业务类型错误!");
} }
} }
}else { } else {
throw new RRException("业务类型错误!"); throw new RRException("业务类型错误!");
} }
return jsonObject; return jsonObject;
...@@ -116,38 +122,38 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -116,38 +122,38 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
String username = userEntity.getUsername(); String username = userEntity.getUsername();
//获取管理员是 中心管理员还是分中心管理员 //获取管理员是 中心管理员还是分中心管理员
Integer levels =memberDao.selectCode_agen(username); //用户权限 空.代表普通用户 0.代表中心管理员,1.代表校验管理员 其他4位.代表分中心管理员 Integer levels = memberDao.selectCode_agen(username); //用户权限 空.代表普通用户 0.代表中心管理员,1.代表校验管理员 其他4位.代表分中心管理员
if (levels==null){ if (levels == null) {
throw new RRException("无权访问"); throw new RRException("无权访问");
}else if (levels==0){ } else if (levels == 0) {
}else if (levels==1){ } else if (levels == 1) {
throw new RRException("无权访问"); throw new RRException("无权访问");
}else if (String.valueOf(levels).length()==4){ } else if (String.valueOf(levels).length() == 4) {
//levels=-99; //levels=-99;
}else { } else {
throw new RRException("无权访问"); throw new RRException("无权访问");
} }
//审核状态 0待审核 1审核成功 2审核失败 //审核状态 0待审核 1审核成功 2审核失败
//查询审核数据 //查询审核数据
String levelsStr=levels+""; String levelsStr = levels + "";
Integer countAll=tycpdmFirmDao.findTycpdmFirmLogoutFlagCountALL(levelsStr,null);//查询 申请总数 Integer countAll = tycpdmFirmDao.findTycpdmFirmLogoutFlagCountALL(levelsStr, null);//查询 申请总数
Integer auditCount=tycpdmFirmDao.findTycpdmFirmLogoutFlagCountALL(levelsStr,0);//查询 等待审核 0 Integer auditCount = tycpdmFirmDao.findTycpdmFirmLogoutFlagCountALL(levelsStr, 0);//查询 等待审核 0
Integer throughCount=tycpdmFirmDao.findTycpdmFirmLogoutFlagCountALL(levelsStr,1);//查询 通过审核 1 Integer throughCount = tycpdmFirmDao.findTycpdmFirmLogoutFlagCountALL(levelsStr, 1);//查询 通过审核 1
Integer notThroughCount=tycpdmFirmDao.findTycpdmFirmLogoutFlagCountALL(levelsStr,2);//查询 未通过审核 2 Integer notThroughCount = tycpdmFirmDao.findTycpdmFirmLogoutFlagCountALL(levelsStr, 2);//查询 未通过审核 2
map.put("countAll",countAll); map.put("countAll", countAll);
map.put("auditCount",auditCount); map.put("auditCount", auditCount);
map.put("throughCount",throughCount); map.put("throughCount", throughCount);
map.put("notThroughCount",notThroughCount); map.put("notThroughCount", notThroughCount);
//查询变更数据 //查询变更数据
Integer countChangeAll=tycpdmFirmChangeDao.findTycpdmFirmLogoutFlagCountALL(levelsStr,null);//查询 申请总数 Integer countChangeAll = tycpdmFirmChangeDao.findTycpdmFirmLogoutFlagCountALL(levelsStr, null);//查询 申请总数
Integer auditChangeCount=tycpdmFirmChangeDao.findTycpdmFirmLogoutFlagCountALL(levelsStr,0);//查询 等待审核 0 Integer auditChangeCount = tycpdmFirmChangeDao.findTycpdmFirmLogoutFlagCountALL(levelsStr, 0);//查询 等待审核 0
Integer throughChangeCount=tycpdmFirmChangeDao.findTycpdmFirmLogoutFlagCountALL(levelsStr,1);//查询 通过审核 1 Integer throughChangeCount = tycpdmFirmChangeDao.findTycpdmFirmLogoutFlagCountALL(levelsStr, 1);//查询 通过审核 1
Integer notThroughChangeCount=tycpdmFirmChangeDao.findTycpdmFirmLogoutFlagCountALL(levelsStr,2);//查询 未通过审核 2 Integer notThroughChangeCount = tycpdmFirmChangeDao.findTycpdmFirmLogoutFlagCountALL(levelsStr, 2);//查询 未通过审核 2
map.put("countChangeAll",countChangeAll); map.put("countChangeAll", countChangeAll);
map.put("auditChangeCount",auditChangeCount); map.put("auditChangeCount", auditChangeCount);
map.put("throughChangeCount",throughChangeCount); map.put("throughChangeCount", throughChangeCount);
map.put("notThroughChangeCount",notThroughChangeCount); map.put("notThroughChangeCount", notThroughChangeCount);
return map; return map;
} }
...@@ -164,22 +170,22 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -164,22 +170,22 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
String contentType = file.getContentType(); String contentType = file.getContentType();
System.out.println(contentType); System.out.println(contentType);
File dir = new File(uploadFileQY); File dir = new File(uploadFileQY);
if (!dir.exists()){ if (!dir.exists()) {
boolean mkdirs = dir.mkdirs(); boolean mkdirs = dir.mkdirs();
System.out.println(mkdirs); System.out.println(mkdirs);
} }
String fileName = file.getOriginalFilename(); String fileName = file.getOriginalFilename();
String substring = fileName.substring(fileName.lastIndexOf("."));//文件后缀 String substring = fileName.substring(fileName.lastIndexOf("."));//文件后缀
if (!(substring.equals(".png")||substring.equals(".bmp")||substring.equals(".jpg"))){ if (!(substring.equals(".png") || substring.equals(".bmp") || substring.equals(".jpg"))) {
throw new RRException("文件类型不正确,支持png,bmp,jpg格式"); throw new RRException("文件类型不正确,支持png,bmp,jpg格式");
} }
String uuid = UUID.randomUUID().toString().replaceAll("-", ""); String uuid = UUID.randomUUID().toString().replaceAll("-", "");
File dest = new File(uploadFileQY + uuid+substring); File dest = new File(uploadFileQY + uuid + substring);
try { try {
file.transferTo(dest); file.transferTo(dest);
//保存路径 firm_archivesFile //保存路径 firm_archivesFile
tycpdmFirmDao.updateByIdfirmArchivesFile(uploadFileQY + uuid+substring,id,0,DateUtils.getTime()); tycpdmFirmDao.updateByIdfirmArchivesFile(uploadFileQY + uuid + substring, id, 0, DateUtils.getTime());
//tycpdm_vip_user表中新增数据 //tycpdm_vip_user表中新增数据
/*TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id); /*TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id);
String baseUser = tycpdmFirmEntity.getBaseUser(); String baseUser = tycpdmFirmEntity.getBaseUser();
...@@ -187,14 +193,14 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -187,14 +193,14 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
tycpdmVipUserDao.insert(new TycpdmVipUserEntity(null,id+"",firmname,baseUser));*/ tycpdmVipUserDao.insert(new TycpdmVipUserEntity(null,id+"",firmname,baseUser));*/
//删除原来的照片 //删除原来的照片
if (firmArchivesfile!=null){ if (firmArchivesfile != null) {
File file1 = new File(firmArchivesfile); File file1 = new File(firmArchivesfile);
if (file1.exists()){ if (file1.exists()) {
file1.delete(); file1.delete();
} }
} }
return ; return;
} catch (IOException e) { } catch (IOException e) {
dir.delete(); dir.delete();
e.printStackTrace(); e.printStackTrace();
...@@ -208,26 +214,26 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -208,26 +214,26 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
throw new RRException("上传失败,请选择文件"); throw new RRException("上传失败,请选择文件");
} }
File dir = new File(uploadFileQYOne); File dir = new File(uploadFileQYOne);
if (!dir.exists()){ if (!dir.exists()) {
boolean mkdirs = dir.mkdirs(); boolean mkdirs = dir.mkdirs();
System.out.println(mkdirs); System.out.println(mkdirs);
} }
String fileName = file.getOriginalFilename(); String fileName = file.getOriginalFilename();
String substring = fileName.substring(fileName.lastIndexOf("."));//文件后缀 String substring = fileName.substring(fileName.lastIndexOf("."));//文件后缀
String uuid = UUID.randomUUID().toString().replaceAll("-", ""); String uuid = UUID.randomUUID().toString().replaceAll("-", "");
if (file.getSize()>3145728){ if (file.getSize() > 3145728) {
System.out.println("文件大小:"+file.getSize()); System.out.println("文件大小:" + file.getSize());
throw new RRException("文件大小不得超过3M"); throw new RRException("文件大小不得超过3M");
} }
if (!(substring.equals(".png")||substring.equals(".bmp")||substring.equals(".jpg"))){ if (!(substring.equals(".png") || substring.equals(".bmp") || substring.equals(".jpg"))) {
throw new RRException("文件类型不正确,支持png,bmp,jpg格式"); throw new RRException("文件类型不正确,支持png,bmp,jpg格式");
} }
File dest = new File(uploadFileQYOne + uuid+substring); File dest = new File(uploadFileQYOne + uuid + substring);
try { try {
file.transferTo(dest); file.transferTo(dest);
return uploadFileQYOne + uuid+substring; return uploadFileQYOne + uuid + substring;
} catch (Exception e) { } catch (Exception e) {
dir.delete(); dir.delete();
e.printStackTrace(); e.printStackTrace();
...@@ -237,42 +243,42 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -237,42 +243,42 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
@Override @Override
public Page<TycpdmFirmEntity> findlist(Map<String, Object> params, Page page) { public Page<TycpdmFirmEntity> findlist(Map<String, Object> params, Page page) {
List<TycpdmFirmEntity> list = tycpdmFirmDao.selectTycpdmFirmList(params,page); List<TycpdmFirmEntity> list = tycpdmFirmDao.selectTycpdmFirmList(params, page);
page.setRecords(list); page.setRecords(list);
return page; return page;
} }
@Override @Override
@Transactional @Transactional
public void audit(Map map,Long memberUserId,String username) throws InvocationTargetException, IllegalAccessException { public void audit(Map map, Long memberUserId, String username) throws InvocationTargetException, IllegalAccessException {
Integer status= map.get("status")==null?0: Integer.valueOf(String.valueOf(map.get("status")));//1.新增(新增时id为fId) 2.变更(id为fId) 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 id = map.get("id") == null ? "" : String.valueOf(map.get("id"));//id
String auditStatus= map.get("auditStatus")==null?"": String.valueOf(map.get("auditStatus"));//审核状态 1.通过 2.不通过 String auditStatus = map.get("auditStatus") == null ? "" : String.valueOf(map.get("auditStatus"));//审核状态 1.通过 2.不通过
String approve_content= map.get("approve_content")==null?"": String.valueOf(map.get("approve_content"));//拒绝理由 String approve_content = map.get("approve_content") == null ? "" : String.valueOf(map.get("approve_content"));//拒绝理由
//logout_flag //logout_flag
if (status==1){ if (status == 1) {
//新增 //新增
//直接修改tycpmFirm表 状态 //直接修改tycpmFirm表 状态
tycpdmFirmDao.updateBYIdLogoutFlag(auditStatus,id,DateUtils.getTime(),username,approve_content); tycpdmFirmDao.updateBYIdLogoutFlag(auditStatus, id, DateUtils.getTime(), username, approve_content);
//在tycpdm_vip_user表中记录 //在tycpdm_vip_user表中记录
if ("1".equals(auditStatus)){ if ("1".equals(auditStatus)) {
TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id); TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id);
String baseUser = tycpdmFirmEntity.getBaseUser(); String baseUser = tycpdmFirmEntity.getBaseUser();
String firmname = tycpdmFirmEntity.getFirmname(); String firmname = tycpdmFirmEntity.getFirmname();
tycpdmVipUserDao.insert(new TycpdmVipUserEntity(null,id+"",firmname,baseUser)); tycpdmVipUserDao.insert(new TycpdmVipUserEntity(null, id + "", firmname, baseUser));
} }
TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id); TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id);
String baseUser = tycpdmFirmEntity.getBaseUser(); String baseUser = tycpdmFirmEntity.getBaseUser();
if (auditStatus.equals("1")){ if (auditStatus.equals("1")) {
memberDao.updateByIdApplystate("通过审核",baseUser); memberDao.updateByIdApplystate("通过审核", baseUser);
} }
}else if (status==2){ } else if (status == 2) {
//变更 //变更
tycpdmFirmChangeDao.updateBYIdLogoutFlag(auditStatus,id,DateUtils.getTime(),username,approve_content); tycpdmFirmChangeDao.updateBYIdLogoutFlag(auditStatus, id, DateUtils.getTime(), username, approve_content);
if ("1".equals(auditStatus)){ if ("1".equals(auditStatus)) {
//通过将变更表的数据同步到tycpdmFirm表 //通过将变更表的数据同步到tycpdmFirm表
TycpdmFirmChangeEntity tycpdmFirmChangeEntity = tycpdmFirmChangeDao.selectById(id); TycpdmFirmChangeEntity tycpdmFirmChangeEntity = tycpdmFirmChangeDao.selectById(id);
Integer fId = tycpdmFirmChangeEntity.getFId(); Integer fId = tycpdmFirmChangeEntity.getFId();
...@@ -284,7 +290,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -284,7 +290,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
tycpdmFirmEntity = tycpdmFirmDao.selectById(fId); tycpdmFirmEntity = tycpdmFirmDao.selectById(fId);
String baseUser = tycpdmFirmEntity.getBaseUser(); String baseUser = tycpdmFirmEntity.getBaseUser();
String firmname = tycpdmFirmEntity.getFirmname(); String firmname = tycpdmFirmEntity.getFirmname();
tycpdmVipUserDao.insert(new TycpdmVipUserEntity(null,id+"",firmname,baseUser)); tycpdmVipUserDao.insert(new TycpdmVipUserEntity(null, id + "", firmname, baseUser));
} }
} }
...@@ -294,170 +300,170 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -294,170 +300,170 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
@Override @Override
public int findLogoutFlag(String userName) { public int findLogoutFlag(String userName) {
//查询tycpdm_firm表 //查询tycpdm_firm表
int findLogoutFlag=0; //业务类型 1.首次 2.变更 int findLogoutFlag = 0; //业务类型 1.首次 2.变更
TycpdmFirmEntity tycpdmFirm = tycpdmFirmDao.findUserName(userName); TycpdmFirmEntity tycpdmFirm = tycpdmFirmDao.findUserName(userName);
if (tycpdmFirm==null){ if (tycpdmFirm == null) {
findLogoutFlag=1; findLogoutFlag = 1;
return findLogoutFlag; return findLogoutFlag;
}else { } else {
Integer logoutFlag = tycpdmFirm.getLogoutFlag(); Integer logoutFlag = tycpdmFirm.getLogoutFlag();
if (logoutFlag==null){ if (logoutFlag == null) {
findLogoutFlag=1; findLogoutFlag = 1;
}else if (logoutFlag==1){ } else if (logoutFlag == 1) {
findLogoutFlag=2; findLogoutFlag = 2;
}else { } else {
findLogoutFlag=1; findLogoutFlag = 1;
} }
} }
return findLogoutFlag; return findLogoutFlag;
} }
@Override @Override
public Integer saveTycpdmFirmInfo(Map body,String userName) throws InvocationTargetException, IllegalAccessException { public Integer saveTycpdmFirmInfo(Map body, String userName) throws InvocationTargetException, IllegalAccessException {
TycpdmFirmEntity tycpdmFirm = new TycpdmFirmEntity(); TycpdmFirmEntity tycpdmFirm = new TycpdmFirmEntity();
TycpdmFirmChangeEntity tycpdmFirmChangeEntity = new TycpdmFirmChangeEntity(); TycpdmFirmChangeEntity tycpdmFirmChangeEntity = new TycpdmFirmChangeEntity();
Integer status = body.get("status")==null?0:Integer.valueOf(String.valueOf(body.get("status"))); Integer status = body.get("status") == null ? 0 : Integer.valueOf(String.valueOf(body.get("status")));
Object certificateCode = body.get("certificatecode");//填统一社会信用代码 Object certificateCode = body.get("certificatecode");//填统一社会信用代码
if (!AlgorithmUtils.checkUSCC(certificateCode.toString())){ if (!AlgorithmUtils.checkUSCC(certificateCode.toString())) {
throw new RRException("统一社会信用代码输入错误"); throw new RRException("统一社会信用代码输入错误");
} }
if(tycpdmFirmDao.selectByIdCertificateCode(String.valueOf(certificateCode),String.valueOf(body.get("fid")))>0){ if (tycpdmFirmDao.selectByIdCertificateCode(String.valueOf(certificateCode), String.valueOf(body.get("fid"))) > 0) {
throw new RRException("统一社会信用代码已存在"); throw new RRException("统一社会信用代码已存在");
} }
//写入死值 //写入死值
body.put("useddesc","企业产品描述信息"); body.put("useddesc", "企业产品描述信息");
body.put("wishusednum",100); body.put("wishusednum", 100);
body.put("receiveflag",1); body.put("receiveflag", 1);
body.put("memo","注册备注信息"); body.put("memo", "注册备注信息");
Integer id=0; Integer id = 0;
if (status==1){ //首次 if (status == 1) { //首次
BeanUtils.populate(tycpdmFirm, body); BeanUtils.populate(tycpdmFirm, body);
String baseUser = tycpdmFirm.getBaseUser(); String baseUser = tycpdmFirm.getBaseUser();
if (baseUser==null){ if (baseUser == null) {
throw new RRException("用户名不能为空"); throw new RRException("用户名不能为空");
} }
String firmname = tycpdmFirm.getFirmname(); String firmname = tycpdmFirm.getFirmname();
if (firmname==null||"".equals(tycpdmFirm)){ if (firmname == null || "".equals(tycpdmFirm)) {
throw new RRException("企业名称不能为空"); throw new RRException("企业名称不能为空");
} }
int count=tycpdmFirmDao.selectByIdFirmNameSC(firmname); int count = tycpdmFirmDao.selectByIdFirmNameSC(firmname);
int countXT=tycpdmFirmDao.selectByIdFirmNameXTSC(firmname); int countXT = tycpdmFirmDao.selectByIdFirmNameXTSC(firmname);
if (count>0){ if (count > 0) {
throw new RRException("厂商名称已重复"); throw new RRException("厂商名称已重复");
} }
if (countXT>0){ if (countXT > 0) {
throw new RRException(" 厂商已为系统成员,请使用条码卡账号登录,无需再次实名认证!"); throw new RRException(" 厂商已为系统成员,请使用条码卡账号登录,无需再次实名认证!");
} }
Integer fid = body.get("fid")==null?0:Integer.valueOf(String.valueOf(body.get("fid"))); Integer fid = body.get("fid") == null ? 0 : Integer.valueOf(String.valueOf(body.get("fid")));
tycpdmFirm.setFId(fid); tycpdmFirm.setFId(fid);
Integer fId = tycpdmFirm.getFId(); Integer fId = tycpdmFirm.getFId();
if (fId==0){//新增数据 if (fId == 0) {//新增数据
tycpdmFirm.setLogoutFlag(-1); tycpdmFirm.setLogoutFlag(-1);
save(tycpdmFirm); save(tycpdmFirm);
id = tycpdmFirm.getFId(); id = tycpdmFirm.getFId();
return id; return id;
}else {//修改数据 } else {//修改数据
//查询旧数据审核状态 //查询旧数据审核状态
TycpdmFirmEntity userName1 = tycpdmFirmDao.findUserName(userName); TycpdmFirmEntity userName1 = tycpdmFirmDao.findUserName(userName);
Integer logoutFlag = userName1.getLogoutFlag(); Integer logoutFlag = userName1.getLogoutFlag();
if (logoutFlag==null||logoutFlag==-1){ if (logoutFlag == null || logoutFlag == -1) {
//修改 信息 //修改 信息
updateById(tycpdmFirm); updateById(tycpdmFirm);
//删除旧文件 //删除旧文件
if (!tycpdmFirm.getFirmbusinesslicensefile().equals("")||tycpdmFirm.getFirmbusinesslicensefile()!=null){ if (!tycpdmFirm.getFirmbusinesslicensefile().equals("") || tycpdmFirm.getFirmbusinesslicensefile() != null) {
if (!userName1.getFirmbusinesslicensefile().equals(tycpdmFirm.getFirmbusinesslicensefile())){ if (!userName1.getFirmbusinesslicensefile().equals(tycpdmFirm.getFirmbusinesslicensefile())) {
File file = new File(userName1.getFirmbusinesslicensefile()); File file = new File(userName1.getFirmbusinesslicensefile());
if (file.exists()){ if (file.exists()) {
file.delete(); file.delete();
} }
} }
} }
id=fId; id = fId;
}else if (logoutFlag==0){ } else if (logoutFlag == 0) {
throw new RRException("信息已提交,等待管理员审核!"); throw new RRException("信息已提交,等待管理员审核!");
}else if (logoutFlag==1){ } else if (logoutFlag == 1) {
throw new RRException("审核状态异常"); throw new RRException("审核状态异常");
}else if (logoutFlag==2){ } else if (logoutFlag == 2) {
updateById(tycpdmFirm); updateById(tycpdmFirm);
id=fId; id = fId;
} }
return id; return id;
} }
}else if (status==2){ //变更 } else if (status == 2) { //变更
Integer fId =0; Integer fId = 0;
Integer type=0; //1.新增 2.修改 Integer type = 0; //1.新增 2.修改
if (body.get("fid")==null){//获取 主表的fId if (body.get("fid") == null) {//获取 主表的fId
TycpdmFirmEntity userName1 = tycpdmFirmDao.findUserName(userName); TycpdmFirmEntity userName1 = tycpdmFirmDao.findUserName(userName);
fId=userName1.getFId(); fId = userName1.getFId();
type=1; type = 1;
}else { } else {
fId=Integer.valueOf(String.valueOf(body.get("fid"))); fId = Integer.valueOf(String.valueOf(body.get("fid")));
type=2; type = 2;
} }
BeanUtils.populate(tycpdmFirmChangeEntity, body); BeanUtils.populate(tycpdmFirmChangeEntity, body);
String baseUser = tycpdmFirmChangeEntity.getBaseUser(); String baseUser = tycpdmFirmChangeEntity.getBaseUser();
if (baseUser==null){ if (baseUser == null) {
throw new RRException("用户名不能为空"); throw new RRException("用户名不能为空");
} }
String firmname = tycpdmFirmChangeEntity.getFirmname(); String firmname = tycpdmFirmChangeEntity.getFirmname();
if (firmname==null||"".equals(tycpdmFirm)){ if (firmname == null || "".equals(tycpdmFirm)) {
throw new RRException("企业名称不能为空"); throw new RRException("企业名称不能为空");
} }
int count=tycpdmFirmDao.selectByIdFirmNameBG(firmname,fId); int count = tycpdmFirmDao.selectByIdFirmNameBG(firmname, fId);
if (count>0){ if (count > 0) {
throw new RRException("企业名称已经存在"); throw new RRException("企业名称已经存在");
} }
int countXT=tycpdmFirmDao.selectByIdFirmNameXTSC(firmname); int countXT = tycpdmFirmDao.selectByIdFirmNameXTSC(firmname);
if (count>0){ if (count > 0) {
throw new RRException("企业名称已经存在"); throw new RRException("企业名称已经存在");
} }
if (countXT>0){ if (countXT > 0) {
throw new RRException("厂商已为系统成员,请使用条码卡账号登录,无需再次实名认证!"); throw new RRException("厂商已为系统成员,请使用条码卡账号登录,无需再次实名认证!");
} }
tycpdmFirmChangeEntity.setFId(fId); tycpdmFirmChangeEntity.setFId(fId);
if (type==1){ if (type == 1) {
tycpdmFirmChangeEntity.setLogoutFlag(-1); tycpdmFirmChangeEntity.setLogoutFlag(-1);
tycpdmFirmChangeService.save(tycpdmFirmChangeEntity); tycpdmFirmChangeService.save(tycpdmFirmChangeEntity);
id = tycpdmFirmChangeEntity.getId(); id = tycpdmFirmChangeEntity.getId();
}else if (type==2){ } else if (type == 2) {
if (tycpdmFirmChangeEntity.getId()==null){ if (tycpdmFirmChangeEntity.getId() == null) {
tycpdmFirmChangeEntity.setLogoutFlag(-1); tycpdmFirmChangeEntity.setLogoutFlag(-1);
tycpdmFirmChangeService.save(tycpdmFirmChangeEntity); tycpdmFirmChangeService.save(tycpdmFirmChangeEntity);
id = tycpdmFirmChangeEntity.getId(); id = tycpdmFirmChangeEntity.getId();
} }
TycpdmFirmChangeEntity tycpdmFirmChangeEntity1 = tycpdmFirmChangeDao.selectById(tycpdmFirmChangeEntity.getId()); TycpdmFirmChangeEntity tycpdmFirmChangeEntity1 = tycpdmFirmChangeDao.selectById(tycpdmFirmChangeEntity.getId());
Integer logoutFlag = tycpdmFirmChangeEntity1.getLogoutFlag(); Integer logoutFlag = tycpdmFirmChangeEntity1.getLogoutFlag();
if (logoutFlag==null||logoutFlag==-1){ if (logoutFlag == null || logoutFlag == -1) {
tycpdmFirmChangeService.updateById(tycpdmFirmChangeEntity); tycpdmFirmChangeService.updateById(tycpdmFirmChangeEntity);
id= tycpdmFirmChangeEntity.getId(); id = tycpdmFirmChangeEntity.getId();
//删除旧文件 //删除旧文件
if (!tycpdmFirmChangeEntity.getFirmbusinesslicensefile().equals("")||tycpdmFirmChangeEntity.getFirmbusinesslicensefile()!=null){ if (!tycpdmFirmChangeEntity.getFirmbusinesslicensefile().equals("") || tycpdmFirmChangeEntity.getFirmbusinesslicensefile() != null) {
if (!tycpdmFirmChangeEntity1.getFirmbusinesslicensefile().equals(tycpdmFirmChangeEntity.getFirmbusinesslicensefile())){ if (!tycpdmFirmChangeEntity1.getFirmbusinesslicensefile().equals(tycpdmFirmChangeEntity.getFirmbusinesslicensefile())) {
File file = new File(tycpdmFirmChangeEntity1.getFirmbusinesslicensefile()); File file = new File(tycpdmFirmChangeEntity1.getFirmbusinesslicensefile());
if (file.exists()){ if (file.exists()) {
file.delete(); file.delete();
} }
} }
} }
}else if (logoutFlag==0){ } else if (logoutFlag == 0) {
throw new RRException("信息已提交,等待管理员审核!"); throw new RRException("信息已提交,等待管理员审核!");
}else if (logoutFlag==1){ } else if (logoutFlag == 1) {
tycpdmFirmChangeEntity.setLogoutFlag(-1); tycpdmFirmChangeEntity.setLogoutFlag(-1);
tycpdmFirmChangeService.save(tycpdmFirmChangeEntity); tycpdmFirmChangeService.save(tycpdmFirmChangeEntity);
id = tycpdmFirmChangeEntity.getId(); id = tycpdmFirmChangeEntity.getId();
}else if (logoutFlag==2){ } else if (logoutFlag == 2) {
tycpdmFirmChangeService.updateById(tycpdmFirmChangeEntity); tycpdmFirmChangeService.updateById(tycpdmFirmChangeEntity);
id= tycpdmFirmChangeEntity.getId(); id = tycpdmFirmChangeEntity.getId();
//删除旧文件 //删除旧文件
if (!tycpdmFirmChangeEntity.getFirmbusinesslicensefile().equals("")||tycpdmFirmChangeEntity.getFirmbusinesslicensefile()!=null){ if (!tycpdmFirmChangeEntity.getFirmbusinesslicensefile().equals("") || tycpdmFirmChangeEntity.getFirmbusinesslicensefile() != null) {
if (!tycpdmFirmChangeEntity1.getFirmbusinesslicensefile().equals(tycpdmFirmChangeEntity.getFirmbusinesslicensefile())){ if (!tycpdmFirmChangeEntity1.getFirmbusinesslicensefile().equals(tycpdmFirmChangeEntity.getFirmbusinesslicensefile())) {
File file = new File(tycpdmFirmChangeEntity1.getFirmbusinesslicensefile()); File file = new File(tycpdmFirmChangeEntity1.getFirmbusinesslicensefile());
if (file.exists()){ if (file.exists()) {
file.delete(); file.delete();
} }
} }
...@@ -465,35 +471,35 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -465,35 +471,35 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
} }
} }
}else { } else {
throw new RRException("请选择业务类型"); throw new RRException("请选择业务类型");
} }
return id; return id;
} }
@Override @Override
public void returnFile(Map<String, Object> params, HttpServletResponse response){ public void returnFile(Map<String, Object> params, HttpServletResponse response) {
Integer status =Integer.valueOf(String.valueOf(params.get("status"))); //1.首次 2.变更 Integer status = Integer.valueOf(String.valueOf(params.get("status"))); //1.首次 2.变更
Integer fileType = Integer.valueOf(String.valueOf(params.get("fileType")));//1.第一步文件 2.第二步文件 Integer fileType = Integer.valueOf(String.valueOf(params.get("fileType")));//1.第一步文件 2.第二步文件
String id =String.valueOf(params.get("id"));//各个表的主键 String id = String.valueOf(params.get("id"));//各个表的主键
String filePath=""; String filePath = "";
if (status==1){ if (status == 1) {
TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id); TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id);
if (fileType==1){ if (fileType == 1) {
filePath = tycpdmFirmEntity.getFirmbusinesslicensefile(); filePath = tycpdmFirmEntity.getFirmbusinesslicensefile();
}else if (fileType==2){ } else if (fileType == 2) {
filePath = tycpdmFirmEntity.getFirmArchivesfile(); filePath = tycpdmFirmEntity.getFirmArchivesfile();
} }
}else if (status==2){ } else if (status == 2) {
TycpdmFirmChangeEntity tycpdmFirmChangeEntity = tycpdmFirmChangeDao.selectById(id); TycpdmFirmChangeEntity tycpdmFirmChangeEntity = tycpdmFirmChangeDao.selectById(id);
if (fileType==1){ if (fileType == 1) {
filePath = tycpdmFirmChangeEntity.getFirmbusinesslicensefile(); filePath = tycpdmFirmChangeEntity.getFirmbusinesslicensefile();
}else if (fileType==2){ } else if (fileType == 2) {
filePath = tycpdmFirmChangeEntity.getFirmArchivesfile(); filePath = tycpdmFirmChangeEntity.getFirmArchivesfile();
} }
} }
File file = new File(filePath); File file = new File(filePath);
if (!file.exists()){ if (!file.exists()) {
throw new RRException("文件不存在"); throw new RRException("文件不存在");
} }
try { try {
...@@ -504,34 +510,33 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -504,34 +510,33 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
} }
@Override @Override
public String returnFileUrl(Map params) { public String returnFileUrl(Map params) {
Integer status =Integer.valueOf(String.valueOf(params.get("status"))); //1.首次 2.变更 Integer status = Integer.valueOf(String.valueOf(params.get("status"))); //1.首次 2.变更
Integer fileType = Integer.valueOf(String.valueOf(params.get("fileType")));//1.第一步文件 2.第二步文件 Integer fileType = Integer.valueOf(String.valueOf(params.get("fileType")));//1.第一步文件 2.第二步文件
String id =String.valueOf(params.get("id"));//各个表的主键 String id = String.valueOf(params.get("id"));//各个表的主键
String filePath=""; String filePath = "";
if (status==1){ if (status == 1) {
TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id); TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id);
if (fileType==1){ if (fileType == 1) {
filePath = tycpdmFirmEntity.getFirmbusinesslicensefile(); filePath = tycpdmFirmEntity.getFirmbusinesslicensefile();
}else if (fileType==2){ } else if (fileType == 2) {
filePath = tycpdmFirmEntity.getFirmArchivesfile(); filePath = tycpdmFirmEntity.getFirmArchivesfile();
} }
}else if (status==2){ } else if (status == 2) {
TycpdmFirmChangeEntity tycpdmFirmChangeEntity = tycpdmFirmChangeDao.selectById(id); TycpdmFirmChangeEntity tycpdmFirmChangeEntity = tycpdmFirmChangeDao.selectById(id);
if (fileType==1){ if (fileType == 1) {
filePath = tycpdmFirmChangeEntity.getFirmbusinesslicensefile(); filePath = tycpdmFirmChangeEntity.getFirmbusinesslicensefile();
}else if (fileType==2){ } else if (fileType == 2) {
filePath = tycpdmFirmChangeEntity.getFirmArchivesfile(); filePath = tycpdmFirmChangeEntity.getFirmArchivesfile();
} }
} }
if (filePath==null){ if (filePath == null) {
return "不存在"; return "不存在";
} }
File file = new File(filePath); File file = new File(filePath);
if (!file.exists()){ if (!file.exists()) {
return "不存在"; return "不存在";
} }
return "存在"; return "存在";
...@@ -540,9 +545,9 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -540,9 +545,9 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
@Override @Override
public FirmEntity findFirmInfoXT(String carno) { public FirmEntity findFirmInfoXT(String carno) {
GdsBindEntity gdsBindEntity = gdsBindDao.selectById(carno); GdsBindEntity gdsBindEntity = gdsBindDao.selectById(carno);
if (gdsBindEntity==null){ if (gdsBindEntity == null) {
throw new RRException("暂无数据"); throw new RRException("暂无数据");
}else { } else {
Integer fId = gdsBindEntity.getFId(); Integer fId = gdsBindEntity.getFId();
FirmEntity firmEntity = firmDao.selectById(fId); FirmEntity firmEntity = firmDao.selectById(fId);
firmEntity.setFirmType("firmType");//刘娜给的文章这样写死值 firmEntity.setFirmType("firmType");//刘娜给的文章这样写死值
...@@ -555,58 +560,68 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -555,58 +560,68 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
Integer id = Integer.valueOf(String.valueOf(params.get("id")));//id为 各个表得ID 变更表和主表 Integer id = Integer.valueOf(String.valueOf(params.get("id")));//id为 各个表得ID 变更表和主表
Integer status = Integer.valueOf(String.valueOf(params.get("status")));//申请状态 1.首次 2.变更 Integer status = Integer.valueOf(String.valueOf(params.get("status")));//申请状态 1.首次 2.变更
Integer branchCode = Integer.valueOf(String.valueOf(params.get("branchCode")));//分中心管理员编码 Integer branchCode = Integer.valueOf(String.valueOf(params.get("branchCode")));//分中心管理员编码
if (status==1){ if (status == 1) {
tycpdmFirmDao.updateByIdBranchCode(id,branchCode); tycpdmFirmDao.updateByIdBranchCode(id, branchCode);
}else if (status==2){ } else if (status == 2) {
tycpdmFirmChangeDao.updateByIdBranchCode(id,branchCode); tycpdmFirmChangeDao.updateByIdBranchCode(id, branchCode);
} }
} }
@Override @Override
public String redirectGDSURL(MemberEntity memberUser,Map<String, Object> params) { public String redirectGDSURL(MemberEntity memberUser, Map<String, Object> params) {
//用户类型 1.业务大厅(手机号用户) 2.业务大厅(条码卡成员) 3.官网用户 //用户类型 1.业务大厅(手机号用户) 2.业务大厅(条码卡成员) 3.官网用户
Integer userType = Integer.valueOf(String.valueOf(params.get("userType"))); Integer userType = Integer.valueOf(String.valueOf(params.get("userType")));
Integer levels=null;//用户权限 空.代表普通用户 0.代表中心管理员,1.代表校验管理员 其他4位.代表分中心管理员 Integer levels = null;//用户权限 空.代表普通用户 0.代表中心管理员,1.代表校验管理员 其他4位.代表分中心管理员
int dept = -2; //0表示中心管理员;-2表示普通成员。-100表示没有任何值时 int dept = -2; //0表示中心管理员;-2表示普通成员。-100表示没有任何值时
String regist_or_login_from_ancc=""; String regist_or_login_from_ancc = "";
String username = null; String username = null;
String pass =null; String pass = null;
if (memberUser!=null){ if (memberUser != null) {
username=memberUser.getUsername(); username = memberUser.getUsername();
pass = memberUser.getPass(); pass = memberUser.getPass();
} }
if (userType==1){ if (userType == 2) {
//手机号用户获取 条码卡号 //手机号用户获取 条码卡号
Integer carno = Integer.valueOf(String.valueOf(params.get("carno"))); Integer carno = Integer.valueOf(String.valueOf(params.get("carno")));
username=carno+""; username = carno + "";
MemberEntity memberEntity = memberDao.selectByName(carno+""); MemberEntity memberEntity = memberDao.selectByName(carno + "");
//获取密码MD5加密后的密码 //获取密码MD5加密后的密码
String pass_MD5 = memberEntity.getPass(); String pass_MD5 = memberEntity.getPass();
//再进行 DES加密 //再进行 DES加密
pass = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(pass_MD5.getBytes(),"appsGdsn".getBytes())); pass = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(pass_MD5.getBytes(), "appsGdsn".getBytes()));
}else {//其他用户 } else {//其他用户
//密码进行 DES加密 //密码进行 DES加密
//String pass_DES = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(pass.getBytes(),DESUtils.Key.getBytes())); //String pass_DES = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(pass.getBytes(),DESUtils.Key.getBytes()));
levels=memberDao.selectCode_agen(username); levels = memberDao.selectCode_agen(username);
if (levels==null){ if (levels == null) {
dept=-2; dept = -2;
}else if (levels==0){ } else if (levels == 0) {
dept=0; dept = 0;
} }
pass = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(pass.getBytes(),"appsGdsn".getBytes())); pass = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(pass.getBytes(), "appsGdsn".getBytes()));
} }
regist_or_login_from_ancc=dept+"{regist_or_login_from_ancc}"; regist_or_login_from_ancc = dept + "{regist_or_login_from_ancc}";
regist_or_login_from_ancc= MD5Util.md5Encrypt32Lower(regist_or_login_from_ancc); regist_or_login_from_ancc = MD5Util.md5Encrypt32Lower(regist_or_login_from_ancc);
String url="http://manage.gds.org.cn/Original/WWW/registerOrLoginFromAncc.aspx?uname="+username+"&pwd="+pass+"&regist_or_login_from_ancc="+regist_or_login_from_ancc+"&dept="+dept; String url = "http://manage.gds.org.cn/Original/WWW/registerOrLoginFromAncc.aspx?uname=" + username + "&pwd=" + pass + "&regist_or_login_from_ancc=" + regist_or_login_from_ancc + "&dept=" + dept;
return url; return url;
} }
@Override
public String redirectGDSURLNew(Map<String, Object> params) {
//用户类型 1.业务大厅(手机号用户) 2.业务大厅(条码卡成员) 3.官网用户
Integer userType = Integer.valueOf(String.valueOf(params.get("userType")));
return null;
}
/** /**
* 只有官网注册用户登录,已通过厂商实名认证的,此处直接跳转,传参为用户名和密码 * 只有官网注册用户登录,已通过厂商实名认证的,此处直接跳转,传参为用户名和密码
* username 参数 进行DES加密 * username 参数 进行DES加密
* password 参数 MD5加密后的字段(也就是member表的pass字段) 再进行DES加密 * password 参数 MD5加密后的字段(也就是member表的pass字段) 再进行DES加密
*
* @param memberUser * @param memberUser
* @return * @return
*/ */
...@@ -623,48 +638,75 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -623,48 +638,75 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
} }
@Override @Override
public String redirectBusinessHall(Map map,MemberEntity memberUser) { public String redirectBusinessHall(Map map, MemberEntity memberUser) {
String phone=""; log.info(JSONUtil.toJsonStr(map));
//1.系统成员 2.手机用户 3.实名认证企业 4.网站用户
String phone = "";
//用户类型 1.业务大厅(手机号用户) 2.业务大厅(条码卡成员) 3.官网用户 //用户类型 1.业务大厅(手机号用户) 2.业务大厅(条码卡成员) 3.官网用户
Integer userType = Integer.valueOf(String.valueOf(map.get("userType"))); Integer userType = Integer.valueOf(String.valueOf(map.get("userType")));
if (userType==1){ if (userType == 2) {
phone=memberUser.getId()+"";//手机号 phone = memberUser.getId() + "";//手机号
}else if (userType==2){ } else if (userType == 1) {
//调用另一个接口 //调用另一个接口
phone=memberUser.getUsername();//条码卡号 String cardNo = memberUser.getId() + "";
String phone_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(phone.getBytes(),"loginkey".getBytes())); MemberEntity memberEntity = memberDao.selectByName(cardNo);
String password = memberUser.getPassword();//名文密码 log.info(JSONUtil.toJsonStr(memberEntity));
String password_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(password.getBytes(),"loginkey".getBytes())); phone = memberEntity.getUsername();//条码卡号
String url="http://wsdt.gs1cn.org/anccoh/login?method=gdsLoginSSO&gdsCode="+phone_M+"&password="+password_M; String phone_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(phone.getBytes(), "loginkey".getBytes()));
String password = memberEntity.getPassword();//名文密码
String password_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(password.getBytes(), "loginkey".getBytes()));
String url = "http://wsdt.gs1cn.org/anccoh/login?method=gdsLoginSSO&gdsCode=" + phone_M + "&password=" + password_M;
log.info(url);
return url; return url;
}else if (userType==3){ } else if (userType == 3) {
phone=memberUser.getPhone();//手机号 MemberEntity memberEntity = memberDao.selectById(memberUser.getId());
}else { phone = memberEntity.getPhone();//手机号
} else if (userType == 4) {
MemberEntity memberEntity = memberDao.selectById(memberUser.getId());
phone = memberEntity.getPhone();//手机号
} else {
throw new RRException("用户类型错误"); throw new RRException("用户类型错误");
} }
String phone_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(phone.getBytes(),"loginkey".getBytes())); String phone_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(phone.getBytes(), "loginkey".getBytes()));
String url="http://wsdt.gs1cn.org/anccoh/login?method=phoneSSO&phone="+phone_M; String url = "http://wsdt.gs1cn.org/anccoh/login?method=phoneSSO&phone=" + phone_M;
String token = HttpUtil.get(url); String token = HttpUtil.get(url);
JSONObject jsonObject = JSON.parseObject(token); JSONObject jsonObject = JSON.parseObject(token);
String status = jsonObject.getString("status"); String status = jsonObject.getString("status");
String msg = jsonObject.getString("msg"); String msg = jsonObject.getString("msg");
if (!"200".equals(status)){ if (!"200".equals(status)) {
throw new RRException("获取token失败"+msg); throw new RRException("获取token失败" + msg);
}
return "http://wsdt.gs1cn.org/anccoh/login?method=redirect&token=" + msg;
} }
return "http://wsdt.gs1cn.org/anccoh/login?method=redirect&token="+msg;
@Override
public String redirectBusinessHallNew(Map map, MemberEntity memberUser, HttpServletResponse response) {
//userType=1 id=carno userType=2 id=phone
//1.系统成员 2.手机用户 3.实名认证企业 4.网站用户
Integer userType = Integer.valueOf(String.valueOf(map.get("userType")));
/**
* 如果是1 系统成员需要条码卡,,然后请求http://wsdt.gs1cn.org/anccoh/login?method=gdsLoginSSO&gdsCode=
* 如果是2、3 手机用户 http://wsdt.gs1cn.org/anccoh/login?method=redirect&token=
*
*/
if (userType == 1) {
} }
return null;
}
/** /**
* 验证手机号 由于号码段不断的更新,只需要判断手机号有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);
......
...@@ -2,7 +2,7 @@ package io.office.modules.manage.utils; ...@@ -2,7 +2,7 @@ package io.office.modules.manage.utils;
import io.office.modules.manage.webservice.PartyDataLine; import io.office.modules.manage.webservice.PartyDataLine;
import io.office.modules.manage.webservice.WebServiceXmlTemplate; import io.office.modules.manage.webservice.WebServiceXmlTemplate;
import org.jdom.Document; import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpEntity; import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
...@@ -16,16 +16,16 @@ import java.io.Reader; ...@@ -16,16 +16,16 @@ import java.io.Reader;
import java.io.StringReader; import java.io.StringReader;
/** /**
*
* 
 @description: * 
 @description:
* *
* @author wudi * @author wudi
* @date 10:37 2021/11/21 * @date 10:37 2021/11/21
*/ */
@Slf4j
public class GLNSearchUtils { public class GLNSearchUtils {
public static PartyDataLine getGLNResult(String cascade,String requestedKeyCode,String requestedKeyValue,String requestedLanguage) { public static PartyDataLine getGLNResult(String cascade, String requestedKeyCode, String requestedKeyValue, String requestedLanguage) {
String smsTemplateXml = WebServiceXmlTemplate.SEND_MESSAGE_TEMPLATE.replaceAll("\\$\\{cascade\\}", cascade).replaceAll("\\$\\{requestedKeyCode\\}", requestedKeyCode) String smsTemplateXml = WebServiceXmlTemplate.SEND_MESSAGE_TEMPLATE.replaceAll("\\$\\{cascade\\}", cascade).replaceAll("\\$\\{requestedKeyCode\\}", requestedKeyCode)
.replaceAll("\\$\\{requestedKeyValue\\}", requestedKeyValue).replaceAll("\\$\\{requestedLanguage\\}", requestedLanguage); .replaceAll("\\$\\{requestedKeyValue\\}", requestedKeyValue).replaceAll("\\$\\{requestedLanguage\\}", requestedLanguage);
String url = "http://webservice.anccnet.com:8080/gepir4/gepirv4.asmx"; String url = "http://webservice.anccnet.com:8080/gepir4/gepirv4.asmx";
...@@ -35,14 +35,14 @@ public class GLNSearchUtils { ...@@ -35,14 +35,14 @@ public class GLNSearchUtils {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.set("Content-Type", "text/xml; charset=utf-8"); headers.set("Content-Type", "text/xml; charset=utf-8");
HttpEntity<String> entity = new HttpEntity<>(smsTemplateXml, headers); HttpEntity<String> entity = new HttpEntity<>(smsTemplateXml, headers);
System.out.println(smsTemplateXml); log.info(smsTemplateXml);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, entity, String.class); ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, entity, String.class);
if (responseEntity.getStatusCode().value() == 200) { if (responseEntity.getStatusCode().value() == 200) {
System.out.println(responseEntity.getBody()); log.info(responseEntity.getBody());
// 下面的是通过解析xml字符串的 // 下面的是通过解析xml字符串的
String returnObjs = responseEntity.getBody().substring(responseEntity.getBody().indexOf("<partyDataLine>"), responseEntity.getBody().indexOf("</gepirParty>")).replaceAll("<partyName />","");//注意 获取根节点的时候要查看返回的xml参数的形式是否为一个根节点 String returnObjs = responseEntity.getBody().substring(responseEntity.getBody().indexOf("<partyDataLine>"), responseEntity.getBody().indexOf("</gepirParty>")).replaceAll("<partyName />", "");//注意 获取根节点的时候要查看返回的xml参数的形式是否为一个根节点
System.out.println(returnObjs); log.info(returnObjs);
PartyDataLine xmlObject = null; PartyDataLine xmlObject = null;
Reader reader = null; Reader reader = null;
//利用JAXBContext将类转为一个实例 //利用JAXBContext将类转为一个实例
...@@ -66,7 +66,7 @@ public class GLNSearchUtils { ...@@ -66,7 +66,7 @@ public class GLNSearchUtils {
} }
public static PartyDataLine getGTINResult(String cascade,String requestedKeyCode,String requestedKeyValue,String requestedLanguage) { public static PartyDataLine getGTINResult(String cascade, String requestedKeyCode, String requestedKeyValue, String requestedLanguage) {
String smsTemplateXml = WebServiceXmlTemplate.SEND_MESSAGE_GTIN_TEMPLATE.replaceAll("\\$\\{cascade\\}", cascade).replaceAll("\\$\\{requestedKeyCode\\}", requestedKeyCode) String smsTemplateXml = WebServiceXmlTemplate.SEND_MESSAGE_GTIN_TEMPLATE.replaceAll("\\$\\{cascade\\}", cascade).replaceAll("\\$\\{requestedKeyCode\\}", requestedKeyCode)
.replaceAll("\\$\\{requestedKeyValue\\}", requestedKeyValue).replaceAll("\\$\\{requestedLanguage\\}", requestedLanguage); .replaceAll("\\$\\{requestedKeyValue\\}", requestedKeyValue).replaceAll("\\$\\{requestedLanguage\\}", requestedLanguage);
String url = "http://webservice.anccnet.com:8080/gepir4/gepirv4.asmx"; String url = "http://webservice.anccnet.com:8080/gepir4/gepirv4.asmx";
...@@ -76,14 +76,14 @@ public class GLNSearchUtils { ...@@ -76,14 +76,14 @@ public class GLNSearchUtils {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.set("Content-Type", "text/xml; charset=utf-8"); headers.set("Content-Type", "text/xml; charset=utf-8");
HttpEntity<String> entity = new HttpEntity<>(smsTemplateXml, headers); HttpEntity<String> entity = new HttpEntity<>(smsTemplateXml, headers);
System.out.println(smsTemplateXml); log.info(smsTemplateXml);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, entity, String.class); ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, entity, String.class);
if (responseEntity.getStatusCode().value() == 200) { if (responseEntity.getStatusCode().value() == 200) {
System.out.println(responseEntity.getBody()); log.info(responseEntity.getBody());
// 下面的是通过解析xml字符串的 // 下面的是通过解析xml字符串的
String returnObjs = responseEntity.getBody().substring(responseEntity.getBody().indexOf("<partyDataLine>"), responseEntity.getBody().indexOf("</gepirParty>")).replaceAll("<partyName />","");//注意 获取根节点的时候要查看返回的xml参数的形式是否为一个根节点 String returnObjs = responseEntity.getBody().substring(responseEntity.getBody().indexOf("<partyDataLine>"), responseEntity.getBody().indexOf("</gepirParty>")).replaceAll("<partyName />", "");//注意 获取根节点的时候要查看返回的xml参数的形式是否为一个根节点
System.out.println(returnObjs); log.info(returnObjs);
PartyDataLine xmlObject = null; PartyDataLine xmlObject = null;
Reader reader = null; Reader reader = null;
//利用JAXBContext将类转为一个实例 //利用JAXBContext将类转为一个实例
......
...@@ -87,7 +87,7 @@ searchLimitSwitch: 0 ...@@ -87,7 +87,7 @@ searchLimitSwitch: 0
#是否开启每次查询次数限制 1 打开 0关闭 #是否开启每次查询次数限制 1 打开 0关闭
searchDayLimitSwitch: 0 searchDayLimitSwitch: 0
#查询次数限制上限 #查询次数限制上限
searchDayCountLimitSwitch: 10 searchDayCountLimitSwitch: 100
#域名 #域名
#域名 #域名
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>debug</level> <level>debug</level>
</filter> </filter>
<encoder> <encoder>
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern> <Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
<!-- 设置字符集 --> <!-- 设置字符集 -->
...@@ -37,7 +38,7 @@ ...@@ -37,7 +38,7 @@
<file>${log.path}/debug.log</file> <file>${log.path}/debug.log</file>
<!--日志文档输出格式--> <!--日志文档输出格式-->
<encoder> <encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - [%file:%line] - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 设置字符集 --> <charset>UTF-8</charset> <!-- 设置字符集 -->
</encoder> </encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
...@@ -64,7 +65,7 @@ ...@@ -64,7 +65,7 @@
<file>${log.path}/info.log</file> <file>${log.path}/info.log</file>
<!--日志文档输出格式--> <!--日志文档输出格式-->
<encoder> <encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - [%file:%line] - %msg%n</pattern>
<charset>UTF-8</charset> <charset>UTF-8</charset>
</encoder> </encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
...@@ -91,7 +92,7 @@ ...@@ -91,7 +92,7 @@
<file>${log.path}/warn.log</file> <file>${log.path}/warn.log</file>
<!--日志文档输出格式--> <!--日志文档输出格式-->
<encoder> <encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - [%file:%line] - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 --> <charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder> </encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
...@@ -117,7 +118,7 @@ ...@@ -117,7 +118,7 @@
<file>${log.path}/error.log</file> <file>${log.path}/error.log</file>
<!--日志文档输出格式--> <!--日志文档输出格式-->
<encoder> <encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - [%file:%line] - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 --> <charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder> </encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
...@@ -143,7 +144,7 @@ ...@@ -143,7 +144,7 @@
<file>${log.path}/all.log</file> <file>${log.path}/all.log</file>
<!--日志文档输出格式--> <!--日志文档输出格式-->
<encoder> <encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - [%file:%line] - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 --> <charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder> </encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
...@@ -207,7 +208,7 @@ ...@@ -207,7 +208,7 @@
<appender-ref ref="ERROR_FILE" /> <appender-ref ref="ERROR_FILE" />
<appender-ref ref="ALL_FILE" /> <appender-ref ref="ALL_FILE" />
</root> </root>
<logger name="io.office.modules.manage.dao" level="debug"/> <!-- 开发环境, 指定某包日志为debug级 --> <logger name="io.office.modules" level="debug"/> <!-- 开发环境, 指定某包日志为debug级 -->
</springProfile> </springProfile>
<springProfile name="jenkins"> <springProfile name="jenkins">
......
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