Commit d26ae2d7 by tyfanchz

Merge remote-tracking branch 'origin/dev' into dev

2 parents bc92bb0a b97e7478
package com.glsx.shop.api.controller.system; package com.glsx.shop.api.controller.system;
import javax.validation.Valid;
import java.util.List;
import com.glsx.shop.bean.constant.Const; import com.glsx.shop.bean.constant.Const;
import com.glsx.shop.bean.constant.factory.PageFactory; import com.glsx.shop.bean.constant.factory.PageFactory;
import com.glsx.shop.bean.constant.state.ManagerStatus; import com.glsx.shop.bean.constant.state.ManagerStatus;
import com.glsx.shop.bean.core.BusinessLog; import com.glsx.shop.bean.core.BusinessLog;
import com.glsx.shop.bean.dto.UserDto; import com.glsx.shop.bean.dto.UserDTO;
import com.glsx.shop.bean.entity.system.User; import com.glsx.shop.bean.entity.system.User;
import com.glsx.shop.bean.enumeration.Permission; import com.glsx.shop.bean.enumeration.Permission;
import com.glsx.shop.bean.exception.ApplicationException; import com.glsx.shop.bean.exception.ApplicationException;
...@@ -31,6 +29,9 @@ import org.springframework.web.bind.annotation.RequestMethod; ...@@ -31,6 +29,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.List;
/** /**
* UserController * UserController
* *
...@@ -64,7 +65,7 @@ public class UserController extends BaseController { ...@@ -64,7 +65,7 @@ public class UserController extends BaseController {
@RequestMapping(method = RequestMethod.POST) @RequestMapping(method = RequestMethod.POST)
@BusinessLog(value = "编辑管理员", key = "name") @BusinessLog(value = "编辑管理员", key = "name")
@RequiresPermissions(value = {Permission.USER_EDIT}) @RequiresPermissions(value = {Permission.USER_EDIT})
public Object save(@Valid UserDto user, BindingResult result) { public Object save(@Valid UserDTO user, BindingResult result) {
if (user.getId() == null) { if (user.getId() == null) {
// 判断账号是否重复 // 判断账号是否重复
User theUser = managerService.findByAccount(user.getAccount()); User theUser = managerService.findByAccount(user.getAccount());
......
package com.glsx.shop.bean.dto;
import lombok.Data;
/**
* @author think.wang
* @version 1.0.0
* @Title AppUserDTO
* @Package com.glsx.shop.bean.dto
* @Description APP传过来参数
* @date 2020/12/21
*/
@Data
public class AppUserDTO {
private String contactNumber;
private String channel;
private Integer appAccountId;
private String nickname;
private String wechatId;
private Integer province;
private Integer city;
}
...@@ -13,7 +13,7 @@ import java.util.Date; ...@@ -13,7 +13,7 @@ import java.util.Date;
* @Date 2017/5/5 22:40 * @Date 2017/5/5 22:40
*/ */
@Data @Data
public class UserDto { public class UserDTO {
private Long id; private Long id;
......
...@@ -48,10 +48,8 @@ public class PlatformCustomer implements Serializable { ...@@ -48,10 +48,8 @@ public class PlatformCustomer implements Serializable {
private String address; private String address;
@Column(columnDefinition = "TINYINT(11) COMMENT '账号状态 0 停用 1 正常 2 待审核 3 审核未通过'") @Column(columnDefinition = "TINYINT(11) COMMENT '账号状态 0 停用 1 正常 2 待审核 3 审核未通过'")
private Integer status; private Integer status;
@Column(columnDefinition = "VARCHAR(256) COMMENT '公钥'") @Column(columnDefinition = "INT(11) COMMENT '秘钥 t_platform_secretkey的id'")
private String publicKey; private Integer keyId;
@Column(columnDefinition = "VARCHAR(256) COMMENT '私钥'")
private String privateKey;
@Column(columnDefinition = "VARCHAR(32) COMMENT '渠道号'") @Column(columnDefinition = "VARCHAR(32) COMMENT '渠道号'")
private String channelNumber; private String channelNumber;
@Column(columnDefinition = "INT(11) COMMENT '创建人'") @Column(columnDefinition = "INT(11) COMMENT '创建人'")
......
package com.glsx.shop.core.factory; package com.glsx.shop.core.factory;
import com.glsx.shop.bean.dto.UserDto; import com.glsx.shop.bean.dto.UserDTO;
import com.glsx.shop.bean.entity.system.User; import com.glsx.shop.bean.entity.system.User;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -12,7 +12,7 @@ import org.springframework.beans.BeanUtils; ...@@ -12,7 +12,7 @@ import org.springframework.beans.BeanUtils;
*/ */
public class UserFactory { public class UserFactory {
public static User createUser(UserDto userDto, User user) { public static User createUser(UserDTO userDto, User user) {
if (userDto == null) { if (userDto == null) {
return null; return null;
} else { } else {
...@@ -21,7 +21,7 @@ public class UserFactory { ...@@ -21,7 +21,7 @@ public class UserFactory {
} }
} }
public static User updateUser(UserDto userDto, User user) { public static User updateUser(UserDTO userDto, User user) {
if (userDto == null) { if (userDto == null) {
return null; return null;
} else { } else {
......
/**
* @author glsx
* @date :Created in 11/5/2019 7:45 PM
*/
package com.glsx.shop.web;
...@@ -86,6 +86,14 @@ ...@@ -86,6 +86,14 @@
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
......
...@@ -2,6 +2,7 @@ package com.glsx.shop.mobile.controller; ...@@ -2,6 +2,7 @@ package com.glsx.shop.mobile.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.glsx.shop.bean.dto.AppUserDTO;
import com.glsx.shop.bean.entity.shop.PlatformCustomer; import com.glsx.shop.bean.entity.shop.PlatformCustomer;
import com.glsx.shop.bean.entity.shop.PlatformUser; import com.glsx.shop.bean.entity.shop.PlatformUser;
import com.glsx.shop.bean.exception.ApplicationExceptionEnum; import com.glsx.shop.bean.exception.ApplicationExceptionEnum;
...@@ -15,11 +16,12 @@ import com.glsx.shop.utils.HttpUtils; ...@@ -15,11 +16,12 @@ import com.glsx.shop.utils.HttpUtils;
import com.glsx.shop.utils.StringUtil; import com.glsx.shop.utils.StringUtil;
import com.glsx.shop.web.controller.BaseController; import com.glsx.shop.web.controller.BaseController;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.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.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Date; import java.util.Date;
...@@ -50,23 +52,24 @@ public class AppLoginController extends BaseController { ...@@ -50,23 +52,24 @@ public class AppLoginController extends BaseController {
@Autowired @Autowired
private PlatformCustomerService customerService; private PlatformCustomerService customerService;
@RequestMapping(value = "/loginOrRegister", method = RequestMethod.POST) @RequestMapping(value = "/loginOrRegister", method = {RequestMethod.POST, RequestMethod.GET})
public Object loginOrRegister(@RequestParam String mobile, @RequestParam String channel) { public Object loginOrRegister(@RequestBody AppUserDTO userDTO) {
if(StringUtil.isEmpty(mobile) || StringUtil.isEmpty(channel)){ if(StringUtil.isEmpty(userDTO.getContactNumber()) || StringUtil.isEmpty(userDTO.getChannel())){
return Rets.failure(ApplicationExceptionEnum.PARAM_IS_EMPTY); return Rets.failure(ApplicationExceptionEnum.PARAM_IS_EMPTY);
} }
Map<String, Object> result = new HashMap<>(4); Map<String, Object> result = new HashMap<>(4);
PlatformCustomer customer = customerService.findByChannelNumber(channel); PlatformCustomer customer = customerService.findByChannelNumber(userDTO.getChannel());
if(customer == null){ if(customer == null){
return Rets.failure(ApplicationExceptionEnum.PARAM_ERROR); return Rets.failure(ApplicationExceptionEnum.PARAM_ERROR);
} }
JwtUser jwtUser = new JwtUser(); //JWT用户信息封装 JwtUser jwtUser = new JwtUser(); //JWT用户信息封装
Date now =new Date(); Date now =new Date();
PlatformUser user = platformUserService.findByContactNumber(mobile); PlatformUser user = platformUserService.findByContactNumber(userDTO.getContactNumber());
if(user != null){ if(user != null){
result.put("tuYaId", user.getTuYaId()); result.put("tuYaId", user.getTuYaId());
jwtUser.setId(user.getId()); jwtUser.setId(user.getId());
jwtUser.setUserName(user.getNickname()); jwtUser.setUserName(user.getNickname());
BeanUtils.copyProperties(userDTO, user);
user.setLastLoginTime(now); user.setLastLoginTime(now);
if(user.getStatus().equals(0)){ //注销用户重新注册 if(user.getStatus().equals(0)){ //注销用户重新注册
user.setStatus(1); //用户正常 user.setStatus(1); //用户正常
...@@ -76,19 +79,20 @@ public class AppLoginController extends BaseController { ...@@ -76,19 +79,20 @@ public class AppLoginController extends BaseController {
platformUserService.update(user); platformUserService.update(user);
}else{ //用户首次注册 }else{ //用户首次注册
PlatformUser pUser = new PlatformUser(); PlatformUser pUser = new PlatformUser();
pUser.setContactNumber(mobile); BeanUtils.copyProperties(userDTO, pUser);
pUser.setCustomerId(customer.getId().intValue()); pUser.setCustomerId(customer.getId().intValue());
pUser.setCreateTime(now); pUser.setCreateTime(now);
pUser.setCreateBy(-1); pUser.setCreateBy(-1);
pUser.setStatus(1); //默认用户正常
pUser.setLastLoginTime(now); pUser.setLastLoginTime(now);
Integer tuYaId = this.syncUser(mobile); //同步用户到涂鸦 Integer tuYaId = this.syncUser(userDTO.getContactNumber()); //同步用户到涂鸦
pUser.setTuYaId(tuYaId); pUser.setTuYaId(tuYaId);
PlatformUser returnUser = platformUserService.insert(pUser); PlatformUser returnUser = platformUserService.insert(pUser);
jwtUser.setId(returnUser.getId()); jwtUser.setId(returnUser.getId());
result.put("tuYaId", tuYaId); result.put("tuYaId", tuYaId);
} }
//JWT信息缓存 //JWT信息缓存
jwtUser.setPassword(channel); jwtUser.setPassword(userDTO.getChannel());
String token = userService.loginForToken(jwtUser); String token = userService.loginForToken(jwtUser);
result.put("token", token); result.put("token", token);
return Rets.success(result); return Rets.success(result);
......
...@@ -15,3 +15,16 @@ wx.notify-url=http://linjiashop.microapp.store/pay/wx/notify ...@@ -15,3 +15,16 @@ wx.notify-url=http://linjiashop.microapp.store/pay/wx/notify
# \u5546\u6237\u8BC1\u4E66\u6587\u4EF6\u8DEF\u5F84 # \u5546\u6237\u8BC1\u4E66\u6587\u4EF6\u8DEF\u5F84
wx.key-path=xxxxx wx.key-path=xxxxx
#server.servlet.context-path=/api #server.servlet.context-path=/api
# FastDFS Configuration
fdfs.so-timeout=1500
fdfs.connect-timeout=600
fdfs.thumb-image.height=150
fdfs.thumb-image.width=150
fdfs.pool.max-total=100
fdfs.pool.max-wait-millis=500
fdfs.tracker-list=192.168.3.222:22122
fdfs_tracker_nginx_domain=http://qcimg01.glsx.net:7060
#fdfs_tracker_nginx_port=80
#\u6D82\u9E26\u540C\u6B65\u7528\u6237\u63A5\u53E3
tu_ya_sync_interface=http://192.168.3.137:8091/smartApi/sync_user
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!