店员,商品导入,sql

This commit is contained in:
chc 2022-09-01 18:53:12 +08:00
parent b873ec2095
commit 2648a0b57e
7 changed files with 299 additions and 14 deletions

View File

@ -1,3 +1,10 @@
/**增加店铺发货信息**/
ALTER TABLE li_store_detail ADD `sales_consignor_address_id` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '发货地址id';
ALTER TABLE li_store_detail ADD `sales_consignor_address_path` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '发货地址名称';
ALTER TABLE li_store_detail ADD `sales_consignor_detail` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '发货详细地址';
ALTER TABLE li_store_detail ADD `sales_consignor_mobile` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '发货人手机';
ALTER TABLE li_store_detail ADD `sales_consignor_name` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '发货人姓名';
/**增加电子面单店铺信息**/
ALTER TABLE `li_store_logistics` ADD `customer_name` varchar(255) DEFAULT NULL COMMENT '客户代码';
ALTER TABLE `li_store_logistics` ADD `customer_pwd` varchar(255) DEFAULT NULL COMMENT '客户密码';
@ -8,3 +15,244 @@ ALTER TABLE `li_store_logistics` ADD `face_sheet_flag` bit(1) DEFAULT NULL COMME
ALTER TABLE `li_store_logistics` ADD `pay_type` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '支付方式';
ALTER TABLE `li_store_logistics` ADD `exp_type` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '快递类型';
/** 店铺--默认页面是否开启**/
ALTER TABLE li_store ADD page_show bit(1) DEFAULT NULL COMMENT '默认页面是否开启';
/** 创建店员表 **/
/*
Navicat Premium Data Transfer
Source Server : lilishop
Source Server Type : MySQL
Source Server Version : 80025
Source Host : 192.168.0.116:3306
Source Schema : zhimai1
Target Server Type : MySQL
Target Server Version : 80025
File Encoding : 65001
Date: 03/03/2022 19:30:20
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for li_clerk
-- ----------------------------
DROP TABLE IF EXISTS `li_clerk`;
CREATE TABLE `li_clerk` (
`id` bigint NOT NULL COMMENT 'ID',
`create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '创建者',
`create_time` datetime(6) NULL DEFAULT NULL COMMENT '创建时间',
`delete_flag` bit(1) NULL DEFAULT NULL COMMENT '删除标志 true/false 删除/未删除',
`update_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '更新者',
`update_time` datetime(6) NULL DEFAULT NULL COMMENT '更新时间',
`clerk_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '店员名称',
`member_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '会员id',
`store_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '店铺id',
`department_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '部门id',
`role_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '角色',
`shopkeeper` bit(1) NULL DEFAULT NULL COMMENT '是否是店主',
`is_super` bit(1) NULL DEFAULT NULL COMMENT '是否是超级管理员 超级管理员/普通管理员',
`status` bit(1) NULL DEFAULT NULL COMMENT '状态',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
/** 店员角色**/
/*
Navicat Premium Data Transfer
Source Server : lilishop
Source Server Type : MySQL
Source Server Version : 80025
Source Host : 192.168.0.116:3306
Source Schema : zhimai1
Target Server Type : MySQL
Target Server Version : 80025
File Encoding : 65001
Date: 03/03/2022 19:30:39
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for li_clerk_role
-- ----------------------------
DROP TABLE IF EXISTS `li_clerk_role`;
CREATE TABLE `li_clerk_role` (
`id` bigint NOT NULL COMMENT 'ID',
`clerk_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '店员唯一id',
`role_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '角色唯一id',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
/** 店铺部门 **/
/*
Navicat Premium Data Transfer
Source Server : lilishop
Source Server Type : MySQL
Source Server Version : 80025
Source Host : 192.168.0.116:3306
Source Schema : zhimai1
Target Server Type : MySQL
Target Server Version : 80025
File Encoding : 65001
Date: 03/03/2022 19:31:39
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for li_store_department
-- ----------------------------
DROP TABLE IF EXISTS `li_store_department`;
CREATE TABLE `li_store_department` (
`id` bigint NOT NULL COMMENT 'ID',
`create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '创建者',
`create_time` datetime(6) NULL DEFAULT NULL COMMENT '创建时间',
`delete_flag` bit(1) NULL DEFAULT NULL COMMENT '删除标志 true/false 删除/未删除',
`update_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '更新者',
`update_time` datetime(6) NULL DEFAULT NULL COMMENT '更新时间',
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '部门名称',
`store_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '店铺id',
`parent_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '父id',
`sort_order` decimal(20, 2) NULL DEFAULT NULL COMMENT '排序值',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
/** 部门角色关联 **/
/*
Navicat Premium Data Transfer
Source Server : lilishop
Source Server Type : MySQL
Source Server Version : 80025
Source Host : 192.168.0.116:3306
Source Schema : zhimai1
Target Server Type : MySQL
Target Server Version : 80025
File Encoding : 65001
Date: 03/03/2022 19:32:01
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for li_store_department_role
-- ----------------------------
DROP TABLE IF EXISTS `li_store_department_role`;
CREATE TABLE `li_store_department_role` (
`id` bigint NOT NULL COMMENT 'ID',
`create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '创建者',
`create_time` datetime(6) NULL DEFAULT NULL COMMENT '创建时间',
`delete_flag` bit(1) NULL DEFAULT NULL COMMENT '删除标志 true/false 删除/未删除',
`update_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '更新者',
`update_time` datetime(6) NULL DEFAULT NULL COMMENT '更新时间',
`role_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '角色id',
`department_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '部门id',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
/**店铺角色菜单**/
/*
Navicat Premium Data Transfer
Source Server : lilishop
Source Server Type : MySQL
Source Server Version : 80025
Source Host : 192.168.0.116:3306
Source Schema : zhimai1
Target Server Type : MySQL
Target Server Version : 80025
File Encoding : 65001
Date: 03/03/2022 19:34:42
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for li_store_menu_role
-- ----------------------------
DROP TABLE IF EXISTS `li_store_menu_role`;
CREATE TABLE `li_store_menu_role` (
`id` bigint NOT NULL COMMENT 'ID',
`create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '创建者',
`create_time` datetime(6) NULL DEFAULT NULL COMMENT '创建时间',
`delete_flag` bit(1) NULL DEFAULT NULL COMMENT '删除标志 true/false 删除/未删除',
`update_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '更新者',
`update_time` datetime(6) NULL DEFAULT NULL COMMENT '更新时间',
`role_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '角色id',
`menu_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '菜单',
`store_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '店铺id',
`is_super` bit(1) NULL DEFAULT NULL COMMENT '是否拥有操作数据权限,为否则只有查看权限',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
/**店铺角色**/
/*
Navicat Premium Data Transfer
Source Server : lilishop
Source Server Type : MySQL
Source Server Version : 80025
Source Host : 192.168.0.116:3306
Source Schema : zhimai1
Target Server Type : MySQL
Target Server Version : 80025
File Encoding : 65001
Date: 03/03/2022 19:32:59
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for li_store_role
-- ----------------------------
DROP TABLE IF EXISTS `li_store_role`;
CREATE TABLE `li_store_role` (
`id` bigint NOT NULL COMMENT 'ID',
`create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '创建者',
`create_time` datetime(6) NULL DEFAULT NULL COMMENT '创建时间',
`delete_flag` bit(1) NULL DEFAULT NULL COMMENT '删除标志 true/false 删除/未删除',
`update_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '更新者',
`update_time` datetime(6) NULL DEFAULT NULL COMMENT '更新时间',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '角色名称',
`store_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '店铺id',
`default_role` bit(1) NULL DEFAULT NULL COMMENT '是否为注册默认角色',
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;

View File

@ -29,8 +29,8 @@ spring:
type: redis
# Redis
redis:
host: 101.43.251.145
port: 6379
host: 192.168.0.108
port: 30379
password: lilishop
lettuce:
pool:
@ -60,7 +60,7 @@ spring:
default-datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://101.43.251.145:3306/clerk?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
url: jdbc:mysql://192.168.0.108:30306/clerk?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: root
password: lilishop
maxActive: 50
@ -119,7 +119,8 @@ ignored:
- /store/passport/login/refresh/**
- /common/common/slider/**
- /common/common/sms/**
- /common/common/site
- /common/common/logo
- /buyer/promotion/kanjiaGoods
- /buyer/payment/cashier/**
- /buyer/other/pageData/**
- /buyer/other/article/**
@ -255,7 +256,7 @@ lili:
# jwt 细节设定
jwt-setting:
# token过期时间分钟
tokenExpireTime: 30
tokenExpireTime: 300000
# 使用Spring @Cacheable注解失效时间
cache:
@ -269,7 +270,7 @@ lili:
data:
elasticsearch:
cluster-name: elasticsearch
cluster-nodes: 101.43.251.145:9200
cluster-nodes: 192.168.0.108:30920
index:
number-of-replicas: 0
number-of-shards: 3
@ -277,10 +278,10 @@ lili:
schema: http
# account:
# username: elastic
# password: LiLiShopES
# password: uE41Dc3m9A52L2omQPV148jG
logstash:
server: 101.43.251.145:4560
server: 192.168.0.108:30560
rocketmq:
promotion-topic: lili_promotion_topic
promotion-group: lili_promotion_group
@ -301,7 +302,7 @@ lili:
after-sale-topic: lili_after_sale_topic
after-sale-group: lili_after_sale_group
rocketmq:
name-server: 101.43.251.145:9876
name-server: 192.168.0.108:30876
isVIPChannel: false
producer:
group: lili_group
@ -310,7 +311,7 @@ rocketmq:
xxl:
job:
admin:
addresses: http://101.43.251.145:9001/xxl-job-admin
addresses: http://192.168.0.108:30001/xxl-job-admin
executor:
appname: xxl-job-executor-lilishop
address:

View File

@ -2,6 +2,7 @@ package cn.lili.modules.member.entity.dos;
import cn.hutool.core.text.CharSequenceUtil;
import cn.lili.modules.member.entity.dto.ClerkAddDTO;
import cn.lili.modules.store.entity.dos.Store;
import cn.lili.mybatis.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
@ -67,4 +68,14 @@ public class Clerk extends BaseEntity {
this.clerkName = clerkAddDTO.getUsername();
}
public Clerk(Store store){
this.memberId = store.getMemberId();
this.storeId = store.getId();
this.clerkName = store.getMemberName();
this.setShopkeeper(true);
this.setIsSuper(true);
this.setStatus(true);
}
}

View File

@ -116,4 +116,6 @@ public interface StoreService extends IService<Store> {
* @param collectionDTO 收藏信息
*/
void updateStoreCollectionNum(CollectionDTO collectionDTO);
void storeToClerk();
}

