供应商关注功能提交

main
rong.liu 11 months ago
parent 800e79d338
commit c3aec6b7fd
  1. 8
      common/src/main/java/com/huoran/common/entity/EnterpriseCertification.java
  2. 97
      nakadai/src/main/java/com/huoran/nakadai/controller/CollectionProviderController.java
  3. 9
      nakadai/src/main/java/com/huoran/nakadai/controller/EnterpriseCertificationController.java
  4. 51
      nakadai/src/main/java/com/huoran/nakadai/entity/CollectionProvider.java
  5. 8
      nakadai/src/main/java/com/huoran/nakadai/entity/req/EnterpriseCertificationLIstReq.java
  6. 16
      nakadai/src/main/java/com/huoran/nakadai/mapper/CollectionProviderMapper.java
  7. 3
      nakadai/src/main/java/com/huoran/nakadai/mapper/EnterpriseCertificationMapper.java
  8. 5
      nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CollectionProviderMapper.xml
  9. 100
      nakadai/src/main/java/com/huoran/nakadai/mapper/xml/EnterpriseCertificationMapper.xml
  10. 16
      nakadai/src/main/java/com/huoran/nakadai/service/CollectionProviderService.java
  11. 3
      nakadai/src/main/java/com/huoran/nakadai/service/EnterpriseCertificationService.java
  12. 20
      nakadai/src/main/java/com/huoran/nakadai/service/impl/CollectionProviderServiceImpl.java
  13. 9
      nakadai/src/main/java/com/huoran/nakadai/service/impl/EnterpriseCertificationServiceImpl.java

@ -138,4 +138,12 @@ public class EnterpriseCertification implements Serializable {
@ApiModelProperty(value = "供应商分类名称")
@TableField(exist = false)
private String supplierClassificationName;
@ApiModelProperty(value = "关注id(用于取消关注,没有表示没有关注过)")
@TableField(exist = false)
private Integer attentionId;
@ApiModelProperty(value = "是否关注(0未关注 1已关注)")
@TableField(exist = false)
private Integer whetherAttention;
}

@ -0,0 +1,97 @@
package com.huoran.nakadai.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.huoran.api.UserClient;
import com.huoran.common.response.R;
import com.huoran.common.utils.TokenUtils;
import com.huoran.nakadai.entity.CollectionProvider;
import com.huoran.nakadai.service.CollectionProviderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* @描述关注供应商控制类
* @作者: Rong
* @日期: 2024-01-12
*/
@RestController
@RequestMapping("/collectionProvider")
@Api(value = "关注供应商:CollectionProviderController", tags = "供应商关注")
public class CollectionProviderController {
@Autowired
public CollectionProviderService service;
@Autowired
private UserClient userClient;
/*@PostMapping("/listByEntity")
@ApiOperation(value = "分页查询", response = CollectionProvider.class)
public R listByEntity(@RequestBody CollectionProvider collectionProvider) {
return null;
}*/
@PostMapping("/findById")
@ApiOperation(value = "查询详情", response = CollectionProvider.class)
public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) {
CollectionProvider collectionProvider = service.getById(id);
return R.ok().put("data", collectionProvider);
}
@PostMapping("/collect")
@ApiOperation(value = "关注", response = CollectionProvider.class)
public R collect(@RequestBody @ApiParam(name = "关注供应商对象", value = "传入json格式", required = true) CollectionProvider collectionProvider, HttpServletRequest request) {
String accountId = TokenUtils.getIdByJwtToken(request);
collectionProvider.setAccountId(Integer.valueOf(accountId));
if (checkCollect(collectionProvider.getSupplierAccountId(), Integer.valueOf(accountId))){
return R.ok("您已关注!请勿重复关注");
}
boolean addState = service.save(collectionProvider);
return addState ? R.ok(collectionProvider.getId()) : R.error("新增失败");
}
//校验是否收藏过
public boolean checkCollect(Integer supplierAccountId, Integer accountId) {
QueryWrapper<CollectionProvider> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("account_id", accountId);
queryWrapper.eq("supplier_account_id", supplierAccountId);
CollectionProvider collectionProvider = service.getOne(queryWrapper);
return collectionProvider != null;
}
/* @PostMapping("/update")
@ApiOperation(value = "修改", response = CollectionProvider.class)
public R update(@RequestBody @ApiParam(name = "关注供应商对象", value = "传入json格式", required = true) CollectionProvider collectionProvider, HttpServletRequest request) {
String accountId = TokenUtils.getIdByJwtToken(request);
Integer schoolId = userClient.getSchoolIdByAccountId(accountId);
collectionProvider.setAccountId(Integer.valueOf(accountId));
boolean updateState = service.updateById(collectionProvider);
return updateState ? R.ok() : R.error("编辑失败");
}*/
@PostMapping("/cancelCollection")
@ApiOperation(value = "取消关注", response = CollectionProvider.class)
public R cancelCollection(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) {
boolean delState = service.removeById(id);
return delState ? R.ok() : R.error("取消失败");
}
@PostMapping("/batchDeletion")
@ApiOperation(value = "批量删除", response = CollectionProvider.class)
public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestBody List<Integer> ids) {
boolean delState = service.removeByIds(ids);
return delState ? R.ok() : R.error("删除失败");
}
}

@ -56,6 +56,15 @@ public class EnterpriseCertificationController {
}
@PostMapping("/supplierList")
@ApiOperation(value = "供应商列表", response = EnterpriseCertification.class)
public R supplierList(@RequestBody EnterpriseCertificationLIstReq req, HttpServletRequest request) {
String accountId = TokenUtils.getIdByJwtToken(request);
req.setAccountId(Integer.valueOf(accountId));
return service.supplierList(req);
}
@PostMapping("/enterpriseCertificationDetails")
@ApiOperation(value = "企业认证详情", response = EnterpriseCertification.class)
public R enterpriseCertificationDetails(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) {

@ -0,0 +1,51 @@
package com.huoran.nakadai.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 收藏供应商
* </p>
*
* @author chen
* @since 2024-01-12
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="CollectionProvider对象", description="收藏供应商")
public class CollectionProvider implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "账号id(关注人id)")
private Integer accountId;
@ApiModelProperty(value = "被关注供应商的账号id")
private Integer supplierAccountId;
@ApiModelProperty(value = "创建时间")
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(value = "更新时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
}

@ -1,5 +1,6 @@
package com.huoran.nakadai.entity.req;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -58,4 +59,11 @@ public class EnterpriseCertificationLIstReq {
@ApiModelProperty(value = "当前页需要显示的数量", name = "pageSize", example = "10", required = true)
private Integer pageSize;
@ApiModelProperty(value = "账号id")
private Integer accountId;
@ApiModelProperty(value = "是否关注(0未关注 1已关注)")
@TableField(exist = false)
private Integer whetherAttention;
}

@ -0,0 +1,16 @@
package com.huoran.nakadai.mapper;
import com.huoran.nakadai.entity.CollectionProvider;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 收藏供应商 Mapper 接口
* </p>
*
* @author chen
* @since 2024-01-12
*/
public interface CollectionProviderMapper extends BaseMapper<CollectionProvider> {
}

@ -22,6 +22,9 @@ public interface EnterpriseCertificationMapper extends BaseMapper<EnterpriseCert
IPage<EnterpriseCertification> selectEnterpriseCertificationList(IPage<EnterpriseCertification> page, @Param("req")EnterpriseCertificationLIstReq req);
IPage<EnterpriseCertification> supplierList(IPage<EnterpriseCertification> page, @Param("req")EnterpriseCertificationLIstReq req);
EnterpriseCertification enterpriseCertificationDetails(@Param("id")Integer id);

@ -0,0 +1,5 @@
<?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.huoran.nakadai.mapper.CollectionProviderMapper">
</mapper>

@ -147,6 +147,106 @@
AND app_open_id = #{openId}
AND platform_id = #{platformId}
</select>
<select id="supplierList" resultType="com.huoran.common.entity.EnterpriseCertification">
SELECT
t.*
FROM
(
SELECT
IFNULL(
info.real_name,
(
SELECT
u.user_name
FROM
hr_user_account ua
INNER JOIN hr_user_info u ON u.user_id = ua.user_id
AND u.is_del = 0
WHERE
ua.is_del = 0
AND ua.app_open_id = c.open_id
AND ua.platform_id = 7
)
) AS proposer,
a.phone AS contactInformation,
a.account,
c.*,
IFNULL( cla.province, '未完善' ) AS province,
IFNULL( cla.city, '未完善' ) AS city,
cla.id AS teamId,
logo_url,
brief_introduction,
cla.create_time AS organizationCreationTime,
cc.classification_id AS supplierClassificationId,
sc.classification_name AS supplierClassificationName,
IF
(
( SELECT p.id FROM collection_provider p WHERE p.supplier_account_id = c.account_id AND p.account_id = #{req.accountId} ) IS NULL,
0,
1
) AS whetherAttention,
( SELECT p.id FROM collection_provider p WHERE p.supplier_account_id = c.account_id AND p.account_id = #{req.accountId} ) AS attentionId
FROM
hr_enterprise_certification c
INNER JOIN hr_user_account a ON a.id = c.account_id
INNER JOIN hr_user_info u ON u.user_id = a.user_id
LEFT JOIN hr_user_authentication_information info ON info.account_id = a.id
LEFT JOIN k_platform_team_account ta ON ta.account_id = a.id
LEFT JOIN k_platform_team t ON ta.manage_id = t.manage_id
LEFT JOIN k_platform_team_classification cla ON cla.id = t.classification_id
LEFT JOIN supplier_classification_config cc ON cc.account_id = c.account_id
LEFT JOIN supplier_classification sc ON sc.id = cc.classification_id
AND is_team = 1
AND cla.is_del = 0
WHERE
a.is_del = 0
AND u.is_del = 0
) t
WHERE
t.platform_source = #{req.platformSource}
<if test=" req.supplierClassificationId!= null">
and t.supplierClassificationId =#{req.supplierClassificationId}
</if>
<if test="req.whetherAttention != null">
and whetherAttention = #{req.whetherAttention}
</if>
<if test=" req.auditStatus!= null and req.auditStatus!= '' or req.auditStatus ==0">
and t.audit_status =#{req.auditStatus,jdbcType=INTEGER}
</if>
<if test=" req.authenticationStatus!= null and req.authenticationStatus!= '' or req.authenticationStatus ==0">
and t.authentication_status =#{req.authenticationStatus,jdbcType=INTEGER}
</if>
<if test="req.startCommitTime != '' and req.startCommitTime!= null
and req.endCommitTime != '' and req.endCommitTime!= null">
AND date_format( t.submit_time, '%Y-%m-%d' )
BETWEEN #{req.startCommitTime} AND #{req.endCommitTime}
</if>
<if test="req.keyWord!=null and req.keyWord!='' ">
and (
proposer like concat('%' #{req.keyWord} '%')
or account like concat('%' #{req.keyWord} '%')
or contactInformation like concat('%' #{req.keyWord} '%')
or company_name like concat('%' #{req.keyWord} '%'))
</if>
<if test="req.province!=null and req.province!='' ">
and t.province=#{req.province,jdbcType=VARCHAR}
</if>
<if test="req.city!=null and req.city!='' ">
and t.city=#{req.province,jdbcType=VARCHAR}
</if>
</select>
<update id="updateUserInformation">

@ -0,0 +1,16 @@
package com.huoran.nakadai.service;
import com.huoran.nakadai.entity.CollectionProvider;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 收藏供应商 服务类
* </p>
*
* @author chen
* @since 2024-01-12
*/
public interface CollectionProviderService extends IService<CollectionProvider> {
}

@ -20,6 +20,9 @@ public interface EnterpriseCertificationService extends IService<EnterpriseCerti
R selectEnterpriseCertificationList(EnterpriseCertificationLIstReq req);
R supplierList(EnterpriseCertificationLIstReq req);
R enterpriseCertificationDetails(Integer id);
boolean deleteTeamInformation(Integer accountId);

@ -0,0 +1,20 @@
package com.huoran.nakadai.service.impl;
import com.huoran.nakadai.entity.CollectionProvider;
import com.huoran.nakadai.mapper.CollectionProviderMapper;
import com.huoran.nakadai.service.CollectionProviderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 收藏供应商 服务实现类
* </p>
*
* @author chen
* @since 2024-01-12
*/
@Service
public class CollectionProviderServiceImpl extends ServiceImpl<CollectionProviderMapper, CollectionProvider> implements CollectionProviderService {
}

@ -46,6 +46,15 @@ public class EnterpriseCertificationServiceImpl extends ServiceImpl<EnterpriseCe
return R.ok().put("data", pageList);
}
@Override
public R supplierList(EnterpriseCertificationLIstReq req) {
Page<EnterpriseCertification> page = new Page<EnterpriseCertification>(req.getPageNum(), req.getPageSize());
IPage<EnterpriseCertification> pageList = baseMapper.supplierList(page, req);
return R.ok().put("data", pageList);
}
@Override
public R enterpriseCertificationDetails(Integer id) {
return R.ok().put("data", baseMapper.enterpriseCertificationDetails(id));

Loading…
Cancel
Save