28 changed files with 1697 additions and 33 deletions
@ -0,0 +1,66 @@ |
|||||
|
package com.elink.esua.epdc.controller; |
||||
|
|
||||
|
import com.elink.esua.epdc.common.token.dto.TokenDto; |
||||
|
import com.elink.esua.epdc.commons.tools.annotation.LoginUser; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.enterprise.form.EnterpriseInfoFormDTO; |
||||
|
import com.elink.esua.epdc.dto.enterprise.result.EnterpriseInfoResultDTO; |
||||
|
import com.elink.esua.epdc.common.token.dto.TokenDto; |
||||
|
import com.elink.esua.epdc.commons.tools.annotation.LoginUser; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.form.CompleteRequisiteInfoDTO; |
||||
|
import com.elink.esua.epdc.service.CustomEnterpriseService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* 企业认证 |
||||
|
* |
||||
|
* @author work@yujt.net.cn |
||||
|
* @date 2020/2/28 11:27 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("custom/enterprise") |
||||
|
public class ApiCustomEnterpriseController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CustomEnterpriseService customEnterpriseService; |
||||
|
|
||||
|
/** |
||||
|
* @Description 企业信息完善 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/2/28 |
||||
|
* @Param [enterpriseInfoDTO] |
||||
|
* @return void |
||||
|
**/ |
||||
|
@GetMapping("/completeSelectiveInfo") |
||||
|
public Result completeEnterpriseInfo(EnterpriseInfoFormDTO enterpriseInfoFormDTO) { |
||||
|
return customEnterpriseService.completeEnterpriseInfo(enterpriseInfoFormDTO); |
||||
|
} |
||||
|
/** |
||||
|
* @Description 查询企业信息 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/2/28 |
||||
|
* @Param [userId] |
||||
|
* @return com.elink.esua.epdc.dto.enterprise.result.EnterpriseInfoResultDTO |
||||
|
**/ |
||||
|
|
||||
|
@GetMapping("/getByUserId") |
||||
|
public Result<EnterpriseInfoResultDTO> getByUserId(@LoginUser TokenDto tokenDto) { |
||||
|
String userId = tokenDto.getUserId(); |
||||
|
return customEnterpriseService.selectOneEnterpriseInfo(userId); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/*** |
||||
|
* 完善企业信息,必填表单 |
||||
|
* @param |
||||
|
* @return Result<DeptOption> |
||||
|
* @author qushutong |
||||
|
* @date 2020/2/28 13:34 |
||||
|
*/ |
||||
|
@PostMapping("completeRequisiteInfo") |
||||
|
public Result completeRequisiteInfo(@RequestBody CompleteRequisiteInfoDTO fromDto, @LoginUser TokenDto tokenDto) { |
||||
|
return customEnterpriseService.completeRequisiteInfo(fromDto, tokenDto); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,47 @@ |
|||||
|
package com.elink.esua.epdc.service; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.enterprise.EnterpriseInfoDTO; |
||||
|
import com.elink.esua.epdc.dto.enterprise.form.EnterpriseInfoFormDTO; |
||||
|
import com.elink.esua.epdc.dto.enterprise.result.EnterpriseInfoResultDTO; |
||||
|
|
||||
|
import com.elink.esua.epdc.common.token.dto.TokenDto; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.form.CompleteRequisiteInfoDTO; |
||||
|
|
||||
|
/** |
||||
|
* 企业认证 |
||||
|
* |
||||
|
* @author work@yujt.net.cn |
||||
|
* @date 2020/2/28 11:28 |
||||
|
*/ |
||||
|
public interface CustomEnterpriseService { |
||||
|
|
||||
|
/** |
||||
|
* @Description 企业信息完善 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/2/28 |
||||
|
* @Param [enterpriseInfoDTO] |
||||
|
* @return void |
||||
|
**/ |
||||
|
Result completeEnterpriseInfo(EnterpriseInfoFormDTO enterpriseInfoFormDTO); |
||||
|
|
||||
|
/** |
||||
|
* @Description 查询企业信息 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/2/28 |
||||
|
* @Param [userId] |
||||
|
* @return com.elink.esua.epdc.dto.enterprise.result.EnterpriseInfoResultDTO |
||||
|
**/ |
||||
|
Result<EnterpriseInfoResultDTO> selectOneEnterpriseInfo(String userId); |
||||
|
|
||||
|
/*** |
||||
|
* 完善企业信息,必填表单 |
||||
|
* @param |
||||
|
* @return |
||||
|
* @author qushutong |
||||
|
* @date 2020/2/28 13:44 |
||||
|
*/ |
||||
|
Result completeRequisiteInfo(CompleteRequisiteInfoDTO fromDto, TokenDto tokenDto); |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,101 @@ |
|||||
|
package com.elink.esua.epdc.service.impl; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.enterprise.form.EnterpriseInfoFormDTO; |
||||
|
import com.elink.esua.epdc.dto.enterprise.result.EnterpriseInfoResultDTO; |
||||
|
import com.elink.esua.epdc.feign.CustomFeignClient; |
||||
|
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; |
||||
|
import cn.binarywang.wx.miniapp.bean.WxMaUserInfo; |
||||
|
import com.elink.esua.epdc.common.token.dto.TokenDto; |
||||
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.form.CompleteRequisiteInfoDTO; |
||||
|
import com.elink.esua.epdc.feign.CustomFeignClient; |
||||
|
import com.elink.esua.epdc.redis.AppUserRedis; |
||||
|
import com.elink.esua.epdc.service.CustomEnterpriseService; |
||||
|
import com.elink.esua.epdc.utils.WxMaServiceUtils; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import me.chanjar.weixin.common.error.WxErrorException; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* 企业认证 |
||||
|
* |
||||
|
* @author work@yujt.net.cn |
||||
|
* @date 2020/2/28 11:28 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class CustomEnterpriseServiceImpl implements CustomEnterpriseService { |
||||
|
|
||||
|
@Autowired |
||||
|
private AppUserRedis appUserRedis; |
||||
|
|
||||
|
@Autowired |
||||
|
private CustomFeignClient customFeignClient; |
||||
|
|
||||
|
@Autowired |
||||
|
private WxMaServiceUtils wxMaServiceUtils; |
||||
|
|
||||
|
@Override |
||||
|
public Result completeEnterpriseInfo(EnterpriseInfoFormDTO enterpriseInfoDTO) { |
||||
|
return customFeignClient.completeEnterpriseInfo(enterpriseInfoDTO); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Result<EnterpriseInfoResultDTO> selectOneEnterpriseInfo(String userId) { |
||||
|
return customFeignClient.getEnterpriseInfoByUserId(userId); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public Result completeRequisiteInfo(CompleteRequisiteInfoDTO fromDto, TokenDto tokenDto) { |
||||
|
// 验证手机号
|
||||
|
this.checkSmsCode(fromDto.getMobile(), fromDto.getSmsCode()); |
||||
|
fromDto.setUserId(tokenDto.getUserId()); |
||||
|
if (StringUtils.isNotBlank(fromDto.getWxCode())&&StringUtils.isNotBlank(fromDto.getIv())&&StringUtils.isNotBlank(fromDto.getEncryptedData())) { |
||||
|
String sessionKey = this.getUserSessionKey(fromDto.getWxCode()); |
||||
|
WxMaUserInfo wxMaUserInfo = wxMaServiceUtils.normalWxMaService().getUserService().getUserInfo(sessionKey, fromDto.getEncryptedData(), fromDto.getIv()); |
||||
|
if (StringUtils.isBlank(wxMaUserInfo.getUnionId())) { |
||||
|
return new Result().error("解析微信开放平台ID失败"); |
||||
|
} |
||||
|
fromDto.setWxUnionId(wxMaUserInfo.getUnionId()); |
||||
|
} |
||||
|
|
||||
|
return customFeignClient.completeRequisiteInfo(fromDto); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 校验手机验证码 |
||||
|
*/ |
||||
|
private void checkSmsCode(String mobile, String smsCode) { |
||||
|
String redisSmsCode = appUserRedis.getSmsCode(mobile); |
||||
|
if (StringUtils.isBlank(redisSmsCode) || !redisSmsCode.equals(smsCode)) { |
||||
|
throw new RenException("手机验证码错误"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据微信code获取session_key |
||||
|
* |
||||
|
* @return java.lang.String |
||||
|
* @params [code] |
||||
|
* @author liuchuang |
||||
|
* @since 2019/10/25 16:31 |
||||
|
*/ |
||||
|
private String getUserSessionKey(String code) { |
||||
|
try { |
||||
|
WxMaJscode2SessionResult wxMaJscode2SessionResult = wxMaServiceUtils.normalWxMaService().jsCode2SessionInfo(code); |
||||
|
if (wxMaJscode2SessionResult != null) { |
||||
|
return wxMaJscode2SessionResult.getSessionKey(); |
||||
|
} |
||||
|
} catch (WxErrorException e) { |
||||
|
e.printStackTrace(); |
||||
|
throw new RenException(e.getError().getErrorMsg()); |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,156 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.dto.enterprise; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 企业信息表 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-02-28 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EnterpriseInfoDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 6426517740744532420L; |
||||
|
|
||||
|
/** |
||||
|
* 主键 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 用户id |
||||
|
*/ |
||||
|
private String userId; |
||||
|
|
||||
|
/** |
||||
|
* 用户姓名 |
||||
|
*/ |
||||
|
private String realName; |
||||
|
|
||||
|
/** |
||||
|
* 性别 0女 1男 |
||||
|
*/ |
||||
|
private String sex; |
||||
|
|
||||
|
/** |
||||
|
* 联系电话 |
||||
|
*/ |
||||
|
private String mobile; |
||||
|
|
||||
|
/** |
||||
|
* 企业名称 |
||||
|
*/ |
||||
|
private String enterpriseName; |
||||
|
|
||||
|
/** |
||||
|
* 统一社会信用代码 |
||||
|
*/ |
||||
|
private String uniformSocialCreditCode; |
||||
|
|
||||
|
/** |
||||
|
* 企业地址 |
||||
|
*/ |
||||
|
private String enterpriseAddress; |
||||
|
|
||||
|
/** |
||||
|
* 法定代表人 |
||||
|
*/ |
||||
|
private String legalPerson; |
||||
|
|
||||
|
/** |
||||
|
* 注册资金(万元) |
||||
|
*/ |
||||
|
private Integer registeredCapital; |
||||
|
|
||||
|
/** |
||||
|
* 从业人数 |
||||
|
*/ |
||||
|
private Integer employedPopulation; |
||||
|
|
||||
|
/** |
||||
|
* 所属行业 |
||||
|
*/ |
||||
|
private String industry; |
||||
|
|
||||
|
/** |
||||
|
* 经营范围 |
||||
|
*/ |
||||
|
private String businessScope; |
||||
|
|
||||
|
/** |
||||
|
* 居住网格id |
||||
|
*/ |
||||
|
private Long deptId; |
||||
|
|
||||
|
/** |
||||
|
* 父所有部门 |
||||
|
*/ |
||||
|
private String parentDeptIds; |
||||
|
|
||||
|
/** |
||||
|
* 父所有部门 |
||||
|
*/ |
||||
|
private String parentDeptNames; |
||||
|
|
||||
|
/** |
||||
|
* 所有部门ID |
||||
|
*/ |
||||
|
private String allDeptIds; |
||||
|
|
||||
|
/** |
||||
|
* 所有部门名称 |
||||
|
*/ |
||||
|
private String allDeptNames; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 0:否,1:是 |
||||
|
*/ |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,75 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.dto.enterprise.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 企业信息完善表单 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-02-28 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EnterpriseInfoFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 6426517740744532420L; |
||||
|
|
||||
|
/** |
||||
|
* 主键 |
||||
|
*/ |
||||
|
@NotBlank(message = "ID不能为空") |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 用户id |
||||
|
*/ |
||||
|
private String userId; |
||||
|
|
||||
|
/** |
||||
|
* 法定代表人 |
||||
|
*/ |
||||
|
private String legalPerson; |
||||
|
|
||||
|
/** |
||||
|
* 注册资金(万元) |
||||
|
*/ |
||||
|
private Integer registeredCapital; |
||||
|
|
||||
|
/** |
||||
|
* 从业人数 |
||||
|
*/ |
||||
|
private Integer employedPopulation; |
||||
|
|
||||
|
/** |
||||
|
* 所属行业 |
||||
|
*/ |
||||
|
private String industry; |
||||
|
|
||||
|
/** |
||||
|
* 经营范围 |
||||
|
*/ |
||||
|
private String businessScope; |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,112 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.dto.enterprise.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 查询企业信息结果 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-02-28 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EnterpriseInfoResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 6426517740744532420L; |
||||
|
|
||||
|
/** |
||||
|
* 主键 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 用户id |
||||
|
*/ |
||||
|
private String userId; |
||||
|
|
||||
|
/** |
||||
|
* 用户姓名 |
||||
|
*/ |
||||
|
private String realName; |
||||
|
|
||||
|
/** |
||||
|
* 性别 0女 1男 |
||||
|
*/ |
||||
|
private String sex; |
||||
|
|
||||
|
/** |
||||
|
* 联系电话 |
||||
|
*/ |
||||
|
private String mobile; |
||||
|
|
||||
|
/** |
||||
|
* 企业名称 |
||||
|
*/ |
||||
|
private String enterpriseName; |
||||
|
|
||||
|
/** |
||||
|
* 统一社会信用代码 |
||||
|
*/ |
||||
|
private String uniformSocialCreditCode; |
||||
|
|
||||
|
/** |
||||
|
* 企业地址 |
||||
|
*/ |
||||
|
private String enterpriseAddress; |
||||
|
|
||||
|
/** |
||||
|
* 法定代表人 |
||||
|
*/ |
||||
|
private String legalPerson; |
||||
|
|
||||
|
/** |
||||
|
* 注册资金(万元) |
||||
|
*/ |
||||
|
private Integer registeredCapital; |
||||
|
|
||||
|
/** |
||||
|
* 从业人数 |
||||
|
*/ |
||||
|
private Integer employedPopulation; |
||||
|
|
||||
|
/** |
||||
|
* 所属行业 |
||||
|
*/ |
||||
|
private String industry; |
||||
|
|
||||
|
/** |
||||
|
* 经营范围 |
||||
|
*/ |
||||
|
private String businessScope; |
||||
|
|
||||
|
/** |
||||
|
* 居住网格id |
||||
|
*/ |
||||
|
private Long deptId; |
||||
|
/** |
||||
|
* 所有部门名称 |
||||
|
*/ |
||||
|
private String allDeptNames; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,73 @@ |
|||||
|
package com.elink.esua.epdc.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @author: qushutong |
||||
|
* @Date: 2020/2/28 13:36 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CompleteRequisiteInfoDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 1371157927862793721L; |
||||
|
|
||||
|
|
||||
|
@NotBlank(message = "姓名不能为空") |
||||
|
private String realName; |
||||
|
|
||||
|
/*** |
||||
|
*性别 0女 1男 |
||||
|
*/ |
||||
|
@NotBlank(message = "性别不能为空") |
||||
|
private String sex; |
||||
|
|
||||
|
@NotBlank(message = "联系电话电话不能为空") |
||||
|
private String mobile; |
||||
|
|
||||
|
@NotBlank(message = "企业名称不能为空") |
||||
|
private String enterpriseName; |
||||
|
|
||||
|
@NotBlank(message = "统一社会信用代码不能为空") |
||||
|
private String uniformSocialCreditCode; |
||||
|
|
||||
|
@NotBlank(message = "企业地址不能为空") |
||||
|
private String enterpriseAddress; |
||||
|
|
||||
|
@NotBlank(message = "居住网格ID不能为空") |
||||
|
private Long deptId; |
||||
|
|
||||
|
/** |
||||
|
* 企业id(修改时必填) |
||||
|
*/ |
||||
|
|
||||
|
private String id; |
||||
|
|
||||
|
@NotBlank(message = "手机号验证码不能为空") |
||||
|
private String smsCode; |
||||
|
|
||||
|
/** |
||||
|
* 微信code不能为空 |
||||
|
*/ |
||||
|
private String wxCode; |
||||
|
|
||||
|
/** |
||||
|
* 微信信息加密向量(用户unionid为空时传入) |
||||
|
*/ |
||||
|
private String iv; |
||||
|
|
||||
|
/** |
||||
|
* 微信加密数据(用户unionid为空时传入) |
||||
|
*/ |
||||
|
private String encryptedData; |
||||
|
|
||||
|
|
||||
|
private String userId; |
||||
|
|
||||
|
|
||||
|
private String wxUnionId; |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,125 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.enterprise.controller; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.elink.esua.epdc.dto.enterprise.EnterpriseInfoDTO; |
||||
|
import com.elink.esua.epdc.dto.enterprise.form.EnterpriseInfoFormDTO; |
||||
|
import com.elink.esua.epdc.dto.enterprise.result.EnterpriseInfoResultDTO; |
||||
|
import com.elink.esua.epdc.dto.form.CompleteRequisiteInfoDTO; |
||||
|
import com.elink.esua.epdc.modules.enterprise.excel.EnterpriseInfoExcel; |
||||
|
import com.elink.esua.epdc.modules.enterprise.service.EnterpriseInfoService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 企业信息表 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-02-28 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("enterpriseinfo") |
||||
|
public class EnterpriseInfoController { |
||||
|
|
||||
|
@Autowired |
||||
|
private EnterpriseInfoService enterpriseInfoService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<EnterpriseInfoDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<EnterpriseInfoDTO> page = enterpriseInfoService.page(params); |
||||
|
return new Result<PageData<EnterpriseInfoDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<EnterpriseInfoDTO> get(@PathVariable("id") String id){ |
||||
|
EnterpriseInfoDTO data = enterpriseInfoService.get(id); |
||||
|
return new Result<EnterpriseInfoDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody EnterpriseInfoDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
enterpriseInfoService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody EnterpriseInfoDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
enterpriseInfoService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
enterpriseInfoService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<EnterpriseInfoDTO> list = enterpriseInfoService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, EnterpriseInfoExcel.class); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/*** |
||||
|
* 完善企业信息,必填表单 |
||||
|
* @param |
||||
|
* @return Result<DeptOption> |
||||
|
* @author qushutong |
||||
|
* @date 2020/2/28 13:34 |
||||
|
*/ |
||||
|
@PostMapping("completeRequisiteInfo") |
||||
|
public Result completeRequisiteInfo(@RequestBody CompleteRequisiteInfoDTO fromDto) { |
||||
|
return enterpriseInfoService.completeRequisiteInfo(fromDto); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("completeSelectiveInfo") |
||||
|
public Result completeEnterpriseInfo(@RequestBody EnterpriseInfoFormDTO dto){ |
||||
|
ValidatorUtils.validateEntity(dto); |
||||
|
enterpriseInfoService.completeEnterpriseInfo(dto); |
||||
|
return new Result().ok(true); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("getByUserId/{userId}") |
||||
|
public Result<EnterpriseInfoResultDTO> getEnterpriseInfoByUserId(@PathVariable("userId") String userId){ |
||||
|
if(userId==null){ |
||||
|
return new Result().error("用户ID为空"); |
||||
|
} |
||||
|
EnterpriseInfoResultDTO enterpriseInfoDTO = enterpriseInfoService.selectOneEnterpriseInfo(userId); |
||||
|
return new Result<EnterpriseInfoResultDTO>().ok(enterpriseInfoDTO); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,53 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.enterprise.dao; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
||||
|
import com.elink.esua.epdc.dto.enterprise.EnterpriseInfoDTO; |
||||
|
import com.elink.esua.epdc.dto.enterprise.form.EnterpriseInfoFormDTO; |
||||
|
import com.elink.esua.epdc.dto.enterprise.result.EnterpriseInfoResultDTO; |
||||
|
import com.elink.esua.epdc.modules.enterprise.entity.EnterpriseInfoEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
/** |
||||
|
* 企业信息表 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-02-28 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface EnterpriseInfoDao extends BaseDao<EnterpriseInfoEntity> { |
||||
|
/** |
||||
|
* @Description 企业信息完善 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/2/28 |
||||
|
* @Param [enterpriseInfoDTO] |
||||
|
* @return void |
||||
|
**/ |
||||
|
void completeEnterpriseInfo(EnterpriseInfoFormDTO formDTO); |
||||
|
|
||||
|
/** |
||||
|
* @Description 查询企业信息 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/2/28 |
||||
|
* @Param [userId] |
||||
|
* @return com.elink.esua.epdc.dto.enterprise.result.EnterpriseInfoResultDTO |
||||
|
**/ |
||||
|
EnterpriseInfoResultDTO selectOneEnterpriseInfo(@Param("userId") String userId); |
||||
|
} |
||||
@ -0,0 +1,124 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.enterprise.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* 企业信息表 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-02-28 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
@TableName("epdc_enterprise_info") |
||||
|
public class EnterpriseInfoEntity extends BaseEpdcEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 178250149688071757L; |
||||
|
|
||||
|
/** |
||||
|
* 用户id |
||||
|
*/ |
||||
|
private String userId; |
||||
|
|
||||
|
/** |
||||
|
* 用户姓名 |
||||
|
*/ |
||||
|
private String realName; |
||||
|
|
||||
|
/** |
||||
|
* 性别 0女 1男 |
||||
|
*/ |
||||
|
private String sex; |
||||
|
|
||||
|
/** |
||||
|
* 联系电话 |
||||
|
*/ |
||||
|
private String mobile; |
||||
|
|
||||
|
/** |
||||
|
* 企业名称 |
||||
|
*/ |
||||
|
private String enterpriseName; |
||||
|
|
||||
|
/** |
||||
|
* 统一社会信用代码 |
||||
|
*/ |
||||
|
private String uniformSocialCreditCode; |
||||
|
|
||||
|
/** |
||||
|
* 企业地址 |
||||
|
*/ |
||||
|
private String enterpriseAddress; |
||||
|
|
||||
|
/** |
||||
|
* 法定代表人 |
||||
|
*/ |
||||
|
private String legalPerson; |
||||
|
|
||||
|
/** |
||||
|
* 注册资金(万元) |
||||
|
*/ |
||||
|
private Integer registeredCapital; |
||||
|
|
||||
|
/** |
||||
|
* 从业人数 |
||||
|
*/ |
||||
|
private Integer employedPopulation; |
||||
|
|
||||
|
/** |
||||
|
* 所属行业 |
||||
|
*/ |
||||
|
private String industry; |
||||
|
|
||||
|
/** |
||||
|
* 经营范围 |
||||
|
*/ |
||||
|
private String businessScope; |
||||
|
|
||||
|
/** |
||||
|
* 居住网格id |
||||
|
*/ |
||||
|
private Long deptId; |
||||
|
|
||||
|
/** |
||||
|
* 父所有部门 |
||||
|
*/ |
||||
|
private String parentDeptIds; |
||||
|
|
||||
|
/** |
||||
|
* 父所有部门 |
||||
|
*/ |
||||
|
private String parentDeptNames; |
||||
|
|
||||
|
/** |
||||
|
* 所有部门ID |
||||
|
*/ |
||||
|
private String allDeptIds; |
||||
|
|
||||
|
/** |
||||
|
* 所有部门名称 |
||||
|
*/ |
||||
|
private String allDeptNames; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,107 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.enterprise.excel; |
||||
|
|
||||
|
import cn.afterturn.easypoi.excel.annotation.Excel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 企业信息表 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-02-28 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EnterpriseInfoExcel { |
||||
|
|
||||
|
@Excel(name = "主键") |
||||
|
private String id; |
||||
|
|
||||
|
@Excel(name = "用户id") |
||||
|
private String userId; |
||||
|
|
||||
|
@Excel(name = "用户姓名") |
||||
|
private String realName; |
||||
|
|
||||
|
@Excel(name = "性别 0女 1男") |
||||
|
private String sex; |
||||
|
|
||||
|
@Excel(name = "联系电话") |
||||
|
private String mobile; |
||||
|
|
||||
|
@Excel(name = "企业名称") |
||||
|
private String enterpriseName; |
||||
|
|
||||
|
@Excel(name = "统一社会信用代码") |
||||
|
private String uniformSocialCreditCode; |
||||
|
|
||||
|
@Excel(name = "企业地址") |
||||
|
private String enterpriseAddress; |
||||
|
|
||||
|
@Excel(name = "法定代表人") |
||||
|
private String legalPerson; |
||||
|
|
||||
|
@Excel(name = "注册资金(万元)") |
||||
|
private Integer registeredCapital; |
||||
|
|
||||
|
@Excel(name = "从业人数") |
||||
|
private Integer employedPopulation; |
||||
|
|
||||
|
@Excel(name = "所属行业") |
||||
|
private String industry; |
||||
|
|
||||
|
@Excel(name = "经营范围") |
||||
|
private String businessScope; |
||||
|
|
||||
|
@Excel(name = "居住网格id") |
||||
|
private Long deptId; |
||||
|
|
||||
|
@Excel(name = "父所有部门") |
||||
|
private String parentDeptIds; |
||||
|
|
||||
|
@Excel(name = "父所有部门") |
||||
|
private String parentDeptNames; |
||||
|
|
||||
|
@Excel(name = "所有部门ID") |
||||
|
private String allDeptIds; |
||||
|
|
||||
|
@Excel(name = "所有部门名称") |
||||
|
private String allDeptNames; |
||||
|
|
||||
|
@Excel(name = "乐观锁") |
||||
|
private Integer revision; |
||||
|
|
||||
|
@Excel(name = "删除标识 0:否,1:是") |
||||
|
private String delFlag; |
||||
|
|
||||
|
@Excel(name = "创建人") |
||||
|
private String createdBy; |
||||
|
|
||||
|
@Excel(name = "创建时间") |
||||
|
private Date createdTime; |
||||
|
|
||||
|
@Excel(name = "更新人") |
||||
|
private String updatedBy; |
||||
|
|
||||
|
@Excel(name = "更新时间") |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,47 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.enterprise.redis; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* 企业信息表 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-02-28 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class EnterpriseInfoRedis { |
||||
|
@Autowired |
||||
|
private RedisUtils redisUtils; |
||||
|
|
||||
|
public void delete(Object[] ids) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void set(){ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public String get(String id){ |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,128 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.enterprise.service; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.enterprise.EnterpriseInfoDTO; |
||||
|
import com.elink.esua.epdc.dto.enterprise.form.EnterpriseInfoFormDTO; |
||||
|
import com.elink.esua.epdc.dto.enterprise.result.EnterpriseInfoResultDTO; |
||||
|
import com.elink.esua.epdc.dto.form.CompleteRequisiteInfoDTO; |
||||
|
import com.elink.esua.epdc.modules.enterprise.entity.EnterpriseInfoEntity; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 企业信息表 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-02-28 |
||||
|
*/ |
||||
|
public interface EnterpriseInfoService extends BaseService<EnterpriseInfoEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<EnterpriseInfoDTO> |
||||
|
* @author generator |
||||
|
* @date 2020-02-28 |
||||
|
*/ |
||||
|
PageData<EnterpriseInfoDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<EnterpriseInfoDTO> |
||||
|
* @author generator |
||||
|
* @date 2020-02-28 |
||||
|
*/ |
||||
|
List<EnterpriseInfoDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return EnterpriseInfoDTO |
||||
|
* @author generator |
||||
|
* @date 2020-02-28 |
||||
|
*/ |
||||
|
EnterpriseInfoDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-02-28 |
||||
|
*/ |
||||
|
void save(EnterpriseInfoDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-02-28 |
||||
|
*/ |
||||
|
void update(EnterpriseInfoDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-02-28 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
|
||||
|
/** |
||||
|
* @Description 企业信息完善 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/2/28 |
||||
|
* @Param [enterpriseInfoDTO] |
||||
|
* @return void |
||||
|
**/ |
||||
|
void completeEnterpriseInfo(EnterpriseInfoFormDTO enterpriseInfoFormDTO); |
||||
|
|
||||
|
/** |
||||
|
* @Description 查询企业信息 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/2/28 |
||||
|
* @Param [userId] |
||||
|
* @return com.elink.esua.epdc.dto.enterprise.result.EnterpriseInfoResultDTO |
||||
|
**/ |
||||
|
EnterpriseInfoResultDTO selectOneEnterpriseInfo(String userId); |
||||
|
|
||||
|
|
||||
|
/*** |
||||
|
* 完善企业信息,必填表单 |
||||
|
* @param |
||||
|
* @return |
||||
|
* @author qushutong |
||||
|
* @date 2020/2/28 13:44 |
||||
|
*/ |
||||
|
Result completeRequisiteInfo(CompleteRequisiteInfoDTO fromDto); |
||||
|
} |
||||
@ -0,0 +1,156 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.enterprise.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; |
||||
|
import com.elink.esua.epdc.dto.enterprise.EnterpriseInfoDTO; |
||||
|
import com.elink.esua.epdc.dto.enterprise.form.EnterpriseInfoFormDTO; |
||||
|
import com.elink.esua.epdc.dto.enterprise.result.EnterpriseInfoResultDTO; |
||||
|
import com.elink.esua.epdc.dto.epdc.form.CompleteRequisiteUserInfoDTO; |
||||
|
import com.elink.esua.epdc.dto.form.CompleteRequisiteInfoDTO; |
||||
|
import com.elink.esua.epdc.modules.enterprise.dao.EnterpriseInfoDao; |
||||
|
import com.elink.esua.epdc.modules.enterprise.entity.EnterpriseInfoEntity; |
||||
|
import com.elink.esua.epdc.modules.enterprise.redis.EnterpriseInfoRedis; |
||||
|
import com.elink.esua.epdc.modules.enterprise.service.EnterpriseInfoService; |
||||
|
import com.elink.esua.epdc.modules.feign.AdminFeignClient; |
||||
|
import com.elink.esua.epdc.modules.feign.UserFeignClient; |
||||
|
import io.seata.spring.annotation.GlobalTransactional; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 企业信息表 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-02-28 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoDao, EnterpriseInfoEntity> implements EnterpriseInfoService { |
||||
|
|
||||
|
@Autowired |
||||
|
private EnterpriseInfoRedis enterpriseInfoRedis; |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
private AdminFeignClient adminFeignClient; |
||||
|
|
||||
|
@Autowired |
||||
|
private UserFeignClient userFeignClient; |
||||
|
|
||||
|
@Override |
||||
|
public PageData<EnterpriseInfoDTO> page(Map<String, Object> params) { |
||||
|
IPage<EnterpriseInfoEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, EnterpriseInfoDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<EnterpriseInfoDTO> list(Map<String, Object> params) { |
||||
|
List<EnterpriseInfoEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, EnterpriseInfoDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<EnterpriseInfoEntity> getWrapper(Map<String, Object> params) { |
||||
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<EnterpriseInfoEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
|
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public EnterpriseInfoDTO get(String id) { |
||||
|
EnterpriseInfoEntity entity = baseDao.selectById(id); |
||||
|
return ConvertUtils.sourceToTarget(entity, EnterpriseInfoDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(EnterpriseInfoDTO dto) { |
||||
|
EnterpriseInfoEntity entity = ConvertUtils.sourceToTarget(dto, EnterpriseInfoEntity.class); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(EnterpriseInfoDTO dto) { |
||||
|
EnterpriseInfoEntity entity = ConvertUtils.sourceToTarget(dto, EnterpriseInfoEntity.class); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void completeEnterpriseInfo(EnterpriseInfoFormDTO enterpriseInfoFormDTO) { |
||||
|
baseDao.completeEnterpriseInfo(enterpriseInfoFormDTO); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public EnterpriseInfoResultDTO selectOneEnterpriseInfo(String userId) { |
||||
|
return baseDao.selectOneEnterpriseInfo(userId); |
||||
|
} |
||||
|
|
||||
|
@GlobalTransactional |
||||
|
@Override |
||||
|
public Result completeRequisiteInfo(CompleteRequisiteInfoDTO fromDto) { |
||||
|
//保存到企业数据库
|
||||
|
EnterpriseInfoDTO enterpriseInfoDTO = ConvertUtils.sourceToTarget(fromDto, EnterpriseInfoDTO.class); |
||||
|
Result<ParentAndAllDeptDTO> parentResult = adminFeignClient.getParentAndAllDept(String.valueOf(fromDto.getDeptId())); |
||||
|
if (!parentResult.success() || parentResult.getData() == null) { |
||||
|
throw new RenException("获取部门信息失败"); |
||||
|
} else { |
||||
|
ParentAndAllDeptDTO deptDTO = parentResult.getData(); |
||||
|
enterpriseInfoDTO.setAllDeptIds(deptDTO.getAllDeptIds()); |
||||
|
enterpriseInfoDTO.setAllDeptNames(deptDTO.getAllDeptNames()); |
||||
|
enterpriseInfoDTO.setParentDeptIds(deptDTO.getParentDeptIds()); |
||||
|
enterpriseInfoDTO.setParentDeptNames(deptDTO.getParentDeptNames()); |
||||
|
} |
||||
|
save(enterpriseInfoDTO); |
||||
|
//更新用户表数据
|
||||
|
CompleteRequisiteUserInfoDTO userInfoDTO = ConvertUtils.sourceToTarget(fromDto, CompleteRequisiteUserInfoDTO.class); |
||||
|
userInfoDTO.setDwellingPlace(enterpriseInfoDTO.getEnterpriseAddress()); |
||||
|
userInfoDTO.setNickName(parentResult.getData().getGrid()+"-"+ fromDto.getRealName().substring(NumConstant.ZERO, NumConstant.ONE) |
||||
|
+ (Integer.parseInt(fromDto.getSex()) == NumConstant.ZERO ? "女士" : "先生")); |
||||
|
userFeignClient.completeRequisiteInfo(userInfoDTO); |
||||
|
return new Result(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,42 @@ |
|||||
|
package com.elink.esua.epdc.modules.feign; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; |
||||
|
import com.elink.esua.epdc.modules.feign.fallback.AdminFeignClientFallback; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author yujintao |
||||
|
* @email yujintao@elink-cn.com |
||||
|
* @date 2019/9/5 14:44 |
||||
|
*/ |
||||
|
@FeignClient(name = ServiceConstant.EPDC_ADMIN_SERVER, fallback = AdminFeignClientFallback.class) |
||||
|
public interface AdminFeignClient { |
||||
|
|
||||
|
/** |
||||
|
* 根据部门ID,获取下属所有网格ID |
||||
|
* |
||||
|
* @param pid |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < java.lang.Long>> |
||||
|
* @author yujintao |
||||
|
* @date 2019/9/5 14:49 |
||||
|
*/ |
||||
|
@GetMapping("/sys/dept/listGridId/{pid}") |
||||
|
Result<List<Long>> listGridIdByDeptPid(@PathVariable("pid") Long pid); |
||||
|
|
||||
|
/** |
||||
|
* 根据部门ID获取上级所有部门信息 |
||||
|
* |
||||
|
* @param deptId |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<ParentAndAllDeptDTO> |
||||
|
* @author gp |
||||
|
* @date 2019-11-29 |
||||
|
*/ |
||||
|
@GetMapping("/sys/dept/getParentAndAllDept/{deptId}") |
||||
|
Result<ParentAndAllDeptDTO> getParentAndAllDept(@PathVariable("deptId") String deptId); |
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
package com.elink.esua.epdc.modules.feign; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.epdc.form.CompleteRequisiteUserInfoDTO; |
||||
|
import com.elink.esua.epdc.modules.feign.fallback.UserFeignClientFallback; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
|
||||
|
/** |
||||
|
* @author: qushutong |
||||
|
* @Date: 2020/2/28 14:41 |
||||
|
* @Description: 更新用户 |
||||
|
*/ |
||||
|
@FeignClient(name = ServiceConstant.EPDC_USER_SERVER, fallback = UserFeignClientFallback.class) |
||||
|
public interface UserFeignClient { |
||||
|
|
||||
|
/*** |
||||
|
* 更新用户 |
||||
|
* @param |
||||
|
* @return Result<List<Long>> |
||||
|
* @author qushutong |
||||
|
* @date 2020/2/28 14:43 |
||||
|
*/ |
||||
|
@PostMapping("app-user/epdc-app/user/completeRequisiteInfo") |
||||
|
Result completeRequisiteInfo(@RequestBody CompleteRequisiteUserInfoDTO fromDto); |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
package com.elink.esua.epdc.modules.feign.fallback; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; |
||||
|
import com.elink.esua.epdc.modules.feign.AdminFeignClient; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author yujintao |
||||
|
* @email yujintao@elink-cn.com |
||||
|
* @date 2019/9/5 14:44 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class AdminFeignClientFallback implements AdminFeignClient { |
||||
|
|
||||
|
@Override |
||||
|
public Result<List<Long>> listGridIdByDeptPid(Long pid) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER, "listGridIdByDeptPid", pid); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Result<ParentAndAllDeptDTO> getParentAndAllDept(String depId) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER, "getParentAndAllDept", depId); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
package com.elink.esua.epdc.modules.feign.fallback; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.epdc.form.CompleteRequisiteUserInfoDTO; |
||||
|
import com.elink.esua.epdc.dto.form.CompleteRequisiteInfoDTO; |
||||
|
import com.elink.esua.epdc.modules.feign.UserFeignClient; |
||||
|
|
||||
|
public class UserFeignClientFallback implements UserFeignClient { |
||||
|
|
||||
|
@Override |
||||
|
public Result completeRequisiteInfo(CompleteRequisiteUserInfoDTO fromDto) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.EPDC_USER_SERVER, "completeRequisiteInfo", fromDto); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,44 @@ |
|||||
|
<?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="com.elink.esua.epdc.modules.enterprise.dao.EnterpriseInfoDao"> |
||||
|
|
||||
|
|
||||
|
<resultMap id="enterpriseInfoMap" type="com.elink.esua.epdc.dto.enterprise.result.EnterpriseInfoResultDTO"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="userId" column="USER_ID"/> |
||||
|
<result property="realName" column="REAL_NAME"/> |
||||
|
<result property="sex" column="SEX"/> |
||||
|
<result property="mobile" column="MOBILE"/> |
||||
|
<result property="enterpriseName" column="ENTERPRISE_NAME"/> |
||||
|
<result property="uniformSocialCreditCode" column="UNIFORM_SOCIAL_CREDIT_CODE"/> |
||||
|
<result property="enterpriseAddress" column="ENTERPRISE_ADDRESS"/> |
||||
|
<result property="legalPerson" column="LEGAL_PERSON"/> |
||||
|
<result property="registeredCapital" column="REGISTERED_CAPITAL"/> |
||||
|
<result property="employedPopulation" column="EMPLOYED_POPULATION"/> |
||||
|
<result property="industry" column="INDUSTRY"/> |
||||
|
<result property="businessScope" column="BUSINESS_SCOPE"/> |
||||
|
<result property="deptId" column="DEPT_ID"/> |
||||
|
<result property="allDeptNames" column="ALL_DEPT_NAMES"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
<update id="completeEnterpriseInfo" parameterType="com.elink.esua.epdc.dto.enterprise.form.EnterpriseInfoFormDTO"> |
||||
|
UPDATE epdc_enterprise_info |
||||
|
<trim prefix="set" suffixOverrides=","> |
||||
|
<if test="legalPerson != null and legalPerson != ''">LEGAL_PERSON=#{legalPerson},</if> |
||||
|
<if test="registeredCapital != null and registeredCapital != 0">REGISTERED_CAPITAL=#{registeredCapital},</if> |
||||
|
<if test="employedPopulation != null and employedPopulation != 0">EMPLOYED_POPULATION=#{employedPopulation},</if> |
||||
|
<if test="industry != null and industry != ''">INDUSTRY=#{industry},</if> |
||||
|
<if test="businessScope != null and businessScope != ''">BUSINESS_SCOPE=#{businessScope},</if> |
||||
|
</trim> |
||||
|
WHERE ID=#{id} |
||||
|
</update> |
||||
|
|
||||
|
<select id="selectOneEnterpriseInfo" resultMap="enterpriseInfoMap"> |
||||
|
select t.ID,t.USER_ID,t.REAL_NAME,t.SEX,MOBILE,t.ENTERPRISE_NAME,t.UNIFORM_SOCIAL_CREDIT_CODE,t.ENTERPRISE_ADDRESS, |
||||
|
t.LEGAL_PERSON,t.REGISTERED_CAPITAL,t.EMPLOYED_POPULATION,t.INDUSTRY,t.BUSINESS_SCOPE,t.DEPT_ID,t.ALL_DEPT_NAMES |
||||
|
from epdc_enterprise_info t |
||||
|
where t.USER_ID = #{userId} |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
||||
@ -0,0 +1,35 @@ |
|||||
|
package com.elink.esua.epdc.dto.epdc.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @author: qushutong |
||||
|
* @Date: 2020/2/28 13:36 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CompleteRequisiteUserInfoDTO implements Serializable { |
||||
|
private static final long serialVersionUID = -6935440742503633316L; |
||||
|
|
||||
|
|
||||
|
private String realName; |
||||
|
|
||||
|
|
||||
|
private String mobile; |
||||
|
|
||||
|
private Long deptId; |
||||
|
|
||||
|
|
||||
|
private String userId; |
||||
|
|
||||
|
private String dwellingPlace; |
||||
|
|
||||
|
private String wxUnionId; |
||||
|
|
||||
|
private String nickName; |
||||
|
|
||||
|
|
||||
|
} |
||||
Loading…
Reference in new issue