提交 88a5de55 作者: zhenjie

企业认证和合作加盟

上级 f6eece08
...@@ -29,6 +29,5 @@ public class CooperationTagVO implements Serializable { ...@@ -29,6 +29,5 @@ public class CooperationTagVO implements Serializable {
@ApiModelProperty(value = "合作标签描述") @ApiModelProperty(value = "合作标签描述")
private String tagDescription; private String tagDescription;
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
} }
...@@ -36,7 +36,7 @@ public class UserApplyTagVO implements Serializable { ...@@ -36,7 +36,7 @@ public class UserApplyTagVO implements Serializable {
@ApiModelProperty(value = "申请人手机号") @ApiModelProperty(value = "申请人手机号")
@NotBlank(message = "申请人手机号不能为空", groups = { Insert.class }) @NotBlank(message = "申请人手机号不能为空", groups = { Insert.class })
private String applyPhone; private String applyPhone;
@ApiModelProperty(value = "申请审核状态") @ApiModelProperty(value = "申请审核状态,0待审核,1通过,2未通过")
private Integer applyStatus; private Integer applyStatus;
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;
......
...@@ -11,7 +11,8 @@ public enum ResultEnum implements BaseErrorInfoInterface{ ...@@ -11,7 +11,8 @@ public enum ResultEnum implements BaseErrorInfoInterface{
//企业认证 //企业认证
BUSINESS_LICENSE_CHECK_ANALYSIS_ERROR("1000", "营业执照解析失败,请上传有效清晰的执照"), BUSINESS_LICENSE_CHECK_ANALYSIS_ERROR("1000", "营业执照解析失败,请上传有效清晰的执照"),
BUSINESS_LICENSE_CHECK_PARAMETER_ERROR("30401", "企业信息与营业执照信息不一致,请重新上传"), COMPANY_NOT_AUTH_ERROR("1001", "未进行企业认证"),
BUSINESS_LICENSE_CHECK_PARAMETER_ERROR("1002", "企业信息与营业执照信息不一致,请重新上传"),
APPLET_PORT_TYPE_ERROR("7001", "小程序端口类型错误"), APPLET_PORT_TYPE_ERROR("7001", "小程序端口类型错误"),
APPLET_LOGIN_ERROR("7002", "获取小程序登录失败"); APPLET_LOGIN_ERROR("7002", "获取小程序登录失败");
......
...@@ -28,4 +28,13 @@ public class UserSystemConstant { ...@@ -28,4 +28,13 @@ public class UserSystemConstant {
@Value("${wx.sub.secret}") @Value("${wx.sub.secret}")
private String wxSubSecret; private String wxSubSecret;
@Value("${third-party.ali.app-code}")
private String aliAppCode;
@Value("${third-party.qcc.app-key}")
private String qccAppKey;
@Value("${third-party.qcc.secret-key}")
private String qccSecretKey;
} }
...@@ -23,7 +23,7 @@ public class CooperationController { ...@@ -23,7 +23,7 @@ public class CooperationController {
private CooperationService cooperationService; private CooperationService cooperationService;
@ApiOperation(value = "加盟标签列表") @ApiOperation(value = "加盟标签列表")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ResultBody.class) }) @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = CooperationTagVO.class) })
@GetMapping("listTag") @GetMapping("listTag")
public ResultBody listTag() { public ResultBody listTag() {
return cooperationService.listTag(); return cooperationService.listTag();
......
...@@ -23,4 +23,17 @@ public interface CooperationDao { ...@@ -23,4 +23,17 @@ public interface CooperationDao {
* @param userApplyTagDO * @param userApplyTagDO
*/ */
void addApply(UserApplyTagDO userApplyTagDO); void addApply(UserApplyTagDO userApplyTagDO);
/**
* 根据用户id获取合作申请
* @param userAccountId
* @return
*/
UserApplyTagDO getUserApplyTag(Integer userAccountId);
/**
* 修改用户申请
* @param userApplyTagDO
*/
void updateUserApplyTag(UserApplyTagDO userApplyTagDO);
} }
...@@ -8,7 +8,16 @@ import com.mmc.iuav.user.model.vo.UserApplyTagVO; ...@@ -8,7 +8,16 @@ import com.mmc.iuav.user.model.vo.UserApplyTagVO;
* @Date: 2023/5/17 21:19 * @Date: 2023/5/17 21:19
*/ */
public interface CooperationService { public interface CooperationService {
/**
* 加盟标签列表
* @return
*/
ResultBody listTag(); ResultBody listTag();
/**
* 用户申请加盟
* @param cooperationTagVO
* @return
*/
ResultBody apply(UserApplyTagVO cooperationTagVO); ResultBody apply(UserApplyTagVO cooperationTagVO);
} }
package com.mmc.iuav.user.service.impl; package com.mmc.iuav.user.service.impl;
import com.mmc.iuav.response.ResultBody; import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.response.ResultEnum;
import com.mmc.iuav.user.dao.CompanyAuthDao;
import com.mmc.iuav.user.dao.CooperationDao; import com.mmc.iuav.user.dao.CooperationDao;
import com.mmc.iuav.user.entity.CompanyAuthDO;
import com.mmc.iuav.user.entity.CooperationTagDO; import com.mmc.iuav.user.entity.CooperationTagDO;
import com.mmc.iuav.user.entity.UserApplyTagDO; import com.mmc.iuav.user.entity.UserApplyTagDO;
import com.mmc.iuav.user.model.vo.CooperationTagVO; import com.mmc.iuav.user.model.vo.CooperationTagVO;
...@@ -22,6 +25,9 @@ public class CooperationServiceImpl implements CooperationService { ...@@ -22,6 +25,9 @@ public class CooperationServiceImpl implements CooperationService {
@Autowired @Autowired
private CooperationDao cooperationDao; private CooperationDao cooperationDao;
@Autowired
private CompanyAuthDao companyAuthDao;
@Override @Override
public ResultBody listTag() { public ResultBody listTag() {
List<CooperationTagDO> list = cooperationDao.listTags(); List<CooperationTagDO> list = cooperationDao.listTags();
...@@ -31,7 +37,26 @@ public class CooperationServiceImpl implements CooperationService { ...@@ -31,7 +37,26 @@ public class CooperationServiceImpl implements CooperationService {
@Override @Override
public ResultBody apply(UserApplyTagVO userApplyTagVO) { public ResultBody apply(UserApplyTagVO userApplyTagVO) {
//判断企业认证
CompanyAuthDO companyAuthDO = companyAuthDao.getCompanyAuth(userApplyTagVO.getUserAccountId());
if (companyAuthDO == null) {
return ResultBody.error(ResultEnum.COMPANY_NOT_AUTH_ERROR);
}
UserApplyTagDO userApplyTagDO = new UserApplyTagDO(userApplyTagVO); UserApplyTagDO userApplyTagDO = new UserApplyTagDO(userApplyTagVO);
//判断是否已加盟
UserApplyTagDO existUserApplyTagDO = cooperationDao.getUserApplyTag(userApplyTagVO.getUserAccountId());
if (existUserApplyTagDO != null) {
if (existUserApplyTagDO.getApplyStatus().equals(0)){
return ResultBody.error("已存在合作申请,待审核");
}else if (existUserApplyTagDO.getApplyStatus().equals(1)){
return ResultBody.success("已申请通过");
}else {
userApplyTagDO.setId(existUserApplyTagDO.getId());
userApplyTagDO.setApplyStatus(0);
cooperationDao.updateUserApplyTag(userApplyTagDO);
return ResultBody.success();
}
}
cooperationDao.addApply(userApplyTagDO); cooperationDao.addApply(userApplyTagDO);
return ResultBody.success(); return ResultBody.success();
} }
......
...@@ -6,10 +6,10 @@ import com.fasterxml.jackson.core.JsonProcessingException; ...@@ -6,10 +6,10 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.mmc.iuav.http.HttpHelper; import com.mmc.iuav.http.HttpHelper;
import com.mmc.iuav.http.HttpsRequestUtil; import com.mmc.iuav.http.HttpsRequestUtil;
import com.mmc.iuav.user.constant.UserSystemConstant;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpHead; import org.apache.http.client.methods.HttpHead;
import org.apache.http.util.EntityUtils; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
...@@ -25,8 +25,8 @@ import java.util.regex.Pattern; ...@@ -25,8 +25,8 @@ import java.util.regex.Pattern;
@Component @Component
public class QccEntAuthUtil { public class QccEntAuthUtil {
private static final String APP_KEY = "5015e664848d406ab1ca4b505c3da803"; @Autowired
private static final String SECRET_KEY = "7C4DB8CCECC148175E46392CC0A1B410"; private UserSystemConstant userSystemConstant;
public String fuzzySearch(String searchKey) { public String fuzzySearch(String searchKey) {
String reqInterNme = "http://api.qichacha.com/FuzzySearch/GetList"; String reqInterNme = "http://api.qichacha.com/FuzzySearch/GetList";
...@@ -42,7 +42,7 @@ public class QccEntAuthUtil { ...@@ -42,7 +42,7 @@ public class QccEntAuthUtil {
reqHeader.setHeader("Accept", "application/json; charset=UTF-8"); reqHeader.setHeader("Accept", "application/json; charset=UTF-8");
reqHeader.setHeader("Accept-language", "zh-CN,zh;q=0.9"); reqHeader.setHeader("Accept-language", "zh-CN,zh;q=0.9");
reqHeader.setHeader("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); reqHeader.setHeader("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
final String reqUri = reqInterNme.concat("?key=").concat(APP_KEY).concat("&searchKey=").concat(searchKey).concat("&pageSize=6"); final String reqUri = reqInterNme.concat("?key=").concat(userSystemConstant.getQccAppKey()).concat("&searchKey=").concat(searchKey).concat("&pageSize=6");
String tokenJson = HttpHelper.httpGet(reqUri, reqHeader.getAllHeaders()); String tokenJson = HttpHelper.httpGet(reqUri, reqHeader.getAllHeaders());
return tokenJson; return tokenJson;
} catch (Exception e1) { } catch (Exception e1) {
...@@ -60,7 +60,7 @@ public class QccEntAuthUtil { ...@@ -60,7 +60,7 @@ public class QccEntAuthUtil {
reqHeader.setHeader("Token", autherHeader[0]); reqHeader.setHeader("Token", autherHeader[0]);
reqHeader.setHeader("Timespan", autherHeader[1]); reqHeader.setHeader("Timespan", autherHeader[1]);
String verifyType = "1"; String verifyType = "1";
final String reqUri = reqInterNme.concat("?key=").concat(APP_KEY).concat("&verifyName=").concat(companyName).concat("&creditCode=").concat(creditCode).concat("&verifyType=").concat(verifyType); final String reqUri = reqInterNme.concat("?key=").concat(userSystemConstant.getQccAppKey()).concat("&verifyName=").concat(companyName).concat("&creditCode=").concat(creditCode).concat("&verifyType=").concat(verifyType);
String tokenJson = HttpHelper.httpGet(reqUri, reqHeader.getAllHeaders()); String tokenJson = HttpHelper.httpGet(reqUri, reqHeader.getAllHeaders());
status = FormartJson(tokenJson, "Status"); status = FormartJson(tokenJson, "Status");
if (!HttpCodeRegex.isAbnornalRequest(status)) { if (!HttpCodeRegex.isAbnornalRequest(status)) {
...@@ -98,7 +98,7 @@ public class QccEntAuthUtil { ...@@ -98,7 +98,7 @@ public class QccEntAuthUtil {
String url = "https://bizlicense.market.alicloudapi.com/rest/160601/ocr/ocr_business_license.json"; String url = "https://bizlicense.market.alicloudapi.com/rest/160601/ocr/ocr_business_license.json";
String method = "POST"; String method = "POST";
Map<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new HashMap<String, String>();
headers.put("Authorization", "APPCODE " + "524b1864a88f47458c1061bae3811570"); headers.put("Authorization", "APPCODE " + userSystemConstant.getAliAppCode());
headers.put("Content-Type", "application/json; charset=UTF-8"); headers.put("Content-Type", "application/json; charset=UTF-8");
Map<String, String> querys = new HashMap<String, String>(); Map<String, String> querys = new HashMap<String, String>();
String bodys = "{\"image\":\""+businessLicenseUrl+"\"}"; String bodys = "{\"image\":\""+businessLicenseUrl+"\"}";
...@@ -130,9 +130,9 @@ public class QccEntAuthUtil { ...@@ -130,9 +130,9 @@ public class QccEntAuthUtil {
* 获取Auth Code * 获取Auth Code
* @return * @return
*/ */
protected static final String[] RandomAuthentHeader() { protected String[] RandomAuthentHeader() {
String timeSpan = String.valueOf(System.currentTimeMillis() / 1000); String timeSpan = String.valueOf(System.currentTimeMillis() / 1000);
String[] authentHeaders = new String[] { DigestUtils.md5Hex(APP_KEY.concat(timeSpan).concat(SECRET_KEY)).toUpperCase(), timeSpan }; String[] authentHeaders = new String[] { DigestUtils.md5Hex(userSystemConstant.getQccAppKey().concat(timeSpan).concat(userSystemConstant.getQccSecretKey())).toUpperCase(), timeSpan };
return authentHeaders; return authentHeaders;
} }
......
...@@ -42,6 +42,8 @@ spring: ...@@ -42,6 +42,8 @@ spring:
enabled: true enabled: true
login-username: druid login-username: druid
login-password: druid login-password: druid
jackson:
date-format: yyyy-MM-dd HH:mm:ss
#mybatis #mybatis
mybatis: mybatis:
...@@ -61,4 +63,11 @@ wx: ...@@ -61,4 +63,11 @@ wx:
miniprogram-state: trial miniprogram-state: trial
env-version: trial env-version: trial
token-path: /userservlet/wechat/getAppletUserAccessToken token-path: /userservlet/wechat/getAppletUserAccessToken
port: user port: user
\ No newline at end of file
third-party:
ali:
app-code: 524b1864a88f47458c1061bae3811570
qcc:
app-key: 5015e664848d406ab1ca4b505c3da803
secret-key: 7C4DB8CCECC148175E46392CC0A1B410
\ No newline at end of file
...@@ -61,4 +61,11 @@ wx: ...@@ -61,4 +61,11 @@ wx:
miniprogram-state: trial miniprogram-state: trial
env-version: trial env-version: trial
token-path: /userservlet/wechat/getAppletUserAccessToken token-path: /userservlet/wechat/getAppletUserAccessToken
port: user port: user
\ No newline at end of file
third-party:
ali:
app-code: 524b1864a88f47458c1061bae3811570
qcc:
app-key: 5015e664848d406ab1ca4b505c3da803
secret-key: 7C4DB8CCECC148175E46392CC0A1B410
\ No newline at end of file
spring: spring:
profiles: profiles:
active: test active: dev
--- ---
......
...@@ -9,7 +9,38 @@ ...@@ -9,7 +9,38 @@
values(#{cooperationTagId}, #{userAccountId}, #{applyName}, #{applyPhone}, #{remark}, NOW()) values(#{cooperationTagId}, #{userAccountId}, #{applyName}, #{applyPhone}, #{remark}, NOW())
</insert> </insert>
<update id="updateUserApplyTag" parameterType="com.mmc.iuav.user.entity.UserApplyTagDO">
UPDATE user_apply_tag
<set>
<if test="cooperationTagId != null">
cooperation_tag_id = #{cooperationTagId},
</if>
<if test="userAccountId != null">
user_account_id = #{userAccountId},
</if>
<if test="applyName != null">
apply_name = #{applyName},
</if>
<if test="applyPhone != null">
apply_phone = #{applyPhone},
</if>
<if test="applyStatus != null">
apply_status = #{applyStatus},
</if>
<if test="remark != null">
remark = #{remark},
</if>
</set>
WHERE id = #{id};
</update>
<select id="listTags" resultType="com.mmc.iuav.user.entity.CooperationTagDO"> <select id="listTags" resultType="com.mmc.iuav.user.entity.CooperationTagDO">
select id, tag_name, tag_img, tag_description, create_time from cooperation_tag select id, tag_name, tag_img, tag_description, create_time from cooperation_tag
</select> </select>
<select id="getUserApplyTag" resultType="com.mmc.iuav.user.entity.UserApplyTagDO">
select id, cooperation_tag_id, user_account_id, apply_name, apply_phone, apply_status, remark, create_time
from user_apply_tag
where user_account_id = #{userAccountId} and is_deleted = 0
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论