著者のホームページ:プログラミング コンパス
著者について: Java 分野の高品質クリエイター、CSDN ブログ エキスパート、CSDN コンテンツ パートナー、Nuggets ゲスト著者、Alibaba Cloud ブログ エキスパート、51CTO ゲスト著者、長年のアーキテクト設計経験、Tencent 教室常駐講師
主な内容:Javaプロジェクト、Pythonプロジェクト、フロントエンドプロジェクト、人工知能とビッグデータ、履歴書テンプレート、学習教材、面接質問バンク、技術相互支援
集めて、いいねして、迷わないように、作者をフォローすると良いです。
記事の最後にあるソースコードを入手してください
プロジェクト番号: L-BS-SC-03
1. 環境の紹介
ロケール: Java: jdk1.8
データベース: MySQL: mysql5.7
アプリケーションサーバー: Tomcat: tomcat8.5.31
開発ツール: IDEA または eclipse
2. プロジェクトの紹介
このプロジェクトは、SpringBoot+MyBatis をベースに実装されたフロントエンドモールシステムとバックエンド管理システムを含む電子商取引システムです。フロントエンド モール システムには、ホームページ ポータル、製品推奨、製品検索、製品表示、ショッピング カート、注文プロセス、メンバー センター、カスタマー サービス、ヘルプ センターなどのモジュールが含まれています。バックエンド管理システムには、製品管理、注文管理、会員管理、プロモーション管理、運用管理、コンテンツ管理、統計レポート、財務管理、権限管理、設定などのモジュールが含まれています。
バックエンドテクノロジー
Mall は現在主流のテクノロジーを使用して実装されており、一般的なプロジェクトで使用されるほぼすべてのテクノロジーをカバーしています。
テクノロジー | バージョン | 説明する |
---|---|---|
スプリングブーツ | 2.7.5 | コンテナ + MVC フレームワーク |
スプリングセキュリティ | 5.7.4 | 認証および認可フレームワーク |
マイバティス | 3.5.10 | ORMフレームワーク |
MyBatisジェネレーター | 1.4.1 | データ層コード生成 |
ラビットMQ | 3.10.5 | メッセージキュー |
レディス | 7.0 | 分散キャッシュ |
モンゴDB | 5.0 | NoSQLデータベース |
エラスティックサーチ | 7.17.3 | 検索エンジン |
ログスタッシュ | 7.17.3 | ログ収集ツール |
キバナ | 7.17.3 | ログ可視化ツール |
Nginx | 1.22 | 静的リソースサーバー |
ドルイド僧 | 1.2.14 | データベース接続プール |
MinIO/OSS | 8.4.5 | オブジェクトストレージ |
フーツール | 5.8.0 | Javaツールライブラリ |
ページヘルパー | 5.3.2 | MyBatis 物理ページング プラグイン |
Swagger-UI | 3.0.0 | ドキュメント生成ツール |
logstash ログバック エンコーダ | 7.2 | Logstash ログ収集プラグイン |
docker-maven-プラグイン | 0.40.2 | Docker イメージにパッケージ化されたアプリケーションを適用する Maven プラグイン |
フロントエンド技術
このプロジェクトは現在普及しているフロントエンドとバックエンドの分離開発モデルを採用しており、電子商取引管理システムのフロントエンドプロジェクトはVue+Elementに基づいて実装されています。
テクノロジー | 説明する |
---|---|
ビュー | フロントエンドフレームワーク |
Vueルーター | ルーティングフレームワーク |
Vuex | グローバルな状態管理フレームワーク |
要素 | フロントエンドUIフレームワーク |
アクシオス | フロントエンドHTTPフレームワーク |
V チャート | Echart に基づくチャート フレームワーク |
Js-cookie | クッキー管理ツール |
進捗なし | プログレスバーコントロール |
vue要素管理者 | プロジェクトの足場のリファレンス |
モバイルテクノロジー
電子商取引システムのモバイル端末プロジェクトはuni-app
に基づいて実装されます。主に、ホームページポータル、製品レコメンデーション、製品検索、製品表示、ショッピングカート、注文処理、メンバーセンター、カスタマーサービス、ヘルプセンターなどの機能が含まれます。
テクノロジー | 説明する |
---|---|
ビュー | コアフロントエンドフレームワーク |
Vuex | グローバルな状態管理フレームワーク |
ユニアプリ | モバイル フロントエンド フレームワーク |
ミックスモール | Eコマースプロジェクトテンプレート |
ランチリクエスト | HTTPリクエストフレームワーク |
バックエンド管理システム
-
製品モジュールには、製品管理、製品分類管理、製品タイプ管理、およびブランド管理が含まれます。
-
注文モジュールには、注文管理、注文設定、返品申請処理、返品理由設定が含まれます。
-
マーケティング モジュールには、フラッシュ セール活動管理、クーポン管理、ブランド推奨管理、新製品推奨管理、人気推奨管理、トピック推奨管理、ホームページ広告管理が含まれます。
-
権限モジュールには、ユーザー管理、メニュー管理、ロール管理、リソース管理が含まれます。
モバイルモール
-
ホーム ページ: カルーセル広告、機能モジュール、ブランド メーカーからの直接供給、フラッシュ セール エリア、新鮮な商品、人気のおすすめ、好みを推測
-
商品:商品分類[レベル2対応]、商品リスト、商品詳細、商品操作(ショッピングカートに追加、コレクション、ショッピングカート)
-
ショッピングカート:ショッピングカート商品リスト、注文支払い、注文リスト、注文詳細
-
My:会員情報、クーポン、注文管理、住所管理、足跡、注目度、コレクション、評価
3. システム表示
4.コアコード表示
4.1 メンバーインターフェース
@Service
public class MemberCollectionServiceImpl implements MemberCollectionService {
@Value("${mongo.insert.sqlEnable}")
private Boolean sqlEnable;
@Autowired
private PmsProductMapper productMapper;
@Autowired
private MemberProductCollectionRepository productCollectionRepository;
@Autowired
private UmsMemberService memberService;
@Override
public int add(MemberProductCollection productCollection) {
int count = 0;
if (productCollection.getProductId() == null) {
return 0;
}
UmsMember member = memberService.getCurrentMember();
productCollection.setMemberId(member.getId());
productCollection.setMemberNickname(member.getNickname());
productCollection.setMemberIcon(member.getIcon());
MemberProductCollection findCollection = productCollectionRepository.findByMemberIdAndProductId(productCollection.getMemberId(), productCollection.getProductId());
if (findCollection == null) {
if (sqlEnable) {
PmsProduct product = productMapper.selectByPrimaryKey(productCollection.getProductId());
if (product == null || product.getDeleteStatus() == 1) {
return 0;
}
productCollection.setProductName(product.getName());
productCollection.setProductSubTitle(product.getSubTitle());
productCollection.setProductPrice(product.getPrice() + "");
productCollection.setProductPic(product.getPic());
}
productCollectionRepository.save(productCollection);
count = 1;
}
return count;
}
@Override
public int delete(Long productId) {
UmsMember member = memberService.getCurrentMember();
return productCollectionRepository.deleteByMemberIdAndProductId(member.getId(), productId);
}
@Override
public Page<MemberProductCollection> list(Integer pageNum, Integer pageSize) {
UmsMember member = memberService.getCurrentMember();
Pageable pageable = PageRequest.of(pageNum - 1, pageSize);
return productCollectionRepository.findByMemberId(member.getId(), pageable);
}
@Override
public MemberProductCollection detail(Long productId) {
UmsMember member = memberService.getCurrentMember();
return productCollectionRepository.findByMemberIdAndProductId(member.getId(), productId);
}
@Override
public void clear() {
UmsMember member = memberService.getCurrentMember();
productCollectionRepository.deleteAllByMemberId(member.getId());
}
}
4.2 製品インターフェース
@Service
public class PmsProductServiceImpl implements PmsProductService {
private static final Logger LOGGER = LoggerFactory.getLogger(PmsProductServiceImpl.class);
@Autowired
private PmsProductMapper productMapper;
@Autowired
private PmsMemberPriceDao memberPriceDao;
@Autowired
private PmsMemberPriceMapper memberPriceMapper;
@Autowired
private PmsProductLadderDao productLadderDao;
@Autowired
private PmsProductLadderMapper productLadderMapper;
@Autowired
private PmsProductFullReductionDao productFullReductionDao;
@Autowired
private PmsProductFullReductionMapper productFullReductionMapper;
@Autowired
private PmsSkuStockDao skuStockDao;
@Autowired
private PmsSkuStockMapper skuStockMapper;
@Autowired
private PmsProductAttributeValueDao productAttributeValueDao;
@Autowired
private PmsProductAttributeValueMapper productAttributeValueMapper;
@Autowired
private CmsSubjectProductRelationDao subjectProductRelationDao;
@Autowired
private CmsSubjectProductRelationMapper subjectProductRelationMapper;
@Autowired
private CmsPrefrenceAreaProductRelationDao prefrenceAreaProductRelationDao;
@Autowired
private CmsPrefrenceAreaProductRelationMapper prefrenceAreaProductRelationMapper;
@Autowired
private PmsProductDao productDao;
@Autowired
private PmsProductVertifyRecordDao productVertifyRecordDao;
@Override
public int create(PmsProductParam productParam) {
int count;
//创建商品
PmsProduct product = productParam;
product.setId(null);
productMapper.insertSelective(product);
//根据促销类型设置价格:会员价格、阶梯价格、满减价格
Long productId = product.getId();
//会员价格
relateAndInsertList(memberPriceDao, productParam.getMemberPriceList(), productId);
//阶梯价格
relateAndInsertList(productLadderDao, productParam.getProductLadderList(), productId);
//满减价格
relateAndInsertList(productFullReductionDao, productParam.getProductFullReductionList(), productId);
//处理sku的编码
handleSkuStockCode(productParam.getSkuStockList(),productId);
//添加sku库存信息
relateAndInsertList(skuStockDao, productParam.getSkuStockList(), productId);
//添加商品参数,添加自定义商品规格
relateAndInsertList(productAttributeValueDao, productParam.getProductAttributeValueList(), productId);
//关联专题
relateAndInsertList(subjectProductRelationDao, productParam.getSubjectProductRelationList(), productId);
//关联优选
relateAndInsertList(prefrenceAreaProductRelationDao, productParam.getPrefrenceAreaProductRelationList(), productId);
count = 1;
return count;
}
private void handleSkuStockCode(List<PmsSkuStock> skuStockList, Long productId) {
if(CollectionUtils.isEmpty(skuStockList))return;
for(int i=0;i<skuStockList.size();i++){
PmsSkuStock skuStock = skuStockList.get(i);
if(StrUtil.isEmpty(skuStock.getSkuCode())){
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
StringBuilder sb = new StringBuilder();
//日期
sb.append(sdf.format(new Date()));
//四位商品id
sb.append(String.format("%04d", productId));
//三位索引id
sb.append(String.format("%03d", i+1));
skuStock.setSkuCode(sb.toString());
}
}
}
@Override
public PmsProductResult getUpdateInfo(Long id) {
return productDao.getUpdateInfo(id);
}
@Override
public int update(Long id, PmsProductParam productParam) {
int count;
//更新商品信息
PmsProduct product = productParam;
product.setId(id);
productMapper.updateByPrimaryKeySelective(product);
//会员价格
PmsMemberPriceExample pmsMemberPriceExample = new PmsMemberPriceExample();
pmsMemberPriceExample.createCriteria().andProductIdEqualTo(id);
memberPriceMapper.deleteByExample(pmsMemberPriceExample);
relateAndInsertList(memberPriceDao, productParam.getMemberPriceList(), id);
//阶梯价格
PmsProductLadderExample ladderExample = new PmsProductLadderExample();
ladderExample.createCriteria().andProductIdEqualTo(id);
productLadderMapper.deleteByExample(ladderExample);
relateAndInsertList(productLadderDao, productParam.getProductLadderList(), id);
//满减价格
PmsProductFullReductionExample fullReductionExample = new PmsProductFullReductionExample();
fullReductionExample.createCriteria().andProductIdEqualTo(id);
productFullReductionMapper.deleteByExample(fullReductionExample);
relateAndInsertList(productFullReductionDao, productParam.getProductFullReductionList(), id);
//修改sku库存信息
handleUpdateSkuStockList(id, productParam);
//修改商品参数,添加自定义商品规格
PmsProductAttributeValueExample productAttributeValueExample = new PmsProductAttributeValueExample();
productAttributeValueExample.createCriteria().andProductIdEqualTo(id);
productAttributeValueMapper.deleteByExample(productAttributeValueExample);
relateAndInsertList(productAttributeValueDao, productParam.getProductAttributeValueList(), id);
//关联专题
CmsSubjectProductRelationExample subjectProductRelationExample = new CmsSubjectProductRelationExample();
subjectProductRelationExample.createCriteria().andProductIdEqualTo(id);
subjectProductRelationMapper.deleteByExample(subjectProductRelationExample);
relateAndInsertList(subjectProductRelationDao, productParam.getSubjectProductRelationList(), id);
//关联优选
CmsPrefrenceAreaProductRelationExample prefrenceAreaExample = new CmsPrefrenceAreaProductRelationExample();
prefrenceAreaExample.createCriteria().andProductIdEqualTo(id);
prefrenceAreaProductRelationMapper.deleteByExample(prefrenceAreaExample);
relateAndInsertList(prefrenceAreaProductRelationDao, productParam.getPrefrenceAreaProductRelationList(), id);
count = 1;
return count;
}
private void handleUpdateSkuStockList(Long id, PmsProductParam productParam) {
//当前的sku信息
List<PmsSkuStock> currSkuList = productParam.getSkuStockList();
//当前没有sku直接删除
if(CollUtil.isEmpty(currSkuList)){
PmsSkuStockExample skuStockExample = new PmsSkuStockExample();
skuStockExample.createCriteria().andProductIdEqualTo(id);
skuStockMapper.deleteByExample(skuStockExample);
return;
}
//获取初始sku信息
PmsSkuStockExample skuStockExample = new PmsSkuStockExample();
skuStockExample.createCriteria().andProductIdEqualTo(id);
List<PmsSkuStock> oriStuList = skuStockMapper.selectByExample(skuStockExample);
//获取新增sku信息
List<PmsSkuStock> insertSkuList = currSkuList.stream().filter(item->item.getId()==null).collect(Collectors.toList());
//获取需要更新的sku信息
List<PmsSkuStock> updateSkuList = currSkuList.stream().filter(item->item.getId()!=null).collect(Collectors.toList());
List<Long> updateSkuIds = updateSkuList.stream().map(PmsSkuStock::getId).collect(Collectors.toList());
//获取需要删除的sku信息
List<PmsSkuStock> removeSkuList = oriStuList.stream().filter(item-> !updateSkuIds.contains(item.getId())).collect(Collectors.toList());
handleSkuStockCode(insertSkuList,id);
handleSkuStockCode(updateSkuList,id);
//新增sku
if(CollUtil.isNotEmpty(insertSkuList)){
relateAndInsertList(skuStockDao, insertSkuList, id);
}
//删除sku
if(CollUtil.isNotEmpty(removeSkuList)){
List<Long> removeSkuIds = removeSkuList.stream().map(PmsSkuStock::getId).collect(Collectors.toList());
PmsSkuStockExample removeExample = new PmsSkuStockExample();
removeExample.createCriteria().andIdIn(removeSkuIds);
skuStockMapper.deleteByExample(removeExample);
}
//修改sku
if(CollUtil.isNotEmpty(updateSkuList)){
for (PmsSkuStock pmsSkuStock : updateSkuList) {
skuStockMapper.updateByPrimaryKeySelective(pmsSkuStock);
}
}
}
@Override
public List<PmsProduct> list(PmsProductQueryParam productQueryParam, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum, pageSize);
PmsProductExample productExample = new PmsProductExample();
PmsProductExample.Criteria criteria = productExample.createCriteria();
criteria.andDeleteStatusEqualTo(0);
if (productQueryParam.getPublishStatus() != null) {
criteria.andPublishStatusEqualTo(productQueryParam.getPublishStatus());
}
if (productQueryParam.getVerifyStatus() != null) {
criteria.andVerifyStatusEqualTo(productQueryParam.getVerifyStatus());
}
if (!StrUtil.isEmpty(productQueryParam.getKeyword())) {
criteria.andNameLike("%" + productQueryParam.getKeyword() + "%");
}
if (!StrUtil.isEmpty(productQueryParam.getProductSn())) {
criteria.andProductSnEqualTo(productQueryParam.getProductSn());
}
if (productQueryParam.getBrandId() != null) {
criteria.andBrandIdEqualTo(productQueryParam.getBrandId());
}
if (productQueryParam.getProductCategoryId() != null) {
criteria.andProductCategoryIdEqualTo(productQueryParam.getProductCategoryId());
}
return productMapper.selectByExample(productExample);
}
@Override
public int updateVerifyStatus(List<Long> ids, Integer verifyStatus, String detail) {
PmsProduct product = new PmsProduct();
product.setVerifyStatus(verifyStatus);
PmsProductExample example = new PmsProductExample();
example.createCriteria().andIdIn(ids);
List<PmsProductVertifyRecord> list = new ArrayList<>();
int count = productMapper.updateByExampleSelective(product, example);
//修改完审核状态后插入审核记录
for (Long id : ids) {
PmsProductVertifyRecord record = new PmsProductVertifyRecord();
record.setProductId(id);
record.setCreateTime(new Date());
record.setDetail(detail);
record.setStatus(verifyStatus);
record.setVertifyMan("test");
list.add(record);
}
productVertifyRecordDao.insertList(list);
return count;
}
@Override
public int updatePublishStatus(List<Long> ids, Integer publishStatus) {
PmsProduct record = new PmsProduct();
record.setPublishStatus(publishStatus);
PmsProductExample example = new PmsProductExample();
example.createCriteria().andIdIn(ids);
return productMapper.updateByExampleSelective(record, example);
}
@Override
public int updateRecommendStatus(List<Long> ids, Integer recommendStatus) {
PmsProduct record = new PmsProduct();
record.setRecommandStatus(recommendStatus);
PmsProductExample example = new PmsProductExample();
example.createCriteria().andIdIn(ids);
return productMapper.updateByExampleSelective(record, example);
}
@Override
public int updateNewStatus(List<Long> ids, Integer newStatus) {
PmsProduct record = new PmsProduct();
record.setNewStatus(newStatus);
PmsProductExample example = new PmsProductExample();
example.createCriteria().andIdIn(ids);
return productMapper.updateByExampleSelective(record, example);
}
@Override
public int updateDeleteStatus(List<Long> ids, Integer deleteStatus) {
PmsProduct record = new PmsProduct();
record.setDeleteStatus(deleteStatus);
PmsProductExample example = new PmsProductExample();
example.createCriteria().andIdIn(ids);
return productMapper.updateByExampleSelective(record, example);
}
@Override
public List<PmsProduct> list(String keyword) {
PmsProductExample productExample = new PmsProductExample();
PmsProductExample.Criteria criteria = productExample.createCriteria();
criteria.andDeleteStatusEqualTo(0);
if(!StrUtil.isEmpty(keyword)){
criteria.andNameLike("%" + keyword + "%");
productExample.or().andDeleteStatusEqualTo(0).andProductSnLike("%" + keyword + "%");
}
return productMapper.selectByExample(productExample);
}
/**
* 建立和插入关系表操作
*
* @param dao 可以操作的dao
* @param dataList 要插入的数据
* @param productId 建立关系的id
*/
private void relateAndInsertList(Object dao, List dataList, Long productId) {
try {
if (CollectionUtils.isEmpty(dataList)) return;
for (Object item : dataList) {
Method setId = item.getClass().getMethod("setId", Long.class);
setId.invoke(item, (Long) null);
Method setProductId = item.getClass().getMethod("setProductId", Long.class);
setProductId.invoke(item, productId);
}
Method insertList = dao.getClass().getMethod("insertList", List.class);
insertList.invoke(dao, dataList);
} catch (Exception e) {
LOGGER.warn("创建产品出错:{}", e.getMessage());
throw new RuntimeException(e.getMessage());
}
}
}
5. 関連作品の展示
Java開発、Python開発、PHP開発、C#開発、その他関連言語をベースにした実践的なプロジェクト
Nodejs、Vue等のフロントエンド技術をベースに開発されたフロントエンド実践プロジェクト
WeChatアプレットおよびAndroid APPアプリケーション開発に基づく関連作品
51 個のマイクロコントローラーおよびその他の組み込みデバイスに基づく組み込み型モノのインターネットの開発と応用
さまざまなアルゴリズムに基づく AI インテリジェント アプリケーション
ビッグデータを活用した各種データ管理・レコメンドシステム