View File

@ -11,6 +11,7 @@ import cn.lili.common.security.context.UserContext;
import cn.lili.common.utils.BeanUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.modules.goods.service.GoodsService;
import cn.lili.modules.member.entity.dos.Clerk;
import cn.lili.modules.member.entity.dos.Member;
import cn.lili.modules.member.entity.dto.ClerkAddDTO;
import cn.lili.modules.member.entity.dto.CollectionDTO;
@ -36,6 +37,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
@ -70,7 +73,6 @@ public class StoreServiceImpl extends ServiceImpl<StoreMapper, Store> implements
@Autowired
private StoreDetailService storeDetailService;
@Autowired
private Cache cache;
@ -313,6 +315,18 @@ public class StoreServiceImpl extends ServiceImpl<StoreMapper, Store> implements
baseMapper.updateCollection(collectionDTO.getId(), collectionDTO.getNum());
}
@Override
public void storeToClerk() {
//清空店铺信息方便重新导入不会有重复数据
clerkService.remove(new LambdaQueryWrapper<Clerk>().eq(Clerk::getShopkeeper,true));
List<Clerk> clerkList = new ArrayList<>();
//遍历已开启的店铺
for (Store store : this.list(new LambdaQueryWrapper<Store>().eq(Store::getDeleteFlag,false).eq(Store::getStoreDisable,StoreStatusEnum.OPEN.name()))) {
clerkList.add(new Clerk(store));
}
clerkService.saveBatch(clerkList);
}
/**
* 获取当前登录操作的店铺
*

View File

@ -126,4 +126,11 @@ public class StoreManagerController {
}
return ResultUtil.data(null);
}
@ApiOperation(value = "将所有店铺导入店员表")
@PostMapping("store/to/clerk")
public ResultMessage<Object> storeToClerk(){
this.storeService.storeToClerk();
return ResultUtil.success();
}
}

View File

@ -6,12 +6,11 @@ import cn.lili.common.enums.ResultUtil;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.service.GoodsImportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
@ -20,6 +19,9 @@ import javax.servlet.http.HttpServletResponse;
* @author chc
* @since 2022/6/2114:46
*/
@Api(tags = "商品导入")
@RestController
@RequestMapping("/store/goods/import")
public class GoodsImportController {
@Autowired
private GoodsImportService goodsImportService;