类型上架数统计
This commit is contained in:
		
							parent
							
								
									6f2c413ef4
								
							
						
					
					
						commit
						c76fac5e55
					
				| 
						 | 
				
			
			@ -46,6 +46,9 @@ public class TreeNode {
 | 
			
		|||
    @ApiModelProperty(value = "实时库存")
 | 
			
		||||
    private Long storageNum;
 | 
			
		||||
 | 
			
		||||
    // 上架数
 | 
			
		||||
    private Integer maCount;
 | 
			
		||||
 | 
			
		||||
    private String remark;
 | 
			
		||||
 | 
			
		||||
    private List<MaTypeProperty> maTypeProperties;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -62,6 +62,9 @@ public class TypeInfo extends BaseEntity
 | 
			
		|||
    @ApiModelProperty(value = "父部门名称", required = true)
 | 
			
		||||
    private String parentName;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "上架数")
 | 
			
		||||
    private Integer maCount;
 | 
			
		||||
 | 
			
		||||
    /** 子部门 */
 | 
			
		||||
    @ApiModelProperty(value = "子部门", required = true)
 | 
			
		||||
    private List<TypeInfo> children = new ArrayList<TypeInfo>();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -224,6 +224,9 @@ public class DevInfo extends BaseEntity {
 | 
			
		|||
    @ApiModelProperty(value = "检测证明、检验pdf")
 | 
			
		||||
    private List<BmFileInfo> examinationPdf = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "唯一标识符列表")
 | 
			
		||||
    private List<String> identifyCodes = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "合格证、保险pdf")
 | 
			
		||||
    private List<List<BmFileInfo>> insurancePdfs = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -334,6 +334,7 @@ public class DevInfoServiceImpl implements DevInfoService {
 | 
			
		|||
            devInfo.setCode(code);
 | 
			
		||||
            devInfo.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId().toString());
 | 
			
		||||
            devInfo.setDeviceCount(1);
 | 
			
		||||
            devInfo.setIdentifyCode(devInfo.getIdentifyCodes().get(i));
 | 
			
		||||
            int saveSuccessNum = devInfoMapper.insertDevInfo(devInfo);
 | 
			
		||||
            code = "";
 | 
			
		||||
            if (saveSuccessNum == 0) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,6 +21,8 @@ public interface MaTypeInfoMapper {
 | 
			
		|||
     */
 | 
			
		||||
    public List<TreeNode> getMaTypeInfoList(TypeInfo typeInfo) ;
 | 
			
		||||
 | 
			
		||||
    List<TypeInfo> getMaCountByTypeId(TypeInfo typeInfo) ;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 热搜设备
 | 
			
		||||
     * @param devInfoVo
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,9 @@ import com.bonus.common.biz.domain.TreeNode;
 | 
			
		|||
import com.bonus.common.biz.domain.TypeInfo;
 | 
			
		||||
import com.bonus.common.biz.domain.vo.AreaVo;
 | 
			
		||||
import com.bonus.common.core.web.domain.AjaxResult;
 | 
			
		||||
import com.bonus.material.book.domain.CompanyPersonPhoneKey;
 | 
			
		||||
import com.bonus.material.device.domain.vo.DevInfoVo;
 | 
			
		||||
import com.bonus.material.device.mapper.DevInfoMapper;
 | 
			
		||||
import com.bonus.material.home.mapper.MaTypeInfoMapper;
 | 
			
		||||
import com.bonus.material.home.service.MaTypeInfoSevice;
 | 
			
		||||
import com.bonus.material.ma.mapper.MaTypeMapper;
 | 
			
		||||
| 
						 | 
				
			
			@ -31,6 +33,9 @@ public class MaTypeInfoServiceImpl implements MaTypeInfoSevice {
 | 
			
		|||
    @Resource
 | 
			
		||||
    private MaTypeMapper maTypeMapper;
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private DevInfoMapper devInfoMapper;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 首页查询分类树
 | 
			
		||||
     * @return
 | 
			
		||||
| 
						 | 
				
			
			@ -41,6 +46,28 @@ public class MaTypeInfoServiceImpl implements MaTypeInfoSevice {
 | 
			
		|||
        List<TreeNode> list = new ArrayList<>();
 | 
			
		||||
        try {
 | 
			
		||||
            list = maTypeInfoMapper.getMaTypeInfoList(typeInfo);
 | 
			
		||||
            List<TypeInfo> typeCountList = maTypeInfoMapper.getMaCountByTypeId(typeInfo);
 | 
			
		||||
            // 计算4级菜单的上架数
 | 
			
		||||
            for (TreeNode treeNode : list) {
 | 
			
		||||
                for (TypeInfo typeCount : typeCountList) {
 | 
			
		||||
                    treeNode.setMaCount(0);
 | 
			
		||||
                    if ("4".equals(treeNode.getLevel()) && treeNode.getId() == typeCount.getTypeId().longValue()) {
 | 
			
		||||
                        treeNode.setMaCount(typeCount.getMaCount());
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            // 计算3级菜单的上架数
 | 
			
		||||
            Map<Long, List<TreeNode>> maTypeCountMap = list.stream().filter(o -> "4".equals(o.getLevel())).collect(Collectors.groupingBy(TreeNode::getParentId));
 | 
			
		||||
            for (TreeNode treeNode : list) {
 | 
			
		||||
                List<TreeNode> mapValues = maTypeCountMap.get(treeNode.getId());
 | 
			
		||||
                if (CollectionUtils.isNotEmpty(mapValues)) {
 | 
			
		||||
                    int sum = 0;
 | 
			
		||||
                    for (TreeNode node : mapValues) {
 | 
			
		||||
                        sum += node.getMaCount() == null ? 0 : node.getMaCount();
 | 
			
		||||
                    }
 | 
			
		||||
                    treeNode.setMaCount(sum);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            //填充自定义属性
 | 
			
		||||
            fillProperties(list);
 | 
			
		||||
            if (CollectionUtils.isNotEmpty(list)) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,8 +5,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
<mapper namespace="com.bonus.material.book.mapper.BookCarMapper">
 | 
			
		||||
 | 
			
		||||
    <insert id="addBookCarDetail">
 | 
			
		||||
        insert into book_car_detail(ma_id, order_status, order_company, order_user, address creater, create_time)
 | 
			
		||||
        values(#{maId}, 0,  #{orderCompany}, #{orderUser}, #{creater}, now())
 | 
			
		||||
        insert into book_car_detail(ma_id, order_status, order_company, order_user, address, creater, create_time)
 | 
			
		||||
        values(#{maId}, 0,  #{orderCompany}, #{orderUser}, #{address}, #{creater}, now())
 | 
			
		||||
    </insert>
 | 
			
		||||
 | 
			
		||||
    <delete id="deleteById">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -78,6 +78,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
        where del_flag = '0'
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <select id="getMaCountByTypeId" resultType="com.bonus.common.biz.domain.TypeInfo">
 | 
			
		||||
        select type_id as typeId,count(1) as maCount from ma_dev_info
 | 
			
		||||
        where ma_status=2
 | 
			
		||||
        group by type_id
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <select id="getArea" resultType="com.bonus.common.biz.domain.vo.AreaVo">
 | 
			
		||||
        select
 | 
			
		||||
        id as areaId,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue