Просмотр исходного кода

//goodsC

release_toaliyun_real
xhxu 3 лет назад
Родитель
Сommit
593387f285
12 измененных файлов: 304 добавлений и 12 удалений
  1. +10
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/basic/TtGoodsCategoryController.java
  2. +57
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/basic/TtMallGoodsCategoryController.java
  3. +3
    -0
      mallinkService/src/main/java/com/iformall/domain/po/TtMallGoodsCategory.java
  4. +52
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/TtMallGoodsCategoryVo.java
  5. +3
    -0
      mallinkService/src/main/java/com/iformall/mapper/TtGoodsCategoryMapper.java
  6. +6
    -0
      mallinkService/src/main/java/com/iformall/mapper/TtMallGoodsCategoryMapper.java
  7. +3
    -0
      mallinkService/src/main/java/com/iformall/service/TtGoodsCategoryService.java
  8. +11
    -0
      mallinkService/src/main/java/com/iformall/service/TtMallGoodsCategoryService.java
  9. +41
    -9
      mallinkService/src/main/java/com/iformall/service/impl/TtGoodsCategoryServiceImpl.java
  10. +58
    -3
      mallinkService/src/main/java/com/iformall/service/impl/TtMallGoodsCategoryServiceImpl.java
  11. +6
    -0
      mallinkService/src/main/resources/mapper/TtGoodsCategoryMapper.xml
  12. +54
    -0
      mallinkService/src/main/resources/mapper/TtMallGoodsCategoryMapper.xml

+ 10
- 0
mallinkAdmin/src/main/java/com/iformall/controller/basic/TtGoodsCategoryController.java Просмотреть файл

@@ -63,6 +63,16 @@ public class TtGoodsCategoryController extends BaseController {
return new ResultData();
}

@TenantIgnore
@ApiOperation("分页列表接口")
@GetMapping("allTreeList")
@ApiImplicitParams({})
@SystemControllerLog(description = "列表")
public ResultData allTreeList() {
logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::allTreeList");
return new ResultData(ttGoodsCategoryService.findAllTreeList());
}

@TenantIgnore
@ApiOperation("设置抖音软件服务费率")
@PostMapping("setServiceFee")


+ 57
- 0
mallinkAdmin/src/main/java/com/iformall/controller/basic/TtMallGoodsCategoryController.java Просмотреть файл

@@ -0,0 +1,57 @@
package com.iformall.controller.basic;


import com.iformall.annotation.SystemControllerLog;
import com.iformall.annotation.TenantIgnore;
import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.controller.base.BaseController;
import com.iformall.domain.po.TtGoodsCategory;
import com.iformall.domain.vo.TtMallGoodsCategoryVo;
import com.iformall.service.TtGoodsCategoryService;
import com.iformall.service.TtMallGoodsCategoryService;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
* @author gongbiao
*/
@RestController
@RequestMapping("mallGoodsCategory")
public class TtMallGoodsCategoryController extends BaseController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
private TtMallGoodsCategoryService ttMallGoodsCategoryService;


@ApiOperation("分页列表接口")
@GetMapping("allTreeList")
@ApiImplicitParams({})
@SystemControllerLog(description = "列表")
public ResultData allTreeList() {
logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::allTreeList");
return new ResultData(ttMallGoodsCategoryService.findAllTreeList(getTenantInfo()));
}

@ApiOperation("设置软件服务费")
@PostMapping("setMallSoftwareFee")
@ApiImplicitParams({})
@SystemControllerLog(description = "修改")
public ResultData setMallSoftwareFee(@RequestBody TtMallGoodsCategoryVo record) {
logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::setMallSoftwareFee");
if(record.getCategoryId() == null || record.getMallSoftwareFee() == null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
record.updateTenantInfo(getTenantInfo());

ttMallGoodsCategoryService.updateFee(record);
return new ResultData();
}

}

+ 3
- 0
mallinkService/src/main/java/com/iformall/domain/po/TtMallGoodsCategory.java Просмотреть файл

@@ -29,4 +29,7 @@ public class TtMallGoodsCategory extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="",name="isDel")
private Integer isDel;

@TableField(exist = false)
private List<Integer> categoryIds;

}

+ 52
- 0
mallinkService/src/main/java/com/iformall/domain/vo/TtMallGoodsCategoryVo.java Просмотреть файл

@@ -0,0 +1,52 @@
package com.iformall.domain.vo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.domain.po.TtGoodsCategory;
import com.iformall.domain.po.base.TenantEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper = true)
public class TtMallGoodsCategoryVo extends TenantEntity {

@io.swagger.annotations.ApiModelProperty(value="",name="categoryId")
private Integer categoryId;

@io.swagger.annotations.ApiModelProperty(value="层级",name="level")
private Integer level;

@io.swagger.annotations.ApiModelProperty(value="",name="name")
private String name;

@io.swagger.annotations.ApiModelProperty(value="",name="parentId")
private Integer parentId;

@io.swagger.annotations.ApiModelProperty(value="类目是否开放",name="enable")
private Integer enable;

@io.swagger.annotations.ApiModelProperty(value="是否是叶子结点",name="isLeaf")
private Integer isLeaf;

@io.swagger.annotations.ApiModelProperty(value="",name="serviceFee")
private Integer serviceFee;

@io.swagger.annotations.ApiModelProperty(value="",name="softwareFee")
private Integer softwareFee;

@io.swagger.annotations.ApiModelProperty(value="",name="mallSoftwareFee")
private Integer mallSoftwareFee;


@TableField(exist = false)
protected List<TtMallGoodsCategoryVo> child;


@io.swagger.annotations.ApiModelProperty(value="",name="isDel")
private Integer isDel;

}

+ 3
- 0
mallinkService/src/main/java/com/iformall/mapper/TtGoodsCategoryMapper.java Просмотреть файл

@@ -10,9 +10,12 @@ public interface TtGoodsCategoryMapper extends CommonMapper<TtGoodsCategory, Str

List<TtGoodsCategory> findList(TtGoodsCategory record);

List<TtGoodsCategory> findMinList(TtGoodsCategory record);

List<Integer> findIdAll(TtGoodsCategory record);

int updDelByIds(TtGoodsCategory record);

int updateFeeByIds(TtGoodsCategory updgc);

}

+ 6
- 0
mallinkService/src/main/java/com/iformall/mapper/TtMallGoodsCategoryMapper.java Просмотреть файл

@@ -3,11 +3,16 @@ package com.iformall.mapper;
import com.iformall.common.CommonMapper;
import com.iformall.domain.po.TtGoodsCategory;
import com.iformall.domain.po.TtMallGoodsCategory;
import com.iformall.domain.vo.TtMallGoodsCategoryVo;

import java.util.List;

public interface TtMallGoodsCategoryMapper extends CommonMapper<TtMallGoodsCategory, String> {


List<TtMallGoodsCategoryVo> findAllTreeList(TtMallGoodsCategoryVo recordVo);


List<TtMallGoodsCategory> findList(TtMallGoodsCategory record);

List<Integer> findIdAll(TtMallGoodsCategory record);
@@ -16,4 +21,5 @@ public interface TtMallGoodsCategoryMapper extends CommonMapper<TtMallGoodsCateg

int updateFeeByIds(TtMallGoodsCategory record);


}

+ 3
- 0
mallinkService/src/main/java/com/iformall/service/TtGoodsCategoryService.java Просмотреть файл

