From 55e1481c21e768d7502b921fce3b189206a6a7c8 Mon Sep 17 00:00:00 2001 From: wangwei <1610949092@qq.com> Date: Fri, 19 May 2023 09:44:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../purchase/SupCertController.java | 110 ++++++++++++++++++ .../sup/UserRegisterController.java | 108 +++++++++++++++-- .../com/glxp/api/dao/sup/UserCertMapper.java | 5 + .../glxp/api/dao/sup/UserRegisterMapper.java | 4 + .../glxp/api/req/auth/loginmobileRequest.java | 14 +++ .../glxp/api/req/purchase/certRequest.java | 104 +++++++++++++++++ .../api/res/auth/registComPerResponse.java | 59 ++++++++++ .../glxp/api/service/sup/UserCertService.java | 11 ++ .../api/service/sup/UserCompanyService.java | 4 +- .../api/service/sup/UserPersonService.java | 3 + .../api/service/sup/UserRegisterService.java | 8 ++ .../service/sup/impl/UserCertServiceImpl.java | 34 ++++++ .../sup/impl/UserCompanyServiceImpl.java | 15 +++ .../sup/impl/UserPersonServiceImpl.java | 14 +++ .../sup/impl/UserRegisterServiceImpl.java | 21 ++++ .../java/com/glxp/api/util/CaptchaUtils.java | 40 ++++--- .../mybatis/mapper/sup/UserCertMapper.xml | 15 ++- .../mybatis/mapper/sup/UserRegisterMapper.xml | 25 ++++ src/main/resources/schemas/schema_v2.1.sql | 14 +++ 19 files changed, 579 insertions(+), 29 deletions(-) create mode 100644 src/main/java/com/glxp/api/controller/purchase/SupCertController.java create mode 100644 src/main/java/com/glxp/api/req/auth/loginmobileRequest.java create mode 100644 src/main/java/com/glxp/api/req/purchase/certRequest.java create mode 100644 src/main/java/com/glxp/api/res/auth/registComPerResponse.java diff --git a/src/main/java/com/glxp/api/controller/purchase/SupCertController.java b/src/main/java/com/glxp/api/controller/purchase/SupCertController.java new file mode 100644 index 0000000..04d4b5c --- /dev/null +++ b/src/main/java/com/glxp/api/controller/purchase/SupCertController.java @@ -0,0 +1,110 @@ +package com.glxp.api.controller.purchase; + +import cn.hutool.core.util.IdUtil; +import com.github.pagehelper.PageInfo; +import com.glxp.api.common.enums.ResultEnum; +import com.glxp.api.common.res.BaseResponse; +import com.glxp.api.common.util.ResultVOUtils; +import com.glxp.api.entity.purchase.SupCertEntity; +import com.glxp.api.entity.sup.UserCertEntity; +import com.glxp.api.req.purchase.FilterImageRequest; +import com.glxp.api.req.purchase.FilterSupCertRequest; +import com.glxp.api.req.purchase.certRequest; +import com.glxp.api.req.system.DeleteCompanyFileRequest; +import com.glxp.api.res.PageSimpleResponse; +import com.glxp.api.service.sup.UserCertService; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +/** + * @author : zhangsan + * @date : 2023/5/18 9:38 + * @modyified By : + */ +@RestController +public class SupCertController { + @Resource + private UserCertService userCertService; + @Value("${file_path}") + private String filePath; + + + @GetMapping("/sup/company/cert/filterList") + public BaseResponse filterCompanyCert(certRequest certRequest , BindingResult bindingResult){ + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + List userCertEntities = userCertService.selectBybId(certRequest); + PageInfo pageInfo; + pageInfo = new PageInfo<>(userCertEntities); + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); + pageSimpleResponse.setTotal(pageInfo.getTotal()); + pageSimpleResponse.setList(userCertEntities); + return ResultVOUtils.success(pageSimpleResponse); + } + + + //资质证书添加 + @PostMapping("/sup/company/cert/isertCert") + public BaseResponse isertCert(@RequestBody UserCertEntity userCert){ + userCert.setCreateTime(new Date()); + userCert.setUpdateTime(new Date()); + userCert.setStatus(0+""); + userCert.setId(IdUtil.getSnowflakeNextId()); + userCertService.insertCert(userCert); + return ResultVOUtils.success("成功"); + } + + //删除 + @PostMapping("/sup/company/cert/deleteCert") + public BaseResponse deleteCert(@RequestBody DeleteCompanyFileRequest deleteCompanyFileRequest){ + boolean b = userCertService.deleteById(deleteCompanyFileRequest.getId()); + String URL = filePath + "/register/file/image2/" + deleteCompanyFileRequest.getFilePath(); + File file = new File(URL); + if (file.exists() && file.isFile()) { + file.delete(); + } + return ResultVOUtils.success("成功"); + } + + //修改 + @PostMapping("/sup/info/updateCert") + public BaseResponse updateCert(@RequestBody UserCertEntity userCert){ + + if (userCert.getValidDate() != null && userCert.getExpireDate() != null) { + if (userCert.getValidDate().getTime() > userCert.getExpireDate().getTime()) { + return ResultVOUtils.error(999, "生效期不能小于失效期!"); + } + } + userCertService.updateCert(userCert); + + return ResultVOUtils.success("修改成功"); + } + + @PostMapping("/udiwms/image/register/file") + public BaseResponse uploadRegisterFile(@RequestBody FilterImageRequest filterImageRequest) { + List urlList = Arrays.asList(filterImageRequest.getImageUrl().split(",")); + List list = new ArrayList<>(); + for (String obj : urlList) { + String url = filterImageRequest.getCertFileUrl() + obj; + list.add(url); + } + return ResultVOUtils.success(list); + } + + + + + +} diff --git a/src/main/java/com/glxp/api/controller/sup/UserRegisterController.java b/src/main/java/com/glxp/api/controller/sup/UserRegisterController.java index f799ebc..266e302 100644 --- a/src/main/java/com/glxp/api/controller/sup/UserRegisterController.java +++ b/src/main/java/com/glxp/api/controller/sup/UserRegisterController.java @@ -1,17 +1,21 @@ package com.glxp.api.controller.sup; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import javax.annotation.Resource; import javax.servlet.http.HttpSession; import javax.validation.Valid; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.IdUtil; +import com.glxp.api.entity.sup.UserCompanyEntity; +import com.glxp.api.req.auth.loginmobileRequest; +import com.glxp.api.res.auth.registComPerResponse; +import com.glxp.api.service.sup.UserCompanyService; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.BeanUtils; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -44,15 +48,18 @@ public class UserRegisterController extends BaseController { private UserRegisterService userRegisterService; @Resource private UserPersonService userPersonService; + + @Resource + private UserCompanyService userCompanyService; @Resource private UserCertService userCertService; @PostMapping("/admin/auth/register/getCheckcode") - public BaseResponse getCheckcode(@RequestBody Map params, HttpSession httpSession) { + public BaseResponse getCheckcode(@RequestBody loginmobileRequest params, HttpSession httpSession) { return CaptchaUtils.getCheckcode(params,httpSession); } @PostMapping("/admin/auth/register/checkCode") - public BaseResponse checkCode(@RequestBody Map params) { + public BaseResponse checkCode(@RequestBody loginmobileRequest params) { return CaptchaUtils.checkCode(params); } @@ -79,7 +86,7 @@ public class UserRegisterController extends BaseController { return ResultVOUtils.success(map); } - + @PostMapping("/admin/auth/register/save") public BaseResponse saveRegister(@RequestBody @Valid UserRegisterEntity userRegisterEntity, HttpSession httpSession, BindingResult bindingResult) { @@ -105,7 +112,7 @@ public class UserRegisterController extends BaseController { userRegisterEntity.setCheckStatus("0"); boolean b = false; b = userRegisterService.saveOrUpdate(userRegisterEntity); - + if (!b) { return ResultVOUtils.error(ResultEnum.NOT_NETWORK); } @@ -121,4 +128,89 @@ public class UserRegisterController extends BaseController { return ResultVOUtils.success(userRegisterService.list(new QueryWrapper().allEq(params))); } + //第一次完善信息 插入默认数据 + @GetMapping("/admin/auth/register/insertInitial") + public BaseResponse insertInitial (String mobile){ + Map map = new HashMap<>(); + //根据手机号去查询 数据是否存在 不存在插入 + UserRegisterEntity userRegister = userRegisterService.getOne(new QueryWrapper().eq("mobile", mobile)); + if(userRegister == null){ + //插入初始数据 + UserRegisterEntity userRegisterEntity = new UserRegisterEntity(); + UserCompanyEntity userCompanyEntity = new UserCompanyEntity(); + UserPersonEntity userPersonEntity = new UserPersonEntity(); + + userCompanyEntity.setId(IdUtil.getSnowflakeNextId()); + userCompanyEntity.setCheckStatus(0+""); + userCompanyEntity.setRegisterTime(new Date()); + + userRegisterEntity.setId(IdUtil.getSnowflakeNextId()); + userRegisterEntity.setCompanyId(userCompanyEntity.getId()); + userRegisterEntity.setMobile(mobile); + userRegisterEntity.setRegisterTime(new Date()); + + +// userPersonEntity.setId(IdUtil.getSnowflakeNextId()); +// userPersonEntity.setCreateTime(new Date()); +// userPersonEntity.setCompanyId(userCompanyEntity.getId()); +// userPersonEntity.setMobile(mobile); + + userRegisterService.insert(userRegisterEntity); + int insert = userCompanyService.insert(userCompanyEntity); +// userPersonService.insert(userPersonEntity); + if(insert>0){ +// map.put("upId",userPersonEntity.getId()+""); + map.put("ucId",userCompanyEntity.getId()+""); + map.put("urId",userRegisterEntity.getId()+""); + return ResultVOUtils.success(map); + } + return ResultVOUtils.error(500,"添加失败"); + }else{ + registComPerResponse registComPerResponse = userRegisterService.selectAllInfo(userRegister.getCompanyId()+""); + map.put("registComPerResponse",registComPerResponse); + return ResultVOUtils.success(map); + } + + } + + + @PostMapping("/admin/auth/register/saveAllInfo") + public BaseResponse saveAllInfo(@RequestBody registComPerResponse registComPerResponse){ + + UserRegisterEntity userRegisterEntity = new UserRegisterEntity(); +// UserPersonEntity userPersonEntity = new UserPersonEntity(); + UserCompanyEntity userCompanyEntity = new UserCompanyEntity(); + BeanUtils.copyProperties(registComPerResponse,userRegisterEntity); +// BeanUtils.copyProperties(registComPerResponse,userPersonEntity); + BeanUtils.copyProperties(registComPerResponse,userCompanyEntity); + userRegisterEntity.setId(Long.valueOf(registComPerResponse.getUrId())); +// userPersonEntity.setId(Long.valueOf(registComPerResponse.getUpId())); + userCompanyEntity.setId(Long.valueOf(registComPerResponse.getUcId())); + if("key".equals(registComPerResponse.getKey())){ + //提交审核 + userCompanyEntity.setCheckStatus(3+""); + } + //插入资质证书 + for (UserCertEntity userCertEntity : registComPerResponse.getList()) { + userCertService.saveOrUpdate(userCertEntity); + } + + + userRegisterService.update(userRegisterEntity); + userCompanyService.update(userCompanyEntity); +// userPersonService.update(userPersonEntity); + + + + return ResultVOUtils.success(); + } + + + + + + + + + } diff --git a/src/main/java/com/glxp/api/dao/sup/UserCertMapper.java b/src/main/java/com/glxp/api/dao/sup/UserCertMapper.java index 59d7a6b..6c2af4a 100644 --- a/src/main/java/com/glxp/api/dao/sup/UserCertMapper.java +++ b/src/main/java/com/glxp/api/dao/sup/UserCertMapper.java @@ -2,6 +2,9 @@ package com.glxp.api.dao.sup; import java.util.List; +import com.glxp.api.entity.purchase.SupCertEntity; +import com.glxp.api.req.purchase.FilterSupCertRequest; +import com.glxp.api.req.purchase.certRequest; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -11,4 +14,6 @@ import com.glxp.api.entity.sup.UserCertEntity; @Mapper public interface UserCertMapper extends BaseMapper { List selectByRegisterId(@Param("registerId") String registerId); + + List filterCompanyCert(certRequest certRequest); } diff --git a/src/main/java/com/glxp/api/dao/sup/UserRegisterMapper.java b/src/main/java/com/glxp/api/dao/sup/UserRegisterMapper.java index b157ae1..aae9753 100644 --- a/src/main/java/com/glxp/api/dao/sup/UserRegisterMapper.java +++ b/src/main/java/com/glxp/api/dao/sup/UserRegisterMapper.java @@ -2,8 +2,12 @@ package com.glxp.api.dao.sup; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.glxp.api.entity.sup.UserRegisterEntity; +import com.glxp.api.res.auth.registComPerResponse; import org.apache.ibatis.annotations.Mapper; @Mapper public interface UserRegisterMapper extends BaseMapper { + + registComPerResponse selectAllInfo(String companyId); + } diff --git a/src/main/java/com/glxp/api/req/auth/loginmobileRequest.java b/src/main/java/com/glxp/api/req/auth/loginmobileRequest.java new file mode 100644 index 0000000..57095a8 --- /dev/null +++ b/src/main/java/com/glxp/api/req/auth/loginmobileRequest.java @@ -0,0 +1,14 @@ +package com.glxp.api.req.auth; + +import com.glxp.api.util.page.ListPageRequest; +import lombok.Data; + +@Data +public class loginmobileRequest extends ListPageRequest { + + + private String mobile; + + private String checkCode; + +} diff --git a/src/main/java/com/glxp/api/req/purchase/certRequest.java b/src/main/java/com/glxp/api/req/purchase/certRequest.java new file mode 100644 index 0000000..2c57c24 --- /dev/null +++ b/src/main/java/com/glxp/api/req/purchase/certRequest.java @@ -0,0 +1,104 @@ +package com.glxp.api.req.purchase; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.glxp.api.util.page.ListPageRequest; +import lombok.Data; + +import java.util.Date; + +/** + * @author : zhangsan + * @date : 2023/5/18 10:05 + * @modyified By : + */ +@Data +public class certRequest extends ListPageRequest { + + @TableId(value = "id", type = IdType.INPUT) + private Long id; + + /** + * 业ID外键 + */ + @TableField(value = "businessId") + private Long businessId; + + /** + * 证书名称 + */ + @TableField(value = "`name`") + private String name; + + /** + * 证书编号 + */ + @TableField(value = "code") + private String code; + + @TableField(value = "filePath") + private String filePath; + + /** + * 有效期 + */ + @TableField(value = "validDate") + private Date validDate; + + /** + * 失效期 + */ + @TableField(value = "expireDate") + private Date expireDate; + + /** + * 审核状态 + */ + @TableField(value = "checkStatus") + private String checkStatus; + + /** + * 审核说明 + */ + @TableField(value = "checkComment") + private String checkComment; + + /** + * 0:启用,1:禁用 + */ + @TableField(value = "`status`") + private String status; + + /** + * 备注 + */ + @TableField(value = "remark") + private String remark; + + /** + * 创建人 + */ + @TableField(value = "`createUser`") + private String createUser; + + /** + * 创建时间 + */ + @TableField(value = "createTime") + private Date createTime; + + /** + * 更新人 + */ + @TableField(value = "updateUser") + private String updateUser; + + /** + * 更新时间 + */ + @TableField(value = "updateTime") + private Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/glxp/api/res/auth/registComPerResponse.java b/src/main/java/com/glxp/api/res/auth/registComPerResponse.java new file mode 100644 index 0000000..4e8f972 --- /dev/null +++ b/src/main/java/com/glxp/api/res/auth/registComPerResponse.java @@ -0,0 +1,59 @@ +package com.glxp.api.res.auth; + +import com.glxp.api.entity.sup.UserCertEntity; +import lombok.Data; + +import java.util.List; + +/** + * @author : zhangsan + * @date : 2023/5/17 17:51 + * @modyified By : + */ +@Data +public class registComPerResponse { + + private String id; + private String name; + private String tel; + private String realName; + private String qq; + private String weChat; + private String companyName; + + //企业类型 + private String bussinessStatus; + private String creditNum; + private String legalPerson; + private String legalIdCard; + private String registerAddress; + private String contactWay; + private String email; + private String mobile; + private String remark; + private String upId; + private String urId; + private String ucId; + private List list; + private String key; + private String checkStatus; + private String ucstatus; + private String xemail; + private String reason; + + + + + + + + + + + + + + + + +} diff --git a/src/main/java/com/glxp/api/service/sup/UserCertService.java b/src/main/java/com/glxp/api/service/sup/UserCertService.java index 8ff17a0..628ec48 100644 --- a/src/main/java/com/glxp/api/service/sup/UserCertService.java +++ b/src/main/java/com/glxp/api/service/sup/UserCertService.java @@ -4,7 +4,18 @@ import java.util.List; import com.baomidou.mybatisplus.extension.service.IService; import com.glxp.api.entity.sup.UserCertEntity; +import com.glxp.api.req.purchase.FilterSupCertRequest; +import com.glxp.api.req.purchase.certRequest; + public interface UserCertService extends IService{ List selectByRegisterId(String registerId); + List selectBybId(certRequest certRequest); + + boolean insertCert(UserCertEntity userCert); + + boolean deleteById(String id); + + boolean updateCert(UserCertEntity userCert); + } diff --git a/src/main/java/com/glxp/api/service/sup/UserCompanyService.java b/src/main/java/com/glxp/api/service/sup/UserCompanyService.java index e1754be..85b451d 100644 --- a/src/main/java/com/glxp/api/service/sup/UserCompanyService.java +++ b/src/main/java/com/glxp/api/service/sup/UserCompanyService.java @@ -2,8 +2,10 @@ package com.glxp.api.service.sup; import com.baomidou.mybatisplus.extension.service.IService; import com.glxp.api.entity.sup.UserCompanyEntity; +import com.glxp.api.entity.sup.UserRegisterEntity; public interface UserCompanyService extends IService{ - + int insert(UserCompanyEntity userCompany); + boolean update(UserCompanyEntity userCompany); } diff --git a/src/main/java/com/glxp/api/service/sup/UserPersonService.java b/src/main/java/com/glxp/api/service/sup/UserPersonService.java index 70aebc9..f495119 100644 --- a/src/main/java/com/glxp/api/service/sup/UserPersonService.java +++ b/src/main/java/com/glxp/api/service/sup/UserPersonService.java @@ -1,8 +1,11 @@ package com.glxp.api.service.sup; +import com.glxp.api.entity.sup.UserCompanyEntity; import com.glxp.api.entity.sup.UserPersonEntity; import com.baomidou.mybatisplus.extension.service.IService; public interface UserPersonService extends IService{ + int insert(UserPersonEntity userPerson); + boolean update(UserPersonEntity userPerson); } diff --git a/src/main/java/com/glxp/api/service/sup/UserRegisterService.java b/src/main/java/com/glxp/api/service/sup/UserRegisterService.java index a5311a2..c217cb3 100644 --- a/src/main/java/com/glxp/api/service/sup/UserRegisterService.java +++ b/src/main/java/com/glxp/api/service/sup/UserRegisterService.java @@ -2,7 +2,15 @@ package com.glxp.api.service.sup; import com.glxp.api.entity.sup.UserRegisterEntity; import com.baomidou.mybatisplus.extension.service.IService; +import com.glxp.api.res.auth.registComPerResponse; + public interface UserRegisterService extends IService{ + int insert(UserRegisterEntity userRegister); + + registComPerResponse selectAllInfo(String companyId); + + boolean update( UserRegisterEntity userRegisterEntity); + } diff --git a/src/main/java/com/glxp/api/service/sup/impl/UserCertServiceImpl.java b/src/main/java/com/glxp/api/service/sup/impl/UserCertServiceImpl.java index be29de5..b3afe25 100644 --- a/src/main/java/com/glxp/api/service/sup/impl/UserCertServiceImpl.java +++ b/src/main/java/com/glxp/api/service/sup/impl/UserCertServiceImpl.java @@ -1,9 +1,13 @@ package com.glxp.api.service.sup.impl; +import java.util.Collections; import java.util.List; import javax.annotation.Resource; +import com.github.pagehelper.PageHelper; +import com.glxp.api.req.purchase.FilterSupCertRequest; +import com.glxp.api.req.purchase.certRequest; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -19,4 +23,34 @@ public class UserCertServiceImpl extends ServiceImpl selectByRegisterId(String registerId) { return userCertDao.selectByRegisterId(registerId); } + + @Override + public List selectBybId(certRequest certRequest) { + + if (certRequest == null) { + return Collections.emptyList(); + } + if (certRequest.getPage() != null) { + int offset = (certRequest.getPage() - 1) * certRequest.getLimit(); + PageHelper.offsetPage(offset, certRequest.getLimit()); + } + return userCertDao.filterCompanyCert(certRequest); + } + + @Override + public boolean insertCert(UserCertEntity userCert) { + return userCertDao.insert(userCert)>0; + } + + @Override + public boolean deleteById(String id) { + return userCertDao.deleteById(id)>0; + } + + @Override + public boolean updateCert(UserCertEntity userCert) { + return userCertDao.updateById(userCert)>0; + } + + } diff --git a/src/main/java/com/glxp/api/service/sup/impl/UserCompanyServiceImpl.java b/src/main/java/com/glxp/api/service/sup/impl/UserCompanyServiceImpl.java index 9ab9d66..10da280 100644 --- a/src/main/java/com/glxp/api/service/sup/impl/UserCompanyServiceImpl.java +++ b/src/main/java/com/glxp/api/service/sup/impl/UserCompanyServiceImpl.java @@ -5,7 +5,22 @@ import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.glxp.api.dao.sup.UserCompanyMapper; import com.glxp.api.service.sup.UserCompanyService; + +import javax.annotation.Resource; + @Service public class UserCompanyServiceImpl extends ServiceImpl implements UserCompanyService{ + @Resource + UserCompanyMapper userCompanyMapper; + + @Override + public int insert(UserCompanyEntity userCompany) { + return userCompanyMapper.insert(userCompany); + } + + @Override + public boolean update(UserCompanyEntity userCompany) { + return userCompanyMapper.updateById(userCompany)>0; + } } diff --git a/src/main/java/com/glxp/api/service/sup/impl/UserPersonServiceImpl.java b/src/main/java/com/glxp/api/service/sup/impl/UserPersonServiceImpl.java index c789117..a26249f 100644 --- a/src/main/java/com/glxp/api/service/sup/impl/UserPersonServiceImpl.java +++ b/src/main/java/com/glxp/api/service/sup/impl/UserPersonServiceImpl.java @@ -6,7 +6,21 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.glxp.api.entity.sup.UserPersonEntity; import com.glxp.api.dao.sup.UserPersonMapper; +import javax.annotation.Resource; + @Service public class UserPersonServiceImpl extends ServiceImpl implements UserPersonService { + @Resource + UserPersonMapper userPersonMapper; + + @Override + public int insert(UserPersonEntity userPerson) { + return userPersonMapper.insert(userPerson); + } + + @Override + public boolean update(UserPersonEntity userPerson) { + return userPersonMapper.updateById(userPerson)>0; + } } diff --git a/src/main/java/com/glxp/api/service/sup/impl/UserRegisterServiceImpl.java b/src/main/java/com/glxp/api/service/sup/impl/UserRegisterServiceImpl.java index 97540ba..e9b9105 100644 --- a/src/main/java/com/glxp/api/service/sup/impl/UserRegisterServiceImpl.java +++ b/src/main/java/com/glxp/api/service/sup/impl/UserRegisterServiceImpl.java @@ -1,12 +1,33 @@ package com.glxp.api.service.sup.impl; +import com.glxp.api.res.auth.registComPerResponse; import com.glxp.api.service.sup.UserRegisterService; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.glxp.api.entity.sup.UserRegisterEntity; import com.glxp.api.dao.sup.UserRegisterMapper; +import javax.annotation.Resource; + @Service public class UserRegisterServiceImpl extends ServiceImpl implements UserRegisterService { + @Resource + UserRegisterMapper userRegisterMapper; + + + @Override + public int insert(UserRegisterEntity userRegister) { + return userRegisterMapper.insert(userRegister); + } + + @Override + public registComPerResponse selectAllInfo(String companyId) { + return userRegisterMapper.selectAllInfo(companyId); + } + + @Override + public boolean update(UserRegisterEntity userRegisterEntity) { + return userRegisterMapper.updateById(userRegisterEntity)>0; + } } diff --git a/src/main/java/com/glxp/api/util/CaptchaUtils.java b/src/main/java/com/glxp/api/util/CaptchaUtils.java index 8d5d742..a4c5835 100644 --- a/src/main/java/com/glxp/api/util/CaptchaUtils.java +++ b/src/main/java/com/glxp/api/util/CaptchaUtils.java @@ -5,6 +5,7 @@ import java.util.Map; import javax.annotation.Resource; import javax.servlet.http.HttpSession; +import com.glxp.api.req.auth.loginmobileRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpEntity; @@ -33,49 +34,50 @@ public class CaptchaUtils { public void getRedisUtil(RedisUtil redisUtil) { this.redisUtil = redisUtil; } - + private CaptchaUtils() { - + } - public static BaseResponse checkCode(Map params) { - logger.info(">>>>>"+redisUtil.get(Constant.CAPTCHAS + params.get("mobile"))); - String codeStr = String.valueOf(redisUtil.get(Constant.CAPTCHAS + params.get("mobile"))); + public static BaseResponse checkCode(loginmobileRequest params) { + logger.info(">>>>>"+redisUtil.get(Constant.CAPTCHAS + params.getMobile())); + String codeStr = String.valueOf(redisUtil.get(Constant.CAPTCHAS + params.getMobile())); if (StrUtil.isBlank(codeStr) || "null".equals(codeStr)) { return ResultVOUtils.error(500, "验证码已过期,请重新获取"); } JSONObject json = JSONObject.parseObject(codeStr); logger.info("code:::"+codeStr); - if(!json.getString("code").equals(params.get("code").toString())) { + if(!json.getString("code").equals(params.getCheckCode())) { return ResultVOUtils.error(500, "验证码错误,请重新获取"); } - redisUtil.del(Constant.CAPTCHAS + params.get("mobile")); - return ResultVOUtils.success(); + redisUtil.del(Constant.CAPTCHAS + params.getMobile()); + return ResultVOUtils.success(params.getMobile()); } - public static BaseResponse getCheckcode(Map params, HttpSession httpSession) { + public static BaseResponse getCheckcode(loginmobileRequest params, HttpSession httpSession) { RestTemplate restTemplate = new RestTemplate(); - int mobile_code = (int) ((Math.random() * 9 + 1) * 100000); +// int mobile_code = (int) ((Math.random() * 9 + 1) * 100000); + int mobile_code = 123456; MultiValueMap postParameters = new LinkedMultiValueMap<>(); int time = 5; String content = new String("您正在进行手机验证,验证码是" + mobile_code + "," + time + "分钟内有效。"); postParameters.add("account", "C07086222"); postParameters.add("password", "2dddbbf73636c193c5903324bdb47c5c"); - postParameters.add("mobile", params.get("mobile")); + postParameters.add("mobile", params.getMobile()); postParameters.add("content", content); HttpHeaders headers = new HttpHeaders(); headers.add("Content-Type", "application/x-www-form-urlencoded;charset=GBK"); - HttpEntity> httpEntity = new HttpEntity<>(postParameters, headers); - String response = restTemplate.postForObject(Url, httpEntity, String.class); - if (response.contains("提交成功")) { +// HttpEntity> httpEntity = new HttpEntity<>(postParameters, headers); +// String response = restTemplate.postForObject(Url, httpEntity, String.class); +// if (response.contains("提交成功")) { JSONObject json = new JSONObject(); - json.put("memPhone", params.get("mobile")); + json.put("memPhone", params.getMobile()); json.put("code", mobile_code); json.put("createTime", System.currentTimeMillis()); //验证码存入redis中 - redisUtil.set(Constant.CAPTCHAS + params.get("mobile"), json, 300L); + redisUtil.set(Constant.CAPTCHAS + params.getMobile(), json, 300L); return ResultVOUtils.success("发送成功"); - } else { - return ResultVOUtils.error(500, "验证码发送失败"); - } +// } else { +// return ResultVOUtils.error(500, "验证码发送失败"); +// } } } diff --git a/src/main/resources/mybatis/mapper/sup/UserCertMapper.xml b/src/main/resources/mybatis/mapper/sup/UserCertMapper.xml index 818081b..b10493b 100644 --- a/src/main/resources/mybatis/mapper/sup/UserCertMapper.xml +++ b/src/main/resources/mybatis/mapper/sup/UserCertMapper.xml @@ -27,7 +27,20 @@ + + + diff --git a/src/main/resources/mybatis/mapper/sup/UserRegisterMapper.xml b/src/main/resources/mybatis/mapper/sup/UserRegisterMapper.xml index 14980d5..df4dc45 100644 --- a/src/main/resources/mybatis/mapper/sup/UserRegisterMapper.xml +++ b/src/main/resources/mybatis/mapper/sup/UserRegisterMapper.xml @@ -28,4 +28,29 @@ registerTime, legalPerson, legalIdCard, registerAddress, contactWay, comments, checkStatus, checkTime + + + + diff --git a/src/main/resources/schemas/schema_v2.1.sql b/src/main/resources/schemas/schema_v2.1.sql index e8e540b..013b5d5 100644 --- a/src/main/resources/schemas/schema_v2.1.sql +++ b/src/main/resources/schemas/schema_v2.1.sql @@ -2,4 +2,18 @@ CALL Pro_Temp_ColumnWork('basic_udi_rel', 'companyType', 'tinyint', 1); +CALL Pro_Temp_ColumnWork('user_register', 'name', 'varchar(255)', 1); +CALL Pro_Temp_ColumnWork('user_register', 'tel', 'varchar(255)', 1); +CALL Pro_Temp_ColumnWork('user_register', 'qq', 'varchar(255)', 1); +CALL Pro_Temp_ColumnWork('user_register', 'weChat', 'varchar(255)', 1); +CALL Pro_Temp_ColumnWork('user_register', 'xemail', 'varchar(255)', 1); +CALL Pro_Temp_ColumnWork('user_company', 'reason', 'varchar(255)', 1); + + + + + + + +