yujian
2019-12-03 06e70064fbc059c8cc9c654376ce589945e9702d
品牌修改
1个文件已修改
32 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java
@@ -95,29 +95,49 @@
            state = 0;
            record.setState(state);
        }
        // 图片上传
        String picture = null;
        if (file != null) {
            try {
            try { // 图片上传
                picture = uploadPicture(file);
            } catch (Exception e) {
                throw new BrandInfoException(1, "图片上传失败");
            }
        }
        String searchKey = record.getSearchKey();
        if (!StringUtil.isNullOrEmpty(searchKey)) {
            if (StringUtil.isNullOrEmpty(record.getSearchKeyJD()))
                record.setSearchKeyJD(searchKey);
            if (StringUtil.isNullOrEmpty(record.getSearchKeyPDD()))
                record.setSearchKeyPDD(searchKey);
        }
        String shopKey = record.getShopKey();
        if (!StringUtil.isNullOrEmpty(shopKey)) {
            if (StringUtil.isNullOrEmpty(record.getShopKeyJD()))
                record.setShopKeyJD(shopKey);
            if (StringUtil.isNullOrEmpty(record.getShopKeyPDD()))
                record.setShopKeyPDD(shopKey);
        }
        record.setName(name.trim());
        record.setUpdateTime(new Date());
        Long id = record.getId();
        if (id == null) {
            record.setCreateTime(new Date());
            record.setIcon(picture);
            record.setWeight(500.00);
            record.setGoodsTotal(0);
            record.setShopTotal(0);
            record.setUpdateTime(new Date());
            record.setCreateTime(new Date());
            brandInfoMapper.insert(record);
            
            BrandInfo resultObj = new BrandInfo();
            resultObj.setId(record.getId());
            resultObj.setOrder(Integer.valueOf(record.getId().toString()));
            resultObj.setWeight(500.00);
            brandInfoMapper.updateByPrimaryKeySelective(resultObj);
        } else {
            BrandInfo resultObj = brandInfoMapper.selectByPrimaryKey(id);
@@ -142,11 +162,9 @@
                record.setGoodsTotal(resultObj.getGoodsTotal());
                record.setShopTotal(resultObj.getShopTotal());
            }
            record.setOrder(resultObj.getOrder());
            record.setWeight(resultObj.getWeight());
            record.setCreateTime(resultObj.getCreateTime());
            record.setUpdateTime(new Date());
            brandInfoMapper.updateByPrimaryKey(record);
            
            if (state == 0){