@@ -19,6 +19,8 @@ public interface TtGoodsCategoryService {
*/
List<TtGoodsCategory> findTreeList();

List<TtGoodsCategory> findAllTreeList();


/**
* A端是否显示处理
@@ -46,4 +48,5 @@ public interface TtGoodsCategoryService {
List<GoodsCategory> categoryGet(Integer categoryId);

void updateFee(TtGoodsCategory record);

}

+ 11
- 0
mallinkService/src/main/java/com/iformall/service/TtMallGoodsCategoryService.java Просмотреть файл

@@ -1,6 +1,17 @@
package com.iformall.service;

import com.iformall.common.ErrorCode;
import com.iformall.domain.po.TtGoodsCategory;
import com.iformall.domain.po.TtMallGoodsCategory;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.TtMallGoodsCategoryVo;

import java.util.List;

public interface TtMallGoodsCategoryService {

List<TtMallGoodsCategoryVo> findAllTreeList(TenantEntity tenantInfo);

void updateFee(TtMallGoodsCategoryVo record);

}

+ 41
- 9
mallinkService/src/main/java/com/iformall/service/impl/TtGoodsCategoryServiceImpl.java Просмотреть файл

@@ -13,6 +13,7 @@ import com.iformall.douyin.web.bean.GoodsCategory;
import com.iformall.douyin.web.bean.GoodsTemplateGet;
import com.iformall.enums.EnumCouponValidType;
import com.iformall.enums.EnumGoodsCategoryRate;
import com.iformall.enums.EnumMerchantStatus;
import com.iformall.enums.EnumYesOrNo;
import com.iformall.exception.MallinkException;
import com.iformall.mapper.TtGoodsCategoryMapper;
@@ -34,6 +35,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

@Service
public class TtGoodsCategoryServiceImpl implements TtGoodsCategoryService {
@@ -53,14 +55,37 @@ public class TtGoodsCategoryServiceImpl implements TtGoodsCategoryService {
public List<TtGoodsCategory> findTreeList() {
TtGoodsCategory record = new TtGoodsCategory();
record.setEnable(EnumYesOrNo.YES.getCode());
record.setIsDel(EnumYesOrNo.NO.getCode());
record.setSortColumns(BaseEntity.SortField.Id_ASC);
List<TtGoodsCategory> listAll = ttGoodsCategoryMapper.findMinList(record);
if(listAll == null || listAll.isEmpty()){
return new ArrayList<>();
}
List<TtGoodsCategory> topList = listAll.stream().filter(gc -> gc.getParentId().intValue() == 0).collect(Collectors.toList());
if(topList != null && !topList.isEmpty()){
listAll.removeAll(topList);
for (TtGoodsCategory category:topList) {
category.setChild(getChild(listAll,category.getId()));
}
}
return topList;
}

@Override
public List<TtGoodsCategory> findAllTreeList() {
TtGoodsCategory record = new TtGoodsCategory();
// record.setEnable(EnumYesOrNo.YES.getCode());
record.setIsDel(EnumYesOrNo.NO.getCode());
record.setSortColumns(BaseEntity.SortField.Id_ASC);
List<TtGoodsCategory> listAll = ttGoodsCategoryMapper.findList(record);
List<TtGoodsCategory> topList = new ArrayList<TtGoodsCategory>();
for (TtGoodsCategory category:listAll) {
if(category.getParentId().intValue() == 0){
if(listAll == null || listAll.isEmpty()){
return new ArrayList<>();
}
List<TtGoodsCategory> topList = listAll.stream().filter(gc -> gc.getParentId().intValue() == 0).collect(Collectors.toList());
if(topList != null && !topList.isEmpty()){
listAll.removeAll(topList);
for (TtGoodsCategory category:topList) {
category.setChild(getChild(listAll,category.getId()));
topList.add(category);
}
}
return topList;
@@ -69,11 +94,18 @@ public class TtGoodsCategoryServiceImpl implements TtGoodsCategoryService {

private List<TtGoodsCategory> getChild(List<TtGoodsCategory> listAll,Integer parentId){
List<TtGoodsCategory> childList = new ArrayList<TtGoodsCategory>();

for(TtGoodsCategory entity : listAll){
if(parentId.equals(entity.getParentId())){
entity.setChild(getChild(listAll,entity.getId()));
childList.add(entity);
if(listAll == null || listAll.isEmpty()){
return childList;
}
for(TtGoodsCategory category : listAll){
if(parentId.equals(category.getParentId())){
childList.add(category);
}
}
if(!childList.isEmpty()){
listAll.removeAll(childList);
for (TtGoodsCategory category:childList) {
category.setChild(getChild(listAll,category.getId()));
}
}



+ 58
- 3
mallinkService/src/main/java/com/iformall/service/impl/TtMallGoodsCategoryServiceImpl.java Просмотреть файл

@@ -1,6 +1,12 @@
package com.iformall.service.impl;


import com.iformall.domain.po.TtGoodsCategory;
import com.iformall.domain.po.TtMallGoodsCategory;
import com.iformall.domain.po.base.BaseEntity;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.TtMallGoodsCategoryVo;
import com.iformall.enums.EnumYesOrNo;
import com.iformall.mapper.TtGoodsCategoryMapper;
import com.iformall.mapper.TtMallGoodsCategoryMapper;
import com.iformall.service.TtMallGoodsCategoryService;
@@ -12,6 +18,10 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@Service
public class TtMallGoodsCategoryServiceImpl implements TtMallGoodsCategoryService {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@@ -19,13 +29,58 @@ public class TtMallGoodsCategoryServiceImpl implements TtMallGoodsCategoryServic
@Autowired
TtMallGoodsCategoryMapper ttMallGoodsCategoryMapper;

@Autowired
private TtMerchantPoiService ttMerchantPoiService;

@Autowired
@Qualifier("objectCommonRedisTemplate")
RedisTemplate<String, Object> categoryRedisTemplate;


@Override
public List<TtMallGoodsCategoryVo> findAllTreeList(TenantEntity tenantInfo) {
TtMallGoodsCategoryVo mgcVoQ = new TtMallGoodsCategoryVo();
mgcVoQ.updateTenantInfo(tenantInfo);
mgcVoQ.setIsDel(EnumYesOrNo.NO.getCode());
mgcVoQ.setSortColumns(BaseEntity.SortField.Id_ASC);
List<TtMallGoodsCategoryVo> listAll = ttMallGoodsCategoryMapper.findAllTreeList(mgcVoQ);
if(listAll == null || listAll.isEmpty()){
return new ArrayList<>();
}
List<TtMallGoodsCategoryVo> topList = listAll.stream().filter(gc -> gc.getParentId().intValue() == 0).collect(Collectors.toList());
if(topList != null && !topList.isEmpty()){
listAll.removeAll(topList);
for (TtMallGoodsCategoryVo categoryVo:topList) {
categoryVo.setChild(getChild(listAll,categoryVo.getCategoryId()));
}
}
return topList;
}

private List<TtMallGoodsCategoryVo> getChild(List<TtMallGoodsCategoryVo> listAll, Integer parentId){
List<TtMallGoodsCategoryVo> childList = new ArrayList<TtMallGoodsCategoryVo>();
if(listAll == null || listAll.isEmpty()){
return childList;
}
for(TtMallGoodsCategoryVo categoryVo : listAll){
if(parentId.equals(categoryVo.getParentId())){
childList.add(categoryVo);
}
}
if(!childList.isEmpty()){
listAll.removeAll(childList);
for (TtMallGoodsCategoryVo categoryVo:childList) {
categoryVo.setChild(getChild(listAll,categoryVo.getCategoryId()));
}
}

return childList;
}

@Override
public void updateFee(TtMallGoodsCategoryVo record) {
TtMallGoodsCategory mgcUpd = new TtMallGoodsCategory();
mgcUpd.setGoodsCategoryId(record.getCategoryId());
mgcUpd.updateTenantInfo(record);
// ttMallGoodsCategoryMapper.selectByTenantAnd();


}
}

+ 6
- 0
mallinkService/src/main/resources/mapper/TtGoodsCategoryMapper.xml Просмотреть файл

@@ -68,6 +68,12 @@
<include refid="dynamicWhereConditions" />
</select>

<select id="findMinList" parameterType="com.iformall.domain.po.TtGoodsCategory" resultMap="BaseResultMap">
select `id`,`level`,`name`,`parent_id`,`enable`,`is_leaf`
from tt_goods_category
<include refid="dynamicWhereConditions" />
</select>

<select id="findIdAll" parameterType="com.iformall.domain.po.TtGoodsCategory" resultType="Integer">
select id from tt_goods_category
<include refid="dynamicWhereConditions" />


+ 54
- 0
mallinkService/src/main/resources/mapper/TtMallGoodsCategoryMapper.xml Просмотреть файл

@@ -65,4 +65,58 @@
</foreach>
</update>




<resultMap id="BaseResultMapVo" type="com.iformall.domain.vo.TtMallGoodsCategoryVo">
<result column="id" jdbcType="INTEGER" property="goodsCategoryId" />
<result column="level" jdbcType="INTEGER" property="level" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="parent_id" jdbcType="INTEGER" property="parentId" />
<result column="enable" jdbcType="INTEGER" property="enable" />
<result column="is_leaf" jdbcType="INTEGER" property="isLeaf" />
<result column="service_fee" jdbcType="INTEGER" property="serviceFee" />
<result column="software_fee" jdbcType="INTEGER" property="softwareFee" />
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
<result column="mall_software_fee" jdbcType="INTEGER" property="mallSoftwareFee" />
</resultMap>

<select id="findAllTreeList" parameterType="com.iformall.domain.vo.TtMallGoodsCategoryVo" resultMap="BaseResultMapVo">
select gc.`id`,gc.`level`,gc.`name`,gc.`parent_id`,gc.`enable`,gc.`is_leaf`,gc.`service_fee`,gc.`software_fee`,
mgc.`tenant_id`,mgc.`parent_tenant_id`,mgc.`software_fee` mall_software_fee
from tt_goods_category gc
left join tt_mall_goods_category mgc on mgc.goods_category_id = gc.id and mgc.tenant_id = #{tenantId}
where 1=1
<if test=" null != categoryId ">
and gc.`id` = #{categoryId}
</if>

<if test=" null != level ">
and gc.`level` = #{level}
</if>

<if test=" null != name ">
and gc.`name` like concat('%', #{name},'%')
</if>

<if test=" null != parentId ">
and gc.`parent_id` = #{parentId}
</if>

<if test=" null != enable ">
and gc.`enable` = #{enable}
</if>

<if test=" null != isLeaf ">
and gc.`is_leaf` = #{isLeaf}
</if>

<if test=" null != isDel ">
and gc.`is_del` = #{isDel}
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>

</select>

</mapper>

Загрузка…
Отмена
Сохранить