提交 4b81f81d 作者: 张小凤

CooperationDao(add)

上级 771a60b5
......@@ -22,27 +22,27 @@ import java.io.Serializable;
public class CompanyInfoVO implements Serializable {
private static final long serialVersionUID = 3247519744829926132L;
@ApiModelProperty(value = "id")
@NotNull(message = "id不能为空", groups = { Update.class })
@NotNull(message = "id不能为空", groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "单位类型,0科比特,1加盟公司", example = "0")
@NotNull(message = "单位类型不能为空", groups = { Insert.class })
@NotNull(message = "单位类型不能为空", groups = {Insert.class})
private Integer companyType;
@ApiModelProperty(value = "单位名称", example = "科比特")
@NotNull(message = "单位名称不能为空", groups = { Insert.class })
@NotNull(message = "单位名称不能为空", groups = {Insert.class})
private String companyName;
@ApiModelProperty(value = "单位全称", example = "浙江科比特创新科技有限公司")
private String fullName;
@ApiModelProperty(value = "省份名称", example = "广东省")
@NotNull(message = "省份名称不能为空", groups = { Insert.class })
@NotNull(message = "省份名称不能为空", groups = {Insert.class})
private String province;
@ApiModelProperty(value = "城市名称", example = "深圳市")
@NotNull(message = "城市名称不能为空", groups = { Insert.class })
@NotNull(message = "城市名称不能为空", groups = {Insert.class})
private String city;
@ApiModelProperty(value = "县区名称", example = "南山区")
@NotNull(message = "县区名称不能为空", groups = { Insert.class })
@NotNull(message = "县区名称不能为空", groups = {Insert.class})
private String district;
@ApiModelProperty(value = "详细地址", example = "西丽街道万科云城国际创新谷6栋")
@NotNull(message = "详细地址不能为空", groups = { Insert.class })
@NotNull(message = "详细地址不能为空", groups = {Insert.class})
private String address;
@ApiModelProperty(value = "联系人", example = "lx")
private String companyUserName;
......@@ -50,4 +50,12 @@ public class CompanyInfoVO implements Serializable {
private String phoneNum;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "用户id")
private Integer userAccountId;
@ApiModelProperty(value = "品牌名称", example = "科比特")
private String brandName;
@ApiModelProperty(value = "品牌logo", example = "http://")
private String brandLogo;
}
package com.mmc.iuav.user.model.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -22,13 +21,13 @@ public class CooperationTagVO implements Serializable {
private static final long serialVersionUID = 8884567706797525506L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "合作标签名称")
@ApiModelProperty(value = "合作标签名称", example = "企业名称")
private String tagName;
@ApiModelProperty(value = "合作标签img")
@ApiModelProperty(value = "合作标签img", example = "http://")
private String tagImg;
@ApiModelProperty(value = "合作标签描述")
@ApiModelProperty(value = "合作标签描述", example = "描述")
private String tagDescription;
@ApiModelProperty(value = "注意事项")
@ApiModelProperty(value = "注意事项", example = "注意事项")
private String tagRequire;
@ApiModelProperty(value = "创建时间")
private Date createTime;
......
......@@ -80,5 +80,15 @@ public class UserApplyTagVO implements Serializable {
@ApiModelProperty(value = "营业执照", example = "http://")
private String licenseImg;
@ApiModelProperty(value = "地址信息", example = "广东省", required = true)
@NotBlank(message = "地址信息不能为空", groups = {Insert.class})
private String address;
@ApiModelProperty(value = "纬度", example = "22.5749", required = true)
@NotNull(message = "纬度不能为空", groups = {Insert.class})
private Double lat;
@ApiModelProperty(value = "经度", example = "113.992563", required = true)
@NotNull(message = "经度不能为空", groups = {Insert.class})
private Double lon;
}
......@@ -50,6 +50,14 @@ public class CooperationController extends BaseController {
return cooperationService.apply(userApplyTagVO);
}
@ApiOperation(value = "app-已申请的品牌与logo列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserApplyTagVO.class)})
@GetMapping("appBrandList")
public ResultBody<CompanyInfoVO> appBrandList() {
return cooperationService.appBrandList();
}
@ApiOperation(value = "后台-申请列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserApplyTagVO.class)})
@PostMapping("listUserApplyTag")
......
......@@ -129,4 +129,8 @@ public interface CooperationDao {
void deleteApplyResource(Integer id);
void insertApplyResource(List<AttachmentVO> list);
void updateCompanyInfo(UserApplyTagDO userApplyTagDO);
List<CompanyInfoDO> appBrandList();
}
......@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
......@@ -28,6 +29,8 @@ public class CompanyAuthDO implements Serializable {
private String licenseImg;
@ApiModelProperty(value = "企业认证状态,0未通过,1已通过")
private Integer authStatus;
@ApiModelProperty(value = "企业认证id")
private Integer companyInfoId;
public CompanyAuthDO(CompanyAuthVO companyAuthVO) {
this.userAccountId = companyAuthVO.getUserAccountId();
......
package com.mmc.iuav.user.entity;
import com.mmc.iuav.user.model.vo.CompanyInfoVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
......@@ -27,9 +29,20 @@ public class CompanyInfoDO implements Serializable {
private String phoneNum;
private String remark;
private Integer backUserAccountId;
@ApiModelProperty(value = "用户id")
private Integer userAccountId;
@ApiModelProperty(value = "品牌名称", example = "科比特")
private String brandName;
@ApiModelProperty(value = "品牌logo", example = "http://")
private String brandLogo;
public CompanyInfoVO buildCompanyInfoVO() {
return CompanyInfoVO.builder().id(id).companyType(companyType).companyName(companyName).fullName(fullName).province(province)
.brandName(brandName)
.brandLogo(brandLogo)
.userAccountId(userAccountId)
.city(city).district(district).address(address).companyUserName(companyUserName).phoneNum(phoneNum).remark(remark).build();
}
......@@ -45,5 +58,10 @@ public class CompanyInfoDO implements Serializable {
this.companyUserName = companyInfo.getCompanyUserName();
this.phoneNum = companyInfo.getPhoneNum();
this.remark = companyInfo.getRemark();
this.userAccountId = companyInfo.getUserAccountId();
this.brandName = companyInfo.getBrandName();
this.brandLogo = companyInfo.getBrandLogo();
}
}
......@@ -30,6 +30,8 @@ public class UserApplyTagDO implements Serializable {
private Integer applyStatus;
private String content;
private Integer score;
@ApiModelProperty(value = "企业认证id")
private Integer companyInfoId;
/**
* 辅助字段start
......@@ -72,6 +74,9 @@ public class UserApplyTagDO implements Serializable {
.brandLogo(this.brandLogo)
.licenseImg(this.licenseImg)
.attachmentList(this.attachmentList)
.address(this.address)
.lat(this.lat)
.lon(this.lon)
.build();
}
......@@ -83,6 +88,9 @@ public class UserApplyTagDO implements Serializable {
this.remark = userApplyTagVO.getRemark();
this.brandLogo = userApplyTagVO.getBrandLogo();
this.brandName = userApplyTagVO.getBrandName();
this.address = userApplyTagVO.getAddress();
this.lon = userApplyTagVO.getLon();
this.lat = userApplyTagVO.getLat();
}
public ApplyTagEditVO buildApplyTagEditVO() {
......
......@@ -58,4 +58,6 @@ public interface CooperationService {
ResultBody editUserApplyTagDetails(Integer id);
PageResult listServiceBitmapData(Integer type, Integer pageNo, Integer pageSize, Double lon, Double lat);
ResultBody appBrandList();
}
......@@ -49,14 +49,16 @@ public class CooperationServiceImpl implements CooperationService {
return ResultBody.error(ResultEnum.COMPANY_NOT_AUTH_ERROR);
}
Integer cooperationTagId = userApplyTagVO.getCooperationTagId();
if (cooperationTagId == 1 || cooperationTagId == 2) {
if (cooperationTagId == 1) {
if ("".equals(userApplyTagVO.getBrandName()) || userApplyTagVO.getBrandName() == null) {
return ResultBody.error(ResultEnum.THE_BRAND_NAME_CANNOT_BE_EMPTY);
} else if ("".equals(userApplyTagVO.getBrandLogo()) || userApplyTagVO.getBrandLogo() == null) {
return ResultBody.error(ResultEnum.THE_BRAND_LOGO_CANNOT_BE_EMPTY);
}
}
UserApplyTagDO userApplyTagDO = new UserApplyTagDO(userApplyTagVO);
userApplyTagDO.setCompanyInfoId(companyAuthDO.getCompanyInfoId());
cooperationDao.addApply(userApplyTagDO);
List<AttachmentVO> attachmentList = userApplyTagVO.getAttachmentList();
for (AttachmentVO attachmentVO : attachmentList) {
......@@ -64,6 +66,8 @@ public class CooperationServiceImpl implements CooperationService {
new TagApplyResourceDO(attachmentVO, userApplyTagDO.getId());
cooperationDao.addApplyResource(tagApplyResourceDO);
}
cooperationDao.updateCompanyInfo(userApplyTagDO);
return ResultBody.success();
}
......@@ -209,4 +213,11 @@ public class CooperationServiceImpl implements CooperationService {
.stream().map(WebsiteInfoDO::buildWebsiteRangeDTO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, pageSize, count, list);
}
@Override
public ResultBody appBrandList() {
List<CompanyInfoDO> companyInfoDOS = cooperationDao.appBrandList();
List<CompanyInfoVO> collect = companyInfoDOS.stream().map(CompanyInfoDO::buildCompanyInfoVO).collect(Collectors.toList());
return ResultBody.success(collect);
}
}
......@@ -4,28 +4,37 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mmc.iuav.user.dao.CompanyAuthDao">
<!-- <resultMap id="companyAuthResultMAp" type="com.mmc.iuav.user.entity.CompanyAuthDO">-->
<!-- <id column="id" property="id"/>-->
<!-- <result property="authStatus" column="auth_status"/>-->
<!-- <result property="userAccountId" column="user_account_id"/>-->
<!-- <result property="companyName" column="company_name"/>-->
<!-- <result property="creditCode" column="credit_code"/>-->
<!-- <result property="licenseImg" column="license_img"/>-->
<!-- </resultMap>-->
<!-- <resultMap id="companyAuthResultMAp" type="com.mmc.iuav.user.entity.CompanyAuthDO">-->
<!-- <id column="id" property="id"/>-->
<!-- <result property="authStatus" column="auth_status"/>-->
<!-- <result property="userAccountId" column="user_account_id"/>-->
<!-- <result property="companyName" column="company_name"/>-->
<!-- <result property="creditCode" column="credit_code"/>-->
<!-- <result property="licenseImg" column="license_img"/>-->
<!-- </resultMap>-->
<insert id="addCompanyAuth" parameterType="com.mmc.iuav.user.entity.CompanyAuthDO"
keyProperty="id" useGeneratedKeys="true">
insert into company_auth(user_account_id,company_name,credit_code,license_img,auth_status,create_time)
values (#{userAccountId}, #{companyName}, #{creditCode}, #{licenseImg}, #{authStatus}, NOW())
insert into company_auth(user_account_id, company_name, credit_code, license_img, auth_status, create_time)
values (#{userAccountId}, #{companyName}, #{creditCode}, #{licenseImg}, #{authStatus}, NOW())
</insert>
<!-- <select id="getCompanyAuth" resultMap="companyAuthResultMAp">-->
<!-- select id,user_account_id,company_name,credit_code,license_img,auth_status-->
<!-- from company_auth where user_account_id = #{userAccountId}-->
<!-- </select>-->
<!-- <select id="getCompanyAuth" resultMap="companyAuthResultMAp">-->
<!-- select id,user_account_id,company_name,credit_code,license_img,auth_status-->
<!-- from company_auth where user_account_id = #{userAccountId}-->
<!-- </select>-->
<select id="getCompanyAuth" resultType="com.mmc.iuav.user.entity.CompanyAuthDO">
select id,user_account_id,company_name,credit_code,license_img,auth_status
from company_auth where user_account_id = #{userAccountId} and is_deleted = 0
SELECT cm.id,
cm.user_account_id,
cm.company_info_id,
cm.is_leader,
cm.create_time,
ci.company_name,
ci.credit_code,
ci.license_img
FROM company_member cm
LEFT JOIN company_info ci ON ci.id = cm.company_info_id
WHERE ci.is_deleted = 0
</select>
</mapper>
\ No newline at end of file
</mapper>
......@@ -21,6 +21,9 @@
<result property="brandName" column="brand_name"/>
<result property="brandLogo" column="brand_logo"/>
<result property="licenseImg" column="license_img"/>
<result property="address" column="address"/>
<result property="lat" column="lat"/>
<result property="lon" column="lon"/>
<collection property="attachmentList" ofType="com.mmc.iuav.user.entity.TagApplyResourceDO"
select="getUserApplyResource"
column="{id=id}">
......@@ -31,10 +34,8 @@
<insert id="addApply" parameterType="com.mmc.iuav.user.entity.UserApplyTagDO" useGeneratedKeys="true"
keyProperty="id">
insert into user_apply_tag(cooperation_tag_id, user_account_id, apply_name, apply_phone, remark, create_time,
brand_name, brand_logo)
values (#{cooperationTagId}, #{userAccountId}, #{applyName}, #{applyPhone}, #{remark}, NOW(), #{brandName},
#{brandLogo})
insert into user_apply_tag(cooperation_tag_id, user_account_id, apply_name, apply_phone, remark, create_time)
values (#{cooperationTagId}, #{userAccountId}, #{applyName}, #{applyPhone}, #{remark}, NOW())
</insert>
<insert id="insertUserTag" useGeneratedKeys="true" parameterType="com.mmc.iuav.user.entity.UserTagDO"
......@@ -77,7 +78,7 @@
lon = #{lon},
</if>
<if test="cooperationTagId != null">
type = #{cooperationTagId}
`type` = #{cooperationTagId}
</if>
</set>
where id = #{websiteId}
......@@ -219,15 +220,19 @@
ua.content,
ua.score,
ct.tag_name,
ca.company_name,
ua.brand_name,
ua.brand_logo,
ca.credit_code,
ca.license_img
ci.company_name,
ci.brand_name,
ci.brand_logo,
ci.credit_code,
ci.license_img,
ci.address,
ci.lat,
ci.lon
FROM
user_apply_tag ua
INNER JOIN cooperation_tag ct ON ua.cooperation_tag_id = ct.id
INNER JOIN company_auth ca ON ca.user_account_id = ua.user_account_id
INNER JOIN company_member cm ON cm.user_account_id = ua.user_account_id
INNER JOIN company_info ci ON cm.company_info_id = ci.id
<where>
ua.is_deleted = 0
<if test="cooperationTagId != null">
......@@ -243,7 +248,7 @@
and ua.create_time &lt;= #{endTime}
</if>
<if test="companyName != null and companyName != ''">
and ca.company_name like CONCAT("%",#{companyName},"%")
and ci.company_name like CONCAT("%",#{companyName},"%")
</if>
</where>
order by ua.create_time desc
......@@ -324,4 +329,42 @@
</foreach>
</insert>
<update id="updateCompanyInfo"
parameterType="com.mmc.iuav.user.entity.UserApplyTagDO">
UPDATE company_info
<set>
<if test=" lat != null and lat != '' ">
lat = #{lat},
</if>
<if test=" lon != null and lon != '' ">
lon = #{lon},
</if>
<if test=" address != null and address != '' ">
address = #{address},
</if>
<if test=" brandName != null and brandName != '' ">
brand_name = #{brandName},
</if>
<if test=" brandLogo != null and brandLogo != '' ">
brand_logo = #{brandLogo},
</if>
update_time=NOW()
</set>
where id = #{companyInfoId}
</update>
<select id="appBrandList" resultType="com.mmc.iuav.user.entity.CompanyInfoDO">
SELECT cm.user_account_id,
cm.company_info_id,
cm.is_leader,
ci.brand_name,
ci.brand_logo,
ci.address,
ci.lon,
ci.lat,
ci.company_name,
ci.id
FROM company_member cm
LEFT JOIN company_info ci ON cm.company_info_id = ci.id
</select>
</mapper>
......@@ -22,3 +22,4 @@ data-filter:
- /userapp/company/listCompanyPageBack
- /userapp/company/getCompanyInfoById
- /userapp/cooperation/service/bitmap
- /userapp/cooperation/appBrandList
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论