Commit 8cb02918 authored by 徐小光's avatar 徐小光

Merge branch 'hotfix/refact' into 'master'

删除一些代码



See merge request !4
parents 99044458 89fe023e
......@@ -21,10 +21,6 @@ public enum EducationEnum {
this.name = name;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
......
......@@ -14,10 +14,6 @@ public enum Gender {
this.name = name;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
......
......@@ -22,10 +22,6 @@ public enum IdType {
this.name = name;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
......
......@@ -23,15 +23,10 @@ public enum MaritalStatus {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("MaritalStatus{");
sb.append("description='").append(description).append('\'');
sb.append('}');
return sb.toString();
String sb = "MaritalStatus{" + "description='" + description + '\'' +
'}';
return sb;
}
}
......@@ -23,10 +23,6 @@ public enum OccupationEnum {
this.name = name;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
......
......@@ -25,15 +25,10 @@ public enum Relation {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("Relation{");
sb.append("description='").append(description).append('\'');
sb.append('}');
return sb.toString();
String sb = "Relation{" + "description='" + description + '\'' +
'}';
return sb;
}
}
......@@ -28,13 +28,6 @@ public class Bootstrap {
public static void main(String[] args) {
SpringApplication springApplication = new SpringApplication(Bootstrap.class);
springApplication.addListeners(new ApplicationListener<ContextRefreshedEvent>() {
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
MotanSwitcherUtil.setSwitcherValue(MotanConstants.REGISTRY_HEARTBEAT_SWITCHER, true);
log.info("注册zookeeper成功");
}
});
springApplication.run(args);
}
......
package cn.quantgroup.xyqb.aspect.logcaller;
import cn.quantgroup.xyqb.util.ApplicationContextHolder;
import cn.quantgroup.xyqb.util.IPUtil;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
......@@ -10,7 +9,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
......@@ -29,7 +27,8 @@ public class LogCallHttpAspect {
private static final Logger LOGGER = LoggerFactory.getLogger(LogCallHttpAspect.class);
@Pointcut("@annotation(cn.quantgroup.xyqb.aspect.logcaller.LogHttpCaller)")
@Pointcut(value = "execution(public * cn.quantgroup.xyqb.controller..*.*(..)) " +
"&& !execution(* cn.quantgroup.xyqb.controller.ExceptionHandlingController.*(..))")
private void logHttpCaller() {
}
......@@ -41,9 +40,7 @@ public class LogCallHttpAspect {
try {
HttpServletRequest request = attrs.getRequest();
String remoteIP = IPUtil.getRemoteIP(request);
LogCallHttpAspect logCallHttpAspect = ApplicationContextHolder.getBean(LogCallHttpAspect.class);
// 异步记录日志
logCallHttpAspect.asyncRecordIt(pjp, result, remoteIP);
this.asyncRecordIt(pjp, result, remoteIP);
} catch (Exception e) {
LOGGER.error("打印http请求日志出错", e);
}
......@@ -58,12 +55,11 @@ public class LogCallHttpAspect {
* @param result
* @param remoteIP
*/
@Async("logExecutor")
public void asyncRecordIt(ProceedingJoinPoint pjp, Object result, String remoteIP) {
private void asyncRecordIt(ProceedingJoinPoint pjp, Object result, String remoteIP) {
Object[] args = pjp.getArgs();
String methodName = pjp.getSignature().getName();
String targetName = pjp.getTarget().getClass().getName();
LOGGER.info("http api is called,from IP:[{}],method :[{}],args:[{}],response:[{}]", remoteIP, targetName.concat(".").concat(methodName), args, result);
LOGGER.info("http api is called,from IP:[{}],method :[{}],args:[{}]", remoteIP, targetName.concat(".").concat(methodName), args);
}
}
package cn.quantgroup.xyqb.config.motan;
import com.weibo.api.motan.config.springsupport.AnnotationBean;
import com.weibo.api.motan.config.springsupport.BasicServiceConfigBean;
import com.weibo.api.motan.config.springsupport.ProtocolConfigBean;
import com.weibo.api.motan.config.springsupport.RegistryConfigBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Created by 11 on 2017/2/27.
*/
@Configuration
public class MotanConfig {
@Bean
public AnnotationBean motanAnnotationBean() {
AnnotationBean motanAnnotationBean = new AnnotationBean();
motanAnnotationBean.setPackage("cn.quantgroup.xyqb.controller.external.motan");
return motanAnnotationBean;
}
@Bean(name = "userMotan")
public ProtocolConfigBean protocolConfig1(
@Value("${protocol.isDefault}") Boolean isDefault, @Value("${protocol.name}") String name,
@Value("${protocol.contentLength}") int contentLength) {
ProtocolConfigBean config = new ProtocolConfigBean();
config.setDefault(isDefault);
config.setName(name);
config.setMaxContentLength(contentLength);
config.setMaxServerConnection(1000);
return config;
}
@Bean(name = "registryConfig")
public RegistryConfigBean registryConfig(@Value("${registry.protocol}") String registryProtocol,
@Value("${registry.address}") String registryAddress
) {
RegistryConfigBean config = new RegistryConfigBean();
config.setRegProtocol(registryProtocol);
config.setAddress(registryAddress);
return config;
}
@Bean
public BasicServiceConfigBean baseServiceConfig(@Value("${motan.port}") int motanPort,
@Value("${motan.user.group}") String userGroup,
@Value("${motan.user.module}") String userModule,
@Value("${motan.application:xyqbUserMotan}") String applicationName) {
BasicServiceConfigBean config = new BasicServiceConfigBean();
config.setExport("userMotan:" + motanPort);
config.setGroup(userGroup);
config.setVersion("1.0");
config.setAccessLog(true);
config.setShareChannel(true);
config.setModule(userModule);
config.setApplication(applicationName);
config.setRegistry("registryConfig");
return config;
}
}
......@@ -88,22 +88,4 @@ public class LoanVestMQConfig {
template.setExchange(loanVestExchange);
return template;
}
//@Bean(name = "loanVestMsgQueue")
//public Queue loanStateMsgQueue() {
// return new Queue(stateQueueName);
//}
//@Bean(name = "loanVestListenerContainer")
//public SimpleMessageListenerContainer loanVestSimpleMessageListenerContainer(@Qualifier("loanVestMQService") IVestService vestService, @Qualifier("vestFactory") ConnectionFactory vestFactory, @Qualifier("loanVestMsgQueue")Queue loanVestMsgQueue) {
// SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
// container.setConnectionFactory(vestFactory);
// container.setQueues(loanVestMsgQueue);
// container.setAcknowledgeMode(AcknowledgeMode.NONE);
// container.setMessageListener(new MessageListenerAdapter(vestService));
// container.start();
// return container;
//
//}
}
package cn.quantgroup.xyqb.config.thread;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
/**
* Created by xuran on 2017/11/8.
*/
@Configuration
@EnableAsync
public class AsyncConfig {
/**
* 生成线程池
*
* @param corePoolSize
* @param maxPoolSize
* @param queueCapacity
* @param waitForCompleteOnShutdown
* @param prefix
* @return
*/
private ThreadPoolTaskExecutor generateThreadPoolTaskExecutor(int corePoolSize, int maxPoolSize, int queueCapacity,
boolean waitForCompleteOnShutdown, int keepAliveSeconds,
boolean allowCoreThreadTimeOut, String prefix) {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(corePoolSize);
executor.setMaxPoolSize(maxPoolSize);
executor.setQueueCapacity(queueCapacity);
executor.setKeepAliveSeconds(keepAliveSeconds);
executor.setAllowCoreThreadTimeOut(allowCoreThreadTimeOut);
executor.setWaitForTasksToCompleteOnShutdown(waitForCompleteOnShutdown);
executor.setThreadNamePrefix(prefix);
executor.initialize();
return executor;
}
/**
* 日志线程池
*
* @return
*/
@Bean(name = "logExecutor")
public Executor loanMqExecutor() {
return generateThreadPoolTaskExecutor(100, 2000, 2000, true, 30, true, "loanMqExecutor-");
}
}
......@@ -37,7 +37,7 @@ public class NewCaptchaController {
@Value("${geetest.close:false}")
private String geetestClose;
@LogHttpCaller
@RequestMapping(value = "/captcha/new")
public JsonResult getCaptcha(String phoneNo, String clientType, HttpServletRequest request) {
String remoteIp = IPUtil.getRemoteIP(request);
......
......@@ -48,7 +48,6 @@ import static cn.quantgroup.xyqb.constant.UserConstant.USER_ERROR_OR_PASSWORD_ER
* Created by 11 on 2017/2/27.
*/
@Slf4j
@MotanService(basicService = "baseServiceConfig")
public class MotanUserServiceImpl implements UserMotanService {
private static final ObjectMapper MAPPER = new ObjectMapper();
......
......@@ -471,7 +471,7 @@ public class UserQueryLogController {
// 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
HSSFSheet sheet = wb.createSheet("用户信息列表");
// 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
HSSFRow row = sheet.createRow((int) 0);
HSSFRow row = sheet.createRow(0);
// 第四步,创建单元格,并设置值表头 设置表头居中
HSSFCellStyle style = wb.createCellStyle();
style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
......@@ -499,7 +499,7 @@ public class UserQueryLogController {
//List list = CreateSimpleExcelToDisk.getStudent();
for (int i = 0; i < uqls.size(); i++) {
row = sheet.createRow((int) i + 1);
row = sheet.createRow(i + 1);
UserQueryInfo user = uqls.get(i);
// 第四步,创建单元格,并设置值
if (user != null && row != null) {
......
......@@ -61,7 +61,7 @@ public class AppController implements IBaseController {
* @param request
* @return Token和phoneNo
*/
@LogHttpCaller
@IpValidator
@RequestMapping("/login")
public JsonResult login(
......@@ -119,7 +119,7 @@ public class AppController implements IBaseController {
* @param request
* @return 用户信息
*/
@LogHttpCaller
@IpValidator
@RequestMapping("/login_super")
public JsonResult loginSuper(
......@@ -186,7 +186,7 @@ public class AppController implements IBaseController {
* @param request
* @return Token和phoneNo
*/
@LogHttpCaller
@IpValidator
@RequestMapping("/login2")
public JsonResult login2(
......
......@@ -103,7 +103,7 @@ public class InnerController implements IBaseController {
};
@RequestMapping("/user/search/phoneNo")
@LogHttpCaller
public JsonResult findByPhoneNo(String phoneNo) {
User user = userService.findByPhoneInDb(phoneNo);
if (user == null) {
......@@ -115,7 +115,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult("", userRet);
}
@LogHttpCaller
@RequestMapping("/user/search/uuid")
public JsonResult findByUuid(String uuid) {
User user = userService.findByUuidWithCache(uuid);
......@@ -126,7 +126,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult("", userRet);
}
@LogHttpCaller
@RequestMapping("/userInfo/search/uuid")
public JsonResult findUserInfoByUuid(@RequestParam(value = "uuid") String uuid) {
log.info("需要查询的用户uuidid, uuid:" + uuid);
......@@ -146,7 +146,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult("", null);
}
@LogHttpCaller
@RequestMapping("/userInfo/search/phone")
public JsonResult findUserInfoByPhone(@RequestParam(value = "phone") String phone) {
log.info("需要查询的用户phone, phone:" + phone);
......@@ -166,7 +166,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult("", null);
}
@LogHttpCaller
@RequestMapping("/user/getPhoneByUserIds")
public JsonResult findByIds(@RequestParam(value = "userIds") String userIdsString) {
log.info("批量查询用户的手机号列表, userIdsString:" + userIdsString);
......@@ -183,7 +183,7 @@ public class InnerController implements IBaseController {
}
}
@LogHttpCaller
@RequestMapping("/user/save")
public JsonResult saveUser(
String phoneNo, Long registeredFrom, Long createdAt, Long updatedAt,
......@@ -235,7 +235,7 @@ public class InnerController implements IBaseController {
* 保存用户详细信息
* 适用于:创建 或 修改
*/
@LogHttpCaller
@RequestMapping("/user_detail/save")
public JsonResult saveUserDetail(Long userId, String phoneNo, String name, String idNo,
String email, String qq) {
......@@ -306,7 +306,7 @@ public class InnerController implements IBaseController {
/**
* 根据用户id查询用户的详细信息
*/
@LogHttpCaller
@RequestMapping("/user_detail/search/userId")
public JsonResult findUserDetailByUserId(Long userId) {
UserDetail userDetail = null;
......@@ -320,7 +320,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult(null, UserDetailRet.getUserDetail(userDetail));
}
@LogHttpCaller
@RequestMapping("/user/search/userId")
public JsonResult findUserByUserId(Long userId) {
User user = userService.findById(userId);
......@@ -330,7 +330,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildErrorStateResult("", null);
}
@LogHttpCaller
@RequestMapping("/user_detail/search/phone")
public JsonResult findUserDetailByPhone(String phoneNo) {
UserDetail userDetail = userDetailService.findByPhoneNo(phoneNo);
......@@ -346,7 +346,7 @@ public class InnerController implements IBaseController {
* @param phoneNo
* @return
*/
@LogHttpCaller
@RequestMapping("/user_full_info/search/phone")
public JsonResult findUserFullInfoByPhone(String phoneNo) {
if (StringUtils.isBlank(phoneNo)) {
......@@ -367,7 +367,7 @@ public class InnerController implements IBaseController {
* @param uuid
* @return
*/
@LogHttpCaller
@RequestMapping("/user_full_info/search/uuid")
public JsonResult findUserFullInfoByUUuid(String uuid) {
if (StringUtils.isBlank(uuid)) {
......@@ -390,7 +390,7 @@ public class InnerController implements IBaseController {
* @param userId - 用户主键
* @return
*/
@LogHttpCaller
@RequestMapping("/user_detail/update")
public JsonResult updateUserDetail(String qq, String email, Long userId) {
if (Objects.isNull(userId) || userId == 0L) {
......@@ -405,7 +405,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult(null, null);
}
@LogHttpCaller
@RequestMapping("/user_detail/update/qq")
public JsonResult updateUserQQ(String qq, Long userId) {
if (StringUtils.isEmpty(qq) || userId == null || userId == 0L) {
......@@ -415,7 +415,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult(null, null);
}
@LogHttpCaller
@RequestMapping("/contact/search/user_id")
public JsonResult findContactsByUserId(Long userId) {
if (null == userId) {
......@@ -428,7 +428,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult(null, ContactRet.contacts2ContactRets(contacts));
}
@LogHttpCaller
@RequestMapping("/contact/save/contacts")
public JsonResult save2Contact(Long userId, @RequestParam(value = "contacts") String contactsStr) {
if (Objects.isNull(userId) || StringUtils.isBlank(contactsStr)) {
......@@ -452,7 +452,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult("保存成功", ContactRet.contacts2ContactRets(result));
}
@LogHttpCaller
@RequestMapping("/contact/update/contact")
public JsonResult updateContact(@RequestParam Long contactId, @RequestParam(required = false) String name,
@RequestParam(required = false) String phoneNo,
......@@ -486,7 +486,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult("修改联系人成功", contact);
}
@LogHttpCaller
@RequestMapping("/address/search/user_id")
public JsonResult findAddressByUserId(Long userId) {
if (userId == null) {
......@@ -499,7 +499,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult(null, AddressRet.address2AddressRet(address));
}
@LogHttpCaller
@RequestMapping("/address/save")
public JsonResult saveAddress(
Long userId, Long provinceCode, Long cityCode, String city,
......@@ -533,7 +533,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult(null, AddressRet.address2AddressRet(addressObj));
}
@LogHttpCaller
@RequestMapping("/user_ext_info/update")
public JsonResult updateMarryStatus(
Long userId, IncomeEnum incomeEnum, IncomeRangeEnum incomeRangeEnum,
......@@ -584,7 +584,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult(null, UserExtInfoRet.getUserExtInfoRet(info));
}
@LogHttpCaller
@RequestMapping("/user_detail/search_list")
public JsonResult searchUserDetailList(String name, String phoneNo, String idNo) {
......@@ -616,7 +616,7 @@ public class InnerController implements IBaseController {
return JSON.parseObject(s, JsonResult.class);
}
@LogHttpCaller
@RequestMapping("/user_ext_info/search/user_id")
public JsonResult searchUserExtInfoByUserId(Long userId) {
if (userId == null) {
......@@ -629,7 +629,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult(null, UserExtInfoRet.getUserExtInfoRet(userExtInfo));
}
@LogHttpCaller
@RequestMapping("/user/query/openId")
public JsonResult queryOpenIdByUserId(Long userId) {
if (userId == null) {
......@@ -655,7 +655,7 @@ public class InnerController implements IBaseController {
* 个人信息
* }
*/
@LogHttpCaller
@RequestMapping("/user-association/search")
public JsonResult findUserAssociationModel(Long id, String phoneNo, String uuid) {
User user = null;
......@@ -739,7 +739,7 @@ public class InnerController implements IBaseController {
return bean;
}
@LogHttpCaller
@RequestMapping("/user-association/search/userId")
public JsonResult findUserAssociationModelByUserId(Long userId, String phoneNo) {
boolean userIdOk = Objects.nonNull(userId) && userId > 0;
......@@ -755,7 +755,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult("", bean);
}
@LogHttpCaller
@RequestMapping("/user-association/search/phone")
public JsonResult findUserAssociationByPhone(String phoneNo) {
UserDetail userDetail = userDetailService.findByPhoneNo(phoneNo);
......@@ -763,7 +763,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult("", bean);
}
@LogHttpCaller
@RequestMapping("/user-association/search/uid")
public JsonResult findUserAssociationByUid(Long uid) {
UserDetail userDetail = userDetailService.findByUserId(uid);
......@@ -844,7 +844,7 @@ public class InnerController implements IBaseController {
return contactRets;
}
@LogHttpCaller
@RequestMapping("/user/wechat/phone_no")
public JsonResult queryOpenIdByPhoneNo(String phoneNo) {
if (StringUtils.isBlank(phoneNo)) {
......@@ -891,7 +891,7 @@ public class InnerController implements IBaseController {
* @param phoneNo
* @return
*/
@LogHttpCaller
@RequestMapping("/flush/cache")
public JsonResult flushCache(String phoneNo) {
if (!ValidationUtil.validatePhoneNo(phoneNo)) {
......@@ -907,7 +907,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult("用户缓存信息已经删除", null);
}
@LogHttpCaller
@RequestMapping("/user/spouse/save")
public JsonResult saveSpouse(Long userId, MaritalStatus status, String spousePhone, String spouseName) {
if (userId == null || userId == 0) {
......@@ -935,7 +935,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult(null, UserSpouseRet.getUserSpouseRet(userSpouse));
}
@LogHttpCaller
@RequestMapping("/user/spouse/findByUserId")
public JsonResult querySpouse(Long userId) {
if (userId == null || userId == 0) {
......@@ -949,7 +949,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult(null, UserSpouseRet.getUserSpouseRet(userSpouse));
}
@LogHttpCaller
@RequestMapping("/user/findByPhones")
public JsonResult getUserIdByPhones(@RequestParam("userPhones") String userPhones) {
if (StringUtils.isBlank(userPhones)) {
......@@ -977,7 +977,7 @@ public class InnerController implements IBaseController {
* @param userPhones
* @return
*/
@LogHttpCaller
@RequestMapping("/uuid/findByPhones")
public JsonResult getUuidsByPhones(@RequestParam("userPhones") String userPhones) {
......@@ -990,7 +990,7 @@ public class InnerController implements IBaseController {
* @author v0.2 jinsong.zhu 2018年05月16日14:22:13
* 保存用户信息,其中地址信息和联系人信息为非必要条件;注意:如果同时提供了province和address字段则需要保证Address的完整
*/
@LogHttpCaller
@RequestMapping("/user/save_multi")
public JsonResult saveMulti(
String registeredFrom,
......@@ -1079,7 +1079,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult(null, userRet);
}
@LogHttpCaller
@RequestMapping("/user/register")
public JsonResult register(String phoneNo, String password, Long channelId) {
if (!ValidationUtil.validatePhoneNo(phoneNo)) {
......@@ -1097,7 +1097,7 @@ public class InnerController implements IBaseController {
}
//根据日期时间段查询新注册用户信息并返回
@LogHttpCaller
@RequestMapping("/contract/queryRegisterUsers")
public JsonResult findRegisterUserByTime(String beginTime, String endTime) {
if (null == beginTime || endTime == null) {
......@@ -1138,7 +1138,7 @@ public class InnerController implements IBaseController {
* @param verificationCode 验证码(短信/语音)
* @return
*/
@LogHttpCaller
@RequestMapping("/verifyPhoneAndCode")
public JsonResult verifyPhoneAndCode(
@RequestParam String phoneNo, @RequestParam String verificationCode,
......@@ -1188,7 +1188,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult("校验成功", new UserRet(user));
}
@LogHttpCaller
@RequestMapping("/login")
public JsonResult login(@RequestParam String phoneNo, @RequestParam String password) {
User user = checkPhoneNoAndPassword(phoneNo, password);
......@@ -1235,7 +1235,7 @@ public class InnerController implements IBaseController {
* @param phoneNo
* @return
*/
@LogHttpCaller
@RequestMapping("/user/enable")
public JsonResult isEnable(String phoneNo) {
boolean flag = false;
......@@ -1258,7 +1258,7 @@ public class InnerController implements IBaseController {
* @param userId
* @return
*/
@LogHttpCaller
@ApiOperation(notes = "激活/启用 用户 - 供内部系统免密调用", value = "激活/启用 用户", nickname = "activeUser")
@RequestMapping(path = "/user/active", method = RequestMethod.POST)
public JsonResult activeUser(Long userId) {
......@@ -1274,7 +1274,7 @@ public class InnerController implements IBaseController {
* @param userId
* @return
*/
@LogHttpCaller
@ApiOperation(notes = "注销/禁用 用户 - 供内部系统免密调用", value = "注销/禁用 用户", nickname = "forbiddenUser")
@RequestMapping(path = "/user/disable", method = RequestMethod.POST)
public JsonResult forbiddenUser(Long userId) {
......@@ -1291,7 +1291,7 @@ public class InnerController implements IBaseController {
* @param idNo - 身份证号
* @param name - 姓名
*/
@LogHttpCaller
@ApiOperation(notes = "重置用户实名信息接口 - 供内部系统免密调用", value = "重置用户实名信息", nickname = "resetName")
@RequestMapping(path = "/userDetail/reset/{userId}", method = RequestMethod.POST)
public JsonResult resetName(@PathVariable("userId") Long userId, @RequestParam("name") String name, @RequestParam("idNo") String idNo) {
......@@ -1315,7 +1315,7 @@ public class InnerController implements IBaseController {
* 重置密码接口
* -- 供内部系统免密调用
*/
@LogHttpCaller
@ApiOperation(notes = "重置密码接口 - 供内部系统免密调用", value = "重置密码", nickname = "resetPassword")
@RequestMapping(path = "/user/password/reset", method = RequestMethod.POST)
public JsonResult resetPassword(@RequestParam("phone") String phone) {
......@@ -1339,7 +1339,7 @@ public class InnerController implements IBaseController {
* 修改实名信息接口
* -- 供内部人员使用(例如绝影)
*/
@LogHttpCaller
@RequestMapping("/updateIdCard")
public JsonResult updateIdCard(@RequestParam(required = false) String name, @RequestParam(required = false) String idNo,
@RequestParam String phoneNo, @RequestParam String reason, @RequestParam String content) {
......@@ -1370,7 +1370,7 @@ public class InnerController implements IBaseController {
* 重置密码接口
* -- 供内部人员使用(例如绝影)
*/
@LogHttpCaller
@RequestMapping("/user/password/reset/{key}/{phone}")
public JsonResult resetPasswordByKey(@PathVariable("key") String key, @PathVariable("phone") String phone) {
log.info("密码重置请求,phone:[{}]", phone);
......@@ -1391,7 +1391,7 @@ public class InnerController implements IBaseController {
* @param content
* @return
*/
@LogHttpCaller
@RequestMapping("/forbiddenUserOrNot")
public JsonResult forbiddenUserOrNot(@RequestParam String phoneNo, @RequestParam Boolean enable,
@RequestParam String reason, @RequestParam String content) {
......@@ -1425,7 +1425,7 @@ public class InnerController implements IBaseController {
* @param content
* @return
*/
@LogHttpCaller
@RequestMapping("/forbiddenUserWeChat")
public JsonResult forbiddenUserWeChat(@RequestParam Long userId, @RequestParam String reason, @RequestParam String content) {
if (StringUtils.isBlank(reason) || null == userId || userId <= 0) {
......
......@@ -83,7 +83,7 @@ public class UserApiController {
* @return
*/
@ApiOperation(notes = "检查token是否有效,如果有效,可选择是否延续生命期(延续后有效期24Hour)", value = "Check token and then prolong session", nickname = "checkToken")
@LogHttpCaller
@IpValidator
@RequestMapping(value = "/valid/{token}", method = RequestMethod.POST)
public JsonResult checkToken(@ApiParam(value = "sid,session的id", required = true) @PathVariable("token") String token,
......
......@@ -24,7 +24,7 @@ import javax.servlet.http.HttpServletRequest;
public class AuthInfoController implements IBaseController {
@LogHttpCaller
@RequestMapping("/info/login")
public JsonResult loginInfo(HttpServletRequest request) {
SessionStruct sessionStruct = getCurrentSessionFromRedis();
......
......@@ -213,7 +213,7 @@ public class SmsController implements IBaseController {
private JsonResult sendVerificationCode2Voice(String phoneNo, String usage) {
String verificationCountKey = Constants.REDIS_VOICE_CODE_COUNT + phoneNo;
Long getVerificationCount = redisTemplate.opsForHash().increment(verificationCountKey, usage.toString(), 1);
Long getVerificationCount = redisTemplate.opsForHash().increment(verificationCountKey, usage, 1);
redisTemplate.expire(verificationCountKey, DateUtils.getSeconds(), TimeUnit.SECONDS);
if (getVerificationCount > 5) {
return JsonResult.buildErrorStateResult("今天已获取5次语音验证码,请使用短信验证码或明天再试", null);
......
......@@ -24,7 +24,7 @@ public class UserAuthorizedController {
@Resource
private IUserAuthorizedService userAuthorizedService;
@LogHttpCaller
@RequestMapping(value = "/hasUserAuthorized")
public JsonResult hasUserAuthorized(String idNo) {
LOGGER.info("[hasUserAuthorized]需要校验的用户的身份证号为idNo:{}", idNo);
......@@ -35,7 +35,7 @@ public class UserAuthorizedController {
}
}
@LogHttpCaller
@RequestMapping(value = "/createUserAuthorized")
public JsonResult createUserAuthorized(UserAuthorizedParam userAuthorizedParam) {
LOGGER.info("[createUserAuthorized]创建实名账户,userAuthorizedParam:{},", userAuthorizedParam);
......@@ -55,7 +55,7 @@ public class UserAuthorizedController {
}
}
@LogHttpCaller
@RequestMapping(value = "/getUserAuthorizedId")
public JsonResult getUserAuthorizedId(String userUuid) {
LOGGER.info("[getUserAuthorizedId]获取实名账户的id,userUuid:{}", userUuid);
......
......@@ -113,7 +113,7 @@ public class UserController implements IBaseController {
return login(channelId, appChannel, createdFrom, userId, key, dimension, request);
}
@LogHttpCaller
@PasswordErrorFiniteValidator
@RequestMapping("/login")
public JsonResult login(
......@@ -328,7 +328,7 @@ public class UserController implements IBaseController {
* @param verificationCode
* @return
*/
@LogHttpCaller
@RequestMapping("/reset_password")
public JsonResult resetPassword(@RequestParam String phoneNo,
@RequestParam String password,
......@@ -364,7 +364,7 @@ public class UserController implements IBaseController {
* @param token - sid,session的id
* @return
*/
@LogHttpCaller
@RequestMapping("/exists_token")
public JsonResult checkToken(@RequestParam String token) {
if (StringUtils.isEmpty(token)) {
......
......@@ -29,9 +29,8 @@ public enum MaritalStatus {
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("MaritalStatus{");
sb.append("description='").append(description).append('\'');
sb.append('}');
return sb.toString();
String sb = "MaritalStatus{" + "description='" + description + '\'' +
'}';
return sb;
}
}
......@@ -27,10 +27,6 @@ public enum OccupationEnum {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return name;
......
......@@ -25,15 +25,10 @@ public enum Relation {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("Relation{");
sb.append("description='").append(description).append('\'');
sb.append('}');
return sb.toString();
String sb = "Relation{" + "description='" + description + '\'' +
'}';
return sb;
}
}
......@@ -429,13 +429,13 @@ public class GeetestLib {
* @time 2014年7月10日 下午3:30:01
*/
private String md5Encode(String plainText) {
String re_md5 = new String();
String re_md5 = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(plainText.getBytes());
byte b[] = md.digest();
int i;
StringBuilder buf = new StringBuilder("");
StringBuilder buf = new StringBuilder();
for (int offset = 0; offset < b.length; offset++) {
i = b[offset];
if (i < 0) {
......
......@@ -3,7 +3,6 @@ package cn.quantgroup.xyqb.service.http.impl;
import cn.quantgroup.tech.brave.service.ITechHttpClient;
import cn.quantgroup.xyqb.service.http.IHttpService;
import cn.quantgroup.xyqb.util.Utils;
import com.google.common.base.Predicates;
import com.google.common.collect.Maps;
import org.apache.commons.codec.Charsets;
import org.apache.commons.collections.MapUtils;
......@@ -29,7 +28,6 @@ import org.apache.http.conn.ssl.SSLContextBuilder;
import org.apache.http.cookie.Cookie;
import org.apache.http.cookie.CookieOrigin;
import org.apache.http.cookie.CookieSpecProvider;
import org.apache.http.cookie.MalformedCookieException;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy;
import org.apache.http.impl.client.StandardHttpRequestRetryHandler;
......@@ -211,7 +209,7 @@ public class HttpServiceImpl implements IHttpService {
*/
private void setParameter(RequestBuilder requestBuilder, Map<String, String> parameters, String method) {
if (MapUtils.isNotEmpty(parameters)) {
parameters = Maps.filterValues(parameters, Predicates.notNull());
parameters = Maps.filterValues(parameters, s -> s != null);
Set<Map.Entry<String, String>> entrys = parameters.entrySet();
/************** Get 请求 **************/
......@@ -244,7 +242,7 @@ public class HttpServiceImpl implements IHttpService {
.setHeader("Connection", "keep-alive");
if (MapUtils.isNotEmpty(headers)) {
headers = Maps.filterValues(headers, Predicates.notNull());
headers = Maps.filterValues(headers, s -> s != null);
Set<Map.Entry<String, String>> entrys = headers.entrySet();
for (Map.Entry<String, String> entry : entrys) {
......
......@@ -118,9 +118,7 @@ public class UserDetailServiceImpl implements IUserDetailService {
private Specification<UserDetail> getSpecification(String name, String phoneNo, String idNo) {
List<Predicate> list = new ArrayList<>();
Specification<UserDetail> specification = new Specification<UserDetail>() {
@Override
public Predicate toPredicate(Root<UserDetail> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
Specification<UserDetail> specification = (root, criteriaQuery, criteriaBuilder) -> {
if (!StringUtils.isEmpty(name)) {
list.add(criteriaBuilder.equal(root.get("name").as(String.class), name));
}
......@@ -132,7 +130,6 @@ public class UserDetailServiceImpl implements IUserDetailService {
}
Predicate[] p = new Predicate[list.size()];
return criteriaBuilder.and(list.toArray(p));
}
};
return specification;
}
......@@ -148,9 +145,7 @@ public class UserDetailServiceImpl implements IUserDetailService {
private Specification<UserDetail> valueInSpecification(List<Long> userId, List<String> phoneNo, List<String> idNo) {
List<Predicate> list = new ArrayList<>();
Specification<UserDetail> specification = new Specification<UserDetail>() {
@Override
public Predicate toPredicate(Root<UserDetail> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
Specification<UserDetail> specification = (root, criteriaQuery, criteriaBuilder) -> {
if (userId != null && userId.size() > 0) {
criteriaQuery.where(root.get("userId").in(userId));
list.add(criteriaQuery.getRestriction());
......@@ -165,7 +160,6 @@ public class UserDetailServiceImpl implements IUserDetailService {
}
Predicate[] p = new Predicate[list.size()];
return criteriaBuilder.and(list.toArray(p));
}
};
return specification;
}
......
......@@ -133,9 +133,7 @@ public class ValidationUtil {
public static String getMd5Key(boolean lock) {
Calendar today = Calendar.getInstance();
int hour_24 = today.get(Calendar.HOUR_OF_DAY);
StringBuilder _key = new StringBuilder();
_key.append(Constants.CLEAR_LOCK_FOR_IPV4_KEY).append(lock).append(hour_24);
return MD5Util.build(_key.toString());
return MD5Util.build(Constants.CLEAR_LOCK_FOR_IPV4_KEY + lock + hour_24);
}
}
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