微信登陆

This commit is contained in:
ly19960718 2021-01-26 16:31:44 +08:00
parent b9826e235c
commit 73c33b2c89
16 changed files with 1382 additions and 2 deletions

14
pom.xml
View File

@ -67,6 +67,20 @@
<artifactId>pagehelper</artifactId>
<version>${pagehelper.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.73</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.5</version>
</dependency>
</dependencies>
<build>

View File

@ -2,8 +2,10 @@ package cn.com.tenlion.businesscard;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@ComponentScan("cn.com")
public class BusinessCardApplication {
public static void main(String[] args) {

View File

@ -0,0 +1,105 @@
package cn.com.tenlion.controller.apis.carduser;
import cn.com.tenlion.pojo.dtos.carduser.CardUserDTO;
import cn.com.tenlion.pojo.vos.carduser.CardUserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.AbstractController;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @ClassName: CardUserController
* @Description: 用户表
* @Author: WenG
* @Date: 2021-01-26 10:55
* @Version: 1.0
**/
@RestController
@RequestMapping("/carduser")
public class CardUserController {
/*
@Autowired
private ICardUserService cardUserService;*/
/*
@ApiOperation(value = "新增用户表", notes = "新增用户表接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("savecarduser")
@CheckRequestBodyAnnotation
public SuccessResult saveCardUser(@RequestBody CardUserVO cardUserVO) throws Exception {
return cardUserService.saveCardUser(cardUserVO);
}
@ApiOperation(value = "删除用户表(id列表)", notes = "删除用户表(id列表)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "ID列表用下划线分隔", paramType = "path", example = "1_2_3")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@DeleteMapping("removecarduser/{ids}")
public SuccessResult removeCardUser(@PathVariable("ids") String ids) throws RemoveException {
return cardUserService.removeCardUser(ids);
}
@ApiOperation(value = "修改用户表", notes = "修改用户表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "cardUserId", value = "用户表ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("updatecarduser/{cardUserId}")
@CheckRequestBodyAnnotation
public SuccessResult updateCardUser(@PathVariable("cardUserId") String cardUserId, @RequestBody CardUserVO cardUserVO) throws Exception {
return cardUserService.updateCardUser(cardUserId, cardUserVO);
}
@ApiOperation(value = "用户表详情(通过ID)", notes = "用户表详情(通过ID)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "cardUserId", value = "用户表ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getcarduserbyid/{cardUserId}")
public CardUserDTO getCardUserById(@PathVariable("cardUserId") String cardUserId) throws SearchException {
return cardUserService.getCardUserById(cardUserId);
}
@ApiOperation(value = "用户表列表", notes = "用户表列表接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listcarduser")
public List<CardUserDTO> listCardUser() throws SearchException {
Map<String, Object> params = requestParams();
return cardUserService.listCardUser(params);
}
@ApiOperation(value = "用户表分页列表", notes = "用户表分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagecarduser")
public SuccessResultList<List<CardUserDTO>> listPageCardUser(ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
page.setParams(params);
return cardUserService.listPageCardUser(page);
}
@ApiOperation(value = "用户表统计", notes = "用户表统计接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("countcarduser")
SuccessResultData<Integer> countCardUser() throws SearchException {
Map<String, Object> params = requestParams();
return cardUserService.countCardUser(params);
}
@ApiOperation(value = "当前用户id信息", notes = "当前用户id信息接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getcurrentuseridinfo")
public CurrentUserIdInfoDTO getCurrentUserIdInfo() {
return securityComponent.getCurrentUserIdInfo();
}*/
}

View File

@ -0,0 +1,113 @@
/*
package cn.com.tenlion.controller.app.apis.carduser;
import cn.com.tenlion.pojo.dtos.carduser.CardUserDTO;
import cn.com.tenlion.pojo.vos.carduser.CardUserVO;
import cn.com.tenlion.service.carduser.ICardUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.AbstractController;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
*/
/**
* @ClassName: CardUserAppController
* @Description: 用户表
* @Author: WenG
* @Date: 2021-01-26 10:55
* @Version: 1.0
**//*
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "用户表接口")
@RestController
@RequestMapping(ISystemConstant.APP_PREFIX + "/carduser")
public class CardUserAppController extends AbstractController {
@Autowired
private ICardUserService cardUserService;
@ApiOperation(value = "新增用户表", notes = "新增用户表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("savecarduser")
@CheckRequestBodyAnnotation
public SuccessResult saveCardUser(@RequestHeader("token") String token, @RequestBody CardUserVO cardUserVO) throws Exception {
return cardUserService.saveCardUserByToken(token, cardUserVO);
}
@ApiOperation(value = "删除用户表(id列表)", notes = "删除用户表(id列表)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "ids", value = "ID列表用下划线分隔", paramType = "path", example = "1_2_3")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@DeleteMapping("removecarduser/{ids}")
public SuccessResult removeCardUser(@RequestHeader("token") String token, @PathVariable("ids") String ids) throws RemoveException {
return cardUserService.removeCardUserByToken(token, ids);
}
@ApiOperation(value = "修改用户表", notes = "修改用户表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "cardUserId", value = "用户表ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("updatecarduser/{cardUserId}")
@CheckRequestBodyAnnotation
public SuccessResult updateCardUser(@RequestHeader("token") String token, @PathVariable("cardUserId") String cardUserId, @RequestBody CardUserVO cardUserVO) throws Exception {
return cardUserService.updateCardUserByToken(token, cardUserId, cardUserVO);
}
@ApiOperation(value = "用户表详情(通过ID)", notes = "用户表详情(通过ID)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "cardUserId", value = "用户表ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getcarduserbyid/{cardUserId}")
public CardUserDTO getCardUserById(@RequestHeader("token") String token, @PathVariable("cardUserId") String cardUserId) throws SearchException {
return cardUserService.getCardUserById(cardUserId);
}
@ApiOperation(value = "用户表列表", notes = "用户表列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listcarduser")
public List<CardUserDTO> listCardUser(@RequestHeader("token") String token) throws SearchException {
Map<String, Object> params = requestParams();
return cardUserService.listCardUser(params);
}
@ApiOperation(value = "用户表分页列表", notes = "用户表分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagecarduser")
public SuccessResultList<List<CardUserDTO>> listPageCardUser(@RequestHeader("token") String token, ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
page.setParams(params);
return cardUserService.listPageCardUser(page);
}
@ApiOperation(value = "用户表统计", notes = "用户表统计接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("countcarduser")
SuccessResultData<Integer> countCardUser() throws SearchException {
Map<String, Object> params = requestParams();
return cardUserService.countCardUser(params);
}
}*/

View File

@ -0,0 +1,40 @@
package cn.com.tenlion.controller.app.apis.weixinlogin;
import cn.com.tenlion.service.weixinlogin.IWeiXinLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 微信登录
* @version 1.0
* @author LY
* @date 2021/1/26 11:08
*/
@RestController
@RequestMapping("/weixinapplogin")
public class WeiXinLoginAppController {
@Autowired
private IWeiXinLoginService weiXinLoginService;
/**
* 小程序登录
* @return
* @throws Exception
*/
@GetMapping("weiXinLoginBySmallRoutine/{vxCode}")
public String weiXinLoginBySmallRoutine (@PathVariable("vxCode") String vxCode) throws Exception{
return weiXinLoginService.weiXinLoginBySmallRoutine(vxCode);
}
}

View File

@ -0,0 +1,114 @@
/*
package cn.com.tenlion.controller.resources.carduser;
import cn.com.tenlion.pojo.dtos.carduser.CardUserDTO;
import cn.com.tenlion.pojo.vos.carduser.CardUserVO;
import cn.com.tenlion.service.carduser.ICardUserService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
*/
/**
* @ClassName: CardUserResourceController
* @Description: 用户表
* @Author: WenG
* @Date: 2021-01-26 10:55
* @Version: 1.0
**//*
@Api(tags = ISystemConstant.API_TAGS_RESOURCE_PREFIX + "用户表接口")
@RestController
@RequestMapping(ISystemConstant.RESOURCE_PREFIX + "/carduser")
public class CardUserResourceController extends AbstractController {
@Autowired
private ICardUserService cardUserService;
@ApiOperation(value = "新增用户表", notes = "新增用户表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("savecarduser")
@CheckRequestBodyAnnotation
public SuccessResult saveCardUser(@RequestBody CardUserVO cardUserVO) throws Exception {
return cardUserService.saveCardUser(cardUserVO);
}
@ApiOperation(value = "删除用户表(id列表)", notes = "删除用户表(id列表)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
@ApiImplicitParam(name = "ids", value = "ID列表用下划线分隔", paramType = "path", example = "1_2_3")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@DeleteMapping("removecarduser/{ids}")
public SuccessResult removeCardUser(@PathVariable("ids") String ids) throws RemoveException {
return cardUserService.removeCardUser(ids);
}
@ApiOperation(value = "修改用户表", notes = "修改用户表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
@ApiImplicitParam(name = "cardUserId", value = "用户表ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("updatecarduser/{cardUserId}")
@CheckRequestBodyAnnotation
public SuccessResult updateCardUser(@PathVariable("cardUserId") String cardUserId, @RequestBody CardUserVO cardUserVO) throws Exception {
return cardUserService.updateCardUser(cardUserId, cardUserVO);
}
@ApiOperation(value = "用户表详情(通过ID)", notes = "用户表详情(通过ID)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
@ApiImplicitParam(name = "cardUserId", value = "用户表ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getcarduserbyid/{cardUserId}")
public CardUserDTO getCardUserById(@PathVariable("cardUserId") String cardUserId) throws SearchException {
return cardUserService.getCardUserById(cardUserId);
}
@ApiOperation(value = "用户表列表", notes = "用户表列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listcarduser")
public List<CardUserDTO> listCardUser() throws SearchException {
Map<String, Object> params = requestParams();
return cardUserService.listCardUser(params);
}
@ApiOperation(value = "用户表分页列表", notes = "用户表分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagecarduser")
public SuccessResultList<List<CardUserDTO>> listPageCardUser(ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
page.setParams(params);
return cardUserService.listPageCardUser(page);
}
@ApiOperation(value = "用户表统计", notes = "用户表统计接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("countcarduser")
SuccessResultData<Integer> countCardUser() throws SearchException {
Map<String, Object> params = requestParams();
return cardUserService.countCardUser(params);
}
}*/

View File

@ -0,0 +1,79 @@
package cn.com.tenlion.dao.carduser;
import cn.com.tenlion.pojo.dtos.carduser.CardUserDTO;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* @ClassName: ICardUserDao
* @Description: 用户表
* @Author: WenG
* @Date: 2021-01-26 10:55
* @Version: 1.0
**/
@Repository
public interface ICardUserDao {
/**
* 新增用户表
*
* @param params
* @throws Exception
*/
void saveCardUser(Map<String, Object> params) throws Exception;
/**
* 删除用户表
*
* @param params
* @throws Exception
*/
void removeCardUser(Map<String, Object> params) throws Exception;
/**
* 删除用户表物理
*
* @param params
* @throws Exception
*/
void deleteCardUser(Map<String, Object> params) throws Exception;
/**
* 修改用户表
*
* @param params
* @throws Exception
*/
void updateCardUser(Map<String, Object> params) throws Exception;
/**
* 用户表详情
*
* @param params
* @return
* @throws Exception
*/
CardUserDTO getCardUser(Map<String, Object> params) throws Exception;
/**
* 用户表列表
*
* @param params
* @return
* @throws Exception
*/
List<CardUserDTO> listCardUser(Map<String, Object> params) throws Exception;
/**
* 用户表统计
*
* @param params
* @return
* @throws Exception
*/
Integer countCardUser(Map<String, Object> params) throws Exception;
}

View File

@ -0,0 +1,76 @@
package cn.com.tenlion.pojo.dtos.carduser;
/**
*
* @ClassName: CardUserDTO
* @Description: 用户表
* @Author: WenG
* @Date: 2021-01-26 10:55
* @Version: 1.0
**/
public class CardUserDTO {
/**
* 主键
*/
private String cardUserId;
/**
* 用户姓名
*/
private String userName;
/**
* 用户手机
*/
private String userPhone;
/**
* 用户开放平台唯一标识
*/
private String VxUnionId;
/**
* 微信用户唯一标识
*/
private String VxOpenId;
public String getCardUserId() {
return cardUserId == null ? "" : cardUserId.trim();
}
public void setCardUserId(String cardUserId) {
this.cardUserId = cardUserId;
}
public String getUserName() {
return userName == null ? "" : userName.trim();
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserPhone() {
return userPhone == null ? "" : userPhone.trim();
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
}
public String getVxUnionId() {
return VxUnionId == null ? "" : VxUnionId.trim();
}
public void setVxUnionId(String VxUnionId) {
this.VxUnionId = VxUnionId;
}
public String getVxOpenId() {
return VxOpenId == null ? "" : VxOpenId.trim();
}
public void setVxOpenId(String VxOpenId) {
this.VxOpenId = VxOpenId;
}
}

View File

@ -0,0 +1,64 @@
package cn.com.tenlion.pojo.vos.carduser;
/**
*
* @ClassName: CardUserVO
* @Description: 用户表
* @Author: WenG
* @Date: 2021-01-26 10:55
* @Version: 1.0
**/
public class CardUserVO {
/**
* 用户姓名
*/
private String userName;
/**
* 用户手机
*/
private String userPhone;
/**
* 用户开放平台唯一标识
*/
private String VxUnionId;
/**
* 微信用户唯一标识
*/
private String VxOpenId;
public String getUserName() {
return userName == null ? "" : userName.trim();
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserPhone() {
return userPhone == null ? "" : userPhone.trim();
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
}
public String getVxUnionId() {
return VxUnionId == null ? "" : VxUnionId.trim();
}
public void setVxUnionId(String VxUnionId) {
this.VxUnionId = VxUnionId;
}
public String getVxOpenId() {
return VxOpenId == null ? "" : VxOpenId.trim();
}
public void setVxOpenId(String VxOpenId) {
this.VxOpenId = VxOpenId;
}
}

View File

@ -0,0 +1,187 @@
/*
package cn.com.tenlion.service.carduser;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import cn.com.tenlion.pojo.dtos.carduser.CardUserDTO;
import cn.com.tenlion.pojo.vos.carduser.CardUserVO;
import java.util.List;
import java.util.Map;
*/
/**
* @ClassName: ICardUserService
* @Description: 用户表
* @Author: WenG
* @Date: 2021-01-26 10:55
* @Version: 1.0
**//*
public interface ICardUserService {
*/
/**
* 新增用户表
*
* @param cardUserVO
* @return
* @throws Exception
*//*
SuccessResult saveCardUser(CardUserVO cardUserVO) throws Exception;
*/
/**
* 新增用户表(APP)
*
* @param token
* @param cardUserVO
* @return
* @throws Exception
*//*
SuccessResult saveCardUserByToken(String token, CardUserVO cardUserVO) throws Exception;
*/
/**
* 新增用户表
*
* @param cardUserVO
* @return cardUserId
* @throws Exception
*//*
String saveCardUserReturnId(CardUserVO cardUserVO) throws Exception;
*/
/**
* 新增用户表(APP)
*
* @param token
* @param cardUserVO
* @return cardUserId
* @throws Exception
*//*
String saveCardUserByTokenReturnId(String token, CardUserVO cardUserVO) throws Exception;
*/
/**
* 删除用户表
*
* @param ids
* @return
* @throws RemoveException
*//*
SuccessResult removeCardUser(String ids) throws RemoveException;
*/
/**
* 删除用户表物理删除
*
* @param ids
* @throws RemoveException
*//*
void deleteCardUser(String ids) throws RemoveException;
*/
/**
* 删除用户表(APP)
*
* @param token
* @param ids
* @return
* @throws RemoveException
*//*
SuccessResult removeCardUserByToken(String token, String ids) throws RemoveException;
*/
/**
* 修改用户表
*
* @param cardUserId
* @param cardUserVO
* @return
* @throws Exception
*//*
SuccessResult updateCardUser(String cardUserId, CardUserVO cardUserVO) throws Exception;
*/
/**
* 修改用户表(APP)
*
* @param token
* @param cardUserId
* @param cardUserVO
* @return
* @throws Exception
*//*
SuccessResult updateCardUserByToken(String token, String cardUserId, CardUserVO cardUserVO) throws Exception;
*/
/**
* 用户表详情(通过ID)
*
* @param cardUserId
* @return
* @throws SearchException
*//*
CardUserDTO getCardUserById(String cardUserId) throws SearchException;
*/
/**
* 用户表列表
*
* @param params
* @return
* @throws SearchException
*//*
List<CardUserDTO> listCardUser(Map<String, Object> params) throws SearchException;
*/
/**
* 用户表分页列表
*
* @param page
* @return
* @throws SearchException
*//*
SuccessResultList<List<CardUserDTO>> listPageCardUser(ListPage page) throws SearchException;
*/
/**
* 用户表统计
*
* @param params
* @return
* @throws SearchException
*//*
Integer countNumberCardUser(Map<String, Object> params) throws SearchException;
*/
/**
* 用户表统计
*
* @param params
* @return
* @throws SearchException
*//*
SuccessResultData<Integer> countCardUser(Map<String, Object> params) throws SearchException;
}*/

View File

@ -0,0 +1,197 @@
/*
package cn.com.tenlion.service.carduser.impl;
import cn.com.tenlion.dao.carduser.ICardUserDao;
import cn.com.tenlion.service.carduser.ICardUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
*/
/**
* @ClassName: CardUserServiceImpl
* @Description: 用户表
* @Author: WenG
* @Date: 2021-01-26 10:55
* @Version: 1.0
**//*
@Service
public class CardUserServiceImpl implements ICardUserService {
@Autowired
private ICardUserDao cardUserDao;
*/
/* @Override
public SuccessResult saveCardUser(CardUserVO cardUserVO) throws Exception {
saveCardUserInfo(null, cardUserVO);
return new SuccessResult();
}
@Override
public SuccessResult saveCardUserByToken(String token, CardUserVO cardUserVO) throws Exception {
saveCardUserInfo(token, cardUserVO);
return new SuccessResult();
}
@Override
public String saveCardUserReturnId(CardUserVO cardUserVO) throws Exception {
return saveCardUserInfoReturnId(null, cardUserVO);
}
@Override
public String saveCardUserByTokenReturnId(String token, CardUserVO cardUserVO) throws Exception {
return saveCardUserInfoReturnId(token, cardUserVO);
}
*//*
*/
/**
* 新增用户表
*
* @param token
* @param cardUserVO
* @throws Exception
*//*
*/
/*
private void saveCardUserInfo(String token, CardUserVO cardUserVO) throws Exception {
saveCardUserInfoReturnId(token, cardUserVO);
}
*//*
*/
/**
* 新增用户表
*
* @param token
* @param cardUserVO
* @return cardUserId
* @throws Exception
*//*
*/
/*
private String saveCardUserInfoReturnId(String token, CardUserVO cardUserVO) throws Exception {
String cardUserId = UUIDUtil.getUUID();
Map<String, Object> params = HashMapUtil.beanToMap(cardUserVO);
params.put("cardUserId", cardUserId);
if (token != null) {
setSaveInfo(token, params);
} else {
setSaveInfo(params);
}
cardUserDao.saveCardUser(params);
return cardUserId;
}
@Override
public SuccessResult removeCardUser(String ids) throws RemoveException {
removeCardUserInfo(null, ids);
return new SuccessResult();
}
@Override
public SuccessResult removeCardUserByToken(String token, String ids) throws RemoveException {
removeCardUserInfo(token, ids);
return new SuccessResult();
}
*//*
*/
/**
* 删除用户表
*
* @param token
* @param ids
*//*
*/
/*
private void removeCardUserInfo(String token, String ids) {
Map<String, Object> params = getHashMap(3);
params.put("cardUserIds", Arrays.asList(ids.split("_")));
if (token != null) {
setUpdateInfo(token, params);
} else {
setUpdateInfo(params);
}
cardUserDao.removeCardUser(params);
}
@Override
public void deleteCardUser(String ids) throws RemoveException {
Map<String, Object> params = getHashMap(3);
params.put("cardUserIds", Arrays.asList(ids.split("_")));
cardUserDao.deleteCardUser(params);
}
@Override
public SuccessResult updateCardUser(String cardUserId, CardUserVO cardUserVO) throws Exception {
updateCardUserInfo(null, cardUserId, cardUserVO);
return new SuccessResult();
}
@Override
public SuccessResult updateCardUserByToken(String token, String cardUserId, CardUserVO cardUserVO) throws Exception {
updateCardUserInfo(token, cardUserId, cardUserVO);
return new SuccessResult();
}
*//*
*/
/**
* 修改用户表
*
* @param token
* @param cardUserId
* @param cardUserVO
*//*
*/
/*
private void updateCardUserInfo(String token, String cardUserId, CardUserVO cardUserVO) throws Exception {
Map<String, Object> params = HashMapUtil.beanToMap(cardUserVO);
params.put("cardUserId", cardUserId);
if (token != null) {
setUpdateInfo(token, params);
} else {
setUpdateInfo(params);
}
cardUserDao.updateCardUser(params);
}
@Override
public CardUserDTO getCardUserById(String cardUserId) throws SearchException {
Map<String, Object> params = super.getHashMap(1);
params.put("cardUserId", cardUserId);
return cardUserDao.getCardUser(params);
}
@Override
public List<CardUserDTO> listCardUser(Map<String, Object> params) throws SearchException {
return cardUserDao.listCardUser(params);
}
@Override
public SuccessResultList<List<CardUserDTO>> listPageCardUser(ListPage page) throws SearchException {
PageHelper.startPage(page.getPage(), page.getRows());
List<CardUserDTO> cardUserDTOs = cardUserDao.listCardUser(page.getParams());
PageInfo<CardUserDTO> pageInfo = new PageInfo<>(cardUserDTOs);
return new SuccessResultList<>(cardUserDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
@Override
public Integer countNumberCardUser(Map<String, Object> params) throws SearchException {
Integer count = cardUserDao.countCardUser(params);
return count == null ? 0 : count;
}
@Override
public SuccessResultData<Integer> countCardUser(Map<String, Object> params) throws SearchException {
return new SuccessResultData<>(countNumberCardUser(params));
}*//*
}*/

View File

@ -0,0 +1,24 @@
package cn.com.tenlion.service.weixinlogin;
import com.alibaba.fastjson.JSONObject;
/**
* TODO
* @version 1.0
* @author LY
* @date 2021/1/26 11:19
*/
public interface IWeiXinLoginService {
/**
* 微信小程序登录
* @param code
* @return
* @throws Exception
*/
String weiXinLoginBySmallRoutine(String code) throws Exception;
}

View File

@ -0,0 +1,58 @@
package cn.com.tenlion.service.weixinlogin.impl;
import cn.com.tenlion.service.weixinlogin.IWeiXinLoginService;
import cn.com.tenlion.util.WxUtil;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
* 微信登录
* @version 1.0
* @author LY
* @date 2021/1/26 11:20
*/
@Service
public class WeiXinLoginServiceImpl implements IWeiXinLoginService {
/**微信小程序获取session key 接口*/
private static String VX_SMALL_ROUTINE_SESSION_KEY = "https://api.weixin.qq.com/sns/jscode2session";
/**小程序 appId*/
private static String APP_ID = "wxa49a60262e53d305 ";
/**小程序 appSecret*/
private static String APP_SECRET = "fcb567e070d48fbb937b192fcc2a0b5b";
/**小程序授权类型*/
private static String GRANT_TYPE = "authorization_code";
/**
* 微信小程序登录
* @param code
* @return
* @throws Exception
*/
public String weiXinLoginBySmallRoutine(String code) throws Exception{
if(StringUtils.isEmpty(code)){
throw new Exception("code不能为空");
}
// 配置请求参数
Map<String, String> param = new HashMap<>();
param.put("appid", APP_ID);
param.put("secret", APP_SECRET);
param.put("js_code", code);
param.put("grant_type", GRANT_TYPE);
String str = WxUtil.doGet(VX_SMALL_ROUTINE_SESSION_KEY, param);
if (StringUtils.isEmpty(str)) {
return "";
} else {
JSONObject json = JSONObject.parseObject(str);
json.getString("");
return "";
}
}
}

View File

@ -0,0 +1,153 @@
package cn.com.tenlion.util;
import com.sun.org.apache.xml.internal.security.utils.Base64;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.boot.configurationprocessor.json.JSONObject;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import javax.net.ssl.HttpsURLConnection;
import java.io.*;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.security.Security;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 微信小程序工具类
* @version 1.0
* @author LY
* @date 2021/1/26 11:28
*/
@Slf4j
public class WxUtil {
public static String doGet(String url, Map<String, String> param) {
// 创建Httpclient对象
CloseableHttpClient httpclient = HttpClients.createDefault();
String resultString = "";
CloseableHttpResponse response = null;
try {
// 创建uri
URIBuilder builder = new URIBuilder(url);
if (param != null) {
for (String key : param.keySet()) {
builder.addParameter(key, param.get(key));
}
}
URI uri = builder.build();
// 创建http GET请求
HttpGet httpGet = new HttpGet(uri);
// 执行请求
response = httpclient.execute(httpGet);
// 判断返回状态是否为200
if (response.getStatusLine().getStatusCode() == 200) {
resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (response != null) {
response.close();
}
httpclient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return resultString;
}
public static String doGet(String url) {
return doGet(url, null);
}
public static String doPost(String url, Map<String, String> param) {
// 创建Httpclient对象
CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse response = null;
String resultString = "";
try {
// 创建Http Post请求
HttpPost httpPost = new HttpPost(url);
// 创建参数列表
if (param != null) {
List<NameValuePair> paramList = new ArrayList<>();
for (String key : param.keySet()) {
paramList.add(new BasicNameValuePair(key, param.get(key)));
}
// 模拟表单
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(paramList);
httpPost.setEntity(entity);
}
// 执行http请求
response = httpClient.execute(httpPost);
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return resultString;
}
public static String doPost(String url) {
return doPost(url, null);
}
public static String doPostJson(String url, String json) {
// 创建Httpclient对象
CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse response = null;
String resultString = "";
try {
// 创建Http Post请求
HttpPost httpPost = new HttpPost(url);
// 创建请求内容
StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON);
httpPost.setEntity(entity);
// 执行http请求
response = httpClient.execute(httpPost);
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return resultString;
}
}

View File

@ -1,5 +1,5 @@
server:
port: 8888
port: 8080
servlet:
context-path: /businesscard
@ -16,7 +16,7 @@ spring:
db-type: mysql
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: root
password: 123456
initial-size: 2
min-idle: 2
max-active: 10

View File

@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.com.tenlion.dao.carduser.ICardUserDao">
<resultMap id="cardUserDTO" type="cn.com.tenlion.pojo.dtos.carduser.CardUserDTO">
<id column="card_user_id" property="cardUserId"/>
<result column="user_name" property="userName"/>
<result column="user_phone" property="userPhone"/>
<result column="vx_union_id" property="VxUnionId"/>
<result column="vx_open_id" property="VxOpenId"/>
</resultMap>
<!-- 新增用户表 -->
<insert id="saveCardUser" parameterType="map">
INSERT INTO gen_card_user(
card_user_id,
user_name,
user_phone,
vx_union_id,
vx_open_id,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{cardUserId},
#{userName},
#{userPhone},
#{VxUnionId},
#{VxOpenId},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 删除用户表 -->
<update id="removeCardUser" parameterType="map">
UPDATE
gen_card_user
SET
is_delete = 1,
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
card_user_id IN
<foreach collection="cardUserIds" index="index" open="(" separator="," close=")">
#{cardUserIds[${index}]}
</foreach>
</update>
<!-- 删除用户表(物理) -->
<update id="deleteCardUser" parameterType="map">
DELETE FROM
gen_card_user
WHERE
card_user_id IN
<foreach collection="cardUserIds" index="index" open="(" separator="," close=")">
#{cardUserIds[${index}]}
</foreach>
</update>
<!-- 修改用户表 -->
<update id="updateCardUser" parameterType="map">
UPDATE
gen_card_user
SET
<if test="userName != null and userName != ''">
user_name = #{userName},
</if>
<if test="userPhone != null and userPhone != ''">
user_phone = #{userPhone},
</if>
<if test="VxUnionId != null and VxUnionId != ''">
vx_union_id = #{VxUnionId},
</if>
<if test="VxOpenId != null and VxOpenId != ''">
vx_open_id = #{VxOpenId},
</if>
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
card_user_id = #{cardUserId}
</update>
<!-- 用户表详情 -->
<select id="getCardUser" parameterType="map" resultMap="cardUserDTO">
SELECT
t1.user_name,
t1.user_phone,
t1.vx_union_id,
t1.vx_open_id,
t1.card_user_id
FROM
gen_card_user t1
WHERE
t1.is_delete = 0
<if test="cardUserId != null and cardUserId != ''">
AND
t1.card_user_id = #{cardUserId}
</if>
</select>
<!-- 用户表列表 -->
<select id="listCardUser" parameterType="map" resultMap="cardUserDTO">
SELECT
t1.user_name,
t1.user_phone,
t1.vx_union_id,
t1.vx_open_id,
t1.card_user_id
FROM
gen_card_user t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
t1.id LIKE CONCAT('%', #{keywords}, '%')
OR
t1.card_user_id LIKE CONCAT('%', #{keywords}, '%')
<!-- 这里添加其他条件 -->
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="cardUserIds != null and cardUserIds.size > 0">
AND
t1.card_user_id IN
<foreach collection="cardUserIds" index="index" open="(" separator="," close=")">
#{cardUserIds[${index}]}
</foreach>
</if>
</select>
<!-- 用户表统计 -->
<select id="countCardUser" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
gen_card_user t1
WHERE
t1.is_delete = 0
</select>
</mapper>