feat():管理员审核通过调用建木地址生成mysql服务
parent
e58f2a2cf1
commit
e445fd5d26
|
@ -17,6 +17,7 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-core</artifactId>
|
||||
|
|
|
@ -38,7 +38,7 @@ public class Enterprise extends BaseEntity {
|
|||
/** 主键 */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "主键", value = "主键")
|
||||
private String id;
|
||||
private Integer id;
|
||||
|
||||
/** 企业名称 */
|
||||
@Excel(name = "企业名称")
|
||||
|
@ -169,11 +169,10 @@ public class Enterprise extends BaseEntity {
|
|||
/**
|
||||
* 修改构造器
|
||||
*/
|
||||
public static Enterprise editBuild(String id, EnterpriseEditReq enterpriseEditReq){
|
||||
public static Enterprise editBuild(Integer id, EnterpriseEditReq enterpriseEditReq){
|
||||
return Enterprise.builder()
|
||||
.id(id)
|
||||
.ebterpriseName(enterpriseEditReq.getEbterpriseName())
|
||||
.legalPerson(enterpriseEditReq.getLegalPerson())
|
||||
.ebterpriseName(enterpriseEditReq.getEbterpriseName()) .legalPerson(enterpriseEditReq.getLegalPerson())
|
||||
.businessLincenseNumber(enterpriseEditReq.getBusinessLincenseNumber())
|
||||
.estabinessDate(enterpriseEditReq.getEstabinessDate())
|
||||
.businessScope(enterpriseEditReq.getBusinessScope())
|
||||
|
|
|
@ -9,6 +9,7 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* 车辆运营平台对象 enterprise
|
||||
|
|
|
@ -17,18 +17,6 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-openfeign-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -157,7 +157,7 @@ public class EnterpriseController extends BaseController {
|
|||
@Log(title = "车辆运营平台", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation("修改车辆运营平台")
|
||||
public Result<String> edit(@PathVariable String id, @RequestBody EnterpriseEditReq enterpriseEditReq) {
|
||||
public Result<String> edit(@PathVariable Integer id, @RequestBody EnterpriseEditReq enterpriseEditReq) {
|
||||
return toAjax(enterpriseService.updateById(Enterprise.editBuild(id,enterpriseEditReq)));
|
||||
}
|
||||
|
||||
|
@ -182,4 +182,21 @@ public class EnterpriseController extends BaseController {
|
|||
|
||||
return toAjax(enterpriseService.removeBatchByIds(ids));
|
||||
}
|
||||
|
||||
@PostMapping("/updateEnterprise/{id}")
|
||||
public Result<String> updateEnterprise(@PathVariable Integer id, @RequestBody EnterpriseEditReq enterpriseEditReq) {
|
||||
return toAjax(enterpriseService.updateById(Enterprise.editBuild(id,enterpriseEditReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 企业认证
|
||||
*/
|
||||
@PostMapping("/authentication")
|
||||
public Result<String> authentication(@RequestBody Enterprise enterprise ) {
|
||||
enterpriseService.authentication(enterprise);
|
||||
if(!enterprise.getEnterpriseStatus().equals("Y")){
|
||||
return Result.error("已经审核完成");
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.net.working.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.net.working.domain.Enterprise;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -13,4 +14,6 @@ import org.apache.ibatis.annotations.Param;
|
|||
public interface EnterpriseMapper extends BaseMapper<Enterprise> {
|
||||
|
||||
Enterprise selectByName(@Param("name") String name);
|
||||
|
||||
void authentication(Enterprise enterprise);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.muyu.net.working.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.net.working.domain.Enterprise;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
|
@ -20,4 +22,6 @@ public interface EnterpriseService extends IService<Enterprise> {
|
|||
List<Enterprise> list(Enterprise enterprise);
|
||||
|
||||
Enterprise selectByName(String name);
|
||||
|
||||
void authentication(Enterprise enterprise);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
package com.muyu.net.working.service.impl;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.ObjUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -95,10 +104,6 @@ public class EnterpriseServiceImpl extends ServiceImpl<EnterpriseMapper, Enterpr
|
|||
queryWrapper.eq(Enterprise::getAddServerId, enterprise.getAddServerId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
|
@ -106,4 +111,52 @@ public class EnterpriseServiceImpl extends ServiceImpl<EnterpriseMapper, Enterpr
|
|||
public Enterprise selectByName(String name) {
|
||||
return enterpriseMapper.selectByName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void authentication(Enterprise enterprise) {
|
||||
enterpriseMapper.authentication(enterprise);
|
||||
try {
|
||||
postTest(enterprise);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void postTest(Enterprise enterprise) throws Exception {
|
||||
// 1.请求URL
|
||||
String postUrl = "http://192.168.116.129:10006/webhook/%E6%96%B0%E5%BB%BA%E4%BC%81%E4%B8%9A%E7%AE%A1%E7%90%86";
|
||||
// 2.请求参数JSON格式
|
||||
enterprise.getId();
|
||||
Map<String, String> parammap = new HashMap<>();
|
||||
parammap.put("enterpriseId", "liu-"+enterprise.getId());
|
||||
parammap.put("mysqlPort", String.valueOf(3306+enterprise.getId()));
|
||||
String json = JSON.toJSONString(parammap);
|
||||
// 3.创建连接与设置连接参数
|
||||
URL urlObj = new URL(postUrl);
|
||||
HttpURLConnection httpConn = (HttpURLConnection) urlObj.openConnection();
|
||||
httpConn.setRequestMethod("POST");
|
||||
httpConn.setRequestProperty("Charset", "UTF-8");
|
||||
// POST请求且JSON数据,必须设置
|
||||
httpConn.setRequestProperty("Content-Type", "application/json");
|
||||
// 打开输出流,默认是false
|
||||
httpConn.setDoOutput(true);
|
||||
// 打开输入流,默认是true,可省略
|
||||
httpConn.setDoInput(true);
|
||||
// 4.从HttpURLConnection获取输出流和写数据
|
||||
OutputStream oStream = httpConn.getOutputStream();
|
||||
oStream.write(json.getBytes());
|
||||
oStream.flush();
|
||||
// 5.发起http调用(getInputStream触发http请求)
|
||||
if (httpConn.getResponseCode() != 200) {
|
||||
throw new Exception("调用服务端异常.");
|
||||
}
|
||||
// 6.从HttpURLConnection获取输入流和读数据
|
||||
BufferedReader br = new BufferedReader(
|
||||
new InputStreamReader(httpConn.getInputStream()));
|
||||
String resultData = br.readLine();
|
||||
System.out.println("从服务端返回结果: " + resultData);
|
||||
// 7.关闭HttpURLConnection连接
|
||||
httpConn.disconnect();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<sql id="selectEnterpriseVo">
|
||||
select id, ebterprise_name, legal_person, business_lincense_number, estabiness_date, business_scope, address, contact_phone, email, enterprise_status, registration_date, certification_id, authentication_date, service_level, open_server_id, add_server_id, create_by, create_time, update_by, update_time, remark from enterprise
|
||||
</sql>
|
||||
<update id="authentication">
|
||||
update enterprise set enterprise_status = 'N' where id = #{id}
|
||||
</update>
|
||||
<select id="selectByName" resultType="com.muyu.net.working.domain.Enterprise">
|
||||
select * from enterprise where ebterprise_name = #{name}
|
||||
</select>
|
||||
|
|
Loading…
Reference in New Issue