commit e5fed2de9f4501b8fbdb1544af3173f65420de43 Author: dy-hu Date: Thu Sep 16 08:13:32 2021 +0800 后台工程代码 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dc93fe1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +*.classpath +*.project +*.iml +*.factorypath +target +.idea/ +*.log +logs +*.DS_Store diff --git a/.run/yshop-admin_Dockerfile.run.xml b/.run/yshop-admin_Dockerfile.run.xml new file mode 100644 index 0000000..c802d31 --- /dev/null +++ b/.run/yshop-admin_Dockerfile.run.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + diff --git a/.run/yshop-app_Dockerfile.run.xml b/.run/yshop-app_Dockerfile.run.xml new file mode 100644 index 0000000..1399164 --- /dev/null +++ b/.run/yshop-app_Dockerfile.run.xml @@ -0,0 +1,25 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Alibaba-PuHuiTi-Regular.otf b/Alibaba-PuHuiTi-Regular.otf new file mode 100644 index 0000000..5960ba1 Binary files /dev/null and b/Alibaba-PuHuiTi-Regular.otf differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..6143bae --- /dev/null +++ b/README.md @@ -0,0 +1,57 @@ +

商城

+ + +#### 项目简介 +基于当前流行技术组合的前后端分离商城系统: SpringBoot2+Jpa+MybatisPlus+SpringSecurity+jwt+redis+Vue的前后端分离的商城系统, 包含商城、拼团、砍价、商户管理、 秒杀、优惠券、积分、分销、会员、充值、到店核销等功能。 + + +## 商城功能 + +* 一:商品模块:商品添加、规格设置,商品上下架等 +* 二:订单模块:下单、购物车、支付,发货、收货、评价、退款等 +* 三:营销模块:积分、优惠券、分销、砍价、拼团、秒杀(、到店核销等 +* 四:微信模块:自定义菜单、自动回复、微信授权、图文管理、模板消息推送 +* 五:配置模块:各种配置 +* 六:用户模块:登陆、注册、会员卡等 +* 七:其他等 + + +#### 项目结构 +项目采用分模块开发方式 +- app 移动端API模块(H5+uniapp端的API) +- admin 管理后台模块 +- weixin 微信相关模块 +- mall 商城公共模块 +- shop 后台商城模块 +- message 消息队列模块 +- common 公共模块 +- logging 日志模块 +- tools 第三方工具模块 +- generator 代码生成模块 +- mproot mybatisPlus配置模块 + + +## 技术选型 +* 1 后端使用技术 + * 1.1 SpringBoot2 + * 1.2 mybatis、MyBatis-Plus + * 1.3 SpringSecurity + * 1.5 Druid + * 1.6 Slf4j + * 1.7 Fastjson + * 1.8 JWT + * 1.9 Redis + * 1.10 Quartz + * 1.11 Mysql + * 1.12 swagger + * 1.13 WxJava + * 1.14 Lombok + * 1.15 Hutool + * 1.16 Mapstruct + * 1.17 Redisson + +* 前端使用技术 + * 2.1 Vue 全家桶 + * 2.2 Element + * 2.3 uniapp + diff --git a/fx.jpg b/fx.jpg new file mode 100644 index 0000000..739d0c1 Binary files /dev/null and b/fx.jpg differ diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..5aeb6c7 --- /dev/null +++ b/pom.xml @@ -0,0 +1,270 @@ + + + 4.0.0 + + co.yixiang + yshop + pom + 3.2 + + + yshop-common + yshop-logging + yshop-admin + yshop-tools + yshop-generator + yshop-app + yshop-weixin + yshop-shop + yshop-mproot + yshop-mall + yshop-message + + + YSHOP商城管理系统 + + + org.springframework.boot + spring-boot-starter-parent + 2.4.8 + + + + UTF-8 + UTF-8 + 1.8 + 2.9.0 + 2.9.2 + 1.2.75 + 1.2.4 + 5.5.7 + 2.5.0 + 1.2.0.Final + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.hibernate.validator + hibernate-validator + 6.1.6.Final + + + org.springframework.boot + spring-boot-starter-aop + + + + org.springframework.boot + spring-boot-starter-cache + + + + org.springframework.boot + spring-boot-starter-data-redis + + + io.lettuce + lettuce-core + + + + + + redis.clients + jedis + 3.3.0 + + + + + + + org.apache.commons + commons-pool2 + ${commons-pool2.version} + + + org.apache.commons + commons-lang3 + + + + + io.springfox + springfox-swagger2 + ${swagger.version} + + + io.swagger + swagger-annotations + + + io.swagger + swagger-models + + + + + io.springfox + springfox-swagger-ui + ${swagger.version} + + + io.swagger + swagger-annotations + 1.5.21 + + + io.swagger + swagger-models + 1.5.21 + + + + com.github.xiaoymin + knife4j-spring-boot-starter + 2.0.1 + + + + mysql + mysql-connector-java + runtime + + + + com.alibaba + druid-spring-boot-starter + ${druid.version} + + + + + org.projectlombok + lombok + true + + + + + cn.hutool + hutool-all + ${hutool.version} + + + + org.apache.poi + poi + 3.17 + + + org.apache.poi + poi-ooxml + 3.17 + + + + xerces + xercesImpl + 2.11.0 + + + + + com.alibaba + fastjson + ${fastjson.version} + + + + org.mapstruct + mapstruct-jdk8 + ${mapstruct.version} + + + org.mapstruct + mapstruct-processor + ${mapstruct.version} + provided + + + javax.inject + javax.inject + 1 + + + com.github.whvcse + easy-captcha + 1.6.2 + + + eu.bitwalker + UserAgentUtils + 1.20 + + + com.google.code.gson + gson + 2.8.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + + + + + aliyun + aliyun-maven + http://maven.aliyun.com/nexus/content/groups/public/ + + + spring-milestones + Spring Milestones + https://maven.aliyun.com/repository/spring + + + central + maven-central + http://central.maven.org/maven2/ + + + + + + public + aliyun nexus + http://maven.aliyun.com/nexus/content/groups/public/ + + true + + + false + + + + diff --git a/poster.jpg b/poster.jpg new file mode 100644 index 0000000..7687578 Binary files /dev/null and b/poster.jpg differ diff --git a/shell/jar-run2.sh b/shell/jar-run2.sh new file mode 100644 index 0000000..83af766 --- /dev/null +++ b/shell/jar-run2.sh @@ -0,0 +1,64 @@ +#cription: 启动重启server服务 +#端口号,根据此端口号确定PID +PORT=767 +#启动命令所在目录 +HOME='/home/sszn/task-agc' + +#查询出监听了test.jar端口TCP协议的程序 +pid=$(ps -ef | grep gdw-agc-task-1.0.0.0.jar | grep -v grep | awk '{print $2}') + +start(){ + echo "start running cloud-core ............... " + if [ -n "$pid" ]; then + echo "server already start,pid:$pid" + echo "pid:$pid agc-job port:$PORT 服务已经在运行了,请停止后再 执行 sh run.sh start " + return 0 + fi + #进入命令所在目录 + cd $HOME + # 启动服务控制台日志输出到nohup.out文件中 + nohup java -jar gdw-agc-task-1.0.0.0.jar >> /home/sszn/task-agc/log/agc-$(date +%Y-%m-%d).log 2>&1 & + echo "running success agc-job port:$PORT" + echo "agc-job port:$PORT 服务启动成功 ..... " +} + +stop(){ + echo "stopping running cloud-core ............... " + if [ -z "$pid" ]; then + echo "not find program on port:$PORT" + echo "agc-job port:$PORT 服务已经被关闭了请执行 sh run.sh start " + return 0 + fi + #结束程序,使用讯号2,如果不行可以尝试讯号9强制结束 + kill -9 $pid + rm -rf $pid + echo "kill program use signal 2,pid:$pid" +} + +status(){ + if [ -z "$pid" ]; then + echo "not find program on port:$PORT" + else + echo "program is running,pid:$pid" + fi +} + +case $1 in + start) + start + ;; + stop) + stop + ;; + restart) + $0 stop + sleep 2 + $0 start + ;; + status) + status + ;; + *) + echo $"Usage: $0 {start|stop|status}" + exit 0 +esac diff --git a/shell/log.sh b/shell/log.sh new file mode 100644 index 0000000..a4737c5 --- /dev/null +++ b/shell/log.sh @@ -0,0 +1 @@ +tail -f nohup.out \ No newline at end of file diff --git a/shell/start.sh b/shell/start.sh new file mode 100644 index 0000000..9ed76c2 --- /dev/null +++ b/shell/start.sh @@ -0,0 +1 @@ +nohup java -jar yshop-app-3.2.jar --spring.profiles.active=prod & diff --git a/shell/startup.sh b/shell/startup.sh new file mode 100644 index 0000000..2a625e0 --- /dev/null +++ b/shell/startup.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash + +INPUT=$2 +FILE_PATH=`readlink -f ${INPUT}` +SERVICE=${INPUT##*/} +SERVICE_NAME=${SERVICE%.*} +DEPLOY_DIR=`pwd` +JVM_OPTS="-server -Xms64m -Xmx128m" + +if [[ "$1" = "" ]]; +then + echo -e "\033[0;31m 未输入操作名 \033[0m \033[0;34m {start|stop|restart|status} \033[0m" + exit 1 +fi + +if [[ "$SERVICE" = "" ]]; +then + echo -e "\033[0;31m 未输入应用名 \033[0m" + exit 1 +fi + +LOGS_DIR="$DEPLOY_DIR/logs/$SERVICE_NAME" +echo "$LOGS_DIR" +if [[ ! -d "$LOGS_DIR" ]]; then + mkdir -p ${LOGS_DIR} +fi + +LOG_PATH="$LOGS_DIR/stdout.out" +pid=0 + +start() +{ + checkPid + if [[ ! -n "$pid" ]]; then + BUILD_ID=dontKillMe nohup java ${JVM_OPTS} -jar ${FILE_PATH} --spring.profiles.active=prod >> ${LOG_PATH} 2>&1 & + echo "$SERVICE_NAME is starting you can check the $LOG_PATH" + else + echo "$SERVICE_NAME is runing PID: $pid" + fi +} + +checkPid() +{ + pid=`ps -ef |grep ${FILE_PATH} |grep -v grep |awk '{print $2}'` +} + +stop() +{ + checkPid + if [[ ! -n "$pid" ]]; then + echo "$SERVICE_NAME not runing" + else + echo "$SERVICE_NAME stop..." + kill -9 ${pid} + fi +} + +restart() +{ + stop + sleep 2 + start +} + +status() +{ + checkPid + if [[ ! -n "$pid" ]]; then + echo "$SERVICE_NAME not runing" + else + echo "$SERVICE_NAME runing PID: $pid" + fi +} + +case $1 in + start) start;; + stop) stop;; + restart) restart;; + status) status;; + *) echo "require start|stop|restart|status" ;; +esac diff --git a/shell/stop.sh b/shell/stop.sh new file mode 100644 index 0000000..3a823cb --- /dev/null +++ b/shell/stop.sh @@ -0,0 +1,7 @@ +PID=$(ps -ef | grep yshop-app-3.2.jar | grep -v grep | awk '{ print $2 }') +if [ -z "$PID" ];then + echo Application is already stopped +else + echo kill $PID + kill $PID +fi diff --git a/shell/yshop.sh b/shell/yshop.sh new file mode 100644 index 0000000..6b2c871 --- /dev/null +++ b/shell/yshop.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash + +INPUT=$2 +FILE_PATH=`readlink -f ${INPUT}` +SERVICE=${INPUT##*/} +SERVICE_NAME=${SERVICE%.*} +DEPLOY_DIR=`pwd` +JVM_OPTS="-server -Xms64m -Xmx128m" + +if [[ "$1" = "" ]]; +then + echo -e "\033[0;31m 未输入操作名 \033[0m \033[0;34m {start|stop|restart|status} \033[0m" + exit 1 +fi + +if [[ "$SERVICE" = "" ]]; +then + echo -e "\033[0;31m 未输入应用名 \033[0m" + exit 1 +fi + +LOGS_DIR="$DEPLOY_DIR/logs/$SERVICE_NAME" +echo "$LOGS_DIR" +if [[ ! -d "$LOGS_DIR" ]]; then + mkdir -p ${LOGS_DIR} +fi + +LOG_PATH="$LOGS_DIR/stdout.out" +pid=0 + +start() +{ + checkPid + if [[ ! -n "$pid" ]]; then + BUILD_ID=dontKillMe nohup java ${JVM_OPTS} -jar ${FILE_PATH} >> ${LOG_PATH} 2>&1 & + echo "$SERVICE_NAME is starting you can check the $LOG_PATH" + else + echo "$SERVICE_NAME is runing PID: $pid" + fi +} + +checkPid() +{ + pid=`ps -ef |grep ${FILE_PATH} |grep -v grep |awk '{print $2}'` +} + +stop() +{ + checkPid + if [[ ! -n "$pid" ]]; then + echo "$SERVICE_NAME not runing" + else + echo "$SERVICE_NAME stop..." + kill -9 ${pid} + fi +} + +restart() +{ + stop + sleep 2 + start +} + +status() +{ + checkPid + if [[ ! -n "$pid" ]]; then + echo "$SERVICE_NAME not runing" + else + echo "$SERVICE_NAME runing PID: $pid" + fi +} + +case $1 in + start) start;; + stop) stop;; + restart) restart;; + status) status;; + *) echo "require start|stop|restart|status" ;; +esac diff --git a/simsunb.ttf b/simsunb.ttf new file mode 100644 index 0000000..1c14f7f Binary files /dev/null and b/simsunb.ttf differ diff --git a/sql/.yshop.version/yshop-V1.1.pdman.json b/sql/.yshop.version/yshop-V1.1.pdman.json new file mode 100644 index 0000000..e2e22d3 --- /dev/null +++ b/sql/.yshop.version/yshop-V1.1.pdman.json @@ -0,0 +1,11450 @@ +{ + "modules": [ + { + "name": "DB_REVERSE_MYSQL", + "chnname": "逆向解析_MYSQL", + "entities": [ + { + "title": "monitor_server", + "chnname": "服务监控", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "cpu_core", + "type": "INT_10", + "chnname": "CPU内核数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cpu_rate", + "type": "DOUBLE_22", + "chnname": "CPU使用率", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "disk_total", + "type": "DOUBLE_22", + "chnname": "磁盘总量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "disk_used", + "type": "DOUBLE_22", + "chnname": "磁盘使用量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mem_total", + "type": "DOUBLE_22", + "chnname": "内存总数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mem_used", + "type": "DOUBLE_22", + "chnname": "内存使用量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "port", + "type": "INT_10", + "chnname": "访问端口", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "state", + "type": "VARCHAR_255", + "chnname": "状态", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "swap_total", + "type": "DOUBLE_22", + "chnname": "交换区总量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "swap_used", + "type": "DOUBLE_22", + "chnname": "交换区使用量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "address", + "type": "VARCHAR_255", + "chnname": "服务地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_wechat_live", + "chnname": "", + "fields": [ + { + "name": "roomid", + "type": "BIGINT_19", + "chnname": "直播间id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "直播间标题", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cover_imge", + "type": "VARCHAR_255", + "chnname": "背景图", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "share_imge", + "type": "VARCHAR_255", + "chnname": "分享图片", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "live_status", + "type": "INT_10", + "chnname": "直播间状态", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "start_time", + "type": "BIGINT_19", + "chnname": "开始时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "end_time", + "type": "BIGINT_19", + "chnname": "预计结束时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "anchor_name", + "type": "VARCHAR_64", + "chnname": "主播昵称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "anchor_wechat", + "type": "VARCHAR_32", + "chnname": "主播微信号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "anchor_imge", + "type": "VARCHAR_255", + "chnname": "主播头像", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "BIT_1", + "chnname": "直播间类型 1:推流 0:手机直播", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "screen_type", + "type": "BIT_1", + "chnname": "横屏、竖屏 【1:横屏,0:竖屏】", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "close_like", + "type": "BIT_1", + "chnname": "是否关闭点赞 【0:开启,1:关闭】", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "close_comment", + "type": "BIT_1", + "chnname": "是否关闭评论 【0:开启,1:关闭】", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "close_goods", + "type": "BIT_1", + "chnname": "是否关闭货架 【0:开启,1:关闭】", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "VARCHAR_255", + "chnname": "商品id 多个,分割", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_wechat_live_goods", + "chnname": "", + "fields": [ + { + "name": "goods_id", + "type": "BIGINT_19", + "chnname": "直播商品id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT_19", + "chnname": "关联商品id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cover_imge_url", + "type": "VARCHAR_255", + "chnname": "商品图片", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_64", + "chnname": "商品小程序路径", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price_type", + "type": "VARCHAR_255", + "chnname": "价格类型 1:一口价(只需要传入price,price2不传) 2:价格区间(price字段为左边界,price2字段为右边界,price和price2必传) 3:显示折扣价(price字段为原价,price2字段为现价, price和price2必传)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "VARCHAR_64", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price2", + "type": "VARCHAR_64", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "商品名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "third_party_tag", + "type": "VARCHAR_255", + "chnname": "1, 2:表示是为api添加商品,否则是直播控制台添加的商品", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "audit_id", + "type": "BIGINT_19", + "chnname": "审核单id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "audit_status", + "type": "INT UNSIGNED_10", + "chnname": "审核状态 0:未审核,1:审核中,2:审核通过,3审核失败", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "edges": [], + "nodes": [] + }, + "associations": [] + }, + { + "name": "tools", + "chnname": "工具模块", + "entities": [ + { + "title": "email_config", + "chnname": "邮箱配置", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "from_user", + "type": "VARCHAR_255", + "chnname": "收件人", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "host", + "type": "VARCHAR_255", + "chnname": "邮件服务器SMTP地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pass", + "type": "VARCHAR_255", + "chnname": "密码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "port", + "type": "VARCHAR_255", + "chnname": "端口", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "user", + "type": "VARCHAR_255", + "chnname": "发件者用户名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "local_storage", + "chnname": "本地存储", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_255", + "chnname": "文件真实的名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "文件名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "suffix", + "type": "VARCHAR_255", + "chnname": "后缀", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "path", + "type": "VARCHAR_255", + "chnname": "路径", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_255", + "chnname": "类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "size", + "type": "VARCHAR_100", + "chnname": "大小", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "operate", + "type": "VARCHAR_255", + "chnname": "操作人", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "picture", + "chnname": "Sm.Ms图床", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "上传日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "delete_url", + "type": "VARCHAR_255", + "chnname": "删除的URL", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "filename", + "type": "VARCHAR_255", + "chnname": "图片名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "height", + "type": "VARCHAR_255", + "chnname": "图片高度", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "size", + "type": "VARCHAR_255", + "chnname": "图片大小", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_255", + "chnname": "图片地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "username", + "type": "VARCHAR_255", + "chnname": "用户名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "width", + "type": "VARCHAR_255", + "chnname": "图片宽度", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "md5code", + "type": "VARCHAR_255", + "chnname": "文件的MD5值", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "qiniu_config", + "chnname": "七牛云配置", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "access_key", + "type": "TEXT", + "chnname": "accessKey", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bucket", + "type": "VARCHAR_255", + "chnname": "Bucket 识别符", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "host", + "type": "VARCHAR_255", + "chnname": "外链域名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "secret_key", + "type": "TEXT", + "chnname": "secretKey", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_255", + "chnname": "空间类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "zone", + "type": "VARCHAR_255", + "chnname": "机房", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "qiniu_content", + "chnname": "七牛云文件存储", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "bucket", + "type": "VARCHAR_255", + "chnname": "Bucket 识别符", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "文件名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "size", + "type": "VARCHAR_255", + "chnname": "文件大小", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_255", + "chnname": "文件类型:私有或公开", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "上传或同步的时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_255", + "chnname": "文件url", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "suffix", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "verification_code", + "chnname": "验证码", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "code", + "type": "VARCHAR_255", + "chnname": "验证码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "状态:1有效、0过期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_255", + "chnname": "验证码类型:email或者短信", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "value", + "type": "VARCHAR_255", + "chnname": "接收邮箱或者手机号码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "scenes", + "type": "VARCHAR_255", + "chnname": "业务名称:如重置邮箱、重置密码等", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "alipay_config", + "chnname": "支付宝配置类", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "主键", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "app_id", + "type": "VARCHAR_255", + "chnname": "应用ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "charset", + "type": "VARCHAR_255", + "chnname": "编码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "format", + "type": "VARCHAR_255", + "chnname": "类型 固定格式json", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "gateway_url", + "type": "VARCHAR_255", + "chnname": "网关地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "notify_url", + "type": "VARCHAR_255", + "chnname": "异步回调", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "private_key", + "type": "TEXT", + "chnname": "私钥", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "public_key", + "type": "TEXT", + "chnname": "公钥", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "return_url", + "type": "VARCHAR_255", + "chnname": "回调地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sign_type", + "type": "VARCHAR_255", + "chnname": "签名方式", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sys_service_provider_id", + "type": "VARCHAR_255", + "chnname": "商户号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + } + }, + { + "name": "logging", + "chnname": "日志", + "entities": [ + { + "title": "log", + "chnname": "系统日志", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "description", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "exception_detail", + "type": "TEXT", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "log_type", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "method", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "params", + "type": "TEXT", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "request_ip", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "time", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "username", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "address", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "browser", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + }, + "associations": [] + }, + { + "name": "gen", + "chnname": "代码生成", + "entities": [ + { + "title": "gen_test", + "chnname": "代码生成测试", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sex", + "type": "INT_10", + "chnname": "性别", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "column_config", + "chnname": "代码生成字段信息存储", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "table_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "column_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "column_type", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "dict_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "extra", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "form_show", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "form_type", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "key_type", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "list_show", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "not_null", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "query_type", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remark", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "date_annotation", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "gen_config", + "chnname": "代码生成器配置", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "table_name", + "type": "VARCHAR_255", + "chnname": "表名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "author", + "type": "VARCHAR_255", + "chnname": "作者", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cover", + "type": "BIT_1", + "chnname": "是否覆盖", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "module_name", + "type": "VARCHAR_255", + "chnname": "模块名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pack", + "type": "VARCHAR_255", + "chnname": "至于哪个包下", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "path", + "type": "VARCHAR_255", + "chnname": "前端代码生成的路径", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "api_path", + "type": "VARCHAR_255", + "chnname": "前端Api文件路径", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "prefix", + "type": "VARCHAR_255", + "chnname": "表前缀", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "api_alias", + "type": "VARCHAR_255", + "chnname": "接口名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "column_config", + "moduleName": false, + "x": 288.359375, + "y": 279, + "id": "09a1ceae" + }, + { + "shape": "table", + "title": "gen_config", + "moduleName": false, + "x": 760, + "y": 200, + "id": "2e380491" + } + ], + "edges": [] + }, + "associations": [] + }, + { + "name": "monitor", + "chnname": "", + "entities": [ + { + "title": "visits", + "chnname": "访客记录", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "date", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ip_counts", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pv_counts", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "week_day", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + }, + "associations": [] + }, + { + "name": "quartz", + "chnname": "定时任务", + "entities": [ + { + "title": "quartz_job", + "chnname": "定时任务", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "bean_name", + "type": "VARCHAR_255", + "chnname": "Spring Bean名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cron_expression", + "type": "VARCHAR_255", + "chnname": "cron 表达式", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_pause", + "type": "BIT_1", + "chnname": "状态:1暂停、0启用", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "job_name", + "type": "VARCHAR_255", + "chnname": "任务名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "method_name", + "type": "VARCHAR_255", + "chnname": "方法名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "params", + "type": "VARCHAR_255", + "chnname": "参数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remark", + "type": "VARCHAR_255", + "chnname": "备注", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "quartz_log", + "chnname": "定时任务日志", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "baen_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cron_expression", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "exception_detail", + "type": "TEXT", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_success", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "job_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "method_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "params", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "time", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "quartz_job", + "moduleName": false, + "x": 422.359375, + "y": 367, + "id": "4b2bda89" + }, + { + "shape": "table", + "title": "quartz_log", + "moduleName": false, + "x": 890, + "y": 340, + "id": "b47ba8e0" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "b47ba8e0", + "target": "4b2bda89", + "id": "01afd2ee", + "controlPoints": [ + { + "x": 759.2236328125, + "y": 356.3101851851852 + }, + { + "x": 608.0595703125, + "y": 354.9063636363636 + } + ], + "sourceAnchor": 12, + "targetAnchor": 9 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "quartz_log", + "field": "job_name" + }, + "to": { + "entity": "quartz_job", + "field": "job_name" + } + } + ] + }, + { + "name": "system", + "chnname": "系统模块", + "entities": [ + { + "title": "users_roles", + "chnname": "用户角色关联", + "fields": [ + { + "name": "user_id", + "type": "BIGINT_19", + "chnname": "用户ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "role_id", + "type": "BIGINT_19", + "chnname": "角色ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "roles_menus", + "chnname": "角色菜单关联", + "fields": [ + { + "name": "menu_id", + "type": "BIGINT_19", + "chnname": "菜单ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "role_id", + "type": "BIGINT_19", + "chnname": "角色ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "roles_depts", + "chnname": "角色部门关联", + "fields": [ + { + "name": "role_id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "dept_id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "user_avatar", + "chnname": "系统用户头像", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_255", + "chnname": "真实文件名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "path", + "type": "VARCHAR_255", + "chnname": "路径", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "size", + "type": "VARCHAR_255", + "chnname": "大小", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "role", + "chnname": "角色表", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remark", + "type": "VARCHAR_255", + "chnname": "备注", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "data_scope", + "type": "VARCHAR_255", + "chnname": "数据权限", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "level", + "type": "INT_10", + "chnname": "角色级别", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "permission", + "type": "VARCHAR_255", + "chnname": "功能权限", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "dict", + "chnname": "数据字典", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "字典名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remark", + "type": "VARCHAR_255", + "chnname": "描述", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "dict_detail", + "chnname": "数据字典详情", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "label", + "type": "VARCHAR_255", + "chnname": "字典标签", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "value", + "type": "VARCHAR_255", + "chnname": "字典值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "VARCHAR_255", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "dict_id", + "type": "BIGINT_19", + "chnname": "字典id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "dept", + "chnname": "部门", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pid", + "type": "BIGINT_19", + "chnname": "上级部门", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "enabled", + "type": "BIT_1", + "chnname": "状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "menu", + "chnname": "", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "i_frame", + "type": "BIT_1", + "chnname": "是否外链", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "菜单名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "component", + "type": "VARCHAR_255", + "chnname": "组件", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pid", + "type": "BIGINT_19", + "chnname": "上级菜单ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "BIGINT_19", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "icon", + "type": "VARCHAR_255", + "chnname": "图标", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "path", + "type": "VARCHAR_255", + "chnname": "链接地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cache", + "type": "BIT_1", + "chnname": "缓存", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "hidden", + "type": "BIT_1", + "chnname": "是否隐藏", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "component_name", + "type": "VARCHAR_20", + "chnname": "组件名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "permission", + "type": "VARCHAR_255", + "chnname": "权限", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "INT_10", + "chnname": "类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "job", + "chnname": "岗位", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "岗位名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "enabled", + "type": "BIT_1", + "chnname": "岗位状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "BIGINT_19", + "chnname": "岗位排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "dept_id", + "type": "BIGINT_19", + "chnname": "部门ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "user", + "chnname": "系统用户", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "avatar_id", + "type": "BIGINT_19", + "chnname": "头像", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "email", + "type": "VARCHAR_255", + "chnname": "邮箱", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "enabled", + "type": "BIGINT_19", + "chnname": "状态:1启用、0禁用", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "password", + "type": "VARCHAR_255", + "chnname": "密码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "username", + "type": "VARCHAR_255", + "chnname": "用户名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "dept_id", + "type": "BIGINT_19", + "chnname": "部门名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "phone", + "type": "VARCHAR_255", + "chnname": "手机号码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "job_id", + "type": "BIGINT_19", + "chnname": "岗位名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "last_password_reset_time", + "type": "DATETIME", + "chnname": "最后修改密码的日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "nick_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sex", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "user", + "moduleName": false, + "x": 730, + "y": 200, + "id": "42584636" + }, + { + "shape": "table", + "title": "menu", + "moduleName": false, + "x": 230, + "y": 580, + "id": "faa9e561" + }, + { + "shape": "table", + "title": "dict_detail", + "moduleName": false, + "x": 1440, + "y": 720, + "id": "de6d0d5f" + }, + { + "shape": "table", + "title": "dict", + "moduleName": false, + "x": 1080, + "y": 770, + "id": "2e3e2ccb" + }, + { + "shape": "table", + "title": "user_avatar", + "moduleName": false, + "x": 220, + "y": 100, + "id": "794cd430" + }, + { + "shape": "table", + "title": "job", + "moduleName": false, + "x": 240, + "y": 290, + "id": "fe1aecfe" + }, + { + "shape": "table", + "title": "roles_menus", + "moduleName": false, + "x": 550, + "y": 490, + "id": "0ba651c7" + }, + { + "shape": "table", + "title": "role", + "moduleName": false, + "x": 850, + "y": 570, + "id": "2dd8b462" + }, + { + "shape": "table", + "title": "roles_depts", + "moduleName": false, + "x": 1140, + "y": 490, + "id": "759d8dd0" + }, + { + "shape": "table", + "title": "users_roles", + "moduleName": false, + "x": 1210, + "y": 50, + "id": "e76717e1" + }, + { + "shape": "table", + "title": "dept", + "moduleName": false, + "x": 1200, + "y": 240, + "id": "2ecdc324" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "42584636", + "target": "fe1aecfe", + "id": "a7e02413", + "controlPoints": [ + { + "x": 518.6240234375, + "y": 225.91161616161617 + }, + { + "x": 384.025390625, + "y": 232.19736842105263 + } + ], + "sourceAnchor": 16, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "42584636", + "target": "2ecdc324", + "id": "99cdad68", + "controlPoints": [ + { + "x": 941.3759765625, + "y": 187.46212121212122 + }, + { + "x": 1055.974609375, + "y": 192.22058823529412 + } + ], + "sourceAnchor": 13, + "targetAnchor": 0 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "de6d0d5f", + "target": "2e3e2ccb", + "id": "0f30581b", + "controlPoints": [ + { + "x": 1296.224609375, + "y": 736.3355263157895 + }, + { + "x": 1223.775390625, + "y": 732.25 + } + ], + "sourceAnchor": 8, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "42584636", + "target": "794cd430", + "id": "618c6bc6", + "controlPoints": [ + { + "x": 518.6240234375, + "y": 91.33838383838385 + }, + { + "x": 368.099609375, + "y": 72.28846153846153 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "0ba651c7", + "target": "faa9e561", + "id": "fdb423ea", + "controlPoints": [ + { + "x": 422.126953125, + "y": 492.281914893617 + }, + { + "x": 395.0341796875, + "y": 442.10714285714283 + } + ], + "sourceAnchor": 0, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "0ba651c7", + "target": "2dd8b462", + "id": "882b95a1", + "controlPoints": [ + { + "x": 677.873046875, + "y": 512.8191489361702 + }, + { + "x": 705.974609375, + "y": 502.17857142857144 + } + ], + "sourceAnchor": 3, + "targetAnchor": 0 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "759d8dd0", + "target": "2dd8b462", + "id": "7a7a3350", + "controlPoints": [ + { + "x": 1034.2080078125, + "y": 492.281914893617 + }, + { + "x": 994.025390625, + "y": 502.17857142857144 + } + ], + "sourceAnchor": 0, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "759d8dd0", + "target": "2ecdc324", + "id": "a9e0dc69", + "controlPoints": [ + { + "x": 1245.7919921875, + "y": 506.48049645390074 + }, + { + "x": 1440, + "y": 500 + }, + { + "x": 1440, + "y": 190 + }, + { + "x": 1344.025390625, + "y": 192.22058823529412 + } + ], + "sourceAnchor": 3, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "e76717e1", + "target": "42584636", + "id": "6179129e", + "controlPoints": [ + { + "x": 1085.4638671875, + "y": 52.28191489361702 + }, + { + "x": 941.3759765625, + "y": 72.11363636363636 + } + ], + "sourceAnchor": 0, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "e76717e1", + "target": "2dd8b462", + "id": "c796f9c9", + "controlPoints": [ + { + "x": 1334.5361328125, + "y": 72.81914893617022 + }, + { + "x": 1480, + "y": 70 + }, + { + "x": 1490, + "y": 580 + }, + { + "x": 1030, + "y": 590 + }, + { + "x": 994.025390625, + "y": 502.17857142857144 + } + ], + "sourceAnchor": 3, + "targetAnchor": 1 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "user", + "field": "job_id" + }, + "to": { + "entity": "job", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "user", + "field": "dept_id" + }, + "to": { + "entity": "dept", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "dict_detail", + "field": "dict_id" + }, + "to": { + "entity": "dict", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "user", + "field": "avatar_id" + }, + "to": { + "entity": "user_avatar", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "roles_menus", + "field": "menu_id" + }, + "to": { + "entity": "menu", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "roles_menus", + "field": "role_id" + }, + "to": { + "entity": "role", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "roles_depts", + "field": "role_id" + }, + "to": { + "entity": "role", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "roles_depts", + "field": "dept_id" + }, + "to": { + "entity": "dept", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "users_roles", + "field": "user_id" + }, + "to": { + "entity": "user", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "users_roles", + "field": "role_id" + }, + "to": { + "entity": "role", + "field": "id" + } + } + ] + }, + { + "name": "activity", + "chnname": "活动", + "entities": [ + { + "title": "yx_store_seckill", + "chnname": "商品秒杀产品表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品秒杀产品表id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_255", + "chnname": "推荐图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "images", + "type": "VARCHAR_2000", + "chnname": "轮播图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_255", + "chnname": "活动标题", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "info", + "type": "VARCHAR_255", + "chnname": "简介", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "价格", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "成本", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ot_price", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "原价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "give_integral", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "返多少积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stock", + "type": "INT UNSIGNED_10", + "chnname": "库存", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sales", + "type": "INT UNSIGNED_10", + "chnname": "销量", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unit_name", + "type": "VARCHAR_16", + "chnname": "单位名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "postage", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "邮费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "description", + "type": "TEXT", + "chnname": "内容", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "start_time", + "type": "DATE", + "chnname": "开始时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stop_time", + "type": "DATE", + "chnname": "结束时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "产品状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_postage", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否包邮", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_hot", + "type": "TINYINT UNSIGNED_1", + "chnname": "热门推荐", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "删除 0未删除1已删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "num", + "type": "INT UNSIGNED_10", + "chnname": "最多秒杀几个", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "TINYINT UNSIGNED_1", + "chnname": "显示", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "time_id", + "type": "INT UNSIGNED_10", + "chnname": "时间段id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spec_type", + "type": "BIT_1", + "chnname": "规格 0单 1多", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temp_id", + "type": "INT_10", + "chnname": "运费模板id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_sub", + "type": "INT_10", + "chnname": "规格设置", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_pink", + "chnname": "拼团表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "order_id", + "type": "VARCHAR_32", + "chnname": "订单id 生成", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "order_id_key", + "type": "INT UNSIGNED_10", + "chnname": "订单id 数据库", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_num", + "type": "INT UNSIGNED_10", + "chnname": "购买商品个数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_price", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "购买总金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cid", + "type": "BIGINT UNSIGNED_20", + "chnname": "拼团产品id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pid", + "type": "BIGINT UNSIGNED_20", + "chnname": "产品id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "people", + "type": "INT UNSIGNED_10", + "chnname": "拼团总人数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "拼团产品单价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "开始时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stop_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "k_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "团长id 0为团长", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_tpl", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否发送模板消息0未发送1已发送", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_refund", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否退款 0未退款 1已退款", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "状态1进行中2已完成3未完成", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_coupon_user", + "chnname": "优惠券发放记录表", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "优惠券发放记录id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "cid", + "type": "INT UNSIGNED_10", + "chnname": "兑换的项目id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "优惠券所属用户", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_title", + "type": "VARCHAR_32", + "chnname": "优惠券名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "优惠券的面值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "use_min_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "最低消费多少金额可用优惠券", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "优惠券创建时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "end_time", + "type": "DATETIME", + "chnname": "优惠券结束时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "use_time", + "type": "DATETIME", + "chnname": "使用时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_32", + "chnname": "获取方式", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "状态(0:未使用,1:已使用, 2:已过期)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_fail", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否有效", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_coupon_issue_user", + "chnname": "优惠券前台用户领取记录表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "领取优惠券用户ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "issue_coupon_id", + "type": "INT_10", + "chnname": "优惠券前台领取ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "领取时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_coupon_issue", + "chnname": "优惠券前台领取表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "cname", + "type": "VARCHAR_50", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cid", + "type": "INT_10", + "chnname": "优惠券ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ctype", + "type": "BIT_1", + "chnname": "优惠券类型 0-通用 1-商品券", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "start_time", + "type": "DATETIME", + "chnname": "优惠券领取开启时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "end_time", + "type": "DATETIME", + "chnname": "优惠券领取结束时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_count", + "type": "INT_10", + "chnname": "优惠券领取数量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remain_count", + "type": "INT_10", + "chnname": "优惠券剩余领取数量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_permanent", + "type": "BIT_1", + "chnname": "是否无限张数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "1 正常 0 未开启 -1 已无效", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "优惠券添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_coupon", + "chnname": "优惠券表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "优惠券表ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_64", + "chnname": "优惠券名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "integral", + "type": "INT UNSIGNED_10", + "chnname": "兑换消耗积分值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "兑换的优惠券面值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "use_min_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "最低消费多少金额可用优惠券", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_time", + "type": "INT UNSIGNED_10", + "chnname": "优惠券有效期限(单位:天)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "状态(0:关闭,1:开启)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "VARCHAR_200", + "chnname": "商品ids", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "TINYINT_3", + "chnname": "优惠券类型 0-通用 1-商品券", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "兑换项目添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_combination", + "chnname": "拼团产品表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT UNSIGNED_10", + "chnname": "商户id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_255", + "chnname": "推荐图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "images", + "type": "VARCHAR_2000", + "chnname": "轮播图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_255", + "chnname": "活动标题", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "attr", + "type": "VARCHAR_255", + "chnname": "活动属性", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "people", + "type": "INT UNSIGNED_10", + "chnname": "参团人数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "info", + "type": "VARCHAR_255", + "chnname": "简介", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "价格", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_price", + "type": "DECIMAL_10_2", + "chnname": "商品原价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sales", + "type": "INT UNSIGNED_10", + "chnname": "销量", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stock", + "type": "INT UNSIGNED_10", + "chnname": "库存", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_host", + "type": "TINYINT UNSIGNED_1", + "chnname": "推荐", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "TINYINT UNSIGNED_1", + "chnname": "产品状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "combination", + "type": "TINYINT UNSIGNED_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_use", + "type": "TINYINT UNSIGNED_1", + "chnname": "商户是否可用1可用0不可用", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "description", + "type": "TEXT", + "chnname": "拼团内容", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "start_time", + "type": "DATETIME", + "chnname": "拼团开始时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stop_time", + "type": "DATETIME", + "chnname": "拼团结束时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "effective_time", + "type": "INT_10", + "chnname": "拼团订单有效时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "INT UNSIGNED_10", + "chnname": "拼团产品成本", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "browse", + "type": "INT_10", + "chnname": "浏览量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unit_name", + "type": "VARCHAR_32", + "chnname": "单位名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spec_type", + "type": "BIT_1", + "chnname": "规格 0单 1多", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temp_id", + "type": "INT_10", + "chnname": "运费模板ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_sub", + "type": "INT_10", + "chnname": "规格设置", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_bargain_user_help", + "chnname": "砍价用户帮助表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "砍价用户帮助表ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "帮助的用户id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "砍价产品ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_user_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户参与砍价表id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "帮助砍价多少金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_bargain_user", + "chnname": "用户参与砍价表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户参与砍价表ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "砍价产品id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_price_min", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "砍价的最低价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_price", + "type": "DECIMAL_8_2", + "chnname": "砍价金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "砍掉的价格", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "状态 1参与中 2 活动结束参与失败 3活动结束参与成功", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "参与时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "是否取消", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_bargain", + "chnname": "砍价表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "砍价产品ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "关联产品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_255", + "chnname": "砍价活动名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_150", + "chnname": "砍价活动图片", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unit_name", + "type": "VARCHAR_16", + "chnname": "单位名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stock", + "type": "INT UNSIGNED_10", + "chnname": "库存", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sales", + "type": "INT UNSIGNED_10", + "chnname": "销量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "images", + "type": "VARCHAR_2000", + "chnname": "砍价产品轮播图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "start_time", + "type": "DATETIME", + "chnname": "砍价开启时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stop_time", + "type": "DATETIME", + "chnname": "砍价结束时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_name", + "type": "VARCHAR_255", + "chnname": "砍价产品名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "砍价金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "min_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "砍价商品最低价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "num", + "type": "INT UNSIGNED_10", + "chnname": "每次购买的砍价产品数量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_max_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "用户每次砍价的最大金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_min_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "用户每次砍价的最小金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_num", + "type": "INT UNSIGNED_10", + "chnname": "用户每次砍价的次数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "砍价状态 0(到砍价时间不自动开启) 1(到砍价时间自动开启时间)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "description", + "type": "TEXT", + "chnname": "砍价详情", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "give_integral", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "反多少积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "info", + "type": "VARCHAR_255", + "chnname": "砍价活动简介", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "成本价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_hot", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否推荐0不推荐1推荐", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除 0未删除 1删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_postage", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否包邮 0不包邮 1包邮", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "postage", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "邮费", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "rule", + "type": "TEXT", + "chnname": "砍价规则", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "look", + "type": "INT UNSIGNED_10", + "chnname": "砍价产品浏览量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "share", + "type": "INT UNSIGNED_10", + "chnname": "砍价产品分享量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_visit", + "chnname": "产品浏览分析表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "INT_10", + "chnname": "产品ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_type", + "type": "VARCHAR_32", + "chnname": "产品类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cate_id", + "type": "INT_10", + "chnname": "产品分类ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "CHAR_50", + "chnname": "产品类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "INT_10", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "count", + "type": "INT_10", + "chnname": "访问次数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "content", + "type": "VARCHAR_255", + "chnname": "备注描述", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "add_time", + "type": "INT_10", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "yx_store_pink", + "moduleName": false, + "x": 310, + "y": 580, + "id": "13513a4e" + }, + { + "shape": "table", + "title": "yx_store_coupon", + "moduleName": false, + "x": 600, + "y": 180, + "id": "2b6bf508" + }, + { + "shape": "table", + "title": "yx_store_coupon_user", + "moduleName": false, + "x": 1310, + "y": 190, + "id": "aa29268e" + }, + { + "shape": "table", + "title": "yx_store_coupon_issue", + "moduleName": false, + "x": 1270, + "y": 580, + "id": "74e5a8f0" + }, + { + "shape": "table", + "title": "yx_store_coupon_issue_user", + "moduleName": false, + "x": 790, + "y": 610, + "id": "dfd12dd0" + }, + { + "shape": "table", + "title": "yx_store_bargain", + "moduleName": false, + "x": -160, + "y": -50, + "id": "1de36ee3" + }, + { + "shape": "table", + "title": "yx_store_bargain_user", + "moduleName": false, + "x": 590, + "y": -340, + "id": "14a47167" + }, + { + "shape": "table", + "title": "yx_store_bargain_user_help", + "moduleName": false, + "x": 490, + "y": -100, + "id": "e979c0f8" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "aa29268e", + "target": "2b6bf508", + "id": "a8da6c7b", + "controlPoints": [ + { + "x": 1041.849609375, + "y": 91.2897465437788 + }, + { + "x": 835.138671875, + "y": 72.12931034482759 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "74e5a8f0", + "target": "2b6bf508", + "id": "6abf3f7d", + "controlPoints": [ + { + "x": 1051.787109375, + "y": 510.3375331564987 + }, + { + "x": 835.138671875, + "y": 72.12931034482759 + } + ], + "sourceAnchor": 4, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "dfd12dd0", + "target": "74e5a8f0", + "id": "0433262a", + "controlPoints": [ + { + "x": 991.1455078125, + "y": 608.3222222222222 + }, + { + "x": 1051.787109375, + "y": 472.12931034482756 + } + ], + "sourceAnchor": 5, + "targetAnchor": 0 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "14a47167", + "target": "1de36ee3", + "id": "e528de82", + "controlPoints": [ + { + "x": 279.8408203125, + "y": -377.6630434782609 + }, + { + "x": 182.1513671875, + "y": -347.9440298507463 + } + ], + "sourceAnchor": 4, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "e979c0f8", + "target": "1de36ee3", + "id": "b2e7774f", + "controlPoints": [ + { + "x": 280.6005859375, + "y": -120.73355263157895 + }, + { + "x": 182.1513671875, + "y": -347.9440298507463 + } + ], + "sourceAnchor": 4, + "targetAnchor": 1 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_coupon_user", + "field": "cid" + }, + "to": { + "entity": "yx_store_coupon", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_coupon_issue", + "field": "cid" + }, + "to": { + "entity": "yx_store_coupon", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_coupon_issue_user", + "field": "issue_coupon_id" + }, + "to": { + "entity": "yx_store_coupon_issue", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_bargain_user", + "field": "bargain_id" + }, + "to": { + "entity": "yx_store_bargain", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_bargain_user_help", + "field": "bargain_id" + }, + "to": { + "entity": "yx_store_bargain", + "field": "id" + } + } + ] + }, + { + "name": "cart", + "chnname": "购物车", + "entities": [ + { + "title": "yx_store_cart", + "chnname": "购物车表", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "购物车表ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_32", + "chnname": "类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_attr_unique", + "type": "VARCHAR_50", + "chnname": "商品属性", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cart_num", + "type": "SMALLINT UNSIGNED_5", + "chnname": "商品数量", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_pay", + "type": "BIT_1", + "chnname": "0 = 未购买 1 = 已购买", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_new", + "type": "BIT_1", + "chnname": "是否为立即购买", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "combination_id", + "type": "INT UNSIGNED_10", + "chnname": "拼团id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "seckill_id", + "type": "INT UNSIGNED_10", + "chnname": "秒杀产品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_id", + "type": "INT UNSIGNED_10", + "chnname": "砍价id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + } + }, + { + "name": "category", + "chnname": "商品分类", + "entities": [ + { + "title": "yx_store_category", + "chnname": "商品分类表", + "fields": [ + { + "name": "id", + "type": "MEDIUMINT_7", + "chnname": "商品分类表ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "pid", + "type": "MEDIUMINT_7", + "chnname": "父id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cate_name", + "type": "VARCHAR_100", + "chnname": "分类名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "MEDIUMINT_7", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pic", + "type": "VARCHAR_128", + "chnname": "图标", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否推荐", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "删除状态", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + } + }, + { + "name": "order", + "chnname": "订单", + "entities": [ + { + "title": "yx_store_order", + "chnname": "订单表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "订单ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "order_id", + "type": "VARCHAR_32", + "chnname": "订单号", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "extend_order_id", + "type": "VARCHAR_32", + "chnname": "额外订单号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_32", + "chnname": "用户姓名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "user_phone", + "type": "VARCHAR_18", + "chnname": "用户电话", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "user_address", + "type": "VARCHAR_100", + "chnname": "详细地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cart_id", + "type": "VARCHAR_256", + "chnname": "购物车id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "freight_price", + "type": "DECIMAL_8_2", + "chnname": "运费金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_num", + "type": "INT UNSIGNED_10", + "chnname": "订单商品总数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "订单总价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_postage", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "邮费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "实际支付金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_postage", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "支付邮费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "deduction_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "抵扣金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_id", + "type": "INT UNSIGNED_10", + "chnname": "优惠券id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "优惠券金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "paid", + "type": "TINYINT UNSIGNED_1", + "chnname": "支付状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_time", + "type": "DATETIME", + "chnname": "支付时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_type", + "type": "VARCHAR_32", + "chnname": "支付方式", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "订单状态(-1 : 申请退款 -2 : 退货成功 0:待发货;1:待收货;2:已收货;3:已完成;-1:已退款)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_status", + "type": "TINYINT UNSIGNED_1", + "chnname": "0 未退款 1 申请中 2 已退款", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_reason_wap_img", + "type": "VARCHAR_255", + "chnname": "退款图片", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_reason_wap_explain", + "type": "VARCHAR_255", + "chnname": "退款用户说明", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_reason_time", + "type": "DATETIME", + "chnname": "退款时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_reason_wap", + "type": "VARCHAR_255", + "chnname": "前台退款原因", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_reason", + "type": "VARCHAR_255", + "chnname": "不退款的理由", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "退款金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "delivery_sn", + "type": "VARCHAR_100", + "chnname": "快递公司编号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "delivery_name", + "type": "VARCHAR_64", + "chnname": "快递名称/送货人姓名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "delivery_type", + "type": "VARCHAR_32", + "chnname": "发货类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "delivery_id", + "type": "VARCHAR_64", + "chnname": "快递单号/手机号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "gain_integral", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "消费赚取积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "use_integral", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "使用积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "back_integral", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "给用户退了多少积分", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mark", + "type": "VARCHAR_512", + "chnname": "备注", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unique", + "type": "CHAR_32", + "chnname": "唯一id(md5加密)类似id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remark", + "type": "VARCHAR_512", + "chnname": "管理员备注", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT UNSIGNED_10", + "chnname": "商户ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_mer_check", + "type": "TINYINT UNSIGNED_3", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "combination_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "拼团产品id0一般产品", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pink_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "拼团id 0没有拼团", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "成本价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "seckill_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "秒杀产品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_id", + "type": "INT UNSIGNED_10", + "chnname": "砍价id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "verify_code", + "type": "VARCHAR_50", + "chnname": "核销码", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_id", + "type": "INT_10", + "chnname": "门店id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "shipping_type", + "type": "BIT_1", + "chnname": "配送方式 1=快递 ,2=门店自提", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_channel", + "type": "TINYINT UNSIGNED_1", + "chnname": "支付渠道(0微信公众号1微信小程序)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_remind", + "type": "TINYINT UNSIGNED_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_system_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_order_cart_info", + "chnname": "订单购物详情表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "oid", + "type": "BIGINT UNSIGNED_20", + "chnname": "订单id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cart_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "购物车id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cart_info", + "type": "TEXT", + "chnname": "购买东西的详细信息", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unique", + "type": "VARCHAR_50", + "chnname": "唯一id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_order_status", + "chnname": "订单操作记录表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "oid", + "type": "BIGINT UNSIGNED_20", + "chnname": "订单id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "change_type", + "type": "VARCHAR_32", + "chnname": "操作类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "change_message", + "type": "VARCHAR_256", + "chnname": "操作备注", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "change_time", + "type": "DATETIME", + "chnname": "操作时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_express", + "chnname": "快递公司表", + "fields": [ + { + "name": "id", + "type": "MEDIUMINT UNSIGNED_8", + "chnname": "快递公司id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "code", + "type": "VARCHAR_50", + "chnname": "快递公司简称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_50", + "chnname": "快递公司全称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否显示", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT_3", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "yx_store_order", + "moduleName": false, + "x": 610, + "y": 550, + "id": "0eda0dc5" + }, + { + "shape": "table", + "title": "yx_store_order_cart_info", + "moduleName": false, + "x": 1370, + "y": 70, + "id": "1412580b" + }, + { + "shape": "table", + "title": "yx_store_cart", + "moduleName": "cart", + "x": 1410, + "y": 330, + "id": "bcf3c95c" + }, + { + "shape": "table", + "title": "yx_store_order_status", + "moduleName": false, + "x": 1380, + "y": 610, + "id": "f5488e91" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "1412580b", + "target": "0eda0dc5", + "id": "6f47eff5", + "controlPoints": [ + { + "x": 1179.8701171875, + "y": 52.38333333333334 + }, + { + "x": 1074.1962890625, + "y": 32.03378378378378 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "1412580b", + "target": "bcf3c95c", + "id": "2c239ffd", + "controlPoints": [ + { + "x": 1179.8701171875, + "y": 72.51666666666668 + }, + { + "x": 1120, + "y": 70 + }, + { + "x": 1120, + "y": 210 + }, + { + "x": 1184.4970703125, + "y": 212.1209677419355 + } + ], + "sourceAnchor": 4, + "targetAnchor": 0 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "f5488e91", + "target": "0eda0dc5", + "id": "70641526", + "controlPoints": [ + { + "x": 1200.5224609375, + "y": 602.4423076923077 + }, + { + "x": 1130, + "y": 450 + }, + { + "x": 1074.1962890625, + "y": 32.03378378378378 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_order_cart_info", + "field": "oid" + }, + "to": { + "entity": "yx_store_order", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_order_cart_info", + "field": "cart_id" + }, + "to": { + "entity": "yx_store_cart", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_order_status", + "field": "oid" + }, + "to": { + "entity": "yx_store_order", + "field": "id" + } + } + ] + }, + { + "name": "product", + "chnname": "商品模块", + "entities": [ + { + "title": "yx_store_product_reply", + "chnname": "评论表", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "评论ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "oid", + "type": "BIGINT_19", + "chnname": "订单ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unique", + "type": "CHAR_32", + "chnname": "唯一id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT_19", + "chnname": "产品id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "reply_type", + "type": "VARCHAR_32", + "chnname": "某种商品类型(普通商品、秒杀商品)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_score", + "type": "BIT_1", + "chnname": "商品分数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "service_score", + "type": "BIT_1", + "chnname": "服务分数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "comment", + "type": "VARCHAR_512", + "chnname": "评论内容", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pics", + "type": "TEXT", + "chnname": "评论图片", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "评论时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "merchant_reply_content", + "type": "VARCHAR_300", + "chnname": "管理员回复内容", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "merchant_reply_time", + "type": "DATETIME", + "chnname": "管理员回复时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "0未删除1已删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_reply", + "type": "BIT_1", + "chnname": "0未回复1已回复", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product_relation", + "chnname": "商品点赞和收藏表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_32", + "chnname": "类型(收藏(collect)、点赞(like))", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "category", + "type": "VARCHAR_32", + "chnname": "某种类型的商品(普通商品、秒杀商品)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product_attr_value", + "chnname": "商品属性值表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sku", + "type": "VARCHAR_128", + "chnname": "商品属性索引值 (attr_value|attr_value[|....])", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stock", + "type": "INT UNSIGNED_10", + "chnname": "属性对应的库存", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sales", + "type": "INT UNSIGNED_10", + "chnname": "销量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "属性金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_128", + "chnname": "图片", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unique", + "type": "VARCHAR_100", + "chnname": "唯一值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "成本价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bar_code", + "type": "VARCHAR_255", + "chnname": "商品条码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ot_price", + "type": "DECIMAL_10_2", + "chnname": "原价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "weight", + "type": "DECIMAL_8_2", + "chnname": "重量", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "volume", + "type": "DECIMAL_8_2", + "chnname": "体积", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "brokerage", + "type": "DECIMAL_8_2", + "chnname": "一级返佣", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "brokerage_two", + "type": "DECIMAL_8_2", + "chnname": "二级返佣", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pink_price", + "type": "DECIMAL_8_2", + "chnname": "拼团价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pink_stock", + "type": "INT_10", + "chnname": "拼团库存", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "seckill_price", + "type": "DECIMAL_10_2", + "chnname": "秒杀价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "seckill_stock", + "type": "INT_10", + "chnname": "秒杀库存", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product_attr_result", + "chnname": "商品属性详情表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "result", + "type": "TEXT", + "chnname": "商品属性参数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "change_time", + "type": "DATETIME", + "chnname": "上次修改时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product_attr", + "chnname": "商品属性表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "attr_name", + "type": "VARCHAR_32", + "chnname": "属性名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "attr_values", + "type": "VARCHAR_256", + "chnname": "属性值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product", + "chnname": "商品表", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "商品id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT UNSIGNED_10", + "chnname": "商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_256", + "chnname": "商品图片", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "slider_image", + "type": "VARCHAR_2000", + "chnname": "轮播图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_name", + "type": "VARCHAR_128", + "chnname": "商品名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_info", + "type": "VARCHAR_256", + "chnname": "商品简介", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "keyword", + "type": "VARCHAR_256", + "chnname": "关键字", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bar_code", + "type": "VARCHAR_15", + "chnname": "产品条码(一维码)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cate_id", + "type": "VARCHAR_64", + "chnname": "分类id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "商品价格", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "vip_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "会员价格", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ot_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "市场价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "postage", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "邮费", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unit_name", + "type": "VARCHAR_32", + "chnname": "单位名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "SMALLINT_5", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sales", + "type": "MEDIUMINT UNSIGNED_8", + "chnname": "销量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stock", + "type": "MEDIUMINT UNSIGNED_8", + "chnname": "库存", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "状态(0:未上架,1:上架)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_hot", + "type": "BIT_1", + "chnname": "是否热卖", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_benefit", + "type": "BIT_1", + "chnname": "是否优惠", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_best", + "type": "BIT_1", + "chnname": "是否精品", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_new", + "type": "BIT_1", + "chnname": "是否新品", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "description", + "type": "TEXT", + "chnname": "产品描述", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_postage", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否包邮", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_use", + "type": "TINYINT UNSIGNED_1", + "chnname": "商户是否代理 0不可代理1可代理", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "give_integral", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "获得积分", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "成本价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_seckill", + "type": "TINYINT UNSIGNED_1", + "chnname": "秒杀状态 0 未开启 1已开启", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_bargain", + "type": "TINYINT UNSIGNED_1", + "chnname": "砍价状态 0未开启 1开启", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_good", + "type": "BIT_1", + "chnname": "是否优品推荐", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ficti", + "type": "MEDIUMINT_7", + "chnname": "虚拟销量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "browse", + "type": "INT_10", + "chnname": "浏览量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "code_path", + "type": "VARCHAR_64", + "chnname": "产品二维码地址(用户小程序海报)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_sub", + "type": "BIT_1", + "chnname": "是否单独分佣", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temp_id", + "type": "INT_10", + "chnname": "运费模板ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spec_type", + "type": "BIT_1", + "chnname": "规格 0单 1多", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product_rule", + "chnname": "商品规则值(规格)表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "rule_name", + "type": "VARCHAR_32", + "chnname": "规格名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "rule_value", + "type": "JSON", + "chnname": "规格值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "yx_store_product", + "moduleName": false, + "x": 390, + "y": 410, + "id": "1f2a5f58" + }, + { + "shape": "table", + "title": "yx_store_product_attr", + "moduleName": false, + "x": 970, + "y": 60, + "id": "8d021563" + }, + { + "shape": "table", + "title": "yx_store_product_attr_value", + "moduleName": false, + "x": 1090, + "y": 360, + "id": "65395cd5" + }, + { + "shape": "table", + "title": "yx_store_product_attr_result", + "moduleName": false, + "x": 1020, + "y": 660, + "id": "f65fda56" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "8d021563", + "target": "1f2a5f58", + "id": "8a5b631d", + "controlPoints": [ + { + "x": 814.5400390625, + "y": 62.52272727272727 + }, + { + "x": 698.1318359375, + "y": 42.0462962962963 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "65395cd5", + "target": "1f2a5f58", + "id": "b3c471e9", + "controlPoints": [ + { + "x": 818.958984375, + "y": 252.17424242424244 + }, + { + "x": 698.1318359375, + "y": 42.0462962962963 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "65395cd5", + "target": "8d021563", + "id": "76f261e2", + "controlPoints": [ + { + "x": 818.958984375, + "y": 272.2348484848485 + }, + { + "x": 750, + "y": 240 + }, + { + "x": 814.5400390625, + "y": 82.70454545454545 + } + ], + "sourceAnchor": 4, + "targetAnchor": 4 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_product_attr", + "field": "product_id" + }, + "to": { + "entity": "yx_store_product", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_product_attr_value", + "field": "product_id" + }, + "to": { + "entity": "yx_store_product", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_product_attr_value", + "field": "sku" + }, + "to": { + "entity": "yx_store_product_attr", + "field": "attr_name" + } + } + ] + }, + { + "name": "shop", + "chnname": "商户模块", + "entities": [ + { + "title": "yx_material_group", + "chnname": "素材分组", + "fields": [ + { + "name": "id", + "type": "VARCHAR_32", + "chnname": "PK", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_id", + "type": "VARCHAR_32", + "chnname": "创建者ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_200", + "chnname": "分组名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_attachment", + "chnname": "附件管理表", + "fields": [ + { + "name": "att_id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_100", + "chnname": "附件名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "att_dir", + "type": "VARCHAR_200", + "chnname": "附件路径", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "satt_dir", + "type": "VARCHAR_200", + "chnname": "压缩图片路径", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "att_size", + "type": "CHAR_30", + "chnname": "附件大小", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "att_type", + "type": "CHAR_30", + "chnname": "附件类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pid", + "type": "INT_10", + "chnname": "分类ID0编辑器,1产品图片,2拼团图片,3砍价图片,4秒杀图片,5文章图片,6组合数据图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image_type", + "type": "TINYINT UNSIGNED_1", + "chnname": "图片上传类型 1本地 2七牛云 3OSS 4COS ", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "module_type", + "type": "TINYINT UNSIGNED_1", + "chnname": "图片上传模块类型 1 后台上传 2 用户生成", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "invite_code", + "type": "VARCHAR_50", + "chnname": "邀请码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_config", + "chnname": "配置表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "配置id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "menu_name", + "type": "VARCHAR_255", + "chnname": "字段名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "value", + "type": "VARCHAR_5000", + "chnname": "默认值", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否隐藏", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_group_data", + "chnname": "组合数据详情表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "组合数据详情ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "group_name", + "type": "VARCHAR_100", + "chnname": "对应的数据名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "value", + "type": "TEXT", + "chnname": "数据组对应的数据值(json数据)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加数据时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT_10", + "chnname": "数据排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "状态(1:开启;2:关闭;)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_store", + "chnname": "门店自提", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_100", + "chnname": "门店名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "introduction", + "type": "VARCHAR_1000", + "chnname": "简介", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "phone", + "type": "CHAR_25", + "chnname": "手机号码", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "address", + "type": "VARCHAR_255", + "chnname": "省市区", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "detailed_address", + "type": "VARCHAR_255", + "chnname": "详细地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_255", + "chnname": "门店logo", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "latitude", + "type": "CHAR_25", + "chnname": "纬度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "longitude", + "type": "CHAR_25", + "chnname": "经度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "valid_time", + "type": "VARCHAR_100", + "chnname": "核销有效日期", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "day_time", + "type": "VARCHAR_100", + "chnname": "每日营业开关时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否显示", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "day_time_end", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "day_time_start", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "valid_time_end", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "valid_time_start", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_store_staff", + "chnname": "门店店员表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "微信用户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "nickname", + "type": "VARCHAR_50", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "avatar", + "type": "VARCHAR_255", + "chnname": "店员头像", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_id", + "type": "INT_10", + "chnname": "门店id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_name", + "type": "VARCHAR_50", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "staff_name", + "type": "VARCHAR_64", + "chnname": "店员名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "phone", + "type": "CHAR_15", + "chnname": "手机号码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "verify_status", + "type": "TINYINT_3", + "chnname": "核销开关", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT_3", + "chnname": "状态", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_user_level", + "chnname": "设置用户等级表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT_10", + "chnname": "商户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "会员名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "money", + "type": "DECIMAL_8_2", + "chnname": "购买金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "valid_date", + "type": "INT_10", + "chnname": "有效时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_forever", + "type": "BIT_1", + "chnname": "是否为永久会员", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_pay", + "type": "BIT_1", + "chnname": "是否购买,1=购买,0=不购买", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否显示 1=显示,0=隐藏", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "grade", + "type": "INT_10", + "chnname": "会员等级", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "discount", + "type": "DECIMAL_8_2", + "chnname": "享受折扣", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_255", + "chnname": "会员卡背景", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "icon", + "type": "VARCHAR_255", + "chnname": "会员图标", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "explain", + "type": "TEXT", + "chnname": "说明", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "是否删除.1=删除,0=未删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_material", + "chnname": "素材库", + "fields": [ + { + "name": "id", + "type": "VARCHAR_32", + "chnname": "PK", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_id", + "type": "VARCHAR_100", + "chnname": "创建者ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "CHAR_2", + "chnname": "类型1、图片;2、视频", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "group_id", + "type": "VARCHAR_32", + "chnname": "分组ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_200", + "chnname": "素材名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_500", + "chnname": "素材链接", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "yx_material", + "moduleName": false, + "x": 442.359375, + "y": 277, + "id": "fe721315" + }, + { + "shape": "table", + "title": "yx_material_group", + "moduleName": false, + "x": 887.359375, + "y": 279, + "id": "f3be72cb" + }, + { + "shape": "table", + "title": "yx_system_store", + "moduleName": false, + "x": 326.359375, + "y": 624, + "id": "396a35b0" + }, + { + "shape": "table", + "title": "yx_system_store_staff", + "moduleName": false, + "x": 870, + "y": 590, + "id": "c3935d4a" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "fe721315", + "target": "f3be72cb", + "id": "e1f3d02d", + "controlPoints": [ + { + "x": 623.05859375, + "y": 283.9775132275132 + }, + { + "x": 743.333984375, + "y": 241.25 + } + ], + "sourceAnchor": 9, + "targetAnchor": 0 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "c3935d4a", + "target": "396a35b0", + "id": "5bfc667b", + "controlPoints": [ + { + "x": 699.7900390625, + "y": 558.5457559681697 + }, + { + "x": 517.833984375, + "y": 456.0914634146342 + } + ], + "sourceAnchor": 8, + "targetAnchor": 1 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "yx_material", + "field": "group_id" + }, + "to": { + "entity": "yx_material_group", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_system_store_staff", + "field": "store_id" + }, + "to": { + "entity": "yx_system_store", + "field": "id" + } + } + ] + }, + { + "name": "template", + "chnname": "运费模板", + "entities": [ + { + "title": "yx_shipping_templates", + "chnname": "运费模板表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "模板ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "模板名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "BIT_1", + "chnname": "计费方式", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "region_info", + "type": "TEXT", + "chnname": "地域以及费用", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "appoint", + "type": "BIT_1", + "chnname": "指定包邮开关", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "appoint_info", + "type": "TEXT", + "chnname": "指定包邮内容", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_shipping_templates_free", + "chnname": "", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "编号", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "province_id", + "type": "INT_10", + "chnname": "省ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temp_id", + "type": "INT_10", + "chnname": "模板ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "city_id", + "type": "INT_10", + "chnname": "城市ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "number", + "type": "DECIMAL_10_2", + "chnname": "包邮件数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL_10_2", + "chnname": "包邮金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "BIT_1", + "chnname": "计费方式", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uniqid", + "type": "VARCHAR_32", + "chnname": "分组唯一值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_city", + "chnname": "城市表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "city_id", + "type": "INT_10", + "chnname": "城市id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "level", + "type": "INT_10", + "chnname": "省市级别", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "parent_id", + "type": "INT_10", + "chnname": "父级id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "area_code", + "type": "VARCHAR_30", + "chnname": "区号", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_100", + "chnname": "名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "merger_name", + "type": "VARCHAR_255", + "chnname": "合并名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "lng", + "type": "VARCHAR_50", + "chnname": "经度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "lat", + "type": "VARCHAR_50", + "chnname": "纬度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否展示", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_shipping_templates_region", + "chnname": "", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "编号", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "province_id", + "type": "INT_10", + "chnname": "省ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temp_id", + "type": "INT_10", + "chnname": "模板ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "city_id", + "type": "INT_10", + "chnname": "城市ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "first", + "type": "DECIMAL_10_2", + "chnname": "首件", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "first_price", + "type": "DECIMAL_10_2", + "chnname": "首件运费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "continues", + "type": "DECIMAL_10_2", + "chnname": "续件", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "continue_price", + "type": "DECIMAL_10_2", + "chnname": "续件运费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "BIT_1", + "chnname": "计费方式", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uniqid", + "type": "VARCHAR_50", + "chnname": "分组唯一值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "yx_shipping_templates", + "moduleName": false, + "x": 680, + "y": 380, + "id": "c8177992" + }, + { + "shape": "table", + "title": "yx_system_city", + "moduleName": false, + "x": 290, + "y": 260, + "id": "f3f8204a" + }, + { + "shape": "table", + "title": "yx_shipping_templates_free", + "moduleName": false, + "x": 1080, + "y": 190, + "id": "ac873dd5" + }, + { + "shape": "table", + "title": "yx_shipping_templates_region", + "moduleName": false, + "x": 1080, + "y": 540, + "id": "7ca63a1e" + } + ], + "edges": [] + }, + "associations": [] + }, + { + "name": "user", + "chnname": "用户模块", + "entities": [ + { + "title": "yx_user_bill", + "chnname": "用户账单表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户账单id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户uid", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "link_id", + "type": "VARCHAR_32", + "chnname": "关联id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pm", + "type": "TINYINT UNSIGNED_1", + "chnname": "0 = 支出 1 = 获得", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_64", + "chnname": "账单标题", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "category", + "type": "VARCHAR_64", + "chnname": "明细种类", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_64", + "chnname": "明细类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "number", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "明细数字", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "balance", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "剩余", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mark", + "type": "VARCHAR_512", + "chnname": "备注", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "0 = 带确定 1 = 有效 -1 = 无效", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_level", + "chnname": "用户等级记录表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "用户uid", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "level_id", + "type": "INT_10", + "chnname": "等级vip", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "grade", + "type": "INT_10", + "chnname": "会员等级", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "valid_time", + "type": "INT_10", + "chnname": "过期时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_forever", + "type": "BIT_1", + "chnname": "是否永久", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT_10", + "chnname": "商户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "0:禁止,1:正常", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mark", + "type": "VARCHAR_255", + "chnname": "备注", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remind", + "type": "BIT_1", + "chnname": "是否已通知", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "是否删除,0=未删除,1=删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "discount", + "type": "INT_10", + "chnname": "享受折扣", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_task_finish", + "chnname": "用户任务完成记录表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "task_id", + "type": "INT_10", + "chnname": "任务id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "用户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "是否有效", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_sign", + "chnname": "签到记录表", + "fields": [ + { + "name": "int", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "用户uid", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_255", + "chnname": "签到说明", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "number", + "type": "INT_10", + "chnname": "获得积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "balance", + "type": "INT_10", + "chnname": "剩余积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_recharge", + "chnname": "用户充值表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "充值用户UID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "nickname", + "type": "VARCHAR_50", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "order_id", + "type": "VARCHAR_32", + "chnname": "订单号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL_8_2", + "chnname": "充值金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "give_price", + "type": "DECIMAL_8_2", + "chnname": "购买赠送金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "recharge_type", + "type": "VARCHAR_32", + "chnname": "充值类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "paid", + "type": "BIT_1", + "chnname": "是否充值", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_time", + "type": "DATETIME", + "chnname": "充值支付时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "充值时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_price", + "type": "DECIMAL_10_2", + "chnname": "退款金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT_3", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_address", + "chnname": "用户地址表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户地址id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_32", + "chnname": "收货人姓名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "phone", + "type": "VARCHAR_16", + "chnname": "收货人电话", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "province", + "type": "VARCHAR_64", + "chnname": "收货人所在省", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "city", + "type": "VARCHAR_64", + "chnname": "收货人所在市", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "city_id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "district", + "type": "VARCHAR_64", + "chnname": "收货人所在区", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "detail", + "type": "VARCHAR_256", + "chnname": "收货人详细地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "post_code", + "type": "VARCHAR_20", + "chnname": "邮编", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "longitude", + "type": "VARCHAR_16", + "chnname": "经度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "latitude", + "type": "VARCHAR_16", + "chnname": "纬度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_default", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否默认", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_group", + "chnname": "用户分组表", + "fields": [ + { + "name": "id", + "type": "SMALLINT UNSIGNED_5", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "group_name", + "type": "VARCHAR_64", + "chnname": "用户分组名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_extract", + "chnname": "用户提现表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_64", + "chnname": "名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "extract_type", + "type": "VARCHAR_32", + "chnname": "bank = 银行卡 alipay = 支付宝wx=微信", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bank_code", + "type": "VARCHAR_32", + "chnname": "银行卡", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bank_address", + "type": "VARCHAR_256", + "chnname": "开户地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "alipay_code", + "type": "VARCHAR_64", + "chnname": "支付宝账号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "extract_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "提现金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mark", + "type": "VARCHAR_512", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "balance", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "fail_msg", + "type": "VARCHAR_128", + "chnname": "无效原因", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "fail_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT_3", + "chnname": "-1 未通过 0 审核中 1 已提现", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "wechat", + "type": "VARCHAR_15", + "chnname": "微信号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_enter", + "chnname": "商户申请表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "商户申请ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "INT UNSIGNED_10", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "province", + "type": "VARCHAR_32", + "chnname": "商户所在省", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "city", + "type": "VARCHAR_32", + "chnname": "商户所在市", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "district", + "type": "VARCHAR_32", + "chnname": "商户所在区", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "address", + "type": "VARCHAR_256", + "chnname": "商户详细地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "merchant_name", + "type": "VARCHAR_256", + "chnname": "商户名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "link_user", + "type": "VARCHAR_32", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "link_tel", + "type": "VARCHAR_16", + "chnname": "商户电话", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "charter", + "type": "VARCHAR_512", + "chnname": "商户证书", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "add_time", + "type": "INT UNSIGNED_10", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "apply_time", + "type": "INT UNSIGNED_10", + "chnname": "审核时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "success_time", + "type": "INT_10", + "chnname": "通过时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "fail_message", + "type": "VARCHAR_256", + "chnname": "未通过原因", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "fail_time", + "type": "INT UNSIGNED_10", + "chnname": "未通过时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "-1 审核未通过 0未审核 1审核通过", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_lock", + "type": "TINYINT UNSIGNED_1", + "chnname": "0 = 开启 1= 关闭", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_user_task", + "chnname": "等级任务设置", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "任务名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_255", + "chnname": "配置原名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "task_type", + "type": "VARCHAR_50", + "chnname": "任务类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "number", + "type": "INT_10", + "chnname": "限定数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "level_id", + "type": "INT_10", + "chnname": "等级id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否显示", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_must", + "type": "BIT_1", + "chnname": "是否务必达成任务,1务必达成,0=满足其一", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "illustrate", + "type": "VARCHAR_255", + "chnname": "任务说明", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "新增时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user", + "chnname": "用户表", + "fields": [ + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "username", + "type": "VARCHAR_255", + "chnname": "用户账户(跟accout一样)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "password", + "type": "VARCHAR_255", + "chnname": "用户密码(跟pwd)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_25", + "chnname": "真实姓名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "birthday", + "type": "INT_10", + "chnname": "生日", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "card_id", + "type": "VARCHAR_20", + "chnname": "身份证号码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mark", + "type": "VARCHAR_255", + "chnname": "用户备注", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "partner_id", + "type": "INT_10", + "chnname": "合伙人id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "group_id", + "type": "INT_10", + "chnname": "用户分组id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "nickname", + "type": "VARCHAR_100", + "chnname": "用户昵称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "avatar", + "type": "VARCHAR_256", + "chnname": "用户头像", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "phone", + "type": "CHAR_15", + "chnname": "手机号码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "add_ip", + "type": "VARCHAR_16", + "chnname": "添加ip", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "最后一次登录时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "last_ip", + "type": "VARCHAR_16", + "chnname": "最后一次登录ip", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "now_money", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "用户余额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "brokerage_price", + "type": "DECIMAL_8_2", + "chnname": "佣金金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "integral", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "用户剩余积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sign_num", + "type": "INT_10", + "chnname": "连续签到天数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "1为正常,0为禁止", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "level", + "type": "TINYINT UNSIGNED_3", + "chnname": "等级", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spread_uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "推广元id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spread_time", + "type": "DATETIME", + "chnname": "推广员关联时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "user_type", + "type": "VARCHAR_32", + "chnname": "用户类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_promoter", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否为推广员", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_count", + "type": "INT UNSIGNED_10", + "chnname": "用户购买次数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spread_count", + "type": "INT_10", + "chnname": "下级人数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "addres", + "type": "VARCHAR_255", + "chnname": "详细地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "adminid", + "type": "INT UNSIGNED_10", + "chnname": "管理员编号 ", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "login_type", + "type": "VARCHAR_36", + "chnname": "用户登陆类型,h5,wechat,routine", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "wx_profile", + "type": "JSON", + "chnname": "微信用户json信息", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + } + }, + { + "name": "wechat", + "chnname": "微信模块", + "entities": [ + { + "title": "yx_wechat_reply", + "chnname": "微信关键字回复表", + "fields": [ + { + "name": "id", + "type": "MEDIUMINT UNSIGNED_8", + "chnname": "微信关键字回复id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "key", + "type": "VARCHAR_64", + "chnname": "关键字", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_32", + "chnname": "回复类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "data", + "type": "TEXT", + "chnname": "回复数据", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "0=不可用 1 =可用", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "hide", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否隐藏", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_wechat_menu", + "chnname": "微信缓存表", + "fields": [ + { + "name": "key", + "type": "VARCHAR_32", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "result", + "type": "TEXT", + "chnname": "缓存数据", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "add_time", + "type": "INT_10", + "chnname": "缓存时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_wechat_media", + "chnname": "微信回复表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "微信视频音频id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_16", + "chnname": "回复类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "path", + "type": "VARCHAR_128", + "chnname": "文件路径", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "media_id", + "type": "VARCHAR_64", + "chnname": "微信服务器返回的id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_256", + "chnname": "地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temporary", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否永久或者临时 0永久1临时", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "add_time", + "type": "INT UNSIGNED_10", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_article", + "chnname": "文章管理表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "文章管理ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "cid", + "type": "VARCHAR_255", + "chnname": "分类id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_255", + "chnname": "文章标题", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "author", + "type": "VARCHAR_255", + "chnname": "文章作者", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image_input", + "type": "VARCHAR_255", + "chnname": "文章图片", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "synopsis", + "type": "VARCHAR_255", + "chnname": "文章简介", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "content", + "type": "TEXT", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "share_title", + "type": "VARCHAR_255", + "chnname": "文章分享标题", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "share_synopsis", + "type": "VARCHAR_255", + "chnname": "文章分享简介", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "visit", + "type": "VARCHAR_255", + "chnname": "浏览次数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_255", + "chnname": "原文链接", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "状态", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "hide", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否隐藏", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "admin_id", + "type": "INT UNSIGNED_10", + "chnname": "管理员id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT UNSIGNED_10", + "chnname": "商户id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "INT_10", + "chnname": "产品关联id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_hot", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否热门(小程序)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_banner", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否轮播图(小程序)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_wechat_template", + "chnname": "微信模板", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "模板id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "tempkey", + "type": "CHAR_50", + "chnname": "模板编号", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "CHAR_100", + "chnname": "模板名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "content", + "type": "VARCHAR_1000", + "chnname": "回复内容", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "tempid", + "type": "CHAR_100", + "chnname": "模板ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT_3", + "chnname": "状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_30", + "chnname": "类型:template:模板消息 subscribe:订阅消息", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + }, + "associations": [] + } + ], + "message": "3.1sql导出", + "version": "V1.1", + "changes": [ + { + "type": "entity", + "name": "yx_wechat_live", + "opt": "add" + }, + { + "type": "entity", + "name": "yx_wechat_live_goods", + "opt": "add" + }, + { + "type": "field", + "name": "yx_store_seckill.price.notNull", + "opt": "update", + "changeData": "true=>false" + }, + { + "type": "field", + "name": "yx_store_seckill.cost.notNull", + "opt": "update", + "changeData": "true=>false" + }, + { + "type": "field", + "name": "yx_store_seckill.ot_price.notNull", + "opt": "update", + "changeData": "true=>false" + }, + { + "type": "field", + "name": "yx_store_seckill.spec_type", + "opt": "add" + }, + { + "type": "field", + "name": "yx_store_seckill.temp_id", + "opt": "add" + }, + { + "type": "field", + "name": "yx_store_seckill.is_sub", + "opt": "add" + }, + { + "type": "field", + "name": "yx_store_combination.price.notNull", + "opt": "update", + "changeData": "true=>false" + }, + { + "type": "field", + "name": "yx_store_combination.stock.notNull", + "opt": "update", + "changeData": "true=>false" + }, + { + "type": "field", + "name": "yx_store_combination.unit_name.notNull", + "opt": "update", + "changeData": "true=>false" + }, + { + "type": "field", + "name": "yx_store_combination.spec_type", + "opt": "add" + }, + { + "type": "field", + "name": "yx_store_combination.temp_id", + "opt": "add" + }, + { + "type": "field", + "name": "yx_store_combination.is_sub", + "opt": "add" + }, + { + "type": "field", + "name": "yx_store_combination.is_postage", + "opt": "delete" + }, + { + "type": "field", + "name": "yx_store_combination.postage", + "opt": "delete" + }, + { + "type": "field", + "name": "yx_store_product_attr_value.pink_price", + "opt": "add" + }, + { + "type": "field", + "name": "yx_store_product_attr_value.pink_stock", + "opt": "add" + }, + { + "type": "field", + "name": "yx_store_product_attr_value.seckill_price", + "opt": "add" + }, + { + "type": "field", + "name": "yx_store_product_attr_value.seckill_stock", + "opt": "add" + }, + { + "type": "field", + "name": "yx_wechat_template.type", + "opt": "add" + } + ], + "date": "2020/9/5 17:13:6" +} diff --git a/sql/.yshop.version/yshop-V1.2.pdman.json b/sql/.yshop.version/yshop-V1.2.pdman.json new file mode 100644 index 0000000..a4aa662 --- /dev/null +++ b/sql/.yshop.version/yshop-V1.2.pdman.json @@ -0,0 +1,11402 @@ +{ + "modules": [ + { + "name": "DB_REVERSE_MYSQL", + "chnname": "逆向解析_MYSQL", + "entities": [ + { + "title": "monitor_server", + "chnname": "服务监控", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "cpu_core", + "type": "INT_10", + "chnname": "CPU内核数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cpu_rate", + "type": "DOUBLE_22", + "chnname": "CPU使用率", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "disk_total", + "type": "DOUBLE_22", + "chnname": "磁盘总量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "disk_used", + "type": "DOUBLE_22", + "chnname": "磁盘使用量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mem_total", + "type": "DOUBLE_22", + "chnname": "内存总数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mem_used", + "type": "DOUBLE_22", + "chnname": "内存使用量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "port", + "type": "INT_10", + "chnname": "访问端口", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "state", + "type": "VARCHAR_255", + "chnname": "状态", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "swap_total", + "type": "DOUBLE_22", + "chnname": "交换区总量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "swap_used", + "type": "DOUBLE_22", + "chnname": "交换区使用量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "address", + "type": "VARCHAR_255", + "chnname": "服务地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "edges": [], + "nodes": [] + }, + "associations": [] + }, + { + "name": "tools", + "chnname": "工具模块", + "entities": [ + { + "title": "email_config", + "chnname": "邮箱配置", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "from_user", + "type": "VARCHAR_255", + "chnname": "收件人", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "host", + "type": "VARCHAR_255", + "chnname": "邮件服务器SMTP地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pass", + "type": "VARCHAR_255", + "chnname": "密码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "port", + "type": "VARCHAR_255", + "chnname": "端口", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "user", + "type": "VARCHAR_255", + "chnname": "发件者用户名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "local_storage", + "chnname": "本地存储", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_255", + "chnname": "文件真实的名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "文件名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "suffix", + "type": "VARCHAR_255", + "chnname": "后缀", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "path", + "type": "VARCHAR_255", + "chnname": "路径", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_255", + "chnname": "类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "size", + "type": "VARCHAR_100", + "chnname": "大小", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "operate", + "type": "VARCHAR_255", + "chnname": "操作人", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "picture", + "chnname": "Sm.Ms图床", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "上传日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "delete_url", + "type": "VARCHAR_255", + "chnname": "删除的URL", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "filename", + "type": "VARCHAR_255", + "chnname": "图片名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "height", + "type": "VARCHAR_255", + "chnname": "图片高度", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "size", + "type": "VARCHAR_255", + "chnname": "图片大小", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_255", + "chnname": "图片地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "username", + "type": "VARCHAR_255", + "chnname": "用户名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "width", + "type": "VARCHAR_255", + "chnname": "图片宽度", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "md5code", + "type": "VARCHAR_255", + "chnname": "文件的MD5值", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "qiniu_config", + "chnname": "七牛云配置", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "access_key", + "type": "TEXT", + "chnname": "accessKey", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bucket", + "type": "VARCHAR_255", + "chnname": "Bucket 识别符", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "host", + "type": "VARCHAR_255", + "chnname": "外链域名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "secret_key", + "type": "TEXT", + "chnname": "secretKey", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_255", + "chnname": "空间类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "zone", + "type": "VARCHAR_255", + "chnname": "机房", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "qiniu_content", + "chnname": "七牛云文件存储", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "bucket", + "type": "VARCHAR_255", + "chnname": "Bucket 识别符", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "文件名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "size", + "type": "VARCHAR_255", + "chnname": "文件大小", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_255", + "chnname": "文件类型:私有或公开", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "上传或同步的时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_255", + "chnname": "文件url", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "suffix", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "verification_code", + "chnname": "验证码", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "code", + "type": "VARCHAR_255", + "chnname": "验证码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "状态:1有效、0过期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_255", + "chnname": "验证码类型:email或者短信", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "value", + "type": "VARCHAR_255", + "chnname": "接收邮箱或者手机号码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "scenes", + "type": "VARCHAR_255", + "chnname": "业务名称:如重置邮箱、重置密码等", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "alipay_config", + "chnname": "支付宝配置类", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "主键", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "app_id", + "type": "VARCHAR_255", + "chnname": "应用ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "charset", + "type": "VARCHAR_255", + "chnname": "编码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "format", + "type": "VARCHAR_255", + "chnname": "类型 固定格式json", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "gateway_url", + "type": "VARCHAR_255", + "chnname": "网关地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "notify_url", + "type": "VARCHAR_255", + "chnname": "异步回调", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "private_key", + "type": "TEXT", + "chnname": "私钥", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "public_key", + "type": "TEXT", + "chnname": "公钥", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "return_url", + "type": "VARCHAR_255", + "chnname": "回调地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sign_type", + "type": "VARCHAR_255", + "chnname": "签名方式", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sys_service_provider_id", + "type": "VARCHAR_255", + "chnname": "商户号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + } + }, + { + "name": "logging", + "chnname": "日志", + "entities": [ + { + "title": "log", + "chnname": "系统日志", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "description", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "exception_detail", + "type": "TEXT", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "log_type", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "method", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "params", + "type": "TEXT", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "request_ip", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "time", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "username", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "address", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "browser", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + }, + "associations": [] + }, + { + "name": "gen", + "chnname": "代码生成", + "entities": [ + { + "title": "gen_test", + "chnname": "代码生成测试", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sex", + "type": "INT_10", + "chnname": "性别", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "column_config", + "chnname": "代码生成字段信息存储", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "table_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "column_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "column_type", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "dict_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "extra", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "form_show", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "form_type", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "key_type", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "list_show", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "not_null", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "query_type", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remark", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "date_annotation", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "gen_config", + "chnname": "代码生成器配置", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "table_name", + "type": "VARCHAR_255", + "chnname": "表名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "author", + "type": "VARCHAR_255", + "chnname": "作者", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cover", + "type": "BIT_1", + "chnname": "是否覆盖", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "module_name", + "type": "VARCHAR_255", + "chnname": "模块名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pack", + "type": "VARCHAR_255", + "chnname": "至于哪个包下", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "path", + "type": "VARCHAR_255", + "chnname": "前端代码生成的路径", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "api_path", + "type": "VARCHAR_255", + "chnname": "前端Api文件路径", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "prefix", + "type": "VARCHAR_255", + "chnname": "表前缀", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "api_alias", + "type": "VARCHAR_255", + "chnname": "接口名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "column_config", + "moduleName": false, + "x": 288.359375, + "y": 279, + "id": "09a1ceae" + }, + { + "shape": "table", + "title": "gen_config", + "moduleName": false, + "x": 760, + "y": 200, + "id": "2e380491" + } + ], + "edges": [] + }, + "associations": [] + }, + { + "name": "monitor", + "chnname": "", + "entities": [ + { + "title": "visits", + "chnname": "访客记录", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "date", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ip_counts", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pv_counts", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "week_day", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + }, + "associations": [] + }, + { + "name": "quartz", + "chnname": "定时任务", + "entities": [ + { + "title": "quartz_job", + "chnname": "定时任务", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "bean_name", + "type": "VARCHAR_255", + "chnname": "Spring Bean名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cron_expression", + "type": "VARCHAR_255", + "chnname": "cron 表达式", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_pause", + "type": "BIT_1", + "chnname": "状态:1暂停、0启用", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "job_name", + "type": "VARCHAR_255", + "chnname": "任务名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "method_name", + "type": "VARCHAR_255", + "chnname": "方法名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "params", + "type": "VARCHAR_255", + "chnname": "参数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remark", + "type": "VARCHAR_255", + "chnname": "备注", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "quartz_log", + "chnname": "定时任务日志", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "baen_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cron_expression", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "exception_detail", + "type": "TEXT", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_success", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "job_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "method_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "params", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "time", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "quartz_job", + "moduleName": false, + "x": 422.359375, + "y": 367, + "id": "4b2bda89" + }, + { + "shape": "table", + "title": "quartz_log", + "moduleName": false, + "x": 890, + "y": 340, + "id": "b47ba8e0" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "b47ba8e0", + "target": "4b2bda89", + "id": "01afd2ee", + "controlPoints": [ + { + "x": 759.2236328125, + "y": 356.3101851851852 + }, + { + "x": 608.0595703125, + "y": 354.9063636363636 + } + ], + "sourceAnchor": 12, + "targetAnchor": 9 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "quartz_log", + "field": "job_name" + }, + "to": { + "entity": "quartz_job", + "field": "job_name" + } + } + ] + }, + { + "name": "system", + "chnname": "系统模块", + "entities": [ + { + "title": "users_roles", + "chnname": "用户角色关联", + "fields": [ + { + "name": "user_id", + "type": "BIGINT_19", + "chnname": "用户ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "role_id", + "type": "BIGINT_19", + "chnname": "角色ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "roles_menus", + "chnname": "角色菜单关联", + "fields": [ + { + "name": "menu_id", + "type": "BIGINT_19", + "chnname": "菜单ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "role_id", + "type": "BIGINT_19", + "chnname": "角色ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "roles_depts", + "chnname": "角色部门关联", + "fields": [ + { + "name": "role_id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "dept_id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "user_avatar", + "chnname": "系统用户头像", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_255", + "chnname": "真实文件名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "path", + "type": "VARCHAR_255", + "chnname": "路径", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "size", + "type": "VARCHAR_255", + "chnname": "大小", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "role", + "chnname": "角色表", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remark", + "type": "VARCHAR_255", + "chnname": "备注", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "data_scope", + "type": "VARCHAR_255", + "chnname": "数据权限", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "level", + "type": "INT_10", + "chnname": "角色级别", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "permission", + "type": "VARCHAR_255", + "chnname": "功能权限", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "dict", + "chnname": "数据字典", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "字典名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remark", + "type": "VARCHAR_255", + "chnname": "描述", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "dict_detail", + "chnname": "数据字典详情", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "label", + "type": "VARCHAR_255", + "chnname": "字典标签", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "value", + "type": "VARCHAR_255", + "chnname": "字典值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "VARCHAR_255", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "dict_id", + "type": "BIGINT_19", + "chnname": "字典id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "dept", + "chnname": "部门", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pid", + "type": "BIGINT_19", + "chnname": "上级部门", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "enabled", + "type": "BIT_1", + "chnname": "状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "menu", + "chnname": "", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "i_frame", + "type": "BIT_1", + "chnname": "是否外链", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "菜单名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "component", + "type": "VARCHAR_255", + "chnname": "组件", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pid", + "type": "BIGINT_19", + "chnname": "上级菜单ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "BIGINT_19", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "icon", + "type": "VARCHAR_255", + "chnname": "图标", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "path", + "type": "VARCHAR_255", + "chnname": "链接地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cache", + "type": "BIT_1", + "chnname": "缓存", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "hidden", + "type": "BIT_1", + "chnname": "是否隐藏", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "component_name", + "type": "VARCHAR_20", + "chnname": "组件名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "permission", + "type": "VARCHAR_255", + "chnname": "权限", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "INT_10", + "chnname": "类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "job", + "chnname": "岗位", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "岗位名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "enabled", + "type": "BIT_1", + "chnname": "岗位状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "BIGINT_19", + "chnname": "岗位排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "dept_id", + "type": "BIGINT_19", + "chnname": "部门ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "user", + "chnname": "系统用户", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "avatar_id", + "type": "BIGINT_19", + "chnname": "头像", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "email", + "type": "VARCHAR_255", + "chnname": "邮箱", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "enabled", + "type": "BIGINT_19", + "chnname": "状态:1启用、0禁用", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "password", + "type": "VARCHAR_255", + "chnname": "密码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "username", + "type": "VARCHAR_255", + "chnname": "用户名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "dept_id", + "type": "BIGINT_19", + "chnname": "部门名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "phone", + "type": "VARCHAR_255", + "chnname": "手机号码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "job_id", + "type": "BIGINT_19", + "chnname": "岗位名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "last_password_reset_time", + "type": "DATETIME", + "chnname": "最后修改密码的日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "nick_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sex", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "user", + "moduleName": false, + "x": 730, + "y": 200, + "id": "42584636" + }, + { + "shape": "table", + "title": "menu", + "moduleName": false, + "x": 230, + "y": 580, + "id": "faa9e561" + }, + { + "shape": "table", + "title": "dict_detail", + "moduleName": false, + "x": 1440, + "y": 720, + "id": "de6d0d5f" + }, + { + "shape": "table", + "title": "dict", + "moduleName": false, + "x": 1080, + "y": 770, + "id": "2e3e2ccb" + }, + { + "shape": "table", + "title": "user_avatar", + "moduleName": false, + "x": 220, + "y": 100, + "id": "794cd430" + }, + { + "shape": "table", + "title": "job", + "moduleName": false, + "x": 240, + "y": 290, + "id": "fe1aecfe" + }, + { + "shape": "table", + "title": "roles_menus", + "moduleName": false, + "x": 550, + "y": 490, + "id": "0ba651c7" + }, + { + "shape": "table", + "title": "role", + "moduleName": false, + "x": 850, + "y": 570, + "id": "2dd8b462" + }, + { + "shape": "table", + "title": "roles_depts", + "moduleName": false, + "x": 1140, + "y": 490, + "id": "759d8dd0" + }, + { + "shape": "table", + "title": "users_roles", + "moduleName": false, + "x": 1210, + "y": 50, + "id": "e76717e1" + }, + { + "shape": "table", + "title": "dept", + "moduleName": false, + "x": 1200, + "y": 240, + "id": "2ecdc324" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "42584636", + "target": "fe1aecfe", + "id": "a7e02413", + "controlPoints": [ + { + "x": 518.6240234375, + "y": 225.91161616161617 + }, + { + "x": 384.025390625, + "y": 232.19736842105263 + } + ], + "sourceAnchor": 16, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "42584636", + "target": "2ecdc324", + "id": "99cdad68", + "controlPoints": [ + { + "x": 941.3759765625, + "y": 187.46212121212122 + }, + { + "x": 1055.974609375, + "y": 192.22058823529412 + } + ], + "sourceAnchor": 13, + "targetAnchor": 0 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "de6d0d5f", + "target": "2e3e2ccb", + "id": "0f30581b", + "controlPoints": [ + { + "x": 1296.224609375, + "y": 736.3355263157895 + }, + { + "x": 1223.775390625, + "y": 732.25 + } + ], + "sourceAnchor": 8, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "42584636", + "target": "794cd430", + "id": "618c6bc6", + "controlPoints": [ + { + "x": 518.6240234375, + "y": 91.33838383838385 + }, + { + "x": 368.099609375, + "y": 72.28846153846153 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "0ba651c7", + "target": "faa9e561", + "id": "fdb423ea", + "controlPoints": [ + { + "x": 422.126953125, + "y": 492.281914893617 + }, + { + "x": 395.0341796875, + "y": 442.10714285714283 + } + ], + "sourceAnchor": 0, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "0ba651c7", + "target": "2dd8b462", + "id": "882b95a1", + "controlPoints": [ + { + "x": 677.873046875, + "y": 512.8191489361702 + }, + { + "x": 705.974609375, + "y": 502.17857142857144 + } + ], + "sourceAnchor": 3, + "targetAnchor": 0 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "759d8dd0", + "target": "2dd8b462", + "id": "7a7a3350", + "controlPoints": [ + { + "x": 1034.2080078125, + "y": 492.281914893617 + }, + { + "x": 994.025390625, + "y": 502.17857142857144 + } + ], + "sourceAnchor": 0, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "759d8dd0", + "target": "2ecdc324", + "id": "a9e0dc69", + "controlPoints": [ + { + "x": 1245.7919921875, + "y": 506.48049645390074 + }, + { + "x": 1440, + "y": 500 + }, + { + "x": 1440, + "y": 190 + }, + { + "x": 1344.025390625, + "y": 192.22058823529412 + } + ], + "sourceAnchor": 3, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "e76717e1", + "target": "42584636", + "id": "6179129e", + "controlPoints": [ + { + "x": 1085.4638671875, + "y": 52.28191489361702 + }, + { + "x": 941.3759765625, + "y": 72.11363636363636 + } + ], + "sourceAnchor": 0, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "e76717e1", + "target": "2dd8b462", + "id": "c796f9c9", + "controlPoints": [ + { + "x": 1334.5361328125, + "y": 72.81914893617022 + }, + { + "x": 1480, + "y": 70 + }, + { + "x": 1490, + "y": 580 + }, + { + "x": 1030, + "y": 590 + }, + { + "x": 994.025390625, + "y": 502.17857142857144 + } + ], + "sourceAnchor": 3, + "targetAnchor": 1 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "user", + "field": "job_id" + }, + "to": { + "entity": "job", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "user", + "field": "dept_id" + }, + "to": { + "entity": "dept", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "dict_detail", + "field": "dict_id" + }, + "to": { + "entity": "dict", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "user", + "field": "avatar_id" + }, + "to": { + "entity": "user_avatar", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "roles_menus", + "field": "menu_id" + }, + "to": { + "entity": "menu", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "roles_menus", + "field": "role_id" + }, + "to": { + "entity": "role", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "roles_depts", + "field": "role_id" + }, + "to": { + "entity": "role", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "roles_depts", + "field": "dept_id" + }, + "to": { + "entity": "dept", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "users_roles", + "field": "user_id" + }, + "to": { + "entity": "user", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "users_roles", + "field": "role_id" + }, + "to": { + "entity": "role", + "field": "id" + } + } + ] + }, + { + "name": "activity", + "chnname": "活动", + "entities": [ + { + "title": "yx_store_seckill", + "chnname": "商品秒杀产品表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品秒杀产品表id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_255", + "chnname": "推荐图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "images", + "type": "VARCHAR_2000", + "chnname": "轮播图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_255", + "chnname": "活动标题", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "info", + "type": "VARCHAR_255", + "chnname": "简介", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "价格", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "成本", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ot_price", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "原价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "give_integral", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "返多少积分", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stock", + "type": "INT UNSIGNED_10", + "chnname": "库存", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sales", + "type": "INT UNSIGNED_10", + "chnname": "销量", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unit_name", + "type": "VARCHAR_16", + "chnname": "单位名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "postage", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "邮费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "description", + "type": "TEXT", + "chnname": "内容", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "start_time", + "type": "DATE", + "chnname": "开始时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stop_time", + "type": "DATE", + "chnname": "结束时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "产品状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_postage", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否包邮", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_hot", + "type": "TINYINT UNSIGNED_1", + "chnname": "热门推荐", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "删除 0未删除1已删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "num", + "type": "INT UNSIGNED_10", + "chnname": "最多秒杀几个", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "TINYINT UNSIGNED_1", + "chnname": "显示", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "time_id", + "type": "INT UNSIGNED_10", + "chnname": "时间段id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spec_type", + "type": "BIT_1", + "chnname": "规格 0单 1多", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temp_id", + "type": "INT_10", + "chnname": "运费模板id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_pink", + "chnname": "拼团表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "order_id", + "type": "VARCHAR_32", + "chnname": "订单id 生成", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "order_id_key", + "type": "INT UNSIGNED_10", + "chnname": "订单id 数据库", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_num", + "type": "INT UNSIGNED_10", + "chnname": "购买商品个数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_price", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "购买总金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cid", + "type": "BIGINT UNSIGNED_20", + "chnname": "拼团产品id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pid", + "type": "BIGINT UNSIGNED_20", + "chnname": "产品id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "people", + "type": "INT UNSIGNED_10", + "chnname": "拼团总人数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "拼团产品单价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "开始时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stop_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "k_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "团长id 0为团长", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_tpl", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否发送模板消息0未发送1已发送", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_refund", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否退款 0未退款 1已退款", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "状态1进行中2已完成3未完成", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_coupon_user", + "chnname": "优惠券发放记录表", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "优惠券发放记录id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "cid", + "type": "INT UNSIGNED_10", + "chnname": "兑换的项目id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "优惠券所属用户", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_title", + "type": "VARCHAR_32", + "chnname": "优惠券名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "优惠券的面值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "use_min_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "最低消费多少金额可用优惠券", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "优惠券创建时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "end_time", + "type": "DATETIME", + "chnname": "优惠券结束时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "use_time", + "type": "DATETIME", + "chnname": "使用时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_32", + "chnname": "获取方式", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "状态(0:未使用,1:已使用, 2:已过期)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_fail", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否有效", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_coupon_issue_user", + "chnname": "优惠券前台用户领取记录表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "领取优惠券用户ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "issue_coupon_id", + "type": "INT_10", + "chnname": "优惠券前台领取ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "领取时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_coupon_issue", + "chnname": "优惠券前台领取表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "cname", + "type": "VARCHAR_50", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cid", + "type": "INT_10", + "chnname": "优惠券ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ctype", + "type": "BIT_1", + "chnname": "优惠券类型 0-通用 1-商品券", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "start_time", + "type": "DATETIME", + "chnname": "优惠券领取开启时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "end_time", + "type": "DATETIME", + "chnname": "优惠券领取结束时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_count", + "type": "INT_10", + "chnname": "优惠券领取数量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remain_count", + "type": "INT_10", + "chnname": "优惠券剩余领取数量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_permanent", + "type": "BIT_1", + "chnname": "是否无限张数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "1 正常 0 未开启 -1 已无效", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "优惠券添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_coupon", + "chnname": "优惠券表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "优惠券表ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_64", + "chnname": "优惠券名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "integral", + "type": "INT UNSIGNED_10", + "chnname": "兑换消耗积分值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "兑换的优惠券面值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "use_min_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "最低消费多少金额可用优惠券", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_time", + "type": "INT UNSIGNED_10", + "chnname": "优惠券有效期限(单位:天)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "状态(0:关闭,1:开启)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "VARCHAR_200", + "chnname": "商品ids", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "TINYINT_3", + "chnname": "优惠券类型 0-通用 1-商品券", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "兑换项目添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_combination", + "chnname": "拼团产品表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT UNSIGNED_10", + "chnname": "商户id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_255", + "chnname": "推荐图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "images", + "type": "VARCHAR_2000", + "chnname": "轮播图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_255", + "chnname": "活动标题", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "attr", + "type": "VARCHAR_255", + "chnname": "活动属性", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "people", + "type": "INT UNSIGNED_10", + "chnname": "参团人数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "info", + "type": "VARCHAR_255", + "chnname": "简介", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "价格", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_price", + "type": "DECIMAL_10_2", + "chnname": "商品原价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sales", + "type": "INT UNSIGNED_10", + "chnname": "销量", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stock", + "type": "INT UNSIGNED_10", + "chnname": "库存", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_host", + "type": "TINYINT UNSIGNED_1", + "chnname": "推荐", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "TINYINT UNSIGNED_1", + "chnname": "产品状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "combination", + "type": "TINYINT UNSIGNED_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_use", + "type": "TINYINT UNSIGNED_1", + "chnname": "商户是否可用1可用0不可用", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "description", + "type": "TEXT", + "chnname": "拼团内容", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "start_time", + "type": "DATETIME", + "chnname": "拼团开始时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stop_time", + "type": "DATETIME", + "chnname": "拼团结束时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "effective_time", + "type": "INT_10", + "chnname": "拼团订单有效时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "INT UNSIGNED_10", + "chnname": "拼团产品成本", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "browse", + "type": "INT_10", + "chnname": "浏览量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unit_name", + "type": "VARCHAR_32", + "chnname": "单位名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spec_type", + "type": "BIT_1", + "chnname": "规格 0单 1多", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temp_id", + "type": "INT_10", + "chnname": "运费模板ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_bargain_user_help", + "chnname": "砍价用户帮助表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "砍价用户帮助表ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "帮助的用户id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "砍价产品ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_user_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户参与砍价表id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "帮助砍价多少金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_bargain_user", + "chnname": "用户参与砍价表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户参与砍价表ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "砍价产品id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_price_min", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "砍价的最低价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_price", + "type": "DECIMAL_8_2", + "chnname": "砍价金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "砍掉的价格", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "状态 1参与中 2 活动结束参与失败 3活动结束参与成功", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "参与时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "是否取消", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_bargain", + "chnname": "砍价表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "砍价产品ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "关联产品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_255", + "chnname": "砍价活动名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_150", + "chnname": "砍价活动图片", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unit_name", + "type": "VARCHAR_16", + "chnname": "单位名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stock", + "type": "INT UNSIGNED_10", + "chnname": "库存", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sales", + "type": "INT UNSIGNED_10", + "chnname": "销量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "images", + "type": "VARCHAR_2000", + "chnname": "砍价产品轮播图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "start_time", + "type": "DATETIME", + "chnname": "砍价开启时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stop_time", + "type": "DATETIME", + "chnname": "砍价结束时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_name", + "type": "VARCHAR_255", + "chnname": "砍价产品名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "砍价金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "min_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "砍价商品最低价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "num", + "type": "INT UNSIGNED_10", + "chnname": "每次购买的砍价产品数量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_max_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "用户每次砍价的最大金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_min_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "用户每次砍价的最小金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_num", + "type": "INT UNSIGNED_10", + "chnname": "用户每次砍价的次数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "砍价状态 0(到砍价时间不自动开启) 1(到砍价时间自动开启时间)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "description", + "type": "TEXT", + "chnname": "砍价详情", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "give_integral", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "反多少积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "info", + "type": "VARCHAR_255", + "chnname": "砍价活动简介", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "成本价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_hot", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否推荐0不推荐1推荐", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除 0未删除 1删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_postage", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否包邮 0不包邮 1包邮", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "postage", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "邮费", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "rule", + "type": "TEXT", + "chnname": "砍价规则", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "look", + "type": "INT UNSIGNED_10", + "chnname": "砍价产品浏览量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "share", + "type": "INT UNSIGNED_10", + "chnname": "砍价产品分享量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_visit", + "chnname": "产品浏览分析表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "INT_10", + "chnname": "产品ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_type", + "type": "VARCHAR_32", + "chnname": "产品类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cate_id", + "type": "INT_10", + "chnname": "产品分类ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "CHAR_50", + "chnname": "产品类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "INT_10", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "count", + "type": "INT_10", + "chnname": "访问次数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "content", + "type": "VARCHAR_255", + "chnname": "备注描述", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "add_time", + "type": "INT_10", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "yx_store_pink", + "moduleName": false, + "x": 310, + "y": 580, + "id": "13513a4e" + }, + { + "shape": "table", + "title": "yx_store_coupon", + "moduleName": false, + "x": 600, + "y": 180, + "id": "2b6bf508" + }, + { + "shape": "table", + "title": "yx_store_coupon_user", + "moduleName": false, + "x": 1310, + "y": 190, + "id": "aa29268e" + }, + { + "shape": "table", + "title": "yx_store_coupon_issue", + "moduleName": false, + "x": 1270, + "y": 580, + "id": "74e5a8f0" + }, + { + "shape": "table", + "title": "yx_store_coupon_issue_user", + "moduleName": false, + "x": 790, + "y": 610, + "id": "dfd12dd0" + }, + { + "shape": "table", + "title": "yx_store_bargain", + "moduleName": false, + "x": -160, + "y": -50, + "id": "1de36ee3" + }, + { + "shape": "table", + "title": "yx_store_bargain_user", + "moduleName": false, + "x": 590, + "y": -340, + "id": "14a47167" + }, + { + "shape": "table", + "title": "yx_store_bargain_user_help", + "moduleName": false, + "x": 490, + "y": -100, + "id": "e979c0f8" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "aa29268e", + "target": "2b6bf508", + "id": "a8da6c7b", + "controlPoints": [ + { + "x": 1041.849609375, + "y": 91.2897465437788 + }, + { + "x": 835.138671875, + "y": 72.12931034482759 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "74e5a8f0", + "target": "2b6bf508", + "id": "6abf3f7d", + "controlPoints": [ + { + "x": 1051.787109375, + "y": 510.3375331564987 + }, + { + "x": 835.138671875, + "y": 72.12931034482759 + } + ], + "sourceAnchor": 4, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "dfd12dd0", + "target": "74e5a8f0", + "id": "0433262a", + "controlPoints": [ + { + "x": 991.1455078125, + "y": 608.3222222222222 + }, + { + "x": 1051.787109375, + "y": 472.12931034482756 + } + ], + "sourceAnchor": 5, + "targetAnchor": 0 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "14a47167", + "target": "1de36ee3", + "id": "e528de82", + "controlPoints": [ + { + "x": 279.8408203125, + "y": -377.6630434782609 + }, + { + "x": 182.1513671875, + "y": -347.9440298507463 + } + ], + "sourceAnchor": 4, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "e979c0f8", + "target": "1de36ee3", + "id": "b2e7774f", + "controlPoints": [ + { + "x": 280.6005859375, + "y": -120.73355263157895 + }, + { + "x": 182.1513671875, + "y": -347.9440298507463 + } + ], + "sourceAnchor": 4, + "targetAnchor": 1 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_coupon_user", + "field": "cid" + }, + "to": { + "entity": "yx_store_coupon", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_coupon_issue", + "field": "cid" + }, + "to": { + "entity": "yx_store_coupon", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_coupon_issue_user", + "field": "issue_coupon_id" + }, + "to": { + "entity": "yx_store_coupon_issue", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_bargain_user", + "field": "bargain_id" + }, + "to": { + "entity": "yx_store_bargain", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_bargain_user_help", + "field": "bargain_id" + }, + "to": { + "entity": "yx_store_bargain", + "field": "id" + } + } + ] + }, + { + "name": "cart", + "chnname": "购物车", + "entities": [ + { + "title": "yx_store_cart", + "chnname": "购物车表", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "购物车表ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_32", + "chnname": "类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_attr_unique", + "type": "VARCHAR_50", + "chnname": "商品属性", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cart_num", + "type": "SMALLINT UNSIGNED_5", + "chnname": "商品数量", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_pay", + "type": "BIT_1", + "chnname": "0 = 未购买 1 = 已购买", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_new", + "type": "BIT_1", + "chnname": "是否为立即购买", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "combination_id", + "type": "INT UNSIGNED_10", + "chnname": "拼团id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "seckill_id", + "type": "INT UNSIGNED_10", + "chnname": "秒杀产品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_id", + "type": "INT UNSIGNED_10", + "chnname": "砍价id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + } + }, + { + "name": "category", + "chnname": "商品分类", + "entities": [ + { + "title": "yx_store_category", + "chnname": "商品分类表", + "fields": [ + { + "name": "id", + "type": "MEDIUMINT_7", + "chnname": "商品分类表ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "pid", + "type": "MEDIUMINT_7", + "chnname": "父id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cate_name", + "type": "VARCHAR_100", + "chnname": "分类名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "MEDIUMINT_7", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pic", + "type": "VARCHAR_128", + "chnname": "图标", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否推荐", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "删除状态", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + } + }, + { + "name": "order", + "chnname": "订单", + "entities": [ + { + "title": "yx_store_order", + "chnname": "订单表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "订单ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "order_id", + "type": "VARCHAR_32", + "chnname": "订单号", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "extend_order_id", + "type": "VARCHAR_32", + "chnname": "额外订单号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_32", + "chnname": "用户姓名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "user_phone", + "type": "VARCHAR_18", + "chnname": "用户电话", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "user_address", + "type": "VARCHAR_100", + "chnname": "详细地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cart_id", + "type": "VARCHAR_256", + "chnname": "购物车id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "freight_price", + "type": "DECIMAL_8_2", + "chnname": "运费金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_num", + "type": "INT UNSIGNED_10", + "chnname": "订单商品总数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "订单总价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_postage", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "邮费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "实际支付金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_postage", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "支付邮费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "deduction_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "抵扣金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_id", + "type": "INT UNSIGNED_10", + "chnname": "优惠券id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "优惠券金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "paid", + "type": "TINYINT UNSIGNED_1", + "chnname": "支付状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_time", + "type": "DATETIME", + "chnname": "支付时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_type", + "type": "VARCHAR_32", + "chnname": "支付方式", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "订单状态(-1 : 申请退款 -2 : 退货成功 0:待发货;1:待收货;2:已收货;3:已完成;-1:已退款)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_status", + "type": "TINYINT UNSIGNED_1", + "chnname": "0 未退款 1 申请中 2 已退款", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_reason_wap_img", + "type": "VARCHAR_255", + "chnname": "退款图片", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_reason_wap_explain", + "type": "VARCHAR_255", + "chnname": "退款用户说明", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_reason_time", + "type": "DATETIME", + "chnname": "退款时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_reason_wap", + "type": "VARCHAR_255", + "chnname": "前台退款原因", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_reason", + "type": "VARCHAR_255", + "chnname": "不退款的理由", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "退款金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "delivery_sn", + "type": "VARCHAR_100", + "chnname": "快递公司编号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "delivery_name", + "type": "VARCHAR_64", + "chnname": "快递名称/送货人姓名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "delivery_type", + "type": "VARCHAR_32", + "chnname": "发货类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "delivery_id", + "type": "VARCHAR_64", + "chnname": "快递单号/手机号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "gain_integral", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "消费赚取积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "use_integral", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "使用积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "back_integral", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "给用户退了多少积分", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mark", + "type": "VARCHAR_512", + "chnname": "备注", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unique", + "type": "CHAR_32", + "chnname": "唯一id(md5加密)类似id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remark", + "type": "VARCHAR_512", + "chnname": "管理员备注", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT UNSIGNED_10", + "chnname": "商户ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_mer_check", + "type": "TINYINT UNSIGNED_3", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "combination_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "拼团产品id0一般产品", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pink_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "拼团id 0没有拼团", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "成本价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "seckill_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "秒杀产品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_id", + "type": "INT UNSIGNED_10", + "chnname": "砍价id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "verify_code", + "type": "VARCHAR_50", + "chnname": "核销码", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_id", + "type": "INT_10", + "chnname": "门店id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "shipping_type", + "type": "BIT_1", + "chnname": "配送方式 1=快递 ,2=门店自提", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_channel", + "type": "TINYINT UNSIGNED_1", + "chnname": "支付渠道(0微信公众号1微信小程序)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_remind", + "type": "TINYINT UNSIGNED_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_system_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_order_cart_info", + "chnname": "订单购物详情表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "oid", + "type": "BIGINT UNSIGNED_20", + "chnname": "订单id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cart_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "购物车id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cart_info", + "type": "TEXT", + "chnname": "购买东西的详细信息", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unique", + "type": "VARCHAR_50", + "chnname": "唯一id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_order_status", + "chnname": "订单操作记录表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "oid", + "type": "BIGINT UNSIGNED_20", + "chnname": "订单id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "change_type", + "type": "VARCHAR_32", + "chnname": "操作类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "change_message", + "type": "VARCHAR_256", + "chnname": "操作备注", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "change_time", + "type": "DATETIME", + "chnname": "操作时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_express", + "chnname": "快递公司表", + "fields": [ + { + "name": "id", + "type": "MEDIUMINT UNSIGNED_8", + "chnname": "快递公司id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "code", + "type": "VARCHAR_50", + "chnname": "快递公司简称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_50", + "chnname": "快递公司全称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否显示", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT_3", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "yx_store_order", + "moduleName": false, + "x": 610, + "y": 550, + "id": "0eda0dc5" + }, + { + "shape": "table", + "title": "yx_store_order_cart_info", + "moduleName": false, + "x": 1370, + "y": 70, + "id": "1412580b" + }, + { + "shape": "table", + "title": "yx_store_cart", + "moduleName": "cart", + "x": 1410, + "y": 330, + "id": "bcf3c95c" + }, + { + "shape": "table", + "title": "yx_store_order_status", + "moduleName": false, + "x": 1380, + "y": 610, + "id": "f5488e91" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "1412580b", + "target": "0eda0dc5", + "id": "6f47eff5", + "controlPoints": [ + { + "x": 1179.8701171875, + "y": 52.38333333333334 + }, + { + "x": 1074.1962890625, + "y": 32.03378378378378 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "1412580b", + "target": "bcf3c95c", + "id": "2c239ffd", + "controlPoints": [ + { + "x": 1179.8701171875, + "y": 72.51666666666668 + }, + { + "x": 1120, + "y": 70 + }, + { + "x": 1120, + "y": 210 + }, + { + "x": 1184.4970703125, + "y": 212.1209677419355 + } + ], + "sourceAnchor": 4, + "targetAnchor": 0 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "f5488e91", + "target": "0eda0dc5", + "id": "70641526", + "controlPoints": [ + { + "x": 1200.5224609375, + "y": 602.4423076923077 + }, + { + "x": 1130, + "y": 450 + }, + { + "x": 1074.1962890625, + "y": 32.03378378378378 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_order_cart_info", + "field": "oid" + }, + "to": { + "entity": "yx_store_order", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_order_cart_info", + "field": "cart_id" + }, + "to": { + "entity": "yx_store_cart", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_order_status", + "field": "oid" + }, + "to": { + "entity": "yx_store_order", + "field": "id" + } + } + ] + }, + { + "name": "product", + "chnname": "商品模块", + "entities": [ + { + "title": "yx_store_product_reply", + "chnname": "评论表", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "评论ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "oid", + "type": "BIGINT_19", + "chnname": "订单ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unique", + "type": "CHAR_32", + "chnname": "唯一id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT_19", + "chnname": "产品id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "reply_type", + "type": "VARCHAR_32", + "chnname": "某种商品类型(普通商品、秒杀商品)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_score", + "type": "BIT_1", + "chnname": "商品分数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "service_score", + "type": "BIT_1", + "chnname": "服务分数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "comment", + "type": "VARCHAR_512", + "chnname": "评论内容", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pics", + "type": "TEXT", + "chnname": "评论图片", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "评论时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "merchant_reply_content", + "type": "VARCHAR_300", + "chnname": "管理员回复内容", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "merchant_reply_time", + "type": "DATETIME", + "chnname": "管理员回复时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "0未删除1已删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_reply", + "type": "BIT_1", + "chnname": "0未回复1已回复", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product_relation", + "chnname": "商品点赞和收藏表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_32", + "chnname": "类型(收藏(collect)、点赞(like))", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "category", + "type": "VARCHAR_32", + "chnname": "某种类型的商品(普通商品、秒杀商品)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product_attr_value", + "chnname": "商品属性值表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sku", + "type": "VARCHAR_128", + "chnname": "商品属性索引值 (attr_value|attr_value[|....])", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stock", + "type": "INT UNSIGNED_10", + "chnname": "属性对应的库存", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sales", + "type": "INT UNSIGNED_10", + "chnname": "销量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "属性金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_128", + "chnname": "图片", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unique", + "type": "VARCHAR_100", + "chnname": "唯一值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "成本价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bar_code", + "type": "VARCHAR_255", + "chnname": "商品条码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ot_price", + "type": "DECIMAL_10_2", + "chnname": "原价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "weight", + "type": "DECIMAL_8_2", + "chnname": "重量", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "volume", + "type": "DECIMAL_8_2", + "chnname": "体积", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "brokerage", + "type": "DECIMAL_8_2", + "chnname": "一级返佣", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "brokerage_two", + "type": "DECIMAL_8_2", + "chnname": "二级返佣", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pink_price", + "type": "DECIMAL_8_2", + "chnname": "拼团价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pink_stock", + "type": "INT_10", + "chnname": "拼团库存", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "seckill_price", + "type": "DECIMAL_10_2", + "chnname": "秒杀价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "seckill_stock", + "type": "INT_10", + "chnname": "秒杀库存", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product_attr_result", + "chnname": "商品属性详情表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "result", + "type": "TEXT", + "chnname": "商品属性参数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "change_time", + "type": "DATETIME", + "chnname": "上次修改时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product_attr", + "chnname": "商品属性表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "attr_name", + "type": "VARCHAR_32", + "chnname": "属性名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "attr_values", + "type": "VARCHAR_256", + "chnname": "属性值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product", + "chnname": "商品表", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "商品id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT UNSIGNED_10", + "chnname": "商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_256", + "chnname": "商品图片", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "slider_image", + "type": "VARCHAR_2000", + "chnname": "轮播图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_name", + "type": "VARCHAR_128", + "chnname": "商品名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_info", + "type": "VARCHAR_256", + "chnname": "商品简介", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "keyword", + "type": "VARCHAR_256", + "chnname": "关键字", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bar_code", + "type": "VARCHAR_15", + "chnname": "产品条码(一维码)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cate_id", + "type": "VARCHAR_64", + "chnname": "分类id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "商品价格", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "vip_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "会员价格", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ot_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "市场价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "postage", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "邮费", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unit_name", + "type": "VARCHAR_32", + "chnname": "单位名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "SMALLINT_5", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sales", + "type": "MEDIUMINT UNSIGNED_8", + "chnname": "销量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stock", + "type": "MEDIUMINT UNSIGNED_8", + "chnname": "库存", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "状态(0:未上架,1:上架)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_hot", + "type": "BIT_1", + "chnname": "是否热卖", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_benefit", + "type": "BIT_1", + "chnname": "是否优惠", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_best", + "type": "BIT_1", + "chnname": "是否精品", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_new", + "type": "BIT_1", + "chnname": "是否新品", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "description", + "type": "TEXT", + "chnname": "产品描述", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_postage", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否包邮", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_use", + "type": "TINYINT UNSIGNED_1", + "chnname": "商户是否代理 0不可代理1可代理", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "give_integral", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "获得积分", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "成本价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_seckill", + "type": "TINYINT UNSIGNED_1", + "chnname": "秒杀状态 0 未开启 1已开启", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_bargain", + "type": "TINYINT UNSIGNED_1", + "chnname": "砍价状态 0未开启 1开启", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_good", + "type": "BIT_1", + "chnname": "是否优品推荐", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ficti", + "type": "MEDIUMINT_7", + "chnname": "虚拟销量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "browse", + "type": "INT_10", + "chnname": "浏览量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "code_path", + "type": "VARCHAR_64", + "chnname": "产品二维码地址(用户小程序海报)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_sub", + "type": "BIT_1", + "chnname": "是否单独分佣", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temp_id", + "type": "INT_10", + "chnname": "运费模板ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spec_type", + "type": "BIT_1", + "chnname": "规格 0单 1多", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product_rule", + "chnname": "商品规则值(规格)表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "rule_name", + "type": "VARCHAR_32", + "chnname": "规格名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "rule_value", + "type": "JSON", + "chnname": "规格值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "yx_store_product", + "moduleName": false, + "x": 390, + "y": 410, + "id": "1f2a5f58" + }, + { + "shape": "table", + "title": "yx_store_product_attr", + "moduleName": false, + "x": 970, + "y": 60, + "id": "8d021563" + }, + { + "shape": "table", + "title": "yx_store_product_attr_value", + "moduleName": false, + "x": 1090, + "y": 360, + "id": "65395cd5" + }, + { + "shape": "table", + "title": "yx_store_product_attr_result", + "moduleName": false, + "x": 1020, + "y": 660, + "id": "f65fda56" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "8d021563", + "target": "1f2a5f58", + "id": "8a5b631d", + "controlPoints": [ + { + "x": 814.5400390625, + "y": 62.52272727272727 + }, + { + "x": 698.1318359375, + "y": 42.0462962962963 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "65395cd5", + "target": "1f2a5f58", + "id": "b3c471e9", + "controlPoints": [ + { + "x": 818.958984375, + "y": 252.17424242424244 + }, + { + "x": 698.1318359375, + "y": 42.0462962962963 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "65395cd5", + "target": "8d021563", + "id": "76f261e2", + "controlPoints": [ + { + "x": 818.958984375, + "y": 272.2348484848485 + }, + { + "x": 750, + "y": 240 + }, + { + "x": 814.5400390625, + "y": 82.70454545454545 + } + ], + "sourceAnchor": 4, + "targetAnchor": 4 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_product_attr", + "field": "product_id" + }, + "to": { + "entity": "yx_store_product", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_product_attr_value", + "field": "product_id" + }, + "to": { + "entity": "yx_store_product", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_product_attr_value", + "field": "sku" + }, + "to": { + "entity": "yx_store_product_attr", + "field": "attr_name" + } + } + ] + }, + { + "name": "shop", + "chnname": "商户模块", + "entities": [ + { + "title": "yx_material_group", + "chnname": "素材分组", + "fields": [ + { + "name": "id", + "type": "VARCHAR_32", + "chnname": "PK", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_id", + "type": "VARCHAR_32", + "chnname": "创建者ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_200", + "chnname": "分组名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_attachment", + "chnname": "附件管理表", + "fields": [ + { + "name": "att_id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_100", + "chnname": "附件名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "att_dir", + "type": "VARCHAR_200", + "chnname": "附件路径", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "satt_dir", + "type": "VARCHAR_200", + "chnname": "压缩图片路径", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "att_size", + "type": "CHAR_30", + "chnname": "附件大小", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "att_type", + "type": "CHAR_30", + "chnname": "附件类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pid", + "type": "INT_10", + "chnname": "分类ID0编辑器,1产品图片,2拼团图片,3砍价图片,4秒杀图片,5文章图片,6组合数据图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image_type", + "type": "TINYINT UNSIGNED_1", + "chnname": "图片上传类型 1本地 2七牛云 3OSS 4COS ", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "module_type", + "type": "TINYINT UNSIGNED_1", + "chnname": "图片上传模块类型 1 后台上传 2 用户生成", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "invite_code", + "type": "VARCHAR_50", + "chnname": "邀请码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_config", + "chnname": "配置表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "配置id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "menu_name", + "type": "VARCHAR_255", + "chnname": "字段名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "value", + "type": "VARCHAR_5000", + "chnname": "默认值", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否隐藏", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_group_data", + "chnname": "组合数据详情表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "组合数据详情ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "group_name", + "type": "VARCHAR_100", + "chnname": "对应的数据名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "value", + "type": "TEXT", + "chnname": "数据组对应的数据值(json数据)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加数据时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT_10", + "chnname": "数据排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "状态(1:开启;2:关闭;)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_store", + "chnname": "门店自提", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_100", + "chnname": "门店名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "introduction", + "type": "VARCHAR_1000", + "chnname": "简介", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "phone", + "type": "CHAR_25", + "chnname": "手机号码", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "address", + "type": "VARCHAR_255", + "chnname": "省市区", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "detailed_address", + "type": "VARCHAR_255", + "chnname": "详细地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_255", + "chnname": "门店logo", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "latitude", + "type": "CHAR_25", + "chnname": "纬度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "longitude", + "type": "CHAR_25", + "chnname": "经度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "valid_time", + "type": "VARCHAR_100", + "chnname": "核销有效日期", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "day_time", + "type": "VARCHAR_100", + "chnname": "每日营业开关时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否显示", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "day_time_end", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "day_time_start", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "valid_time_end", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "valid_time_start", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_store_staff", + "chnname": "门店店员表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "微信用户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "nickname", + "type": "VARCHAR_50", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "avatar", + "type": "VARCHAR_255", + "chnname": "店员头像", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_id", + "type": "INT_10", + "chnname": "门店id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_name", + "type": "VARCHAR_50", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "staff_name", + "type": "VARCHAR_64", + "chnname": "店员名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "phone", + "type": "CHAR_15", + "chnname": "手机号码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "verify_status", + "type": "TINYINT_3", + "chnname": "核销开关", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT_3", + "chnname": "状态", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_user_level", + "chnname": "设置用户等级表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT_10", + "chnname": "商户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "会员名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "money", + "type": "DECIMAL_8_2", + "chnname": "购买金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "valid_date", + "type": "INT_10", + "chnname": "有效时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_forever", + "type": "BIT_1", + "chnname": "是否为永久会员", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_pay", + "type": "BIT_1", + "chnname": "是否购买,1=购买,0=不购买", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否显示 1=显示,0=隐藏", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "grade", + "type": "INT_10", + "chnname": "会员等级", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "discount", + "type": "DECIMAL_8_2", + "chnname": "享受折扣", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_255", + "chnname": "会员卡背景", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "icon", + "type": "VARCHAR_255", + "chnname": "会员图标", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "explain", + "type": "TEXT", + "chnname": "说明", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "是否删除.1=删除,0=未删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_material", + "chnname": "素材库", + "fields": [ + { + "name": "id", + "type": "VARCHAR_32", + "chnname": "PK", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_id", + "type": "VARCHAR_100", + "chnname": "创建者ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "CHAR_2", + "chnname": "类型1、图片;2、视频", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "group_id", + "type": "VARCHAR_32", + "chnname": "分组ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_200", + "chnname": "素材名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_500", + "chnname": "素材链接", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "yx_material", + "moduleName": false, + "x": 442.359375, + "y": 277, + "id": "fe721315" + }, + { + "shape": "table", + "title": "yx_material_group", + "moduleName": false, + "x": 887.359375, + "y": 279, + "id": "f3be72cb" + }, + { + "shape": "table", + "title": "yx_system_store", + "moduleName": false, + "x": 326.359375, + "y": 624, + "id": "396a35b0" + }, + { + "shape": "table", + "title": "yx_system_store_staff", + "moduleName": false, + "x": 870, + "y": 590, + "id": "c3935d4a" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "fe721315", + "target": "f3be72cb", + "id": "e1f3d02d", + "controlPoints": [ + { + "x": 623.05859375, + "y": 283.9775132275132 + }, + { + "x": 743.333984375, + "y": 241.25 + } + ], + "sourceAnchor": 9, + "targetAnchor": 0 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "c3935d4a", + "target": "396a35b0", + "id": "5bfc667b", + "controlPoints": [ + { + "x": 699.7900390625, + "y": 558.5457559681697 + }, + { + "x": 517.833984375, + "y": 456.0914634146342 + } + ], + "sourceAnchor": 8, + "targetAnchor": 1 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "yx_material", + "field": "group_id" + }, + "to": { + "entity": "yx_material_group", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_system_store_staff", + "field": "store_id" + }, + "to": { + "entity": "yx_system_store", + "field": "id" + } + } + ] + }, + { + "name": "template", + "chnname": "运费模板", + "entities": [ + { + "title": "yx_shipping_templates", + "chnname": "运费模板表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "模板ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "模板名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "BIT_1", + "chnname": "计费方式", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "region_info", + "type": "TEXT", + "chnname": "地域以及费用", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "appoint", + "type": "BIT_1", + "chnname": "指定包邮开关", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "appoint_info", + "type": "TEXT", + "chnname": "指定包邮内容", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_shipping_templates_free", + "chnname": "", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "编号", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "province_id", + "type": "INT_10", + "chnname": "省ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temp_id", + "type": "INT_10", + "chnname": "模板ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "city_id", + "type": "INT_10", + "chnname": "城市ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "number", + "type": "DECIMAL_10_2", + "chnname": "包邮件数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL_10_2", + "chnname": "包邮金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "BIT_1", + "chnname": "计费方式", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uniqid", + "type": "VARCHAR_32", + "chnname": "分组唯一值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_city", + "chnname": "城市表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "city_id", + "type": "INT_10", + "chnname": "城市id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "level", + "type": "INT_10", + "chnname": "省市级别", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "parent_id", + "type": "INT_10", + "chnname": "父级id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "area_code", + "type": "VARCHAR_30", + "chnname": "区号", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_100", + "chnname": "名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "merger_name", + "type": "VARCHAR_255", + "chnname": "合并名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "lng", + "type": "VARCHAR_50", + "chnname": "经度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "lat", + "type": "VARCHAR_50", + "chnname": "纬度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否展示", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_shipping_templates_region", + "chnname": "", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "编号", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "province_id", + "type": "INT_10", + "chnname": "省ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temp_id", + "type": "INT_10", + "chnname": "模板ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "city_id", + "type": "INT_10", + "chnname": "城市ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "first", + "type": "DECIMAL_10_2", + "chnname": "首件", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "first_price", + "type": "DECIMAL_10_2", + "chnname": "首件运费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "continues", + "type": "DECIMAL_10_2", + "chnname": "续件", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "continue_price", + "type": "DECIMAL_10_2", + "chnname": "续件运费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "BIT_1", + "chnname": "计费方式", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uniqid", + "type": "VARCHAR_50", + "chnname": "分组唯一值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "yx_shipping_templates", + "moduleName": false, + "x": 680, + "y": 380, + "id": "c8177992" + }, + { + "shape": "table", + "title": "yx_system_city", + "moduleName": false, + "x": 290, + "y": 260, + "id": "f3f8204a" + }, + { + "shape": "table", + "title": "yx_shipping_templates_free", + "moduleName": false, + "x": 1080, + "y": 190, + "id": "ac873dd5" + }, + { + "shape": "table", + "title": "yx_shipping_templates_region", + "moduleName": false, + "x": 1080, + "y": 540, + "id": "7ca63a1e" + } + ], + "edges": [] + }, + "associations": [] + }, + { + "name": "user", + "chnname": "用户模块", + "entities": [ + { + "title": "yx_user_bill", + "chnname": "用户账单表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户账单id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户uid", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "link_id", + "type": "VARCHAR_32", + "chnname": "关联id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pm", + "type": "TINYINT UNSIGNED_1", + "chnname": "0 = 支出 1 = 获得", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_64", + "chnname": "账单标题", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "category", + "type": "VARCHAR_64", + "chnname": "明细种类", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_64", + "chnname": "明细类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "number", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "明细数字", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "balance", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "剩余", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mark", + "type": "VARCHAR_512", + "chnname": "备注", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "0 = 带确定 1 = 有效 -1 = 无效", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_level", + "chnname": "用户等级记录表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "用户uid", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "level_id", + "type": "INT_10", + "chnname": "等级vip", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "grade", + "type": "INT_10", + "chnname": "会员等级", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "valid_time", + "type": "INT_10", + "chnname": "过期时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_forever", + "type": "BIT_1", + "chnname": "是否永久", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT_10", + "chnname": "商户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "0:禁止,1:正常", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mark", + "type": "VARCHAR_255", + "chnname": "备注", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remind", + "type": "BIT_1", + "chnname": "是否已通知", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "是否删除,0=未删除,1=删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "discount", + "type": "INT_10", + "chnname": "享受折扣", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_task_finish", + "chnname": "用户任务完成记录表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "task_id", + "type": "INT_10", + "chnname": "任务id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "用户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "是否有效", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_sign", + "chnname": "签到记录表", + "fields": [ + { + "name": "int", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "用户uid", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_255", + "chnname": "签到说明", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "number", + "type": "INT_10", + "chnname": "获得积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "balance", + "type": "INT_10", + "chnname": "剩余积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_recharge", + "chnname": "用户充值表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "充值用户UID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "nickname", + "type": "VARCHAR_50", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "order_id", + "type": "VARCHAR_32", + "chnname": "订单号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL_8_2", + "chnname": "充值金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "give_price", + "type": "DECIMAL_8_2", + "chnname": "购买赠送金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "recharge_type", + "type": "VARCHAR_32", + "chnname": "充值类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "paid", + "type": "BIT_1", + "chnname": "是否充值", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_time", + "type": "DATETIME", + "chnname": "充值支付时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "充值时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_price", + "type": "DECIMAL_10_2", + "chnname": "退款金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT_3", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_address", + "chnname": "用户地址表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户地址id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_32", + "chnname": "收货人姓名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "phone", + "type": "VARCHAR_16", + "chnname": "收货人电话", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "province", + "type": "VARCHAR_64", + "chnname": "收货人所在省", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "city", + "type": "VARCHAR_64", + "chnname": "收货人所在市", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "city_id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "district", + "type": "VARCHAR_64", + "chnname": "收货人所在区", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "detail", + "type": "VARCHAR_256", + "chnname": "收货人详细地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "post_code", + "type": "VARCHAR_20", + "chnname": "邮编", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "longitude", + "type": "VARCHAR_16", + "chnname": "经度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "latitude", + "type": "VARCHAR_16", + "chnname": "纬度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_default", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否默认", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_group", + "chnname": "用户分组表", + "fields": [ + { + "name": "id", + "type": "SMALLINT UNSIGNED_5", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "group_name", + "type": "VARCHAR_64", + "chnname": "用户分组名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_extract", + "chnname": "用户提现表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_64", + "chnname": "名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "extract_type", + "type": "VARCHAR_32", + "chnname": "bank = 银行卡 alipay = 支付宝wx=微信", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bank_code", + "type": "VARCHAR_32", + "chnname": "银行卡", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bank_address", + "type": "VARCHAR_256", + "chnname": "开户地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "alipay_code", + "type": "VARCHAR_64", + "chnname": "支付宝账号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "extract_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "提现金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mark", + "type": "VARCHAR_512", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "balance", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "fail_msg", + "type": "VARCHAR_128", + "chnname": "无效原因", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "fail_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT_3", + "chnname": "-1 未通过 0 审核中 1 已提现", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "wechat", + "type": "VARCHAR_15", + "chnname": "微信号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_enter", + "chnname": "商户申请表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "商户申请ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "INT UNSIGNED_10", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "province", + "type": "VARCHAR_32", + "chnname": "商户所在省", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "city", + "type": "VARCHAR_32", + "chnname": "商户所在市", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "district", + "type": "VARCHAR_32", + "chnname": "商户所在区", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "address", + "type": "VARCHAR_256", + "chnname": "商户详细地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "merchant_name", + "type": "VARCHAR_256", + "chnname": "商户名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "link_user", + "type": "VARCHAR_32", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "link_tel", + "type": "VARCHAR_16", + "chnname": "商户电话", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "charter", + "type": "VARCHAR_512", + "chnname": "商户证书", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "add_time", + "type": "INT UNSIGNED_10", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "apply_time", + "type": "INT UNSIGNED_10", + "chnname": "审核时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "success_time", + "type": "INT_10", + "chnname": "通过时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "fail_message", + "type": "VARCHAR_256", + "chnname": "未通过原因", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "fail_time", + "type": "INT UNSIGNED_10", + "chnname": "未通过时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "-1 审核未通过 0未审核 1审核通过", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_lock", + "type": "TINYINT UNSIGNED_1", + "chnname": "0 = 开启 1= 关闭", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_user_task", + "chnname": "等级任务设置", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "任务名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_255", + "chnname": "配置原名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "task_type", + "type": "VARCHAR_50", + "chnname": "任务类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "number", + "type": "INT_10", + "chnname": "限定数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "level_id", + "type": "INT_10", + "chnname": "等级id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否显示", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_must", + "type": "BIT_1", + "chnname": "是否务必达成任务,1务必达成,0=满足其一", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "illustrate", + "type": "VARCHAR_255", + "chnname": "任务说明", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "新增时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user", + "chnname": "用户表", + "fields": [ + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "username", + "type": "VARCHAR_255", + "chnname": "用户账户(跟accout一样)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "password", + "type": "VARCHAR_255", + "chnname": "用户密码(跟pwd)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_25", + "chnname": "真实姓名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "birthday", + "type": "INT_10", + "chnname": "生日", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "card_id", + "type": "VARCHAR_20", + "chnname": "身份证号码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mark", + "type": "VARCHAR_255", + "chnname": "用户备注", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "partner_id", + "type": "INT_10", + "chnname": "合伙人id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "group_id", + "type": "INT_10", + "chnname": "用户分组id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "nickname", + "type": "VARCHAR_100", + "chnname": "用户昵称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "avatar", + "type": "VARCHAR_256", + "chnname": "用户头像", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "phone", + "type": "CHAR_15", + "chnname": "手机号码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "add_ip", + "type": "VARCHAR_16", + "chnname": "添加ip", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "最后一次登录时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "last_ip", + "type": "VARCHAR_16", + "chnname": "最后一次登录ip", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "now_money", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "用户余额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "brokerage_price", + "type": "DECIMAL_8_2", + "chnname": "佣金金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "integral", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "用户剩余积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sign_num", + "type": "INT_10", + "chnname": "连续签到天数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "1为正常,0为禁止", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "level", + "type": "TINYINT UNSIGNED_3", + "chnname": "等级", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spread_uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "推广元id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spread_time", + "type": "DATETIME", + "chnname": "推广员关联时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "user_type", + "type": "VARCHAR_32", + "chnname": "用户类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_promoter", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否为推广员", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_count", + "type": "INT UNSIGNED_10", + "chnname": "用户购买次数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spread_count", + "type": "INT_10", + "chnname": "下级人数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "addres", + "type": "VARCHAR_255", + "chnname": "详细地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "adminid", + "type": "INT UNSIGNED_10", + "chnname": "管理员编号 ", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "login_type", + "type": "VARCHAR_36", + "chnname": "用户登陆类型,h5,wechat,routine", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "wx_profile", + "type": "JSON", + "chnname": "微信用户json信息", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + } + }, + { + "name": "wechat", + "chnname": "微信模块", + "entities": [ + { + "title": "yx_wechat_reply", + "chnname": "微信关键字回复表", + "fields": [ + { + "name": "id", + "type": "MEDIUMINT UNSIGNED_8", + "chnname": "微信关键字回复id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "key", + "type": "VARCHAR_64", + "chnname": "关键字", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_32", + "chnname": "回复类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "data", + "type": "TEXT", + "chnname": "回复数据", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "0=不可用 1 =可用", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "hide", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否隐藏", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_wechat_menu", + "chnname": "微信缓存表", + "fields": [ + { + "name": "key", + "type": "VARCHAR_32", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "result", + "type": "TEXT", + "chnname": "缓存数据", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "add_time", + "type": "INT_10", + "chnname": "缓存时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_wechat_media", + "chnname": "微信回复表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "微信视频音频id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_16", + "chnname": "回复类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "path", + "type": "VARCHAR_128", + "chnname": "文件路径", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "media_id", + "type": "VARCHAR_64", + "chnname": "微信服务器返回的id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_256", + "chnname": "地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temporary", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否永久或者临时 0永久1临时", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "add_time", + "type": "INT UNSIGNED_10", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_article", + "chnname": "文章管理表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "文章管理ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "cid", + "type": "VARCHAR_255", + "chnname": "分类id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_255", + "chnname": "文章标题", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "author", + "type": "VARCHAR_255", + "chnname": "文章作者", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image_input", + "type": "VARCHAR_255", + "chnname": "文章图片", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "synopsis", + "type": "VARCHAR_255", + "chnname": "文章简介", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "content", + "type": "TEXT", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "share_title", + "type": "VARCHAR_255", + "chnname": "文章分享标题", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "share_synopsis", + "type": "VARCHAR_255", + "chnname": "文章分享简介", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "visit", + "type": "VARCHAR_255", + "chnname": "浏览次数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_255", + "chnname": "原文链接", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "状态", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "hide", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否隐藏", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "admin_id", + "type": "INT UNSIGNED_10", + "chnname": "管理员id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT UNSIGNED_10", + "chnname": "商户id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "INT_10", + "chnname": "产品关联id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_hot", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否热门(小程序)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_banner", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否轮播图(小程序)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_wechat_template", + "chnname": "微信模板", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "模板id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "tempkey", + "type": "CHAR_50", + "chnname": "模板编号", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "CHAR_100", + "chnname": "模板名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "content", + "type": "VARCHAR_1000", + "chnname": "回复内容", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "tempid", + "type": "CHAR_100", + "chnname": "模板ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT_3", + "chnname": "状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_30", + "chnname": "类型:template:模板消息 subscribe:订阅消息", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_wechat_live_goods", + "chnname": "微信小程序直播商品表", + "fields": [ + { + "name": "goods_id", + "type": "BIGINT_19", + "chnname": "直播商品id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT_19", + "chnname": "关联商品id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cover_imge_url", + "type": "VARCHAR_255", + "chnname": "商品图片", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_64", + "chnname": "商品小程序路径", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price_type", + "type": "VARCHAR_255", + "chnname": "价格类型 1:一口价(只需要传入price,price2不传) 2:价格区间(price字段为左边界,price2字段为右边界,price和price2必传) 3:显示折扣价(price字段为原价,price2字段为现价, price和price2必传)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "VARCHAR_64", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price2", + "type": "VARCHAR_64", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "商品名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "third_party_tag", + "type": "VARCHAR_255", + "chnname": "1, 2:表示是为api添加商品,否则是直播控制台添加的商品", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "audit_id", + "type": "BIGINT_19", + "chnname": "审核单id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "audit_status", + "type": "INT UNSIGNED_10", + "chnname": "审核状态 0:未审核,1:审核中,2:审核通过,3审核失败", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_wechat_live", + "chnname": "微信小程序直播表", + "fields": [ + { + "name": "room_id", + "type": "BIGINT_19", + "chnname": "直播间id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "直播间标题", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cover_imge", + "type": "VARCHAR_255", + "chnname": "背景图", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "share_imge", + "type": "VARCHAR_255", + "chnname": "分享图片", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "live_status", + "type": "INT_10", + "chnname": "直播间状态", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "start_time", + "type": "BIGINT_19", + "chnname": "开始时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "end_time", + "type": "BIGINT_19", + "chnname": "预计结束时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "anchor_name", + "type": "VARCHAR_64", + "chnname": "主播昵称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "anchor_wechat", + "type": "VARCHAR_32", + "chnname": "主播微信号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "anchor_imge", + "type": "VARCHAR_255", + "chnname": "主播头像", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "BIT_1", + "chnname": "直播间类型 1:推流 0:手机直播", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "screen_type", + "type": "BIT_1", + "chnname": "横屏、竖屏 【1:横屏,0:竖屏】", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "close_like", + "type": "BIT_1", + "chnname": "是否关闭点赞 【0:开启,1:关闭】", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "close_comment", + "type": "BIT_1", + "chnname": "是否关闭评论 【0:开启,1:关闭】", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "close_goods", + "type": "BIT_1", + "chnname": "是否关闭货架 【0:开启,1:关闭】", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "VARCHAR_255", + "chnname": "商品id 多个,分割", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "close_replay", + "type": "BIT_1", + "chnname": "是否关闭回放【0:开启,1:关闭】", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "close_share", + "type": "BIT_1", + "chnname": "是否关闭分享【0:开启,1:关闭】", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "close_kf", + "type": "BIT_1", + "chnname": "是否关闭客服【0:开启,1:关闭】", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + }, + "associations": [] + } + ], + "message": "3.0升级sql", + "version": "V1.2", + "changes": [ + { + "type": "field", + "name": "yx_store_seckill.give_integral.notNull", + "opt": "update", + "changeData": "true=>false" + }, + { + "type": "field", + "name": "yx_store_seckill.is_sub", + "opt": "delete" + }, + { + "type": "field", + "name": "yx_store_combination.is_sub", + "opt": "delete" + }, + { + "type": "entity", + "name": "yx_wechat_live_goods.chnname", + "opt": "update", + "changeData": "=>微信小程序直播商品表" + }, + { + "type": "field", + "name": "yx_wechat_live.room_id", + "opt": "add" + }, + { + "type": "field", + "name": "yx_wechat_live.close_replay", + "opt": "add" + }, + { + "type": "field", + "name": "yx_wechat_live.close_share", + "opt": "add" + }, + { + "type": "field", + "name": "yx_wechat_live.close_kf", + "opt": "add" + }, + { + "type": "field", + "name": "yx_wechat_live.roomid", + "opt": "delete" + }, + { + "type": "entity", + "name": "yx_wechat_live.chnname", + "opt": "update", + "changeData": "=>微信小程序直播表" + } + ], + "date": "2020/9/12 23:56:59" +} diff --git a/sql/.yshop.version/yshop-base.pdman.json b/sql/.yshop.version/yshop-base.pdman.json new file mode 100644 index 0000000..ff6ce22 --- /dev/null +++ b/sql/.yshop.version/yshop-base.pdman.json @@ -0,0 +1,11247 @@ +{ + "modules": [ + { + "name": "DB_REVERSE_MYSQL", + "chnname": "逆向解析_MYSQL", + "entities": [ + { + "title": "monitor_server", + "chnname": "服务监控", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "cpu_core", + "type": "INT_10", + "chnname": "CPU内核数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cpu_rate", + "type": "DOUBLE_22", + "chnname": "CPU使用率", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "disk_total", + "type": "DOUBLE_22", + "chnname": "磁盘总量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "disk_used", + "type": "DOUBLE_22", + "chnname": "磁盘使用量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mem_total", + "type": "DOUBLE_22", + "chnname": "内存总数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mem_used", + "type": "DOUBLE_22", + "chnname": "内存使用量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "port", + "type": "INT_10", + "chnname": "访问端口", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "state", + "type": "VARCHAR_255", + "chnname": "状态", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "swap_total", + "type": "DOUBLE_22", + "chnname": "交换区总量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "swap_used", + "type": "DOUBLE_22", + "chnname": "交换区使用量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "address", + "type": "VARCHAR_255", + "chnname": "服务地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ], + "indexs": [], + "headers": [ + { + "fieldName": "chnname", + "relationNoShow": false + }, + { + "fieldName": "name", + "relationNoShow": false + }, + { + "fieldName": "type", + "relationNoShow": false + }, + { + "fieldName": "dataType", + "relationNoShow": true + }, + { + "fieldName": "remark", + "relationNoShow": true + }, + { + "fieldName": "pk", + "relationNoShow": false + }, + { + "fieldName": "notNull", + "relationNoShow": true + }, + { + "fieldName": "autoIncrement", + "relationNoShow": true + }, + { + "fieldName": "defaultValue", + "relationNoShow": true + }, + { + "fieldName": "relationNoShow", + "relationNoShow": true + }, + { + "fieldName": "uiHint", + "relationNoShow": true + } + ] + } + ], + "graphCanvas": { + "edges": [], + "nodes": [] + }, + "associations": [] + }, + { + "name": "tools", + "chnname": "工具模块", + "entities": [ + { + "title": "email_config", + "chnname": "邮箱配置", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "from_user", + "type": "VARCHAR_255", + "chnname": "收件人", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "host", + "type": "VARCHAR_255", + "chnname": "邮件服务器SMTP地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pass", + "type": "VARCHAR_255", + "chnname": "密码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "port", + "type": "VARCHAR_255", + "chnname": "端口", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "user", + "type": "VARCHAR_255", + "chnname": "发件者用户名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "local_storage", + "chnname": "本地存储", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_255", + "chnname": "文件真实的名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "文件名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "suffix", + "type": "VARCHAR_255", + "chnname": "后缀", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "path", + "type": "VARCHAR_255", + "chnname": "路径", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_255", + "chnname": "类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "size", + "type": "VARCHAR_100", + "chnname": "大小", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "operate", + "type": "VARCHAR_255", + "chnname": "操作人", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "picture", + "chnname": "Sm.Ms图床", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "上传日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "delete_url", + "type": "VARCHAR_255", + "chnname": "删除的URL", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "filename", + "type": "VARCHAR_255", + "chnname": "图片名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "height", + "type": "VARCHAR_255", + "chnname": "图片高度", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "size", + "type": "VARCHAR_255", + "chnname": "图片大小", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_255", + "chnname": "图片地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "username", + "type": "VARCHAR_255", + "chnname": "用户名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "width", + "type": "VARCHAR_255", + "chnname": "图片宽度", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "md5code", + "type": "VARCHAR_255", + "chnname": "文件的MD5值", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "qiniu_config", + "chnname": "七牛云配置", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "access_key", + "type": "TEXT", + "chnname": "accessKey", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bucket", + "type": "VARCHAR_255", + "chnname": "Bucket 识别符", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "host", + "type": "VARCHAR_255", + "chnname": "外链域名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "secret_key", + "type": "TEXT", + "chnname": "secretKey", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_255", + "chnname": "空间类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "zone", + "type": "VARCHAR_255", + "chnname": "机房", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "qiniu_content", + "chnname": "七牛云文件存储", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "bucket", + "type": "VARCHAR_255", + "chnname": "Bucket 识别符", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "文件名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "size", + "type": "VARCHAR_255", + "chnname": "文件大小", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_255", + "chnname": "文件类型:私有或公开", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "上传或同步的时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_255", + "chnname": "文件url", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "suffix", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "verification_code", + "chnname": "验证码", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "code", + "type": "VARCHAR_255", + "chnname": "验证码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "状态:1有效、0过期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_255", + "chnname": "验证码类型:email或者短信", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "value", + "type": "VARCHAR_255", + "chnname": "接收邮箱或者手机号码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "scenes", + "type": "VARCHAR_255", + "chnname": "业务名称:如重置邮箱、重置密码等", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "alipay_config", + "chnname": "支付宝配置类", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "主键", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "app_id", + "type": "VARCHAR_255", + "chnname": "应用ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "charset", + "type": "VARCHAR_255", + "chnname": "编码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "format", + "type": "VARCHAR_255", + "chnname": "类型 固定格式json", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "gateway_url", + "type": "VARCHAR_255", + "chnname": "网关地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "notify_url", + "type": "VARCHAR_255", + "chnname": "异步回调", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "private_key", + "type": "TEXT", + "chnname": "私钥", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "public_key", + "type": "TEXT", + "chnname": "公钥", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "return_url", + "type": "VARCHAR_255", + "chnname": "回调地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sign_type", + "type": "VARCHAR_255", + "chnname": "签名方式", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sys_service_provider_id", + "type": "VARCHAR_255", + "chnname": "商户号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + } + }, + { + "name": "logging", + "chnname": "日志", + "entities": [ + { + "title": "log", + "chnname": "系统日志", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "description", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "exception_detail", + "type": "TEXT", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "log_type", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "method", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "params", + "type": "TEXT", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "request_ip", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "time", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "username", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "address", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "browser", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ], + "indexs": [], + "headers": [ + { + "fieldName": "chnname", + "relationNoShow": false + }, + { + "fieldName": "name", + "relationNoShow": false + }, + { + "fieldName": "type", + "relationNoShow": false + }, + { + "fieldName": "dataType", + "relationNoShow": true + }, + { + "fieldName": "remark", + "relationNoShow": true + }, + { + "fieldName": "pk", + "relationNoShow": false + }, + { + "fieldName": "notNull", + "relationNoShow": true + }, + { + "fieldName": "autoIncrement", + "relationNoShow": true + }, + { + "fieldName": "defaultValue", + "relationNoShow": true + }, + { + "fieldName": "relationNoShow", + "relationNoShow": true + }, + { + "fieldName": "uiHint", + "relationNoShow": true + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + }, + "associations": [] + }, + { + "name": "gen", + "chnname": "代码生成", + "entities": [ + { + "title": "gen_test", + "chnname": "代码生成测试", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sex", + "type": "INT_10", + "chnname": "性别", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "column_config", + "chnname": "代码生成字段信息存储", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "table_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "column_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "column_type", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "dict_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "extra", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "form_show", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "form_type", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "key_type", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "list_show", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "not_null", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "query_type", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remark", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "date_annotation", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "gen_config", + "chnname": "代码生成器配置", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "table_name", + "type": "VARCHAR_255", + "chnname": "表名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "author", + "type": "VARCHAR_255", + "chnname": "作者", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cover", + "type": "BIT_1", + "chnname": "是否覆盖", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "module_name", + "type": "VARCHAR_255", + "chnname": "模块名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pack", + "type": "VARCHAR_255", + "chnname": "至于哪个包下", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "path", + "type": "VARCHAR_255", + "chnname": "前端代码生成的路径", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "api_path", + "type": "VARCHAR_255", + "chnname": "前端Api文件路径", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "prefix", + "type": "VARCHAR_255", + "chnname": "表前缀", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "api_alias", + "type": "VARCHAR_255", + "chnname": "接口名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "column_config", + "moduleName": false, + "x": 288.359375, + "y": 279, + "id": "09a1ceae" + }, + { + "shape": "table", + "title": "gen_config", + "moduleName": false, + "x": 760, + "y": 200, + "id": "2e380491" + } + ], + "edges": [] + }, + "associations": [] + }, + { + "name": "monitor", + "chnname": "", + "entities": [ + { + "title": "visits", + "chnname": "访客记录", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "date", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ip_counts", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pv_counts", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "week_day", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ], + "indexs": [], + "headers": [ + { + "fieldName": "chnname", + "relationNoShow": false + }, + { + "fieldName": "name", + "relationNoShow": false + }, + { + "fieldName": "type", + "relationNoShow": false + }, + { + "fieldName": "dataType", + "relationNoShow": true + }, + { + "fieldName": "remark", + "relationNoShow": true + }, + { + "fieldName": "pk", + "relationNoShow": false + }, + { + "fieldName": "notNull", + "relationNoShow": true + }, + { + "fieldName": "autoIncrement", + "relationNoShow": true + }, + { + "fieldName": "defaultValue", + "relationNoShow": true + }, + { + "fieldName": "relationNoShow", + "relationNoShow": true + }, + { + "fieldName": "uiHint", + "relationNoShow": true + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + }, + "associations": [] + }, + { + "name": "quartz", + "chnname": "定时任务", + "entities": [ + { + "title": "quartz_job", + "chnname": "定时任务", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "bean_name", + "type": "VARCHAR_255", + "chnname": "Spring Bean名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cron_expression", + "type": "VARCHAR_255", + "chnname": "cron 表达式", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_pause", + "type": "BIT_1", + "chnname": "状态:1暂停、0启用", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "job_name", + "type": "VARCHAR_255", + "chnname": "任务名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "method_name", + "type": "VARCHAR_255", + "chnname": "方法名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "params", + "type": "VARCHAR_255", + "chnname": "参数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remark", + "type": "VARCHAR_255", + "chnname": "备注", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ], + "indexs": [], + "headers": [ + { + "fieldName": "chnname", + "relationNoShow": false + }, + { + "fieldName": "name", + "relationNoShow": false + }, + { + "fieldName": "type", + "relationNoShow": false + }, + { + "fieldName": "dataType", + "relationNoShow": true + }, + { + "fieldName": "remark", + "relationNoShow": true + }, + { + "fieldName": "pk", + "relationNoShow": false + }, + { + "fieldName": "notNull", + "relationNoShow": true + }, + { + "fieldName": "autoIncrement", + "relationNoShow": true + }, + { + "fieldName": "defaultValue", + "relationNoShow": true + }, + { + "fieldName": "relationNoShow", + "relationNoShow": true + }, + { + "fieldName": "uiHint", + "relationNoShow": true + } + ] + }, + { + "title": "quartz_log", + "chnname": "定时任务日志", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "baen_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cron_expression", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "exception_detail", + "type": "TEXT", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_success", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "job_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "method_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "params", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "time", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ], + "indexs": [], + "headers": [ + { + "fieldName": "chnname", + "relationNoShow": false + }, + { + "fieldName": "name", + "relationNoShow": false + }, + { + "fieldName": "type", + "relationNoShow": false + }, + { + "fieldName": "dataType", + "relationNoShow": true + }, + { + "fieldName": "remark", + "relationNoShow": true + }, + { + "fieldName": "pk", + "relationNoShow": false + }, + { + "fieldName": "notNull", + "relationNoShow": true + }, + { + "fieldName": "autoIncrement", + "relationNoShow": true + }, + { + "fieldName": "defaultValue", + "relationNoShow": true + }, + { + "fieldName": "relationNoShow", + "relationNoShow": true + }, + { + "fieldName": "uiHint", + "relationNoShow": true + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "quartz_job", + "moduleName": false, + "x": 422.359375, + "y": 367, + "id": "4b2bda89" + }, + { + "shape": "table", + "title": "quartz_log", + "moduleName": false, + "x": 890, + "y": 340, + "id": "b47ba8e0" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "b47ba8e0", + "target": "4b2bda89", + "id": "01afd2ee", + "controlPoints": [ + { + "x": 759.2236328125, + "y": 356.3101851851852 + }, + { + "x": 608.0595703125, + "y": 354.9063636363636 + } + ], + "sourceAnchor": 12, + "targetAnchor": 9 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "quartz_log", + "field": "job_name" + }, + "to": { + "entity": "quartz_job", + "field": "job_name" + } + } + ] + }, + { + "name": "system", + "chnname": "系统模块", + "entities": [ + { + "title": "users_roles", + "chnname": "用户角色关联", + "fields": [ + { + "name": "user_id", + "type": "BIGINT_19", + "chnname": "用户ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "role_id", + "type": "BIGINT_19", + "chnname": "角色ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "roles_menus", + "chnname": "角色菜单关联", + "fields": [ + { + "name": "menu_id", + "type": "BIGINT_19", + "chnname": "菜单ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "role_id", + "type": "BIGINT_19", + "chnname": "角色ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "roles_depts", + "chnname": "角色部门关联", + "fields": [ + { + "name": "role_id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "dept_id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "user_avatar", + "chnname": "系统用户头像", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_255", + "chnname": "真实文件名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "path", + "type": "VARCHAR_255", + "chnname": "路径", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "size", + "type": "VARCHAR_255", + "chnname": "大小", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "role", + "chnname": "角色表", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remark", + "type": "VARCHAR_255", + "chnname": "备注", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "data_scope", + "type": "VARCHAR_255", + "chnname": "数据权限", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "level", + "type": "INT_10", + "chnname": "角色级别", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "permission", + "type": "VARCHAR_255", + "chnname": "功能权限", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "dict", + "chnname": "数据字典", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "字典名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remark", + "type": "VARCHAR_255", + "chnname": "描述", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "dict_detail", + "chnname": "数据字典详情", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "label", + "type": "VARCHAR_255", + "chnname": "字典标签", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "value", + "type": "VARCHAR_255", + "chnname": "字典值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "VARCHAR_255", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "dict_id", + "type": "BIGINT_19", + "chnname": "字典id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "dept", + "chnname": "部门", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pid", + "type": "BIGINT_19", + "chnname": "上级部门", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "enabled", + "type": "BIT_1", + "chnname": "状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "menu", + "chnname": "", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "i_frame", + "type": "BIT_1", + "chnname": "是否外链", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "菜单名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "component", + "type": "VARCHAR_255", + "chnname": "组件", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pid", + "type": "BIGINT_19", + "chnname": "上级菜单ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "BIGINT_19", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "icon", + "type": "VARCHAR_255", + "chnname": "图标", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "path", + "type": "VARCHAR_255", + "chnname": "链接地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cache", + "type": "BIT_1", + "chnname": "缓存", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "hidden", + "type": "BIT_1", + "chnname": "是否隐藏", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "component_name", + "type": "VARCHAR_20", + "chnname": "组件名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "permission", + "type": "VARCHAR_255", + "chnname": "权限", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "INT_10", + "chnname": "类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "job", + "chnname": "岗位", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "岗位名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "enabled", + "type": "BIT_1", + "chnname": "岗位状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "BIGINT_19", + "chnname": "岗位排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "dept_id", + "type": "BIGINT_19", + "chnname": "部门ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "user", + "chnname": "系统用户", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "avatar_id", + "type": "BIGINT_19", + "chnname": "头像", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "email", + "type": "VARCHAR_255", + "chnname": "邮箱", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "enabled", + "type": "BIGINT_19", + "chnname": "状态:1启用、0禁用", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "password", + "type": "VARCHAR_255", + "chnname": "密码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "username", + "type": "VARCHAR_255", + "chnname": "用户名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "dept_id", + "type": "BIGINT_19", + "chnname": "部门名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "phone", + "type": "VARCHAR_255", + "chnname": "手机号码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "job_id", + "type": "BIGINT_19", + "chnname": "岗位名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "last_password_reset_time", + "type": "DATETIME", + "chnname": "最后修改密码的日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "nick_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sex", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "user", + "moduleName": false, + "x": 730, + "y": 200, + "id": "42584636" + }, + { + "shape": "table", + "title": "menu", + "moduleName": false, + "x": 230, + "y": 580, + "id": "faa9e561" + }, + { + "shape": "table", + "title": "dict_detail", + "moduleName": false, + "x": 1440, + "y": 720, + "id": "de6d0d5f" + }, + { + "shape": "table", + "title": "dict", + "moduleName": false, + "x": 1080, + "y": 770, + "id": "2e3e2ccb" + }, + { + "shape": "table", + "title": "user_avatar", + "moduleName": false, + "x": 220, + "y": 100, + "id": "794cd430" + }, + { + "shape": "table", + "title": "job", + "moduleName": false, + "x": 240, + "y": 290, + "id": "fe1aecfe" + }, + { + "shape": "table", + "title": "roles_menus", + "moduleName": false, + "x": 550, + "y": 490, + "id": "0ba651c7" + }, + { + "shape": "table", + "title": "role", + "moduleName": false, + "x": 850, + "y": 570, + "id": "2dd8b462" + }, + { + "shape": "table", + "title": "roles_depts", + "moduleName": false, + "x": 1140, + "y": 490, + "id": "759d8dd0" + }, + { + "shape": "table", + "title": "users_roles", + "moduleName": false, + "x": 1210, + "y": 50, + "id": "e76717e1" + }, + { + "shape": "table", + "title": "dept", + "moduleName": false, + "x": 1200, + "y": 240, + "id": "2ecdc324" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "42584636", + "target": "fe1aecfe", + "id": "a7e02413", + "controlPoints": [ + { + "x": 518.6240234375, + "y": 225.91161616161617 + }, + { + "x": 384.025390625, + "y": 232.19736842105263 + } + ], + "sourceAnchor": 16, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "42584636", + "target": "2ecdc324", + "id": "99cdad68", + "controlPoints": [ + { + "x": 941.3759765625, + "y": 187.46212121212122 + }, + { + "x": 1055.974609375, + "y": 192.22058823529412 + } + ], + "sourceAnchor": 13, + "targetAnchor": 0 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "de6d0d5f", + "target": "2e3e2ccb", + "id": "0f30581b", + "controlPoints": [ + { + "x": 1296.224609375, + "y": 736.3355263157895 + }, + { + "x": 1223.775390625, + "y": 732.25 + } + ], + "sourceAnchor": 8, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "42584636", + "target": "794cd430", + "id": "618c6bc6", + "controlPoints": [ + { + "x": 518.6240234375, + "y": 91.33838383838385 + }, + { + "x": 368.099609375, + "y": 72.28846153846153 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "0ba651c7", + "target": "faa9e561", + "id": "fdb423ea", + "controlPoints": [ + { + "x": 422.126953125, + "y": 492.281914893617 + }, + { + "x": 395.0341796875, + "y": 442.10714285714283 + } + ], + "sourceAnchor": 0, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "0ba651c7", + "target": "2dd8b462", + "id": "882b95a1", + "controlPoints": [ + { + "x": 677.873046875, + "y": 512.8191489361702 + }, + { + "x": 705.974609375, + "y": 502.17857142857144 + } + ], + "sourceAnchor": 3, + "targetAnchor": 0 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "759d8dd0", + "target": "2dd8b462", + "id": "7a7a3350", + "controlPoints": [ + { + "x": 1034.2080078125, + "y": 492.281914893617 + }, + { + "x": 994.025390625, + "y": 502.17857142857144 + } + ], + "sourceAnchor": 0, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "759d8dd0", + "target": "2ecdc324", + "id": "a9e0dc69", + "controlPoints": [ + { + "x": 1245.7919921875, + "y": 506.48049645390074 + }, + { + "x": 1440, + "y": 500 + }, + { + "x": 1440, + "y": 190 + }, + { + "x": 1344.025390625, + "y": 192.22058823529412 + } + ], + "sourceAnchor": 3, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "e76717e1", + "target": "42584636", + "id": "6179129e", + "controlPoints": [ + { + "x": 1085.4638671875, + "y": 52.28191489361702 + }, + { + "x": 941.3759765625, + "y": 72.11363636363636 + } + ], + "sourceAnchor": 0, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "e76717e1", + "target": "2dd8b462", + "id": "c796f9c9", + "controlPoints": [ + { + "x": 1334.5361328125, + "y": 72.81914893617022 + }, + { + "x": 1480, + "y": 70 + }, + { + "x": 1490, + "y": 580 + }, + { + "x": 1030, + "y": 590 + }, + { + "x": 994.025390625, + "y": 502.17857142857144 + } + ], + "sourceAnchor": 3, + "targetAnchor": 1 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "user", + "field": "job_id" + }, + "to": { + "entity": "job", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "user", + "field": "dept_id" + }, + "to": { + "entity": "dept", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "dict_detail", + "field": "dict_id" + }, + "to": { + "entity": "dict", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "user", + "field": "avatar_id" + }, + "to": { + "entity": "user_avatar", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "roles_menus", + "field": "menu_id" + }, + "to": { + "entity": "menu", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "roles_menus", + "field": "role_id" + }, + "to": { + "entity": "role", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "roles_depts", + "field": "role_id" + }, + "to": { + "entity": "role", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "roles_depts", + "field": "dept_id" + }, + "to": { + "entity": "dept", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "users_roles", + "field": "user_id" + }, + "to": { + "entity": "user", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "users_roles", + "field": "role_id" + }, + "to": { + "entity": "role", + "field": "id" + } + } + ] + }, + { + "name": "activity", + "chnname": "活动", + "entities": [ + { + "title": "yx_store_seckill", + "chnname": "商品秒杀产品表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品秒杀产品表id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_255", + "chnname": "推荐图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "images", + "type": "VARCHAR_2000", + "chnname": "轮播图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_255", + "chnname": "活动标题", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "info", + "type": "VARCHAR_255", + "chnname": "简介", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "价格", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "成本", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ot_price", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "原价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "give_integral", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "返多少积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stock", + "type": "INT UNSIGNED_10", + "chnname": "库存", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sales", + "type": "INT UNSIGNED_10", + "chnname": "销量", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unit_name", + "type": "VARCHAR_16", + "chnname": "单位名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "postage", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "邮费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "description", + "type": "TEXT", + "chnname": "内容", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "start_time", + "type": "DATE", + "chnname": "开始时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stop_time", + "type": "DATE", + "chnname": "结束时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "产品状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_postage", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否包邮", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_hot", + "type": "TINYINT UNSIGNED_1", + "chnname": "热门推荐", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "删除 0未删除1已删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "num", + "type": "INT UNSIGNED_10", + "chnname": "最多秒杀几个", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "TINYINT UNSIGNED_1", + "chnname": "显示", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "time_id", + "type": "INT UNSIGNED_10", + "chnname": "时间段id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_pink", + "chnname": "拼团表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "order_id", + "type": "VARCHAR_32", + "chnname": "订单id 生成", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "order_id_key", + "type": "INT UNSIGNED_10", + "chnname": "订单id 数据库", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_num", + "type": "INT UNSIGNED_10", + "chnname": "购买商品个数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_price", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "购买总金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cid", + "type": "BIGINT UNSIGNED_20", + "chnname": "拼团产品id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pid", + "type": "BIGINT UNSIGNED_20", + "chnname": "产品id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "people", + "type": "INT UNSIGNED_10", + "chnname": "拼团总人数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "拼团产品单价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "开始时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stop_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "k_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "团长id 0为团长", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_tpl", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否发送模板消息0未发送1已发送", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_refund", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否退款 0未退款 1已退款", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "状态1进行中2已完成3未完成", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_coupon_user", + "chnname": "优惠券发放记录表", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "优惠券发放记录id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "cid", + "type": "INT UNSIGNED_10", + "chnname": "兑换的项目id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "优惠券所属用户", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_title", + "type": "VARCHAR_32", + "chnname": "优惠券名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "优惠券的面值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "use_min_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "最低消费多少金额可用优惠券", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "优惠券创建时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "end_time", + "type": "DATETIME", + "chnname": "优惠券结束时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "use_time", + "type": "DATETIME", + "chnname": "使用时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_32", + "chnname": "获取方式", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "状态(0:未使用,1:已使用, 2:已过期)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_fail", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否有效", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_coupon_issue_user", + "chnname": "优惠券前台用户领取记录表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "领取优惠券用户ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "issue_coupon_id", + "type": "INT_10", + "chnname": "优惠券前台领取ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "领取时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_coupon_issue", + "chnname": "优惠券前台领取表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "cname", + "type": "VARCHAR_50", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cid", + "type": "INT_10", + "chnname": "优惠券ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ctype", + "type": "BIT_1", + "chnname": "优惠券类型 0-通用 1-商品券", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "start_time", + "type": "DATETIME", + "chnname": "优惠券领取开启时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "end_time", + "type": "DATETIME", + "chnname": "优惠券领取结束时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_count", + "type": "INT_10", + "chnname": "优惠券领取数量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remain_count", + "type": "INT_10", + "chnname": "优惠券剩余领取数量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_permanent", + "type": "BIT_1", + "chnname": "是否无限张数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "1 正常 0 未开启 -1 已无效", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "优惠券添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_coupon", + "chnname": "优惠券表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "优惠券表ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_64", + "chnname": "优惠券名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "integral", + "type": "INT UNSIGNED_10", + "chnname": "兑换消耗积分值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "兑换的优惠券面值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "use_min_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "最低消费多少金额可用优惠券", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_time", + "type": "INT UNSIGNED_10", + "chnname": "优惠券有效期限(单位:天)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "状态(0:关闭,1:开启)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "VARCHAR_200", + "chnname": "商品ids", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "TINYINT_3", + "chnname": "优惠券类型 0-通用 1-商品券", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "兑换项目添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_combination", + "chnname": "拼团产品表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT UNSIGNED_10", + "chnname": "商户id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_255", + "chnname": "推荐图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "images", + "type": "VARCHAR_2000", + "chnname": "轮播图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_255", + "chnname": "活动标题", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "attr", + "type": "VARCHAR_255", + "chnname": "活动属性", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "people", + "type": "INT UNSIGNED_10", + "chnname": "参团人数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "info", + "type": "VARCHAR_255", + "chnname": "简介", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "价格", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_price", + "type": "DECIMAL_10_2", + "chnname": "商品原价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sales", + "type": "INT UNSIGNED_10", + "chnname": "销量", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stock", + "type": "INT UNSIGNED_10", + "chnname": "库存", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_host", + "type": "TINYINT UNSIGNED_1", + "chnname": "推荐", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "TINYINT UNSIGNED_1", + "chnname": "产品状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "combination", + "type": "TINYINT UNSIGNED_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_use", + "type": "TINYINT UNSIGNED_1", + "chnname": "商户是否可用1可用0不可用", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_postage", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否包邮1是0否", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "postage", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "邮费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "description", + "type": "TEXT", + "chnname": "拼团内容", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "start_time", + "type": "DATETIME", + "chnname": "拼团开始时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stop_time", + "type": "DATETIME", + "chnname": "拼团结束时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "effective_time", + "type": "INT_10", + "chnname": "拼团订单有效时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "INT UNSIGNED_10", + "chnname": "拼团产品成本", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "browse", + "type": "INT_10", + "chnname": "浏览量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unit_name", + "type": "VARCHAR_32", + "chnname": "单位名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_bargain_user_help", + "chnname": "砍价用户帮助表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "砍价用户帮助表ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "帮助的用户id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "砍价产品ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_user_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户参与砍价表id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "帮助砍价多少金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_bargain_user", + "chnname": "用户参与砍价表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户参与砍价表ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "砍价产品id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_price_min", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "砍价的最低价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_price", + "type": "DECIMAL_8_2", + "chnname": "砍价金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "砍掉的价格", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "状态 1参与中 2 活动结束参与失败 3活动结束参与成功", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "参与时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "是否取消", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_bargain", + "chnname": "砍价表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "砍价产品ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "关联产品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_255", + "chnname": "砍价活动名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_150", + "chnname": "砍价活动图片", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unit_name", + "type": "VARCHAR_16", + "chnname": "单位名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stock", + "type": "INT UNSIGNED_10", + "chnname": "库存", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sales", + "type": "INT UNSIGNED_10", + "chnname": "销量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "images", + "type": "VARCHAR_2000", + "chnname": "砍价产品轮播图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "start_time", + "type": "DATETIME", + "chnname": "砍价开启时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stop_time", + "type": "DATETIME", + "chnname": "砍价结束时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_name", + "type": "VARCHAR_255", + "chnname": "砍价产品名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "砍价金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "min_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "砍价商品最低价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "num", + "type": "INT UNSIGNED_10", + "chnname": "每次购买的砍价产品数量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_max_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "用户每次砍价的最大金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_min_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "用户每次砍价的最小金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_num", + "type": "INT UNSIGNED_10", + "chnname": "用户每次砍价的次数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "砍价状态 0(到砍价时间不自动开启) 1(到砍价时间自动开启时间)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "description", + "type": "TEXT", + "chnname": "砍价详情", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "give_integral", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "反多少积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "info", + "type": "VARCHAR_255", + "chnname": "砍价活动简介", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "成本价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_hot", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否推荐0不推荐1推荐", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除 0未删除 1删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_postage", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否包邮 0不包邮 1包邮", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "postage", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "邮费", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "rule", + "type": "TEXT", + "chnname": "砍价规则", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "look", + "type": "INT UNSIGNED_10", + "chnname": "砍价产品浏览量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "share", + "type": "INT UNSIGNED_10", + "chnname": "砍价产品分享量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_visit", + "chnname": "产品浏览分析表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "INT_10", + "chnname": "产品ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_type", + "type": "VARCHAR_32", + "chnname": "产品类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cate_id", + "type": "INT_10", + "chnname": "产品分类ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "CHAR_50", + "chnname": "产品类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "INT_10", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "count", + "type": "INT_10", + "chnname": "访问次数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "content", + "type": "VARCHAR_255", + "chnname": "备注描述", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "add_time", + "type": "INT_10", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "yx_store_pink", + "moduleName": false, + "x": 310, + "y": 580, + "id": "13513a4e" + }, + { + "shape": "table", + "title": "yx_store_coupon", + "moduleName": false, + "x": 600, + "y": 180, + "id": "2b6bf508" + }, + { + "shape": "table", + "title": "yx_store_coupon_user", + "moduleName": false, + "x": 1310, + "y": 190, + "id": "aa29268e" + }, + { + "shape": "table", + "title": "yx_store_coupon_issue", + "moduleName": false, + "x": 1270, + "y": 580, + "id": "74e5a8f0" + }, + { + "shape": "table", + "title": "yx_store_coupon_issue_user", + "moduleName": false, + "x": 790, + "y": 610, + "id": "dfd12dd0" + }, + { + "shape": "table", + "title": "yx_store_bargain", + "moduleName": false, + "x": -160, + "y": -50, + "id": "1de36ee3" + }, + { + "shape": "table", + "title": "yx_store_bargain_user", + "moduleName": false, + "x": 590, + "y": -340, + "id": "14a47167" + }, + { + "shape": "table", + "title": "yx_store_bargain_user_help", + "moduleName": false, + "x": 490, + "y": -100, + "id": "e979c0f8" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "aa29268e", + "target": "2b6bf508", + "id": "a8da6c7b", + "controlPoints": [ + { + "x": 1041.849609375, + "y": 91.2897465437788 + }, + { + "x": 835.138671875, + "y": 72.12931034482759 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "74e5a8f0", + "target": "2b6bf508", + "id": "6abf3f7d", + "controlPoints": [ + { + "x": 1051.787109375, + "y": 510.3375331564987 + }, + { + "x": 835.138671875, + "y": 72.12931034482759 + } + ], + "sourceAnchor": 4, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "dfd12dd0", + "target": "74e5a8f0", + "id": "0433262a", + "controlPoints": [ + { + "x": 991.1455078125, + "y": 608.3222222222222 + }, + { + "x": 1051.787109375, + "y": 472.12931034482756 + } + ], + "sourceAnchor": 5, + "targetAnchor": 0 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "14a47167", + "target": "1de36ee3", + "id": "e528de82", + "controlPoints": [ + { + "x": 279.8408203125, + "y": -377.6630434782609 + }, + { + "x": 182.1513671875, + "y": -347.9440298507463 + } + ], + "sourceAnchor": 4, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "e979c0f8", + "target": "1de36ee3", + "id": "b2e7774f", + "controlPoints": [ + { + "x": 280.6005859375, + "y": -120.73355263157895 + }, + { + "x": 182.1513671875, + "y": -347.9440298507463 + } + ], + "sourceAnchor": 4, + "targetAnchor": 1 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_coupon_user", + "field": "cid" + }, + "to": { + "entity": "yx_store_coupon", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_coupon_issue", + "field": "cid" + }, + "to": { + "entity": "yx_store_coupon", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_coupon_issue_user", + "field": "issue_coupon_id" + }, + "to": { + "entity": "yx_store_coupon_issue", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_bargain_user", + "field": "bargain_id" + }, + "to": { + "entity": "yx_store_bargain", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_bargain_user_help", + "field": "bargain_id" + }, + "to": { + "entity": "yx_store_bargain", + "field": "id" + } + } + ] + }, + { + "name": "cart", + "chnname": "购物车", + "entities": [ + { + "title": "yx_store_cart", + "chnname": "购物车表", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "购物车表ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_32", + "chnname": "类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_attr_unique", + "type": "VARCHAR_50", + "chnname": "商品属性", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cart_num", + "type": "SMALLINT UNSIGNED_5", + "chnname": "商品数量", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_pay", + "type": "BIT_1", + "chnname": "0 = 未购买 1 = 已购买", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_new", + "type": "BIT_1", + "chnname": "是否为立即购买", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "combination_id", + "type": "INT UNSIGNED_10", + "chnname": "拼团id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "seckill_id", + "type": "INT UNSIGNED_10", + "chnname": "秒杀产品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_id", + "type": "INT UNSIGNED_10", + "chnname": "砍价id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + } + }, + { + "name": "category", + "chnname": "商品分类", + "entities": [ + { + "title": "yx_store_category", + "chnname": "商品分类表", + "fields": [ + { + "name": "id", + "type": "MEDIUMINT_7", + "chnname": "商品分类表ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "pid", + "type": "MEDIUMINT_7", + "chnname": "父id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cate_name", + "type": "VARCHAR_100", + "chnname": "分类名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "MEDIUMINT_7", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pic", + "type": "VARCHAR_128", + "chnname": "图标", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否推荐", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "删除状态", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + } + }, + { + "name": "order", + "chnname": "订单", + "entities": [ + { + "title": "yx_store_order", + "chnname": "订单表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "订单ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "order_id", + "type": "VARCHAR_32", + "chnname": "订单号", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "extend_order_id", + "type": "VARCHAR_32", + "chnname": "额外订单号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_32", + "chnname": "用户姓名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "user_phone", + "type": "VARCHAR_18", + "chnname": "用户电话", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "user_address", + "type": "VARCHAR_100", + "chnname": "详细地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cart_id", + "type": "VARCHAR_256", + "chnname": "购物车id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "freight_price", + "type": "DECIMAL_8_2", + "chnname": "运费金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_num", + "type": "INT UNSIGNED_10", + "chnname": "订单商品总数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "订单总价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_postage", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "邮费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "实际支付金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_postage", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "支付邮费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "deduction_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "抵扣金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_id", + "type": "INT UNSIGNED_10", + "chnname": "优惠券id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "优惠券金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "paid", + "type": "TINYINT UNSIGNED_1", + "chnname": "支付状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_time", + "type": "DATETIME", + "chnname": "支付时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_type", + "type": "VARCHAR_32", + "chnname": "支付方式", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "订单状态(-1 : 申请退款 -2 : 退货成功 0:待发货;1:待收货;2:已收货;3:已完成;-1:已退款)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_status", + "type": "TINYINT UNSIGNED_1", + "chnname": "0 未退款 1 申请中 2 已退款", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_reason_wap_img", + "type": "VARCHAR_255", + "chnname": "退款图片", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_reason_wap_explain", + "type": "VARCHAR_255", + "chnname": "退款用户说明", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_reason_time", + "type": "DATETIME", + "chnname": "退款时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_reason_wap", + "type": "VARCHAR_255", + "chnname": "前台退款原因", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_reason", + "type": "VARCHAR_255", + "chnname": "不退款的理由", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "退款金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "delivery_sn", + "type": "VARCHAR_100", + "chnname": "快递公司编号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "delivery_name", + "type": "VARCHAR_64", + "chnname": "快递名称/送货人姓名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "delivery_type", + "type": "VARCHAR_32", + "chnname": "发货类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "delivery_id", + "type": "VARCHAR_64", + "chnname": "快递单号/手机号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "gain_integral", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "消费赚取积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "use_integral", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "使用积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "back_integral", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "给用户退了多少积分", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mark", + "type": "VARCHAR_512", + "chnname": "备注", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unique", + "type": "CHAR_32", + "chnname": "唯一id(md5加密)类似id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remark", + "type": "VARCHAR_512", + "chnname": "管理员备注", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT UNSIGNED_10", + "chnname": "商户ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_mer_check", + "type": "TINYINT UNSIGNED_3", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "combination_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "拼团产品id0一般产品", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pink_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "拼团id 0没有拼团", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "成本价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "seckill_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "秒杀产品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_id", + "type": "INT UNSIGNED_10", + "chnname": "砍价id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "verify_code", + "type": "VARCHAR_50", + "chnname": "核销码", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_id", + "type": "INT_10", + "chnname": "门店id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "shipping_type", + "type": "BIT_1", + "chnname": "配送方式 1=快递 ,2=门店自提", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_channel", + "type": "TINYINT UNSIGNED_1", + "chnname": "支付渠道(0微信公众号1微信小程序)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_remind", + "type": "TINYINT UNSIGNED_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_system_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_order_cart_info", + "chnname": "订单购物详情表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "oid", + "type": "BIGINT UNSIGNED_20", + "chnname": "订单id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cart_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "购物车id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cart_info", + "type": "TEXT", + "chnname": "购买东西的详细信息", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unique", + "type": "VARCHAR_50", + "chnname": "唯一id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_order_status", + "chnname": "订单操作记录表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "oid", + "type": "BIGINT UNSIGNED_20", + "chnname": "订单id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "change_type", + "type": "VARCHAR_32", + "chnname": "操作类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "change_message", + "type": "VARCHAR_256", + "chnname": "操作备注", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "change_time", + "type": "DATETIME", + "chnname": "操作时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_express", + "chnname": "快递公司表", + "fields": [ + { + "name": "id", + "type": "MEDIUMINT UNSIGNED_8", + "chnname": "快递公司id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "code", + "type": "VARCHAR_50", + "chnname": "快递公司简称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_50", + "chnname": "快递公司全称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否显示", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT_3", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "yx_store_order", + "moduleName": false, + "x": 610, + "y": 550, + "id": "0eda0dc5" + }, + { + "shape": "table", + "title": "yx_store_order_cart_info", + "moduleName": false, + "x": 1370, + "y": 70, + "id": "1412580b" + }, + { + "shape": "table", + "title": "yx_store_cart", + "moduleName": "cart", + "x": 1410, + "y": 330, + "id": "bcf3c95c" + }, + { + "shape": "table", + "title": "yx_store_order_status", + "moduleName": false, + "x": 1380, + "y": 610, + "id": "f5488e91" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "1412580b", + "target": "0eda0dc5", + "id": "6f47eff5", + "controlPoints": [ + { + "x": 1179.8701171875, + "y": 52.38333333333334 + }, + { + "x": 1074.1962890625, + "y": 32.03378378378378 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "1412580b", + "target": "bcf3c95c", + "id": "2c239ffd", + "controlPoints": [ + { + "x": 1179.8701171875, + "y": 72.51666666666668 + }, + { + "x": 1120, + "y": 70 + }, + { + "x": 1120, + "y": 210 + }, + { + "x": 1184.4970703125, + "y": 212.1209677419355 + } + ], + "sourceAnchor": 4, + "targetAnchor": 0 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "f5488e91", + "target": "0eda0dc5", + "id": "70641526", + "controlPoints": [ + { + "x": 1200.5224609375, + "y": 602.4423076923077 + }, + { + "x": 1130, + "y": 450 + }, + { + "x": 1074.1962890625, + "y": 32.03378378378378 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_order_cart_info", + "field": "oid" + }, + "to": { + "entity": "yx_store_order", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_order_cart_info", + "field": "cart_id" + }, + "to": { + "entity": "yx_store_cart", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_order_status", + "field": "oid" + }, + "to": { + "entity": "yx_store_order", + "field": "id" + } + } + ] + }, + { + "name": "product", + "chnname": "商品模块", + "entities": [ + { + "title": "yx_store_product_reply", + "chnname": "评论表", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "评论ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "oid", + "type": "BIGINT_19", + "chnname": "订单ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unique", + "type": "CHAR_32", + "chnname": "唯一id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT_19", + "chnname": "产品id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "reply_type", + "type": "VARCHAR_32", + "chnname": "某种商品类型(普通商品、秒杀商品)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_score", + "type": "BIT_1", + "chnname": "商品分数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "service_score", + "type": "BIT_1", + "chnname": "服务分数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "comment", + "type": "VARCHAR_512", + "chnname": "评论内容", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pics", + "type": "TEXT", + "chnname": "评论图片", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "评论时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "merchant_reply_content", + "type": "VARCHAR_300", + "chnname": "管理员回复内容", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "merchant_reply_time", + "type": "DATETIME", + "chnname": "管理员回复时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "0未删除1已删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_reply", + "type": "BIT_1", + "chnname": "0未回复1已回复", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product_relation", + "chnname": "商品点赞和收藏表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_32", + "chnname": "类型(收藏(collect)、点赞(like))", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "category", + "type": "VARCHAR_32", + "chnname": "某种类型的商品(普通商品、秒杀商品)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product_attr_value", + "chnname": "商品属性值表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sku", + "type": "VARCHAR_128", + "chnname": "商品属性索引值 (attr_value|attr_value[|....])", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stock", + "type": "INT UNSIGNED_10", + "chnname": "属性对应的库存", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sales", + "type": "INT UNSIGNED_10", + "chnname": "销量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "属性金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_128", + "chnname": "图片", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unique", + "type": "VARCHAR_100", + "chnname": "唯一值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "成本价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bar_code", + "type": "VARCHAR_255", + "chnname": "商品条码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ot_price", + "type": "DECIMAL_10_2", + "chnname": "原价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "weight", + "type": "DECIMAL_8_2", + "chnname": "重量", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "volume", + "type": "DECIMAL_8_2", + "chnname": "体积", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "brokerage", + "type": "DECIMAL_8_2", + "chnname": "一级返佣", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "brokerage_two", + "type": "DECIMAL_8_2", + "chnname": "二级返佣", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product_attr_result", + "chnname": "商品属性详情表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "result", + "type": "TEXT", + "chnname": "商品属性参数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "change_time", + "type": "DATETIME", + "chnname": "上次修改时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product_attr", + "chnname": "商品属性表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "attr_name", + "type": "VARCHAR_32", + "chnname": "属性名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "attr_values", + "type": "VARCHAR_256", + "chnname": "属性值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product", + "chnname": "商品表", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "商品id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT UNSIGNED_10", + "chnname": "商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_256", + "chnname": "商品图片", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "slider_image", + "type": "VARCHAR_2000", + "chnname": "轮播图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_name", + "type": "VARCHAR_128", + "chnname": "商品名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_info", + "type": "VARCHAR_256", + "chnname": "商品简介", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "keyword", + "type": "VARCHAR_256", + "chnname": "关键字", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bar_code", + "type": "VARCHAR_15", + "chnname": "产品条码(一维码)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cate_id", + "type": "VARCHAR_64", + "chnname": "分类id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "商品价格", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "vip_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "会员价格", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ot_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "市场价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "postage", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "邮费", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unit_name", + "type": "VARCHAR_32", + "chnname": "单位名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "SMALLINT_5", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sales", + "type": "MEDIUMINT UNSIGNED_8", + "chnname": "销量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stock", + "type": "MEDIUMINT UNSIGNED_8", + "chnname": "库存", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "状态(0:未上架,1:上架)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_hot", + "type": "BIT_1", + "chnname": "是否热卖", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_benefit", + "type": "BIT_1", + "chnname": "是否优惠", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_best", + "type": "BIT_1", + "chnname": "是否精品", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_new", + "type": "BIT_1", + "chnname": "是否新品", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "description", + "type": "TEXT", + "chnname": "产品描述", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_postage", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否包邮", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_use", + "type": "TINYINT UNSIGNED_1", + "chnname": "商户是否代理 0不可代理1可代理", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "give_integral", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "获得积分", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "成本价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_seckill", + "type": "TINYINT UNSIGNED_1", + "chnname": "秒杀状态 0 未开启 1已开启", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_bargain", + "type": "TINYINT UNSIGNED_1", + "chnname": "砍价状态 0未开启 1开启", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_good", + "type": "BIT_1", + "chnname": "是否优品推荐", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ficti", + "type": "MEDIUMINT_7", + "chnname": "虚拟销量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "browse", + "type": "INT_10", + "chnname": "浏览量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "code_path", + "type": "VARCHAR_64", + "chnname": "产品二维码地址(用户小程序海报)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_sub", + "type": "BIT_1", + "chnname": "是否单独分佣", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temp_id", + "type": "INT_10", + "chnname": "运费模板ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spec_type", + "type": "BIT_1", + "chnname": "规格 0单 1多", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product_rule", + "chnname": "商品规则值(规格)表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "rule_name", + "type": "VARCHAR_32", + "chnname": "规格名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "rule_value", + "type": "JSON", + "chnname": "规格值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "yx_store_product", + "moduleName": false, + "x": 390, + "y": 410, + "id": "1f2a5f58" + }, + { + "shape": "table", + "title": "yx_store_product_attr", + "moduleName": false, + "x": 970, + "y": 60, + "id": "8d021563" + }, + { + "shape": "table", + "title": "yx_store_product_attr_value", + "moduleName": false, + "x": 1090, + "y": 360, + "id": "65395cd5" + }, + { + "shape": "table", + "title": "yx_store_product_attr_result", + "moduleName": false, + "x": 1020, + "y": 660, + "id": "f65fda56" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "8d021563", + "target": "1f2a5f58", + "id": "8a5b631d", + "controlPoints": [ + { + "x": 814.5400390625, + "y": 62.52272727272727 + }, + { + "x": 698.1318359375, + "y": 42.0462962962963 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "65395cd5", + "target": "1f2a5f58", + "id": "b3c471e9", + "controlPoints": [ + { + "x": 818.958984375, + "y": 252.17424242424244 + }, + { + "x": 698.1318359375, + "y": 42.0462962962963 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "65395cd5", + "target": "8d021563", + "id": "76f261e2", + "controlPoints": [ + { + "x": 818.958984375, + "y": 272.2348484848485 + }, + { + "x": 750, + "y": 240 + }, + { + "x": 814.5400390625, + "y": 82.70454545454545 + } + ], + "sourceAnchor": 4, + "targetAnchor": 4 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_product_attr", + "field": "product_id" + }, + "to": { + "entity": "yx_store_product", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_product_attr_value", + "field": "product_id" + }, + "to": { + "entity": "yx_store_product", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_product_attr_value", + "field": "sku" + }, + "to": { + "entity": "yx_store_product_attr", + "field": "attr_name" + } + } + ] + }, + { + "name": "shop", + "chnname": "商户模块", + "entities": [ + { + "title": "yx_material_group", + "chnname": "素材分组", + "fields": [ + { + "name": "id", + "type": "VARCHAR_32", + "chnname": "PK", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_id", + "type": "VARCHAR_32", + "chnname": "创建者ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_200", + "chnname": "分组名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_attachment", + "chnname": "附件管理表", + "fields": [ + { + "name": "att_id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_100", + "chnname": "附件名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "att_dir", + "type": "VARCHAR_200", + "chnname": "附件路径", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "satt_dir", + "type": "VARCHAR_200", + "chnname": "压缩图片路径", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "att_size", + "type": "CHAR_30", + "chnname": "附件大小", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "att_type", + "type": "CHAR_30", + "chnname": "附件类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pid", + "type": "INT_10", + "chnname": "分类ID0编辑器,1产品图片,2拼团图片,3砍价图片,4秒杀图片,5文章图片,6组合数据图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image_type", + "type": "TINYINT UNSIGNED_1", + "chnname": "图片上传类型 1本地 2七牛云 3OSS 4COS ", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "module_type", + "type": "TINYINT UNSIGNED_1", + "chnname": "图片上传模块类型 1 后台上传 2 用户生成", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "invite_code", + "type": "VARCHAR_50", + "chnname": "邀请码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_config", + "chnname": "配置表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "配置id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "menu_name", + "type": "VARCHAR_255", + "chnname": "字段名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "value", + "type": "VARCHAR_5000", + "chnname": "默认值", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否隐藏", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_group_data", + "chnname": "组合数据详情表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "组合数据详情ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "group_name", + "type": "VARCHAR_100", + "chnname": "对应的数据名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "value", + "type": "TEXT", + "chnname": "数据组对应的数据值(json数据)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加数据时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT_10", + "chnname": "数据排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "状态(1:开启;2:关闭;)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_store", + "chnname": "门店自提", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_100", + "chnname": "门店名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "introduction", + "type": "VARCHAR_1000", + "chnname": "简介", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "phone", + "type": "CHAR_25", + "chnname": "手机号码", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "address", + "type": "VARCHAR_255", + "chnname": "省市区", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "detailed_address", + "type": "VARCHAR_255", + "chnname": "详细地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_255", + "chnname": "门店logo", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "latitude", + "type": "CHAR_25", + "chnname": "纬度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "longitude", + "type": "CHAR_25", + "chnname": "经度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "valid_time", + "type": "VARCHAR_100", + "chnname": "核销有效日期", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "day_time", + "type": "VARCHAR_100", + "chnname": "每日营业开关时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否显示", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "day_time_end", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "day_time_start", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "valid_time_end", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "valid_time_start", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_store_staff", + "chnname": "门店店员表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "微信用户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "nickname", + "type": "VARCHAR_50", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "avatar", + "type": "VARCHAR_255", + "chnname": "店员头像", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_id", + "type": "INT_10", + "chnname": "门店id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_name", + "type": "VARCHAR_50", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "staff_name", + "type": "VARCHAR_64", + "chnname": "店员名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "phone", + "type": "CHAR_15", + "chnname": "手机号码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "verify_status", + "type": "TINYINT_3", + "chnname": "核销开关", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT_3", + "chnname": "状态", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_user_level", + "chnname": "设置用户等级表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT_10", + "chnname": "商户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "会员名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "money", + "type": "DECIMAL_8_2", + "chnname": "购买金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "valid_date", + "type": "INT_10", + "chnname": "有效时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_forever", + "type": "BIT_1", + "chnname": "是否为永久会员", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_pay", + "type": "BIT_1", + "chnname": "是否购买,1=购买,0=不购买", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否显示 1=显示,0=隐藏", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "grade", + "type": "INT_10", + "chnname": "会员等级", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "discount", + "type": "DECIMAL_8_2", + "chnname": "享受折扣", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_255", + "chnname": "会员卡背景", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "icon", + "type": "VARCHAR_255", + "chnname": "会员图标", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "explain", + "type": "TEXT", + "chnname": "说明", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "是否删除.1=删除,0=未删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_material", + "chnname": "素材库", + "fields": [ + { + "name": "id", + "type": "VARCHAR_32", + "chnname": "PK", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_id", + "type": "VARCHAR_100", + "chnname": "创建者ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "CHAR_2", + "chnname": "类型1、图片;2、视频", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "group_id", + "type": "VARCHAR_32", + "chnname": "分组ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_200", + "chnname": "素材名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_500", + "chnname": "素材链接", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "yx_material", + "moduleName": false, + "x": 442.359375, + "y": 277, + "id": "fe721315" + }, + { + "shape": "table", + "title": "yx_material_group", + "moduleName": false, + "x": 887.359375, + "y": 279, + "id": "f3be72cb" + }, + { + "shape": "table", + "title": "yx_system_store", + "moduleName": false, + "x": 326.359375, + "y": 624, + "id": "396a35b0" + }, + { + "shape": "table", + "title": "yx_system_store_staff", + "moduleName": false, + "x": 870, + "y": 590, + "id": "c3935d4a" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "fe721315", + "target": "f3be72cb", + "id": "e1f3d02d", + "controlPoints": [ + { + "x": 623.05859375, + "y": 283.9775132275132 + }, + { + "x": 743.333984375, + "y": 241.25 + } + ], + "sourceAnchor": 9, + "targetAnchor": 0 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "c3935d4a", + "target": "396a35b0", + "id": "5bfc667b", + "controlPoints": [ + { + "x": 699.7900390625, + "y": 558.5457559681697 + }, + { + "x": 517.833984375, + "y": 456.0914634146342 + } + ], + "sourceAnchor": 8, + "targetAnchor": 1 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "yx_material", + "field": "group_id" + }, + "to": { + "entity": "yx_material_group", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_system_store_staff", + "field": "store_id" + }, + "to": { + "entity": "yx_system_store", + "field": "id" + } + } + ] + }, + { + "name": "template", + "chnname": "运费模板", + "entities": [ + { + "title": "yx_shipping_templates", + "chnname": "运费模板表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "模板ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "模板名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "BIT_1", + "chnname": "计费方式", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "region_info", + "type": "TEXT", + "chnname": "地域以及费用", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "appoint", + "type": "BIT_1", + "chnname": "指定包邮开关", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "appoint_info", + "type": "TEXT", + "chnname": "指定包邮内容", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_shipping_templates_free", + "chnname": "", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "编号", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "province_id", + "type": "INT_10", + "chnname": "省ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temp_id", + "type": "INT_10", + "chnname": "模板ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "city_id", + "type": "INT_10", + "chnname": "城市ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "number", + "type": "DECIMAL_10_2", + "chnname": "包邮件数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL_10_2", + "chnname": "包邮金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "BIT_1", + "chnname": "计费方式", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uniqid", + "type": "VARCHAR_32", + "chnname": "分组唯一值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_city", + "chnname": "城市表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "city_id", + "type": "INT_10", + "chnname": "城市id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "level", + "type": "INT_10", + "chnname": "省市级别", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "parent_id", + "type": "INT_10", + "chnname": "父级id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "area_code", + "type": "VARCHAR_30", + "chnname": "区号", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_100", + "chnname": "名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "merger_name", + "type": "VARCHAR_255", + "chnname": "合并名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "lng", + "type": "VARCHAR_50", + "chnname": "经度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "lat", + "type": "VARCHAR_50", + "chnname": "纬度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否展示", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_shipping_templates_region", + "chnname": "", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "编号", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "province_id", + "type": "INT_10", + "chnname": "省ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temp_id", + "type": "INT_10", + "chnname": "模板ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "city_id", + "type": "INT_10", + "chnname": "城市ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "first", + "type": "DECIMAL_10_2", + "chnname": "首件", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "first_price", + "type": "DECIMAL_10_2", + "chnname": "首件运费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "continues", + "type": "DECIMAL_10_2", + "chnname": "续件", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "continue_price", + "type": "DECIMAL_10_2", + "chnname": "续件运费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "BIT_1", + "chnname": "计费方式", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uniqid", + "type": "VARCHAR_50", + "chnname": "分组唯一值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "yx_shipping_templates", + "moduleName": false, + "x": 680, + "y": 380, + "id": "c8177992" + }, + { + "shape": "table", + "title": "yx_system_city", + "moduleName": false, + "x": 290, + "y": 260, + "id": "f3f8204a" + }, + { + "shape": "table", + "title": "yx_shipping_templates_free", + "moduleName": false, + "x": 1080, + "y": 190, + "id": "ac873dd5" + }, + { + "shape": "table", + "title": "yx_shipping_templates_region", + "moduleName": false, + "x": 1080, + "y": 540, + "id": "7ca63a1e" + } + ], + "edges": [] + }, + "associations": [] + }, + { + "name": "user", + "chnname": "用户模块", + "entities": [ + { + "title": "yx_user_bill", + "chnname": "用户账单表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户账单id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户uid", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "link_id", + "type": "VARCHAR_32", + "chnname": "关联id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pm", + "type": "TINYINT UNSIGNED_1", + "chnname": "0 = 支出 1 = 获得", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_64", + "chnname": "账单标题", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "category", + "type": "VARCHAR_64", + "chnname": "明细种类", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_64", + "chnname": "明细类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "number", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "明细数字", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "balance", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "剩余", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mark", + "type": "VARCHAR_512", + "chnname": "备注", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "0 = 带确定 1 = 有效 -1 = 无效", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_level", + "chnname": "用户等级记录表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "用户uid", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "level_id", + "type": "INT_10", + "chnname": "等级vip", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "grade", + "type": "INT_10", + "chnname": "会员等级", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "valid_time", + "type": "INT_10", + "chnname": "过期时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_forever", + "type": "BIT_1", + "chnname": "是否永久", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT_10", + "chnname": "商户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "0:禁止,1:正常", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mark", + "type": "VARCHAR_255", + "chnname": "备注", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remind", + "type": "BIT_1", + "chnname": "是否已通知", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "是否删除,0=未删除,1=删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "discount", + "type": "INT_10", + "chnname": "享受折扣", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_task_finish", + "chnname": "用户任务完成记录表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "task_id", + "type": "INT_10", + "chnname": "任务id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "用户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "是否有效", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_sign", + "chnname": "签到记录表", + "fields": [ + { + "name": "int", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "用户uid", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_255", + "chnname": "签到说明", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "number", + "type": "INT_10", + "chnname": "获得积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "balance", + "type": "INT_10", + "chnname": "剩余积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_recharge", + "chnname": "用户充值表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "充值用户UID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "nickname", + "type": "VARCHAR_50", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "order_id", + "type": "VARCHAR_32", + "chnname": "订单号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL_8_2", + "chnname": "充值金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "give_price", + "type": "DECIMAL_8_2", + "chnname": "购买赠送金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "recharge_type", + "type": "VARCHAR_32", + "chnname": "充值类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "paid", + "type": "BIT_1", + "chnname": "是否充值", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_time", + "type": "DATETIME", + "chnname": "充值支付时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "充值时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_price", + "type": "DECIMAL_10_2", + "chnname": "退款金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT_3", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_address", + "chnname": "用户地址表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户地址id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_32", + "chnname": "收货人姓名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "phone", + "type": "VARCHAR_16", + "chnname": "收货人电话", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "province", + "type": "VARCHAR_64", + "chnname": "收货人所在省", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "city", + "type": "VARCHAR_64", + "chnname": "收货人所在市", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "city_id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "district", + "type": "VARCHAR_64", + "chnname": "收货人所在区", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "detail", + "type": "VARCHAR_256", + "chnname": "收货人详细地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "post_code", + "type": "VARCHAR_20", + "chnname": "邮编", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "longitude", + "type": "VARCHAR_16", + "chnname": "经度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "latitude", + "type": "VARCHAR_16", + "chnname": "纬度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_default", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否默认", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_group", + "chnname": "用户分组表", + "fields": [ + { + "name": "id", + "type": "SMALLINT UNSIGNED_5", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "group_name", + "type": "VARCHAR_64", + "chnname": "用户分组名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_extract", + "chnname": "用户提现表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_64", + "chnname": "名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "extract_type", + "type": "VARCHAR_32", + "chnname": "bank = 银行卡 alipay = 支付宝wx=微信", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bank_code", + "type": "VARCHAR_32", + "chnname": "银行卡", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bank_address", + "type": "VARCHAR_256", + "chnname": "开户地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "alipay_code", + "type": "VARCHAR_64", + "chnname": "支付宝账号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "extract_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "提现金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mark", + "type": "VARCHAR_512", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "balance", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "fail_msg", + "type": "VARCHAR_128", + "chnname": "无效原因", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "fail_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT_3", + "chnname": "-1 未通过 0 审核中 1 已提现", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "wechat", + "type": "VARCHAR_15", + "chnname": "微信号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_enter", + "chnname": "商户申请表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "商户申请ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "INT UNSIGNED_10", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "province", + "type": "VARCHAR_32", + "chnname": "商户所在省", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "city", + "type": "VARCHAR_32", + "chnname": "商户所在市", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "district", + "type": "VARCHAR_32", + "chnname": "商户所在区", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "address", + "type": "VARCHAR_256", + "chnname": "商户详细地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "merchant_name", + "type": "VARCHAR_256", + "chnname": "商户名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "link_user", + "type": "VARCHAR_32", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "link_tel", + "type": "VARCHAR_16", + "chnname": "商户电话", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "charter", + "type": "VARCHAR_512", + "chnname": "商户证书", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "add_time", + "type": "INT UNSIGNED_10", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "apply_time", + "type": "INT UNSIGNED_10", + "chnname": "审核时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "success_time", + "type": "INT_10", + "chnname": "通过时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "fail_message", + "type": "VARCHAR_256", + "chnname": "未通过原因", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "fail_time", + "type": "INT UNSIGNED_10", + "chnname": "未通过时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "-1 审核未通过 0未审核 1审核通过", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_lock", + "type": "TINYINT UNSIGNED_1", + "chnname": "0 = 开启 1= 关闭", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_user_task", + "chnname": "等级任务设置", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "任务名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_255", + "chnname": "配置原名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "task_type", + "type": "VARCHAR_50", + "chnname": "任务类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "number", + "type": "INT_10", + "chnname": "限定数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "level_id", + "type": "INT_10", + "chnname": "等级id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否显示", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_must", + "type": "BIT_1", + "chnname": "是否务必达成任务,1务必达成,0=满足其一", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "illustrate", + "type": "VARCHAR_255", + "chnname": "任务说明", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "新增时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user", + "chnname": "用户表", + "fields": [ + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "username", + "type": "VARCHAR_255", + "chnname": "用户账户(跟accout一样)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "password", + "type": "VARCHAR_255", + "chnname": "用户密码(跟pwd)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_25", + "chnname": "真实姓名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "birthday", + "type": "INT_10", + "chnname": "生日", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "card_id", + "type": "VARCHAR_20", + "chnname": "身份证号码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mark", + "type": "VARCHAR_255", + "chnname": "用户备注", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "partner_id", + "type": "INT_10", + "chnname": "合伙人id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "group_id", + "type": "INT_10", + "chnname": "用户分组id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "nickname", + "type": "VARCHAR_100", + "chnname": "用户昵称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "avatar", + "type": "VARCHAR_256", + "chnname": "用户头像", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "phone", + "type": "CHAR_15", + "chnname": "手机号码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "add_ip", + "type": "VARCHAR_16", + "chnname": "添加ip", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "最后一次登录时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "last_ip", + "type": "VARCHAR_16", + "chnname": "最后一次登录ip", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "now_money", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "用户余额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "brokerage_price", + "type": "DECIMAL_8_2", + "chnname": "佣金金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "integral", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "用户剩余积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sign_num", + "type": "INT_10", + "chnname": "连续签到天数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "1为正常,0为禁止", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "level", + "type": "TINYINT UNSIGNED_3", + "chnname": "等级", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spread_uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "推广元id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spread_time", + "type": "DATETIME", + "chnname": "推广员关联时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "user_type", + "type": "VARCHAR_32", + "chnname": "用户类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_promoter", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否为推广员", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_count", + "type": "INT UNSIGNED_10", + "chnname": "用户购买次数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spread_count", + "type": "INT_10", + "chnname": "下级人数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "addres", + "type": "VARCHAR_255", + "chnname": "详细地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "adminid", + "type": "INT UNSIGNED_10", + "chnname": "管理员编号 ", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "login_type", + "type": "VARCHAR_36", + "chnname": "用户登陆类型,h5,wechat,routine", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "wx_profile", + "type": "JSON", + "chnname": "微信用户json信息", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + } + }, + { + "name": "wechat", + "chnname": "微信模块", + "entities": [ + { + "title": "yx_wechat_reply", + "chnname": "微信关键字回复表", + "fields": [ + { + "name": "id", + "type": "MEDIUMINT UNSIGNED_8", + "chnname": "微信关键字回复id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "key", + "type": "VARCHAR_64", + "chnname": "关键字", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_32", + "chnname": "回复类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "data", + "type": "TEXT", + "chnname": "回复数据", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "0=不可用 1 =可用", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "hide", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否隐藏", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_wechat_menu", + "chnname": "微信缓存表", + "fields": [ + { + "name": "key", + "type": "VARCHAR_32", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "result", + "type": "TEXT", + "chnname": "缓存数据", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "add_time", + "type": "INT_10", + "chnname": "缓存时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_wechat_media", + "chnname": "微信回复表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "微信视频音频id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_16", + "chnname": "回复类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "path", + "type": "VARCHAR_128", + "chnname": "文件路径", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "media_id", + "type": "VARCHAR_64", + "chnname": "微信服务器返回的id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_256", + "chnname": "地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temporary", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否永久或者临时 0永久1临时", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "add_time", + "type": "INT UNSIGNED_10", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_article", + "chnname": "文章管理表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "文章管理ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "cid", + "type": "VARCHAR_255", + "chnname": "分类id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_255", + "chnname": "文章标题", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "author", + "type": "VARCHAR_255", + "chnname": "文章作者", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image_input", + "type": "VARCHAR_255", + "chnname": "文章图片", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "synopsis", + "type": "VARCHAR_255", + "chnname": "文章简介", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "content", + "type": "TEXT", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "share_title", + "type": "VARCHAR_255", + "chnname": "文章分享标题", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "share_synopsis", + "type": "VARCHAR_255", + "chnname": "文章分享简介", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "visit", + "type": "VARCHAR_255", + "chnname": "浏览次数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_255", + "chnname": "原文链接", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "状态", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "hide", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否隐藏", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "admin_id", + "type": "INT UNSIGNED_10", + "chnname": "管理员id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT UNSIGNED_10", + "chnname": "商户id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "INT_10", + "chnname": "产品关联id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_hot", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否热门(小程序)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_banner", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否轮播图(小程序)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ], + "indexs": [], + "headers": [ + { + "fieldName": "chnname", + "relationNoShow": false + }, + { + "fieldName": "name", + "relationNoShow": false + }, + { + "fieldName": "type", + "relationNoShow": false + }, + { + "fieldName": "dataType", + "relationNoShow": true + }, + { + "fieldName": "remark", + "relationNoShow": true + }, + { + "fieldName": "pk", + "relationNoShow": false + }, + { + "fieldName": "notNull", + "relationNoShow": true + }, + { + "fieldName": "autoIncrement", + "relationNoShow": true + }, + { + "fieldName": "defaultValue", + "relationNoShow": true + }, + { + "fieldName": "relationNoShow", + "relationNoShow": true + }, + { + "fieldName": "uiHint", + "relationNoShow": true + } + ] + }, + { + "title": "yx_wechat_template", + "chnname": "微信模板", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "模板id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "tempkey", + "type": "CHAR_50", + "chnname": "模板编号", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "CHAR_100", + "chnname": "模板名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "content", + "type": "VARCHAR_1000", + "chnname": "回复内容", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "tempid", + "type": "CHAR_100", + "chnname": "模板ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT_3", + "chnname": "状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + }, + "associations": [] + } + ], + "version": "V1.0", + "message": "V1", + "date": "2020/7/21 12:14:27" +} diff --git a/sql/3.0升级3.1sql.sql b/sql/3.0升级3.1sql.sql new file mode 100644 index 0000000..bafcc8e --- /dev/null +++ b/sql/3.0升级3.1sql.sql @@ -0,0 +1,136 @@ + + +-- ---------------------------- +-- 字段修改 +-- ---------------------------- +ALTER TABLE `yx_store_seckill` + CHANGE COLUMN `price` `price` DECIMAL(10,2) UNSIGNED COMMENT '价格' AFTER `info`, + CHANGE COLUMN `cost` `cost` DECIMAL(8,2) UNSIGNED COMMENT '成本' AFTER `price`, + CHANGE COLUMN `ot_price` `ot_price` DECIMAL(10,2) UNSIGNED COMMENT '原价' AFTER `cost`; +ALTER TABLE yx_store_seckill ADD COLUMN spec_type tinyint(1) COMMENT '规格 0单 1多' AFTER time_id; +ALTER TABLE yx_store_seckill ADD COLUMN temp_id INT(10) COMMENT '运费模板id' AFTER spec_type; +ALTER TABLE yx_store_pink ADD COLUMN unique_id VARCHAR(128) COMMENT '库存唯一值' AFTER is_del; +ALTER TABLE yx_store_seckill MODIFY COLUMN give_integral DECIMAL(10,2) UNSIGNED COMMENT '返多少积分'; +ALTER TABLE `yx_store_combination` + CHANGE COLUMN `price` `price` DECIMAL(10,2) UNSIGNED NULL DEFAULT '0.00' COMMENT '价格' AFTER `info`, + CHANGE COLUMN `stock` `stock` INT(10) UNSIGNED NULL DEFAULT '0' COMMENT '库存' AFTER `sales`, + CHANGE COLUMN `unit_name` `unit_name` VARCHAR(32) NULL DEFAULT '' COMMENT '单位名' AFTER `browse`; +ALTER TABLE yx_store_combination ADD COLUMN spec_type tinyint(1) COMMENT '规格 0单 1多' AFTER unit_name; +ALTER TABLE yx_store_combination ADD COLUMN temp_id INT(10) COMMENT '运费模板ID' AFTER spec_type; +ALTER TABLE yx_store_combination DROP is_postage; +ALTER TABLE yx_store_combination DROP postage; +ALTER TABLE yx_store_product_attr_value ADD COLUMN pink_price DECIMAL(8,2) NOT NULL COMMENT '拼团价' AFTER brokerage_two; +ALTER TABLE yx_store_product_attr_value ADD COLUMN pink_stock INT(10) NOT NULL COMMENT '拼团库存' AFTER pink_price; +ALTER TABLE yx_store_product_attr_value ADD COLUMN seckill_price DECIMAL(10,2) NOT NULL COMMENT '秒杀价' AFTER pink_stock; +ALTER TABLE yx_store_product_attr_value ADD COLUMN seckill_stock INT(10) NOT NULL COMMENT '秒杀库存' AFTER seckill_price; +ALTER TABLE yx_wechat_template ADD COLUMN type VARCHAR(30) COMMENT '类型:template:模板消息 subscribe:订阅消息' AFTER is_del; + +-- ---------------------------- +-- 足迹菜单添加 +-- ---------------------------- +INSERT INTO `yx_system_group_data` VALUES (225, 'yshop_my_menus', '{\"imageArr\":[\"https://consoleapi.xinxintuan.co/file/pic/20200911093912577832.png\"],\"uniapp_url\":\"/pages/shop/GoodsFoot/index\",\"name\":\"我的足迹\",\"id\":225,\"pic\":\"https://consoleapi.xinxintuan.co/file/pic/20200911093912577832.png\",\"sort\":10,\"url\":\"\",\"wxapp_url\":\"\",\"status\":1}', '2020-09-11 09:39:21', '2020-09-11 09:40:49', 10, 1, 0); + +-- ---------------------------- +-- 菜单添加 +-- ---------------------------- +INSERT INTO `menu` VALUES (237, b'0', '规格新增、修改', NULL, 233, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-28 16:35:00', 'yxStoreProductRule:add', 2, '2020-07-16 20:09:03', 0); +INSERT INTO `menu` VALUES (238, b'0', '规格删除', NULL, 233, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-28 16:35:00', 'yxStoreProductRule:del', 2, '2020-07-16 20:08:57', 0); +INSERT INTO `menu` VALUES (240, b'0', '新增、修改模板', NULL, 234, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-29 17:16:06', 'yxShippingTemplates:add', 2, '2020-07-16 20:09:11', 0); +INSERT INTO `menu` VALUES (241, b'0', '删除模板', NULL, 234, 2, NULL, NULL, b'0', b'0', NULL, '2020-06-29 17:16:06', 'yxShippingTemplates:del', 2, '2020-07-16 20:09:16', 0); +INSERT INTO `menu` VALUES (242, b'0', '直播管理', 'wechat/live/index', 48, 999, 'weixin', 'wxlive', b'0', b'0', 'Wxlive', '2020-08-10 17:20:54', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (243, b'0', '直播商品管理', 'wechat/goods/index', 48, 999, 'weixin', 'wxlivegoods', b'0', b'0', 'WxliveGoods', '2020-08-10 17:20:54', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (244, b'0', '拼团商品添加', 'activity/combination/form', 63, 999, NULL, 'combinationAdd', b'0', b'1', 'CombinationAdd', '2020-08-13 21:28:45', 'YXSTORECOMBINATION_EDIT', 1, '2020-08-13 21:31:26', 0); +INSERT INTO `menu` VALUES (245, b'0', '拼团商品修改', 'activity/combination/form', 63, 3, 'anq', 'combinationEdit/:id', b'0', b'1', 'CombinationEdit', '2019-12-24 13:02:23', 'YXSTORECOMBINATION_EDIT', 1, '2020-07-10 16:45:33', 0); +INSERT INTO `menu` VALUES (246, b'0', '秒杀商品添加', 'activity/seckill/form', 63, 999, NULL, 'secKillAdd', b'0', b'1', 'SecKillAdd', '2020-08-13 21:28:45', 'YXSTORESECKILL_EDIT', 1, '2020-08-13 21:31:26', 0); +INSERT INTO `menu` VALUES (247, b'0', '秒杀商品修改', 'activity/seckill/form', 63, 3, 'anq', 'secKillEdit/:id', b'0', b'1', 'SecKillEdit', '2019-12-24 13:02:23', 'YXSTORESECKILL_EDIT', 1, '2020-07-10 16:45:33', 0); +INSERT INTO `menu` VALUES (248, b'0', '多级菜单', NULL, 0, 999, 'menu', 'nested', b'0', b'0', '-', '2020-08-19 11:31:10', NULL, 0, NULL, 0); +INSERT INTO `menu` VALUES (249, b'0', '二级菜单1', 'nested/menu1/index', 248, 999, 'menu', 'menu1', b'0', b'0', '-', '2020-08-19 11:34:34', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (250, b'0', '三级菜单1', 'nested/menu1/menu1-1', 249, 999, 'menu', 'menu1-1', b'0', b'0', '-', '2020-08-19 11:35:52', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (251, b'0', '三级菜单2', 'nested/menu1/menu1-2', 249, 999, 'menu', 'menu1-2', b'0', b'0', '-', '2020-08-19 11:37:48', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (252, b'0', '二级菜单2', 'nested/menu2/index', 248, 999, 'menu', 'menu2', b'0', b'0', '-', '2020-08-19 11:38:35', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (253, b'0', '浏览记录', 'monitor/log/mlog', 40, 15, 'log', 'viewlog', b'0', b'0', 'Viewlog', '2020-07-31 09:47:11', 'log:list', 1, '2020-07-31 09:49:39', 0); +INSERT INTO `menu` VALUES (256, b'0', '商品收藏', 'shop/collect/index', 40, 16, 'menu', 'productRelation', b'0', b'0', 'ProductRelation', '2020-09-03 14:32:49', 'yxStoreProductRelation:list', 1, '2020-09-03 16:21:08', 0); +INSERT INTO `menu` VALUES (257, b'0', '用户足迹', 'shop/foot/index', 40, 17, 'list', 'footRelation', b'0', b'0', 'FootRelation', '2020-09-03 16:20:21', 'yxStoreProductRelation:list', 1, '2020-09-03 16:21:16', 0); +INSERT INTO `menu` VALUES (258, b'0', '订单详情', 'shop/order/detail', 53, 999, 'sqlMonitor', 'detail/:id', b'0', b'1', 'Detail', '2020-09-10 07:29:34', NULL, 1, '2020-09-10 08:52:09', 0); +-- ---------------------------- +-- 菜单添加权限 +-- ---------------------------- +INSERT INTO `roles_menus` VALUES (237, 1); +INSERT INTO `roles_menus` VALUES (238, 1); +INSERT INTO `roles_menus` VALUES (240, 1); +INSERT INTO `roles_menus` VALUES (241, 1); +INSERT INTO `roles_menus` VALUES (242, 1); +INSERT INTO `roles_menus` VALUES (243, 1); +INSERT INTO `roles_menus` VALUES (244, 1); +INSERT INTO `roles_menus` VALUES (245, 1); +INSERT INTO `roles_menus` VALUES (246, 1); +INSERT INTO `roles_menus` VALUES (247, 1); +INSERT INTO `roles_menus` VALUES (248, 1); +INSERT INTO `roles_menus` VALUES (249, 1); +INSERT INTO `roles_menus` VALUES (250, 1); +INSERT INTO `roles_menus` VALUES (251, 1); +INSERT INTO `roles_menus` VALUES (252, 1); +INSERT INTO `roles_menus` VALUES (253, 1); +INSERT INTO `roles_menus` VALUES (256, 1); +INSERT INTO `roles_menus` VALUES (257, 1); +INSERT INTO `roles_menus` VALUES (258, 1); + + + + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for yx_wechat_live +-- ---------------------------- +DROP TABLE IF EXISTS `yx_wechat_live`; +CREATE TABLE `yx_wechat_live` ( + `room_id` bigint(11) NOT NULL COMMENT '直播间id', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '直播间标题', + `cover_imge` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '背景图', + `share_imge` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分享图片', + `live_status` int(9) NULL DEFAULT NULL COMMENT '直播间状态', + `start_time` bigint(11) NULL DEFAULT NULL COMMENT '开始时间', + `end_time` bigint(11) NULL DEFAULT NULL COMMENT '预计结束时间', + `anchor_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主播昵称', + `anchor_wechat` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主播微信号', + `anchor_imge` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主播头像', + `type` tinyint(1) NULL DEFAULT NULL COMMENT '直播间类型 1:推流 0:手机直播', + `screen_type` tinyint(1) NULL DEFAULT NULL COMMENT '横屏、竖屏 【1:横屏,0:竖屏】', + `close_like` tinyint(1) NULL DEFAULT NULL COMMENT '是否关闭点赞 【0:开启,1:关闭】', + `close_comment` tinyint(1) NULL DEFAULT NULL COMMENT '是否关闭评论 【0:开启,1:关闭】', + `close_goods` tinyint(1) NULL DEFAULT NULL COMMENT '是否关闭货架 【0:开启,1:关闭】', + `product_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品id 多个,分割', + `close_replay` tinyint(1) NULL DEFAULT NULL COMMENT '是否关闭回放【0:开启,1:关闭】', + `close_share` tinyint(1) NULL DEFAULT NULL COMMENT '是否关闭分享【0:开启,1:关闭】', + `close_kf` tinyint(1) NULL DEFAULT NULL COMMENT '是否关闭客服【0:开启,1:关闭】', + PRIMARY KEY (`room_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信直播表' ROW_FORMAT = Dynamic; + + +-- ---------------------------- +-- Table structure for yx_wechat_live_goods +-- ---------------------------- +DROP TABLE IF EXISTS `yx_wechat_live_goods`; +CREATE TABLE `yx_wechat_live_goods` ( + `goods_id` bigint(9) NOT NULL COMMENT '直播商品id', + `product_id` bigint(9) NULL DEFAULT NULL COMMENT '关联商品id', + `cover_imge_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品图片', + `url` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品小程序路径', + `price_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '价格类型 1:一口价(只需要传入price,price2不传) 2:价格区间(price字段为左边界,price2字段为右边界,price和price2必传) 3:显示折扣价(price字段为原价,price2字段为现价, price和price2必传)', + `price` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `price2` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品名称', + `third_party_tag` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '1, 2:表示是为api添加商品,否则是直播控制台添加的商品', + `audit_id` bigint(20) NULL DEFAULT NULL COMMENT '审核单id', + `audit_status` int(1) UNSIGNED ZEROFILL NULL DEFAULT NULL COMMENT '审核状态 0:未审核,1:审核中,2:审核通过,3审核失败', + PRIMARY KEY (`goods_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信直播商品表' ROW_FORMAT = Dynamic; + +SET FOREIGN_KEY_CHECKS = 1; + + + + +drop index uid on yx_store_product_relation; \ No newline at end of file diff --git a/sql/3.1升级3.2sql.sql b/sql/3.1升级3.2sql.sql new file mode 100644 index 0000000..fe4f698 --- /dev/null +++ b/sql/3.1升级3.2sql.sql @@ -0,0 +1,52 @@ + + +-- ---------------------------- +-- 字段修改 +-- ---------------------------- +ALTER TABLE yx_store_product ADD COLUMN is_integral tinyint(1) ZEROFILL NULL DEFAULT 0 COMMENT '是开启积分兑换' AFTER is_del; + +ALTER TABLE yx_store_product ADD COLUMN integral int(11) NULL DEFAULT 0 COMMENT '需要多少积分兑换 只在开启积分兑换时生效' AFTER is_integral; + +ALTER TABLE yx_store_product_attr_value ADD COLUMN integral INT(10) DEFAULT 0 COMMENT '需要多少积分兑换' AFTER seckill_price; + +ALTER TABLE yx_store_order ADD COLUMN `pay_integral` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '实际支付积分'; + +ALTER TABLE yx_user modify column add_ip varchar(100) NULL DEFAULT '' COMMENT '添加ip'; + +ALTER TABLE yx_user modify column last_ip varchar(100) NULL DEFAULT '' COMMENT '最后一次登录ip'; + +ALTER TABLE yx_store_visit modify column id bigint(20) NOT NULL; + +ALTER TABLE yx_store_visit modify column product_id bigint(20) NULL DEFAULT NULL COMMENT '产品ID'; + +ALTER TABLE yx_store_visit modify column uid bigint(20) NULL DEFAULT NULL COMMENT '用户ID'; + +INSERT INTO `menu` VALUES (264, b'0', '终端装修', NULL, 0, 0, 'theme', 'theme', b'0', b'0', '--', '2021-02-25 19:33:17', '', 1, '2021-02-25 19:33:32', 0); +INSERT INTO `menu` VALUES (265, b'1', '商城装修', NULL, 264, 999, 'theme', 'https://demo2.yixiang.co/container', b'0', b'0', '-', '2021-02-25 19:35:13', NULL, 1, NULL, 0); +INSERT INTO `roles_menus` VALUES (264, 1); +INSERT INTO `roles_menus` VALUES (265, 1); + +-- ---------------------------- +-- Table structure for yx_store_canvas +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_canvas`; +CREATE TABLE `yx_store_canvas` ( + `canvas_id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT '画布id', + `terminal` tinyint(1) NOT NULL COMMENT '终端 1-小程序 2-H5 3-APP 4-PC', + `json` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '画布json数据', + `type` tinyint(1) NULL DEFAULT 1 COMMENT '类型 1-系统画布 2-自定义页面 3-商家店铺装修', + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '名称', + `shop_id` bigint(20) NULL DEFAULT 0 COMMENT '店铺id,当type=3的时候,值为具体的店铺id,其它情况为0', + `create_time` timestamp(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` timestamp(0) NULL DEFAULT NULL COMMENT '修改时间', + `is_del` tinyint(1) NULL DEFAULT NULL COMMENT '删除标识', + PRIMARY KEY (`canvas_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '画布信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of yx_store_canvas +-- ---------------------------- +INSERT INTO `yx_store_canvas` VALUES (11, 3, '[{\"title\":\"店铺头部\",\"type\":\"header\",\"componentContent\":{\"title\":\"Yshop\"},\"index\":0},{\"title\":\"搜索商品\",\"type\":\"search\",\"componentContent\":{},\"index\":1},{\"title\":\"轮播图\",\"type\":\"banner\",\"componentContent\":{\"bannerData\":[{\"pic\":\"./static/img/banner.f96c3f5.png\",\"name\":\"0\",\"sort\":0,\"url\":\"/\",\"status\":1}]},\"index\":2},{\"title\":\"滚动新闻\",\"type\":\"noticeBar\",\"componentContent\":{\"roll\":[{\"uniapp_url\":\"/pages/shop/news/NewsList/index\",\"url\":\"/news_list\",\"info\":\"yshop基于springboot2+Mybatisplus商城系统,3.0版本重构了代码,新增了运费模板、sku单独管理、商品券等\",\"wxapp_url\":\"/pages/shop/news/NewsList/main\"}]},\"index\":3},{\"title\":\"菜单\",\"type\":\"menu\",\"componentContent\":{\"menus\":[{\"imageArr\":[\"https://image.dayouqiantu.cn/5e85bfa61251d.png\"],\"uniapp_url\":\"/pages/shop/GoodsList/index\",\"name\":\"全部商品\",\"id\":180,\"pic\":\"https://image.dayouqiantu.cn/all.png\",\"sort\":9,\"url\":\"/goods_list\",\"wxapp_url\":\"/pages/shop/GoodsClass/main\",\"status\":1},{\"imageArr\":[\"https://image.dayouqiantu.cn/news.png\"],\"uniapp_url\":\"/pages/shop/news/NewsList/index\",\"name\":\"图文资讯\",\"id\":196,\"pic\":\"https://image.dayouqiantu.cn/xw.png\",\"sort\":8,\"url\":\"/news_list\",\"wxapp_url\":\"/pages/shop/news/NewsList/main\",\"status\":1},{\"imageArr\":[\"https://image.dayouqiantu.cn/5e4e939507b5e.png\"],\"uniapp_url\":\"/pages/shop/GoodsCollection/index\",\"name\":\"我的收藏\",\"id\":197,\"pic\":\"https://image.dayouqiantu.cn/colle.png\",\"sort\":7,\"url\":\"/collection\",\"wxapp_url\":\"/pages/shop/GoodsCollection/main\",\"status\":1},{\"imageArr\":[\"https://image.dayouqiantu.cn/coupon.png\"],\"uniapp_url\":\"\",\"name\":\"优惠券\",\"id\":199,\"pic\":\"https://image.dayouqiantu.cn/cou.png\",\"sort\":6,\"url\":\"/user/get_coupon\",\"wxapp_url\":\"/pages/user/coupon/GetCoupon/main\",\"status\":1},{\"imageArr\":[\"https://image.dayouqiantu.cn/pink.png\"],\"uniapp_url\":\"/pages/activity/GoodsGroup/index\",\"name\":\"拼团专区\",\"id\":200,\"pic\":\"https://image.dayouqiantu.cn/62ac09d2914d36c65b9b59d2147d809a.png\",\"sort\":5,\"url\":\"/activity/group\",\"wxapp_url\":\"/pages/activity/GoodsGroup/main\",\"status\":1},{\"imageArr\":[\"https://image.dayouqiantu.cn/sign.png\"],\"uniapp_url\":\"/pages/user/signIn/Sign/index\",\"name\":\"积分签到\",\"id\":209,\"pic\":\"https://image.dayouqiantu.cn/29ea4acebbf99e7eaf6f85af2b6d79ae.png\",\"sort\":4,\"url\":\"/user/sign\",\"wxapp_url\":\"/pages/user/signIn/Sign/main\",\"status\":1},{\"imageArr\":[\"https://image.dayouqiantu.cn/sekill.png\"],\"uniapp_url\":\"/pages/activity/GoodsSeckill/index\",\"name\":\"秒杀专区\",\"id\":216,\"pic\":\"https://image.dayouqiantu.cn/b0344c148141b50d68db9722708ea49e.png\",\"sort\":3,\"url\":\"/activity/goods_seckill\",\"wxapp_url\":\"/pages/activity/GoodsSeckill/main\",\"status\":1},{\"imageArr\":[\"https://image.dayouqiantu.cn/bargin.png\"],\"uniapp_url\":\"/pages/activity/GoodsBargain/index\",\"name\":\"砍价专区\",\"id\":217,\"pic\":\"https://image.dayouqiantu.cn/bar.png\",\"sort\":2,\"url\":\"/activity/bargain\",\"wxapp_url\":\"/pages/activity/GoodsBargain/main\",\"status\":1}]},\"index\":4},{\"title\":\"广告\",\"type\":\"adv\",\"componentContent\":{\"detail\":{\"list\":[{\"image\":\"https://wx.yixiang.co/static/images/index001.png\",\"url\":\"\",\"uniapp_url\":\"/pages/user/coupon/GetCoupon/index\",\"wxapp_url\":\"/pages/user/coupon/GetCoupon/index\",\"path_type\":1},{\"image\":\"https://wx.yixiang.co/static/images/index002.png\",\"url\":\"\",\"uniapp_url\":\"/pages/shop/GoodsList/index\",\"wxapp_url\":\"/pages/shop/GoodsList/index\",\"path_type\":1},{\"image\":\"https://wx.yixiang.co/static/images/index003.png\",\"url\":\"\",\"uniapp_url\":\"/pages/shop/GoodsList/index?title=\\\"积分商城\\\"&isIntegral=true\",\"wxapp_url\":\"/pages/shop/GoodsList/index?title=\\\"积分商城\\\"&isIntegral=true\",\"path_type\":1}],\"name\":\"\",\"style\":3}},\"index\":5},{\"title\":\"热门榜单\",\"type\":\"hotCommodity\",\"componentContent\":{},\"index\":6},{\"title\":\"为您推荐\",\"type\":\"promotionGood\",\"componentContent\":{},\"index\":7}]', 1, '1', 0, '2021-02-25 19:36:06', '2021-02-25 22:39:55', 0); + + + diff --git a/sql/sql执行顺序说明.txt b/sql/sql执行顺序说明.txt new file mode 100644 index 0000000..f0977c4 --- /dev/null +++ b/sql/sql执行顺序说明.txt @@ -0,0 +1,4 @@ +1、3.0平滑升级3.2 直接导入3.0升级3.1sql.sql再执行3.1升级3.2sql.sql(特别说明:平滑升级只限于没有改过添加过菜单之类的,如果你已经添加了菜单,请自行解决一下) +2、如果你已经是3.1版本了直接执行3.1升级3.2sql.sql即可 +3、如果是全新下载的直接导入yshop3.2.sql +4、注意:操作数据库属于危险行为,请勿用于生产库,请事先做好备份,再执行sql操作!!! diff --git a/sql/yshop.pdman.json b/sql/yshop.pdman.json new file mode 100644 index 0000000..783d2b7 --- /dev/null +++ b/sql/yshop.pdman.json @@ -0,0 +1,12704 @@ +{ + "modules": [ + { + "name": "DB_REVERSE_MYSQL", + "chnname": "逆向解析_MYSQL", + "entities": [ + { + "title": "monitor_server", + "chnname": "服务监控", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "cpu_core", + "type": "INT_10", + "chnname": "CPU内核数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cpu_rate", + "type": "DOUBLE_22", + "chnname": "CPU使用率", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "disk_total", + "type": "DOUBLE_22", + "chnname": "磁盘总量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "disk_used", + "type": "DOUBLE_22", + "chnname": "磁盘使用量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mem_total", + "type": "DOUBLE_22", + "chnname": "内存总数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mem_used", + "type": "DOUBLE_22", + "chnname": "内存使用量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "port", + "type": "INT_10", + "chnname": "访问端口", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "state", + "type": "VARCHAR_255", + "chnname": "状态", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "swap_total", + "type": "DOUBLE_22", + "chnname": "交换区总量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "swap_used", + "type": "DOUBLE_22", + "chnname": "交换区使用量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "address", + "type": "VARCHAR_255", + "chnname": "服务地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "edges": [], + "nodes": [] + }, + "associations": [] + }, + { + "name": "tools", + "chnname": "工具模块", + "entities": [ + { + "title": "email_config", + "chnname": "邮箱配置", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "from_user", + "type": "VARCHAR_255", + "chnname": "收件人", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "host", + "type": "VARCHAR_255", + "chnname": "邮件服务器SMTP地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pass", + "type": "VARCHAR_255", + "chnname": "密码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "port", + "type": "VARCHAR_255", + "chnname": "端口", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "user", + "type": "VARCHAR_255", + "chnname": "发件者用户名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "local_storage", + "chnname": "本地存储", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_255", + "chnname": "文件真实的名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "文件名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "suffix", + "type": "VARCHAR_255", + "chnname": "后缀", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "path", + "type": "VARCHAR_255", + "chnname": "路径", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_255", + "chnname": "类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "size", + "type": "VARCHAR_100", + "chnname": "大小", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "operate", + "type": "VARCHAR_255", + "chnname": "操作人", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "picture", + "chnname": "Sm.Ms图床", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "上传日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "delete_url", + "type": "VARCHAR_255", + "chnname": "删除的URL", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "filename", + "type": "VARCHAR_255", + "chnname": "图片名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "height", + "type": "VARCHAR_255", + "chnname": "图片高度", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "size", + "type": "VARCHAR_255", + "chnname": "图片大小", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_255", + "chnname": "图片地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "username", + "type": "VARCHAR_255", + "chnname": "用户名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "width", + "type": "VARCHAR_255", + "chnname": "图片宽度", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "md5code", + "type": "VARCHAR_255", + "chnname": "文件的MD5值", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "qiniu_config", + "chnname": "七牛云配置", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "access_key", + "type": "TEXT", + "chnname": "accessKey", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bucket", + "type": "VARCHAR_255", + "chnname": "Bucket 识别符", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "host", + "type": "VARCHAR_255", + "chnname": "外链域名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "secret_key", + "type": "TEXT", + "chnname": "secretKey", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_255", + "chnname": "空间类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "zone", + "type": "VARCHAR_255", + "chnname": "机房", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "qiniu_content", + "chnname": "七牛云文件存储", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "bucket", + "type": "VARCHAR_255", + "chnname": "Bucket 识别符", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "文件名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "size", + "type": "VARCHAR_255", + "chnname": "文件大小", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_255", + "chnname": "文件类型:私有或公开", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "上传或同步的时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_255", + "chnname": "文件url", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "suffix", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "verification_code", + "chnname": "验证码", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "code", + "type": "VARCHAR_255", + "chnname": "验证码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "状态:1有效、0过期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_255", + "chnname": "验证码类型:email或者短信", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "value", + "type": "VARCHAR_255", + "chnname": "接收邮箱或者手机号码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "scenes", + "type": "VARCHAR_255", + "chnname": "业务名称:如重置邮箱、重置密码等", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "alipay_config", + "chnname": "支付宝配置类", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "主键", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "app_id", + "type": "VARCHAR_255", + "chnname": "应用ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "charset", + "type": "VARCHAR_255", + "chnname": "编码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "format", + "type": "VARCHAR_255", + "chnname": "类型 固定格式json", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "gateway_url", + "type": "VARCHAR_255", + "chnname": "网关地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "notify_url", + "type": "VARCHAR_255", + "chnname": "异步回调", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "private_key", + "type": "TEXT", + "chnname": "私钥", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "public_key", + "type": "TEXT", + "chnname": "公钥", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "return_url", + "type": "VARCHAR_255", + "chnname": "回调地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sign_type", + "type": "VARCHAR_255", + "chnname": "签名方式", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sys_service_provider_id", + "type": "VARCHAR_255", + "chnname": "商户号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + } + }, + { + "name": "logging", + "chnname": "日志", + "entities": [ + { + "title": "log", + "chnname": "系统日志", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "description", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "exception_detail", + "type": "TEXT", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "log_type", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "method", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "params", + "type": "TEXT", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "request_ip", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "time", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "username", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "address", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "browser", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + }, + "associations": [] + }, + { + "name": "gen", + "chnname": "代码生成", + "entities": [ + { + "title": "gen_test", + "chnname": "代码生成测试", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sex", + "type": "INT_10", + "chnname": "性别", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "column_config", + "chnname": "代码生成字段信息存储", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "table_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "column_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "column_type", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "dict_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "extra", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "form_show", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "form_type", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "key_type", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "list_show", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "not_null", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "query_type", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remark", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "date_annotation", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "gen_config", + "chnname": "代码生成器配置", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "table_name", + "type": "VARCHAR_255", + "chnname": "表名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "author", + "type": "VARCHAR_255", + "chnname": "作者", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cover", + "type": "BIT_1", + "chnname": "是否覆盖", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "module_name", + "type": "VARCHAR_255", + "chnname": "模块名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pack", + "type": "VARCHAR_255", + "chnname": "至于哪个包下", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "path", + "type": "VARCHAR_255", + "chnname": "前端代码生成的路径", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "api_path", + "type": "VARCHAR_255", + "chnname": "前端Api文件路径", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "prefix", + "type": "VARCHAR_255", + "chnname": "表前缀", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "api_alias", + "type": "VARCHAR_255", + "chnname": "接口名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "column_config", + "moduleName": false, + "x": 288.359375, + "y": 279, + "id": "09a1ceae" + }, + { + "shape": "table", + "title": "gen_config", + "moduleName": false, + "x": 760, + "y": 200, + "id": "2e380491" + } + ], + "edges": [] + }, + "associations": [] + }, + { + "name": "monitor", + "chnname": "", + "entities": [ + { + "title": "visits", + "chnname": "访客记录", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "date", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ip_counts", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pv_counts", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "week_day", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + }, + "associations": [] + }, + { + "name": "quartz", + "chnname": "定时任务", + "entities": [ + { + "title": "quartz_job", + "chnname": "定时任务", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "bean_name", + "type": "VARCHAR_255", + "chnname": "Spring Bean名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cron_expression", + "type": "VARCHAR_255", + "chnname": "cron 表达式", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_pause", + "type": "BIT_1", + "chnname": "状态:1暂停、0启用", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "job_name", + "type": "VARCHAR_255", + "chnname": "任务名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "method_name", + "type": "VARCHAR_255", + "chnname": "方法名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "params", + "type": "VARCHAR_255", + "chnname": "参数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remark", + "type": "VARCHAR_255", + "chnname": "备注", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "quartz_log", + "chnname": "定时任务日志", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "baen_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cron_expression", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "exception_detail", + "type": "TEXT", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_success", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "job_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "method_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "params", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "time", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "quartz_job", + "moduleName": false, + "x": 422.359375, + "y": 367, + "id": "4b2bda89" + }, + { + "shape": "table", + "title": "quartz_log", + "moduleName": false, + "x": 890, + "y": 340, + "id": "b47ba8e0" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "b47ba8e0", + "target": "4b2bda89", + "id": "01afd2ee", + "controlPoints": [ + { + "x": 759.2236328125, + "y": 356.3101851851852 + }, + { + "x": 608.0595703125, + "y": 354.9063636363636 + } + ], + "sourceAnchor": 12, + "targetAnchor": 9 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "quartz_log", + "field": "job_name" + }, + "to": { + "entity": "quartz_job", + "field": "job_name" + } + } + ] + }, + { + "name": "system", + "chnname": "系统模块", + "entities": [ + { + "title": "users_roles", + "chnname": "用户角色关联", + "fields": [ + { + "name": "user_id", + "type": "BIGINT_19", + "chnname": "用户ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "role_id", + "type": "BIGINT_19", + "chnname": "角色ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "roles_menus", + "chnname": "角色菜单关联", + "fields": [ + { + "name": "menu_id", + "type": "BIGINT_19", + "chnname": "菜单ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "role_id", + "type": "BIGINT_19", + "chnname": "角色ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "roles_depts", + "chnname": "角色部门关联", + "fields": [ + { + "name": "role_id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "dept_id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "user_avatar", + "chnname": "系统用户头像", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_255", + "chnname": "真实文件名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "path", + "type": "VARCHAR_255", + "chnname": "路径", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "size", + "type": "VARCHAR_255", + "chnname": "大小", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "role", + "chnname": "角色表", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remark", + "type": "VARCHAR_255", + "chnname": "备注", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "data_scope", + "type": "VARCHAR_255", + "chnname": "数据权限", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "level", + "type": "INT_10", + "chnname": "角色级别", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "permission", + "type": "VARCHAR_255", + "chnname": "功能权限", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "dict", + "chnname": "数据字典", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "字典名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remark", + "type": "VARCHAR_255", + "chnname": "描述", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "dict_detail", + "chnname": "数据字典详情", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "label", + "type": "VARCHAR_255", + "chnname": "字典标签", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "value", + "type": "VARCHAR_255", + "chnname": "字典值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "VARCHAR_255", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "dict_id", + "type": "BIGINT_19", + "chnname": "字典id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "dept", + "chnname": "部门", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pid", + "type": "BIGINT_19", + "chnname": "上级部门", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "enabled", + "type": "BIT_1", + "chnname": "状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "menu", + "chnname": "", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "i_frame", + "type": "BIT_1", + "chnname": "是否外链", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "菜单名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "component", + "type": "VARCHAR_255", + "chnname": "组件", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pid", + "type": "BIGINT_19", + "chnname": "上级菜单ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "BIGINT_19", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "icon", + "type": "VARCHAR_255", + "chnname": "图标", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "path", + "type": "VARCHAR_255", + "chnname": "链接地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cache", + "type": "BIT_1", + "chnname": "缓存", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "hidden", + "type": "BIT_1", + "chnname": "是否隐藏", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "component_name", + "type": "VARCHAR_20", + "chnname": "组件名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "permission", + "type": "VARCHAR_255", + "chnname": "权限", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "INT_10", + "chnname": "类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "job", + "chnname": "岗位", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "岗位名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "enabled", + "type": "BIT_1", + "chnname": "岗位状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "BIGINT_19", + "chnname": "岗位排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "dept_id", + "type": "BIGINT_19", + "chnname": "部门ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "user", + "chnname": "系统用户", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "avatar_id", + "type": "BIGINT_19", + "chnname": "头像", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "email", + "type": "VARCHAR_255", + "chnname": "邮箱", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "enabled", + "type": "BIGINT_19", + "chnname": "状态:1启用、0禁用", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "password", + "type": "VARCHAR_255", + "chnname": "密码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "username", + "type": "VARCHAR_255", + "chnname": "用户名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "dept_id", + "type": "BIGINT_19", + "chnname": "部门名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "phone", + "type": "VARCHAR_255", + "chnname": "手机号码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "job_id", + "type": "BIGINT_19", + "chnname": "岗位名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "last_password_reset_time", + "type": "DATETIME", + "chnname": "最后修改密码的日期", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "nick_name", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sex", + "type": "VARCHAR_255", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "user", + "moduleName": false, + "x": 730, + "y": 200, + "id": "42584636" + }, + { + "shape": "table", + "title": "menu", + "moduleName": false, + "x": 230, + "y": 580, + "id": "faa9e561" + }, + { + "shape": "table", + "title": "dict_detail", + "moduleName": false, + "x": 1440, + "y": 720, + "id": "de6d0d5f" + }, + { + "shape": "table", + "title": "dict", + "moduleName": false, + "x": 1080, + "y": 770, + "id": "2e3e2ccb" + }, + { + "shape": "table", + "title": "user_avatar", + "moduleName": false, + "x": 220, + "y": 100, + "id": "794cd430" + }, + { + "shape": "table", + "title": "job", + "moduleName": false, + "x": 240, + "y": 290, + "id": "fe1aecfe" + }, + { + "shape": "table", + "title": "roles_menus", + "moduleName": false, + "x": 550, + "y": 490, + "id": "0ba651c7" + }, + { + "shape": "table", + "title": "role", + "moduleName": false, + "x": 850, + "y": 570, + "id": "2dd8b462" + }, + { + "shape": "table", + "title": "roles_depts", + "moduleName": false, + "x": 1140, + "y": 490, + "id": "759d8dd0" + }, + { + "shape": "table", + "title": "users_roles", + "moduleName": false, + "x": 1210, + "y": 50, + "id": "e76717e1" + }, + { + "shape": "table", + "title": "dept", + "moduleName": false, + "x": 1200, + "y": 240, + "id": "2ecdc324" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "42584636", + "target": "fe1aecfe", + "id": "a7e02413", + "controlPoints": [ + { + "x": 518.6240234375, + "y": 225.91161616161617 + }, + { + "x": 384.025390625, + "y": 232.19736842105263 + } + ], + "sourceAnchor": 16, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "42584636", + "target": "2ecdc324", + "id": "99cdad68", + "controlPoints": [ + { + "x": 941.3759765625, + "y": 187.46212121212122 + }, + { + "x": 1055.974609375, + "y": 192.22058823529412 + } + ], + "sourceAnchor": 13, + "targetAnchor": 0 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "de6d0d5f", + "target": "2e3e2ccb", + "id": "0f30581b", + "controlPoints": [ + { + "x": 1296.224609375, + "y": 736.3355263157895 + }, + { + "x": 1223.775390625, + "y": 732.25 + } + ], + "sourceAnchor": 8, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "42584636", + "target": "794cd430", + "id": "618c6bc6", + "controlPoints": [ + { + "x": 518.6240234375, + "y": 91.33838383838385 + }, + { + "x": 368.099609375, + "y": 72.28846153846153 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "0ba651c7", + "target": "faa9e561", + "id": "fdb423ea", + "controlPoints": [ + { + "x": 422.126953125, + "y": 492.281914893617 + }, + { + "x": 395.0341796875, + "y": 442.10714285714283 + } + ], + "sourceAnchor": 0, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "0ba651c7", + "target": "2dd8b462", + "id": "882b95a1", + "controlPoints": [ + { + "x": 677.873046875, + "y": 512.8191489361702 + }, + { + "x": 705.974609375, + "y": 502.17857142857144 + } + ], + "sourceAnchor": 3, + "targetAnchor": 0 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "759d8dd0", + "target": "2dd8b462", + "id": "7a7a3350", + "controlPoints": [ + { + "x": 1034.2080078125, + "y": 492.281914893617 + }, + { + "x": 994.025390625, + "y": 502.17857142857144 + } + ], + "sourceAnchor": 0, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "759d8dd0", + "target": "2ecdc324", + "id": "a9e0dc69", + "controlPoints": [ + { + "x": 1245.7919921875, + "y": 506.48049645390074 + }, + { + "x": 1440, + "y": 500 + }, + { + "x": 1440, + "y": 190 + }, + { + "x": 1344.025390625, + "y": 192.22058823529412 + } + ], + "sourceAnchor": 3, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "e76717e1", + "target": "42584636", + "id": "6179129e", + "controlPoints": [ + { + "x": 1085.4638671875, + "y": 52.28191489361702 + }, + { + "x": 941.3759765625, + "y": 72.11363636363636 + } + ], + "sourceAnchor": 0, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "e76717e1", + "target": "2dd8b462", + "id": "c796f9c9", + "controlPoints": [ + { + "x": 1334.5361328125, + "y": 72.81914893617022 + }, + { + "x": 1480, + "y": 70 + }, + { + "x": 1490, + "y": 580 + }, + { + "x": 1030, + "y": 590 + }, + { + "x": 994.025390625, + "y": 502.17857142857144 + } + ], + "sourceAnchor": 3, + "targetAnchor": 1 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "user", + "field": "job_id" + }, + "to": { + "entity": "job", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "user", + "field": "dept_id" + }, + "to": { + "entity": "dept", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "dict_detail", + "field": "dict_id" + }, + "to": { + "entity": "dict", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "user", + "field": "avatar_id" + }, + "to": { + "entity": "user_avatar", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "roles_menus", + "field": "menu_id" + }, + "to": { + "entity": "menu", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "roles_menus", + "field": "role_id" + }, + "to": { + "entity": "role", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "roles_depts", + "field": "role_id" + }, + "to": { + "entity": "role", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "roles_depts", + "field": "dept_id" + }, + "to": { + "entity": "dept", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "users_roles", + "field": "user_id" + }, + "to": { + "entity": "user", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "users_roles", + "field": "role_id" + }, + "to": { + "entity": "role", + "field": "id" + } + } + ] + }, + { + "name": "activity", + "chnname": "活动", + "entities": [ + { + "title": "yx_store_seckill", + "chnname": "商品秒杀产品表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品秒杀产品表id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_255", + "chnname": "推荐图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "images", + "type": "VARCHAR_2000", + "chnname": "轮播图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_255", + "chnname": "活动标题", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "info", + "type": "VARCHAR_255", + "chnname": "简介", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "价格", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "成本", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ot_price", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "原价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "give_integral", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "返多少积分", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stock", + "type": "INT UNSIGNED_10", + "chnname": "库存", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sales", + "type": "INT UNSIGNED_10", + "chnname": "销量", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unit_name", + "type": "VARCHAR_16", + "chnname": "单位名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "postage", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "邮费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "description", + "type": "TEXT", + "chnname": "内容", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "start_time", + "type": "DATE", + "chnname": "开始时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stop_time", + "type": "DATE", + "chnname": "结束时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "产品状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_postage", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否包邮", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_hot", + "type": "TINYINT UNSIGNED_1", + "chnname": "热门推荐", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "删除 0未删除1已删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "num", + "type": "INT UNSIGNED_10", + "chnname": "最多秒杀几个", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "TINYINT UNSIGNED_1", + "chnname": "显示", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "time_id", + "type": "INT UNSIGNED_10", + "chnname": "时间段id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spec_type", + "type": "BIT_1", + "chnname": "规格 0单 1多", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temp_id", + "type": "INT_10", + "chnname": "运费模板id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_pink", + "chnname": "拼团表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "order_id", + "type": "VARCHAR_32", + "chnname": "订单id 生成", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "order_id_key", + "type": "INT UNSIGNED_10", + "chnname": "订单id 数据库", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_num", + "type": "INT UNSIGNED_10", + "chnname": "购买商品个数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_price", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "购买总金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cid", + "type": "BIGINT UNSIGNED_20", + "chnname": "拼团产品id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pid", + "type": "BIGINT UNSIGNED_20", + "chnname": "产品id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "people", + "type": "INT UNSIGNED_10", + "chnname": "拼团总人数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "拼团产品单价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "开始时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stop_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "k_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "团长id 0为团长", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_tpl", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否发送模板消息0未发送1已发送", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_refund", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否退款 0未退款 1已退款", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "状态1进行中2已完成3未完成", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_coupon_user", + "chnname": "优惠券发放记录表", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "优惠券发放记录id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "cid", + "type": "INT UNSIGNED_10", + "chnname": "兑换的项目id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "优惠券所属用户", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_title", + "type": "VARCHAR_32", + "chnname": "优惠券名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "优惠券的面值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "use_min_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "最低消费多少金额可用优惠券", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "优惠券创建时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "end_time", + "type": "DATETIME", + "chnname": "优惠券结束时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "use_time", + "type": "DATETIME", + "chnname": "使用时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_32", + "chnname": "获取方式", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "状态(0:未使用,1:已使用, 2:已过期)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_fail", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否有效", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_coupon_issue_user", + "chnname": "优惠券前台用户领取记录表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "领取优惠券用户ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "issue_coupon_id", + "type": "INT_10", + "chnname": "优惠券前台领取ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "领取时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_coupon_issue", + "chnname": "优惠券前台领取表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "cname", + "type": "VARCHAR_50", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cid", + "type": "INT_10", + "chnname": "优惠券ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ctype", + "type": "BIT_1", + "chnname": "优惠券类型 0-通用 1-商品券", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "start_time", + "type": "DATETIME", + "chnname": "优惠券领取开启时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "end_time", + "type": "DATETIME", + "chnname": "优惠券领取结束时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_count", + "type": "INT_10", + "chnname": "优惠券领取数量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remain_count", + "type": "INT_10", + "chnname": "优惠券剩余领取数量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_permanent", + "type": "BIT_1", + "chnname": "是否无限张数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "1 正常 0 未开启 -1 已无效", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "优惠券添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_coupon", + "chnname": "优惠券表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "优惠券表ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_64", + "chnname": "优惠券名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "integral", + "type": "INT UNSIGNED_10", + "chnname": "兑换消耗积分值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "兑换的优惠券面值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "use_min_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "最低消费多少金额可用优惠券", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_time", + "type": "INT UNSIGNED_10", + "chnname": "优惠券有效期限(单位:天)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "状态(0:关闭,1:开启)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "VARCHAR_200", + "chnname": "商品ids", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "TINYINT_3", + "chnname": "优惠券类型 0-通用 1-商品券", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "兑换项目添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_combination", + "chnname": "拼团产品表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT UNSIGNED_10", + "chnname": "商户id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_255", + "chnname": "推荐图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "images", + "type": "VARCHAR_2000", + "chnname": "轮播图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_255", + "chnname": "活动标题", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "attr", + "type": "VARCHAR_255", + "chnname": "活动属性", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "people", + "type": "INT UNSIGNED_10", + "chnname": "参团人数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "info", + "type": "VARCHAR_255", + "chnname": "简介", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "价格", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_price", + "type": "DECIMAL_10_2", + "chnname": "商品原价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sales", + "type": "INT UNSIGNED_10", + "chnname": "销量", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stock", + "type": "INT UNSIGNED_10", + "chnname": "库存", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_host", + "type": "TINYINT UNSIGNED_1", + "chnname": "推荐", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "TINYINT UNSIGNED_1", + "chnname": "产品状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "combination", + "type": "TINYINT UNSIGNED_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_use", + "type": "TINYINT UNSIGNED_1", + "chnname": "商户是否可用1可用0不可用", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "description", + "type": "TEXT", + "chnname": "拼团内容", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "start_time", + "type": "DATETIME", + "chnname": "拼团开始时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stop_time", + "type": "DATETIME", + "chnname": "拼团结束时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "effective_time", + "type": "INT_10", + "chnname": "拼团订单有效时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "INT UNSIGNED_10", + "chnname": "拼团产品成本", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "browse", + "type": "INT_10", + "chnname": "浏览量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unit_name", + "type": "VARCHAR_32", + "chnname": "单位名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spec_type", + "type": "BIT_1", + "chnname": "规格 0单 1多", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temp_id", + "type": "INT_10", + "chnname": "运费模板ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_bargain_user_help", + "chnname": "砍价用户帮助表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "砍价用户帮助表ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "帮助的用户id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "砍价产品ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_user_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户参与砍价表id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "帮助砍价多少金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_bargain_user", + "chnname": "用户参与砍价表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户参与砍价表ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "砍价产品id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_price_min", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "砍价的最低价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_price", + "type": "DECIMAL_8_2", + "chnname": "砍价金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "砍掉的价格", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "状态 1参与中 2 活动结束参与失败 3活动结束参与成功", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "参与时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "是否取消", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_bargain", + "chnname": "砍价表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "砍价产品ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "关联产品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_255", + "chnname": "砍价活动名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_150", + "chnname": "砍价活动图片", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unit_name", + "type": "VARCHAR_16", + "chnname": "单位名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stock", + "type": "INT UNSIGNED_10", + "chnname": "库存", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sales", + "type": "INT UNSIGNED_10", + "chnname": "销量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "images", + "type": "VARCHAR_2000", + "chnname": "砍价产品轮播图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "start_time", + "type": "DATETIME", + "chnname": "砍价开启时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stop_time", + "type": "DATETIME", + "chnname": "砍价结束时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_name", + "type": "VARCHAR_255", + "chnname": "砍价产品名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "砍价金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "min_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "砍价商品最低价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "num", + "type": "INT UNSIGNED_10", + "chnname": "每次购买的砍价产品数量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_max_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "用户每次砍价的最大金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_min_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "用户每次砍价的最小金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_num", + "type": "INT UNSIGNED_10", + "chnname": "用户每次砍价的次数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "砍价状态 0(到砍价时间不自动开启) 1(到砍价时间自动开启时间)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "description", + "type": "TEXT", + "chnname": "砍价详情", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "give_integral", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "反多少积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "info", + "type": "VARCHAR_255", + "chnname": "砍价活动简介", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "成本价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_hot", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否推荐0不推荐1推荐", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除 0未删除 1删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_postage", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否包邮 0不包邮 1包邮", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "postage", + "type": "DECIMAL UNSIGNED_10_2", + "chnname": "邮费", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "rule", + "type": "TEXT", + "chnname": "砍价规则", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "look", + "type": "INT UNSIGNED_10", + "chnname": "砍价产品浏览量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "share", + "type": "INT UNSIGNED_10", + "chnname": "砍价产品分享量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_visit", + "chnname": "产品浏览分析表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "INT_10", + "chnname": "产品ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_type", + "type": "VARCHAR_32", + "chnname": "产品类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cate_id", + "type": "INT_10", + "chnname": "产品分类ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "CHAR_50", + "chnname": "产品类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "INT_10", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "count", + "type": "INT_10", + "chnname": "访问次数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "content", + "type": "VARCHAR_255", + "chnname": "备注描述", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "add_time", + "type": "INT_10", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "yx_store_pink", + "moduleName": false, + "x": 310, + "y": 580, + "id": "13513a4e" + }, + { + "shape": "table", + "title": "yx_store_coupon", + "moduleName": false, + "x": 600, + "y": 180, + "id": "2b6bf508" + }, + { + "shape": "table", + "title": "yx_store_coupon_user", + "moduleName": false, + "x": 1310, + "y": 190, + "id": "aa29268e" + }, + { + "shape": "table", + "title": "yx_store_coupon_issue", + "moduleName": false, + "x": 1270, + "y": 580, + "id": "74e5a8f0" + }, + { + "shape": "table", + "title": "yx_store_coupon_issue_user", + "moduleName": false, + "x": 790, + "y": 610, + "id": "dfd12dd0" + }, + { + "shape": "table", + "title": "yx_store_bargain", + "moduleName": false, + "x": -160, + "y": -50, + "id": "1de36ee3" + }, + { + "shape": "table", + "title": "yx_store_bargain_user", + "moduleName": false, + "x": 590, + "y": -340, + "id": "14a47167" + }, + { + "shape": "table", + "title": "yx_store_bargain_user_help", + "moduleName": false, + "x": 490, + "y": -100, + "id": "e979c0f8" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "aa29268e", + "target": "2b6bf508", + "id": "a8da6c7b", + "controlPoints": [ + { + "x": 1041.849609375, + "y": 91.2897465437788 + }, + { + "x": 835.138671875, + "y": 72.12931034482759 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "74e5a8f0", + "target": "2b6bf508", + "id": "6abf3f7d", + "controlPoints": [ + { + "x": 1051.787109375, + "y": 510.3375331564987 + }, + { + "x": 835.138671875, + "y": 72.12931034482759 + } + ], + "sourceAnchor": 4, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "dfd12dd0", + "target": "74e5a8f0", + "id": "0433262a", + "controlPoints": [ + { + "x": 991.1455078125, + "y": 608.3222222222222 + }, + { + "x": 1051.787109375, + "y": 472.12931034482756 + } + ], + "sourceAnchor": 5, + "targetAnchor": 0 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "14a47167", + "target": "1de36ee3", + "id": "e528de82", + "controlPoints": [ + { + "x": 279.8408203125, + "y": -377.6630434782609 + }, + { + "x": 182.1513671875, + "y": -347.9440298507463 + } + ], + "sourceAnchor": 4, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "e979c0f8", + "target": "1de36ee3", + "id": "b2e7774f", + "controlPoints": [ + { + "x": 280.6005859375, + "y": -120.73355263157895 + }, + { + "x": 182.1513671875, + "y": -347.9440298507463 + } + ], + "sourceAnchor": 4, + "targetAnchor": 1 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_coupon_user", + "field": "cid" + }, + "to": { + "entity": "yx_store_coupon", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_coupon_issue", + "field": "cid" + }, + "to": { + "entity": "yx_store_coupon", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_coupon_issue_user", + "field": "issue_coupon_id" + }, + "to": { + "entity": "yx_store_coupon_issue", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_bargain_user", + "field": "bargain_id" + }, + "to": { + "entity": "yx_store_bargain", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_bargain_user_help", + "field": "bargain_id" + }, + "to": { + "entity": "yx_store_bargain", + "field": "id" + } + } + ] + }, + { + "name": "cart", + "chnname": "购物车", + "entities": [ + { + "title": "yx_store_cart", + "chnname": "购物车表", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "购物车表ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_32", + "chnname": "类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_attr_unique", + "type": "VARCHAR_50", + "chnname": "商品属性", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cart_num", + "type": "SMALLINT UNSIGNED_5", + "chnname": "商品数量", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_pay", + "type": "BIT_1", + "chnname": "0 = 未购买 1 = 已购买", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_new", + "type": "BIT_1", + "chnname": "是否为立即购买", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "combination_id", + "type": "INT UNSIGNED_10", + "chnname": "拼团id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "seckill_id", + "type": "INT UNSIGNED_10", + "chnname": "秒杀产品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_id", + "type": "INT UNSIGNED_10", + "chnname": "砍价id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + } + }, + { + "name": "category", + "chnname": "商品分类", + "entities": [ + { + "title": "yx_store_category", + "chnname": "商品分类表", + "fields": [ + { + "name": "id", + "type": "MEDIUMINT_7", + "chnname": "商品分类表ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "pid", + "type": "MEDIUMINT_7", + "chnname": "父id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cate_name", + "type": "VARCHAR_100", + "chnname": "分类名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "MEDIUMINT_7", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pic", + "type": "VARCHAR_128", + "chnname": "图标", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否推荐", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "删除状态", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + } + }, + { + "name": "order", + "chnname": "订单", + "entities": [ + { + "title": "yx_store_order", + "chnname": "订单表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "订单ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "order_id", + "type": "VARCHAR_32", + "chnname": "订单号", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "extend_order_id", + "type": "VARCHAR_32", + "chnname": "额外订单号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_32", + "chnname": "用户姓名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "user_phone", + "type": "VARCHAR_18", + "chnname": "用户电话", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "user_address", + "type": "VARCHAR_100", + "chnname": "详细地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cart_id", + "type": "VARCHAR_256", + "chnname": "购物车id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "freight_price", + "type": "DECIMAL_8_2", + "chnname": "运费金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_num", + "type": "INT UNSIGNED_10", + "chnname": "订单商品总数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "订单总价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "total_postage", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "邮费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "实际支付金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_postage", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "支付邮费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "deduction_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "抵扣金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_id", + "type": "INT UNSIGNED_10", + "chnname": "优惠券id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "coupon_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "优惠券金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "paid", + "type": "TINYINT UNSIGNED_1", + "chnname": "支付状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_time", + "type": "DATETIME", + "chnname": "支付时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_type", + "type": "VARCHAR_32", + "chnname": "支付方式", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "订单状态(-1 : 申请退款 -2 : 退货成功 0:待发货;1:待收货;2:已收货;3:已完成;-1:已退款)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_status", + "type": "TINYINT UNSIGNED_1", + "chnname": "0 未退款 1 申请中 2 已退款", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_reason_wap_img", + "type": "VARCHAR_255", + "chnname": "退款图片", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_reason_wap_explain", + "type": "VARCHAR_255", + "chnname": "退款用户说明", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_reason_time", + "type": "DATETIME", + "chnname": "退款时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_reason_wap", + "type": "VARCHAR_255", + "chnname": "前台退款原因", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_reason", + "type": "VARCHAR_255", + "chnname": "不退款的理由", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "退款金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "delivery_sn", + "type": "VARCHAR_100", + "chnname": "快递公司编号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "delivery_name", + "type": "VARCHAR_64", + "chnname": "快递名称/送货人姓名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "delivery_type", + "type": "VARCHAR_32", + "chnname": "发货类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "delivery_id", + "type": "VARCHAR_64", + "chnname": "快递单号/手机号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "gain_integral", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "消费赚取积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "use_integral", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "使用积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "back_integral", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "给用户退了多少积分", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mark", + "type": "VARCHAR_512", + "chnname": "备注", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unique", + "type": "CHAR_32", + "chnname": "唯一id(md5加密)类似id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remark", + "type": "VARCHAR_512", + "chnname": "管理员备注", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT UNSIGNED_10", + "chnname": "商户ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_mer_check", + "type": "TINYINT UNSIGNED_3", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "combination_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "拼团产品id0一般产品", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pink_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "拼团id 0没有拼团", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "成本价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "seckill_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "秒杀产品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bargain_id", + "type": "INT UNSIGNED_10", + "chnname": "砍价id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "verify_code", + "type": "VARCHAR_50", + "chnname": "核销码", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_id", + "type": "INT_10", + "chnname": "门店id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "shipping_type", + "type": "BIT_1", + "chnname": "配送方式 1=快递 ,2=门店自提", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_channel", + "type": "TINYINT UNSIGNED_1", + "chnname": "支付渠道(0微信公众号1微信小程序)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_remind", + "type": "TINYINT UNSIGNED_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_system_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ], + "indexs": [], + "headers": [ + { + "fieldName": "chnname", + "relationNoShow": false + }, + { + "fieldName": "name", + "relationNoShow": false + }, + { + "fieldName": "type", + "relationNoShow": false + }, + { + "fieldName": "dataType", + "relationNoShow": true + }, + { + "fieldName": "remark", + "relationNoShow": true + }, + { + "fieldName": "pk", + "relationNoShow": false + }, + { + "fieldName": "notNull", + "relationNoShow": true + }, + { + "fieldName": "autoIncrement", + "relationNoShow": true + }, + { + "fieldName": "defaultValue", + "relationNoShow": true + }, + { + "fieldName": "relationNoShow", + "relationNoShow": true + }, + { + "fieldName": "uiHint", + "relationNoShow": true + } + ] + }, + { + "title": "yx_store_order_cart_info", + "chnname": "订单购物详情表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "oid", + "type": "BIGINT UNSIGNED_20", + "chnname": "订单id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cart_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "购物车id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cart_info", + "type": "TEXT", + "chnname": "购买东西的详细信息", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unique", + "type": "VARCHAR_50", + "chnname": "唯一id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_order_status", + "chnname": "订单操作记录表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "oid", + "type": "BIGINT UNSIGNED_20", + "chnname": "订单id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "change_type", + "type": "VARCHAR_32", + "chnname": "操作类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "change_message", + "type": "VARCHAR_256", + "chnname": "操作备注", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "change_time", + "type": "DATETIME", + "chnname": "操作时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_express", + "chnname": "快递公司表", + "fields": [ + { + "name": "id", + "type": "MEDIUMINT UNSIGNED_8", + "chnname": "快递公司id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "code", + "type": "VARCHAR_50", + "chnname": "快递公司简称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_50", + "chnname": "快递公司全称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否显示", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT_3", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "yx_store_order", + "moduleName": false, + "x": 610, + "y": 550, + "id": "0eda0dc5" + }, + { + "shape": "table", + "title": "yx_store_order_cart_info", + "moduleName": false, + "x": 1370, + "y": 70, + "id": "1412580b" + }, + { + "shape": "table", + "title": "yx_store_cart", + "moduleName": "cart", + "x": 1410, + "y": 330, + "id": "bcf3c95c" + }, + { + "shape": "table", + "title": "yx_store_order_status", + "moduleName": false, + "x": 1380, + "y": 610, + "id": "f5488e91" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "1412580b", + "target": "0eda0dc5", + "id": "6f47eff5", + "controlPoints": [ + { + "x": 1179.8701171875, + "y": 52.38333333333334 + }, + { + "x": 1074.1962890625, + "y": 32.03378378378378 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "1412580b", + "target": "bcf3c95c", + "id": "2c239ffd", + "controlPoints": [ + { + "x": 1179.8701171875, + "y": 72.51666666666668 + }, + { + "x": 1120, + "y": 70 + }, + { + "x": 1120, + "y": 210 + }, + { + "x": 1184.4970703125, + "y": 212.1209677419355 + } + ], + "sourceAnchor": 4, + "targetAnchor": 0 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "f5488e91", + "target": "0eda0dc5", + "id": "70641526", + "controlPoints": [ + { + "x": 1200.5224609375, + "y": 602.4423076923077 + }, + { + "x": 1130, + "y": 450 + }, + { + "x": 1074.1962890625, + "y": 32.03378378378378 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_order_cart_info", + "field": "oid" + }, + "to": { + "entity": "yx_store_order", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_order_status", + "field": "oid" + }, + "to": { + "entity": "yx_store_order", + "field": "id" + } + } + ] + }, + { + "name": "product", + "chnname": "商品模块", + "entities": [ + { + "title": "yx_store_product_reply", + "chnname": "评论表", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "评论ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "oid", + "type": "BIGINT_19", + "chnname": "订单ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unique", + "type": "CHAR_32", + "chnname": "唯一id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT_19", + "chnname": "产品id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "reply_type", + "type": "VARCHAR_32", + "chnname": "某种商品类型(普通商品、秒杀商品)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_score", + "type": "BIT_1", + "chnname": "商品分数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "service_score", + "type": "BIT_1", + "chnname": "服务分数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "comment", + "type": "VARCHAR_512", + "chnname": "评论内容", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pics", + "type": "TEXT", + "chnname": "评论图片", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "评论时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "merchant_reply_content", + "type": "VARCHAR_300", + "chnname": "管理员回复内容", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "merchant_reply_time", + "type": "DATETIME", + "chnname": "管理员回复时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "0未删除1已删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_reply", + "type": "BIT_1", + "chnname": "0未回复1已回复", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product_relation", + "chnname": "商品点赞和收藏表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_32", + "chnname": "类型(收藏(collect)、点赞(like))", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "category", + "type": "VARCHAR_32", + "chnname": "某种类型的商品(普通商品、秒杀商品)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product_attr_value", + "chnname": "商品属性值表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sku", + "type": "VARCHAR_128", + "chnname": "商品属性索引值 (attr_value|attr_value[|....])", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stock", + "type": "INT UNSIGNED_10", + "chnname": "属性对应的库存", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sales", + "type": "INT UNSIGNED_10", + "chnname": "销量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "属性金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_128", + "chnname": "图片", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unique", + "type": "VARCHAR_100", + "chnname": "唯一值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "成本价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bar_code", + "type": "VARCHAR_255", + "chnname": "商品条码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ot_price", + "type": "DECIMAL_10_2", + "chnname": "原价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "weight", + "type": "DECIMAL_8_2", + "chnname": "重量", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "volume", + "type": "DECIMAL_8_2", + "chnname": "体积", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "brokerage", + "type": "DECIMAL_8_2", + "chnname": "一级返佣", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "brokerage_two", + "type": "DECIMAL_8_2", + "chnname": "二级返佣", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pink_price", + "type": "DECIMAL_8_2", + "chnname": "拼团价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pink_stock", + "type": "INT_10", + "chnname": "拼团库存", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "seckill_price", + "type": "DECIMAL_10_2", + "chnname": "秒杀价", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "seckill_stock", + "type": "INT_10", + "chnname": "秒杀库存", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product_attr_result", + "chnname": "商品属性详情表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "result", + "type": "TEXT", + "chnname": "商品属性参数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "change_time", + "type": "DATETIME", + "chnname": "上次修改时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product_attr", + "chnname": "商品属性表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "商品ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "attr_name", + "type": "VARCHAR_32", + "chnname": "属性名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "attr_values", + "type": "VARCHAR_256", + "chnname": "属性值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product", + "chnname": "商品表", + "fields": [ + { + "name": "id", + "type": "BIGINT_19", + "chnname": "商品id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT UNSIGNED_10", + "chnname": "商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_256", + "chnname": "商品图片", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "slider_image", + "type": "VARCHAR_2000", + "chnname": "轮播图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_name", + "type": "VARCHAR_128", + "chnname": "商品名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_info", + "type": "VARCHAR_256", + "chnname": "商品简介", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "keyword", + "type": "VARCHAR_256", + "chnname": "关键字", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bar_code", + "type": "VARCHAR_15", + "chnname": "产品条码(一维码)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cate_id", + "type": "VARCHAR_64", + "chnname": "分类id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "商品价格", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "vip_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "会员价格", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ot_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "市场价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "postage", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "邮费", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "unit_name", + "type": "VARCHAR_32", + "chnname": "单位名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "SMALLINT_5", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sales", + "type": "MEDIUMINT UNSIGNED_8", + "chnname": "销量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "stock", + "type": "MEDIUMINT UNSIGNED_8", + "chnname": "库存", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "状态(0:未上架,1:上架)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_hot", + "type": "BIT_1", + "chnname": "是否热卖", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_benefit", + "type": "BIT_1", + "chnname": "是否优惠", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_best", + "type": "BIT_1", + "chnname": "是否精品", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_new", + "type": "BIT_1", + "chnname": "是否新品", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "description", + "type": "TEXT", + "chnname": "产品描述", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_postage", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否包邮", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_use", + "type": "TINYINT UNSIGNED_1", + "chnname": "商户是否代理 0不可代理1可代理", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "give_integral", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "获得积分", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cost", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "成本价", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_seckill", + "type": "TINYINT UNSIGNED_1", + "chnname": "秒杀状态 0 未开启 1已开启", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_bargain", + "type": "TINYINT UNSIGNED_1", + "chnname": "砍价状态 0未开启 1开启", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_good", + "type": "BIT_1", + "chnname": "是否优品推荐", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "ficti", + "type": "MEDIUMINT_7", + "chnname": "虚拟销量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "browse", + "type": "INT_10", + "chnname": "浏览量", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "code_path", + "type": "VARCHAR_64", + "chnname": "产品二维码地址(用户小程序海报)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_sub", + "type": "BIT_1", + "chnname": "是否单独分佣", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temp_id", + "type": "INT_10", + "chnname": "运费模板ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spec_type", + "type": "BIT_1", + "chnname": "规格 0单 1多", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_store_product_rule", + "chnname": "商品规则值(规格)表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "rule_name", + "type": "VARCHAR_32", + "chnname": "规格名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "rule_value", + "type": "JSON", + "chnname": "规格值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "yx_store_product", + "moduleName": false, + "x": 390, + "y": 410, + "id": "1f2a5f58" + }, + { + "shape": "table", + "title": "yx_store_product_attr", + "moduleName": false, + "x": 970, + "y": 60, + "id": "8d021563" + }, + { + "shape": "table", + "title": "yx_store_product_attr_value", + "moduleName": false, + "x": 1090, + "y": 360, + "id": "65395cd5" + }, + { + "shape": "table", + "title": "yx_store_product_attr_result", + "moduleName": false, + "x": 1020, + "y": 660, + "id": "f65fda56" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "8d021563", + "target": "1f2a5f58", + "id": "8a5b631d", + "controlPoints": [ + { + "x": 814.5400390625, + "y": 62.52272727272727 + }, + { + "x": 698.1318359375, + "y": 42.0462962962963 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "65395cd5", + "target": "1f2a5f58", + "id": "b3c471e9", + "controlPoints": [ + { + "x": 818.958984375, + "y": 252.17424242424244 + }, + { + "x": 698.1318359375, + "y": 42.0462962962963 + } + ], + "sourceAnchor": 2, + "targetAnchor": 1 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "65395cd5", + "target": "8d021563", + "id": "76f261e2", + "controlPoints": [ + { + "x": 818.958984375, + "y": 272.2348484848485 + }, + { + "x": 750, + "y": 240 + }, + { + "x": 814.5400390625, + "y": 82.70454545454545 + } + ], + "sourceAnchor": 4, + "targetAnchor": 4 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_product_attr", + "field": "product_id" + }, + "to": { + "entity": "yx_store_product", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_product_attr_value", + "field": "product_id" + }, + "to": { + "entity": "yx_store_product", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_store_product_attr_value", + "field": "sku" + }, + "to": { + "entity": "yx_store_product_attr", + "field": "attr_name" + } + } + ] + }, + { + "name": "shop", + "chnname": "商户模块", + "entities": [ + { + "title": "yx_material_group", + "chnname": "素材分组", + "fields": [ + { + "name": "id", + "type": "VARCHAR_32", + "chnname": "PK", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_id", + "type": "VARCHAR_32", + "chnname": "创建者ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_200", + "chnname": "分组名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_attachment", + "chnname": "附件管理表", + "fields": [ + { + "name": "att_id", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_100", + "chnname": "附件名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "att_dir", + "type": "VARCHAR_200", + "chnname": "附件路径", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "satt_dir", + "type": "VARCHAR_200", + "chnname": "压缩图片路径", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "att_size", + "type": "CHAR_30", + "chnname": "附件大小", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "att_type", + "type": "CHAR_30", + "chnname": "附件类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pid", + "type": "INT_10", + "chnname": "分类ID0编辑器,1产品图片,2拼团图片,3砍价图片,4秒杀图片,5文章图片,6组合数据图", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image_type", + "type": "TINYINT UNSIGNED_1", + "chnname": "图片上传类型 1本地 2七牛云 3OSS 4COS ", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "module_type", + "type": "TINYINT UNSIGNED_1", + "chnname": "图片上传模块类型 1 后台上传 2 用户生成", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "invite_code", + "type": "VARCHAR_50", + "chnname": "邀请码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_config", + "chnname": "配置表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "配置id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "menu_name", + "type": "VARCHAR_255", + "chnname": "字段名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "value", + "type": "VARCHAR_5000", + "chnname": "默认值", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否隐藏", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_group_data", + "chnname": "组合数据详情表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "组合数据详情ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "group_name", + "type": "VARCHAR_100", + "chnname": "对应的数据名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "value", + "type": "TEXT", + "chnname": "数据组对应的数据值(json数据)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加数据时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT_10", + "chnname": "数据排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "状态(1:开启;2:关闭;)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_store", + "chnname": "门店自提", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_100", + "chnname": "门店名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "introduction", + "type": "VARCHAR_1000", + "chnname": "简介", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "phone", + "type": "CHAR_25", + "chnname": "手机号码", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "address", + "type": "VARCHAR_255", + "chnname": "省市区", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "detailed_address", + "type": "VARCHAR_255", + "chnname": "详细地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_255", + "chnname": "门店logo", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "latitude", + "type": "CHAR_25", + "chnname": "纬度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "longitude", + "type": "CHAR_25", + "chnname": "经度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "valid_time", + "type": "VARCHAR_100", + "chnname": "核销有效日期", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "day_time", + "type": "VARCHAR_100", + "chnname": "每日营业开关时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否显示", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "day_time_end", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "day_time_start", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "valid_time_end", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "valid_time_start", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_store_staff", + "chnname": "门店店员表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "微信用户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "nickname", + "type": "VARCHAR_50", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "avatar", + "type": "VARCHAR_255", + "chnname": "店员头像", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_id", + "type": "INT_10", + "chnname": "门店id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "store_name", + "type": "VARCHAR_50", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "staff_name", + "type": "VARCHAR_64", + "chnname": "店员名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "phone", + "type": "CHAR_15", + "chnname": "手机号码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "verify_status", + "type": "TINYINT_3", + "chnname": "核销开关", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT_3", + "chnname": "状态", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_user_level", + "chnname": "设置用户等级表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT_10", + "chnname": "商户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "会员名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "money", + "type": "DECIMAL_8_2", + "chnname": "购买金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "valid_date", + "type": "INT_10", + "chnname": "有效时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_forever", + "type": "BIT_1", + "chnname": "是否为永久会员", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_pay", + "type": "BIT_1", + "chnname": "是否购买,1=购买,0=不购买", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否显示 1=显示,0=隐藏", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "grade", + "type": "INT_10", + "chnname": "会员等级", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "discount", + "type": "DECIMAL_8_2", + "chnname": "享受折扣", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image", + "type": "VARCHAR_255", + "chnname": "会员卡背景", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "icon", + "type": "VARCHAR_255", + "chnname": "会员图标", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "explain", + "type": "TEXT", + "chnname": "说明", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "是否删除.1=删除,0=未删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_material", + "chnname": "素材库", + "fields": [ + { + "name": "id", + "type": "VARCHAR_32", + "chnname": "PK", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "创建时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_id", + "type": "VARCHAR_100", + "chnname": "创建者ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "CHAR_2", + "chnname": "类型1、图片;2、视频", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "group_id", + "type": "VARCHAR_32", + "chnname": "分组ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_200", + "chnname": "素材名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_500", + "chnname": "素材链接", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "yx_material", + "moduleName": false, + "x": 442.359375, + "y": 277, + "id": "fe721315" + }, + { + "shape": "table", + "title": "yx_material_group", + "moduleName": false, + "x": 887.359375, + "y": 279, + "id": "f3be72cb" + }, + { + "shape": "table", + "title": "yx_system_store", + "moduleName": false, + "x": 326.359375, + "y": 624, + "id": "396a35b0" + }, + { + "shape": "table", + "title": "yx_system_store_staff", + "moduleName": false, + "x": 870, + "y": 590, + "id": "c3935d4a" + } + ], + "edges": [ + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "fe721315", + "target": "f3be72cb", + "id": "e1f3d02d", + "controlPoints": [ + { + "x": 623.05859375, + "y": 283.9775132275132 + }, + { + "x": 743.333984375, + "y": 241.25 + } + ], + "sourceAnchor": 9, + "targetAnchor": 0 + }, + { + "shape": "erdRelation", + "relation": "0,n:1", + "source": "c3935d4a", + "target": "396a35b0", + "id": "5bfc667b", + "controlPoints": [ + { + "x": 699.7900390625, + "y": 558.5457559681697 + }, + { + "x": 517.833984375, + "y": 456.0914634146342 + } + ], + "sourceAnchor": 8, + "targetAnchor": 1 + } + ] + }, + "associations": [ + { + "relation": "0,n:1", + "from": { + "entity": "yx_material", + "field": "group_id" + }, + "to": { + "entity": "yx_material_group", + "field": "id" + } + }, + { + "relation": "0,n:1", + "from": { + "entity": "yx_system_store_staff", + "field": "store_id" + }, + "to": { + "entity": "yx_system_store", + "field": "id" + } + } + ] + }, + { + "name": "template", + "chnname": "运费模板", + "entities": [ + { + "title": "yx_shipping_templates", + "chnname": "运费模板表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "模板ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "模板名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "BIT_1", + "chnname": "计费方式", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "region_info", + "type": "TEXT", + "chnname": "地域以及费用", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "appoint", + "type": "BIT_1", + "chnname": "指定包邮开关", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "appoint_info", + "type": "TEXT", + "chnname": "指定包邮内容", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_shipping_templates_free", + "chnname": "", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "编号", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "province_id", + "type": "INT_10", + "chnname": "省ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temp_id", + "type": "INT_10", + "chnname": "模板ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "city_id", + "type": "INT_10", + "chnname": "城市ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "number", + "type": "DECIMAL_10_2", + "chnname": "包邮件数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL_10_2", + "chnname": "包邮金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "BIT_1", + "chnname": "计费方式", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uniqid", + "type": "VARCHAR_32", + "chnname": "分组唯一值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_city", + "chnname": "城市表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "city_id", + "type": "INT_10", + "chnname": "城市id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "level", + "type": "INT_10", + "chnname": "省市级别", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "parent_id", + "type": "INT_10", + "chnname": "父级id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "area_code", + "type": "VARCHAR_30", + "chnname": "区号", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_100", + "chnname": "名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "merger_name", + "type": "VARCHAR_255", + "chnname": "合并名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "lng", + "type": "VARCHAR_50", + "chnname": "经度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "lat", + "type": "VARCHAR_50", + "chnname": "纬度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否展示", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_shipping_templates_region", + "chnname": "", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "编号", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "province_id", + "type": "INT_10", + "chnname": "省ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temp_id", + "type": "INT_10", + "chnname": "模板ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "city_id", + "type": "INT_10", + "chnname": "城市ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "first", + "type": "DECIMAL_10_2", + "chnname": "首件", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "first_price", + "type": "DECIMAL_10_2", + "chnname": "首件运费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "continues", + "type": "DECIMAL_10_2", + "chnname": "续件", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "continue_price", + "type": "DECIMAL_10_2", + "chnname": "续件运费", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "BIT_1", + "chnname": "计费方式", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uniqid", + "type": "VARCHAR_50", + "chnname": "分组唯一值", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [ + { + "shape": "table", + "title": "yx_shipping_templates", + "moduleName": false, + "x": 680, + "y": 380, + "id": "c8177992" + }, + { + "shape": "table", + "title": "yx_system_city", + "moduleName": false, + "x": 290, + "y": 260, + "id": "f3f8204a" + }, + { + "shape": "table", + "title": "yx_shipping_templates_free", + "moduleName": false, + "x": 1080, + "y": 190, + "id": "ac873dd5" + }, + { + "shape": "table", + "title": "yx_shipping_templates_region", + "moduleName": false, + "x": 1080, + "y": 540, + "id": "7ca63a1e" + } + ], + "edges": [] + }, + "associations": [] + }, + { + "name": "user", + "chnname": "用户模块", + "entities": [ + { + "title": "yx_user_bill", + "chnname": "用户账单表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户账单id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户uid", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "link_id", + "type": "VARCHAR_32", + "chnname": "关联id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pm", + "type": "TINYINT UNSIGNED_1", + "chnname": "0 = 支出 1 = 获得", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_64", + "chnname": "账单标题", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "category", + "type": "VARCHAR_64", + "chnname": "明细种类", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_64", + "chnname": "明细类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "number", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "明细数字", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "balance", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "剩余", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mark", + "type": "VARCHAR_512", + "chnname": "备注", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "0 = 带确定 1 = 有效 -1 = 无效", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_level", + "chnname": "用户等级记录表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "用户uid", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "level_id", + "type": "INT_10", + "chnname": "等级vip", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "grade", + "type": "INT_10", + "chnname": "会员等级", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "valid_time", + "type": "INT_10", + "chnname": "过期时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_forever", + "type": "BIT_1", + "chnname": "是否永久", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT_10", + "chnname": "商户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "0:禁止,1:正常", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mark", + "type": "VARCHAR_255", + "chnname": "备注", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "remind", + "type": "BIT_1", + "chnname": "是否已通知", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "是否删除,0=未删除,1=删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "discount", + "type": "INT_10", + "chnname": "享受折扣", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_task_finish", + "chnname": "用户任务完成记录表", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "task_id", + "type": "INT_10", + "chnname": "任务id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "用户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "是否有效", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_sign", + "chnname": "签到记录表", + "fields": [ + { + "name": "int", + "type": "BIGINT_19", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "用户uid", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_255", + "chnname": "签到说明", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "number", + "type": "INT_10", + "chnname": "获得积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "balance", + "type": "INT_10", + "chnname": "剩余积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_recharge", + "chnname": "用户充值表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT_19", + "chnname": "充值用户UID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "nickname", + "type": "VARCHAR_50", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "order_id", + "type": "VARCHAR_32", + "chnname": "订单号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "DECIMAL_8_2", + "chnname": "充值金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "give_price", + "type": "DECIMAL_8_2", + "chnname": "购买赠送金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "recharge_type", + "type": "VARCHAR_32", + "chnname": "充值类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "paid", + "type": "BIT_1", + "chnname": "是否充值", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_time", + "type": "DATETIME", + "chnname": "充值支付时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "充值时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "refund_price", + "type": "DECIMAL_10_2", + "chnname": "退款金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT_3", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_address", + "chnname": "用户地址表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户地址id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_32", + "chnname": "收货人姓名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "phone", + "type": "VARCHAR_16", + "chnname": "收货人电话", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "province", + "type": "VARCHAR_64", + "chnname": "收货人所在省", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "city", + "type": "VARCHAR_64", + "chnname": "收货人所在市", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "city_id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "district", + "type": "VARCHAR_64", + "chnname": "收货人所在区", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "detail", + "type": "VARCHAR_256", + "chnname": "收货人详细地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "post_code", + "type": "VARCHAR_20", + "chnname": "邮编", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "longitude", + "type": "VARCHAR_16", + "chnname": "经度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "latitude", + "type": "VARCHAR_16", + "chnname": "纬度", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_default", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否默认", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_group", + "chnname": "用户分组表", + "fields": [ + { + "name": "id", + "type": "SMALLINT UNSIGNED_5", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "group_name", + "type": "VARCHAR_64", + "chnname": "用户分组名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_extract", + "chnname": "用户提现表", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_64", + "chnname": "名称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "extract_type", + "type": "VARCHAR_32", + "chnname": "bank = 银行卡 alipay = 支付宝wx=微信", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bank_code", + "type": "VARCHAR_32", + "chnname": "银行卡", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "bank_address", + "type": "VARCHAR_256", + "chnname": "开户地址", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "alipay_code", + "type": "VARCHAR_64", + "chnname": "支付宝账号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "extract_price", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "提现金额", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mark", + "type": "VARCHAR_512", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "balance", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "fail_msg", + "type": "VARCHAR_128", + "chnname": "无效原因", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "fail_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT_3", + "chnname": "-1 未通过 0 审核中 1 已提现", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "wechat", + "type": "VARCHAR_15", + "chnname": "微信号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user_enter", + "chnname": "商户申请表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "商户申请ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "uid", + "type": "INT UNSIGNED_10", + "chnname": "用户ID", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "province", + "type": "VARCHAR_32", + "chnname": "商户所在省", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "city", + "type": "VARCHAR_32", + "chnname": "商户所在市", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "district", + "type": "VARCHAR_32", + "chnname": "商户所在区", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "address", + "type": "VARCHAR_256", + "chnname": "商户详细地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "merchant_name", + "type": "VARCHAR_256", + "chnname": "商户名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "link_user", + "type": "VARCHAR_32", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "link_tel", + "type": "VARCHAR_16", + "chnname": "商户电话", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "charter", + "type": "VARCHAR_512", + "chnname": "商户证书", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "add_time", + "type": "INT UNSIGNED_10", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "apply_time", + "type": "INT UNSIGNED_10", + "chnname": "审核时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "success_time", + "type": "INT_10", + "chnname": "通过时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "fail_message", + "type": "VARCHAR_256", + "chnname": "未通过原因", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "fail_time", + "type": "INT UNSIGNED_10", + "chnname": "未通过时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "-1 审核未通过 0未审核 1审核通过", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_lock", + "type": "TINYINT UNSIGNED_1", + "chnname": "0 = 开启 1= 关闭", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否删除", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_system_user_task", + "chnname": "等级任务设置", + "fields": [ + { + "name": "id", + "type": "INT_10", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "任务名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_255", + "chnname": "配置原名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "task_type", + "type": "VARCHAR_50", + "chnname": "任务类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "number", + "type": "INT_10", + "chnname": "限定数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "level_id", + "type": "INT_10", + "chnname": "等级id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_show", + "type": "BIT_1", + "chnname": "是否显示", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_must", + "type": "BIT_1", + "chnname": "是否务必达成任务,1务必达成,0=满足其一", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "illustrate", + "type": "VARCHAR_255", + "chnname": "任务说明", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "新增时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_user", + "chnname": "用户表", + "fields": [ + { + "name": "uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "用户id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "username", + "type": "VARCHAR_255", + "chnname": "用户账户(跟accout一样)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "password", + "type": "VARCHAR_255", + "chnname": "用户密码(跟pwd)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "real_name", + "type": "VARCHAR_25", + "chnname": "真实姓名", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "birthday", + "type": "INT_10", + "chnname": "生日", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "card_id", + "type": "VARCHAR_20", + "chnname": "身份证号码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mark", + "type": "VARCHAR_255", + "chnname": "用户备注", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "partner_id", + "type": "INT_10", + "chnname": "合伙人id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "group_id", + "type": "INT_10", + "chnname": "用户分组id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "nickname", + "type": "VARCHAR_100", + "chnname": "用户昵称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "avatar", + "type": "VARCHAR_256", + "chnname": "用户头像", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "phone", + "type": "CHAR_15", + "chnname": "手机号码", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "add_ip", + "type": "VARCHAR_16", + "chnname": "添加ip", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "最后一次登录时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "last_ip", + "type": "VARCHAR_16", + "chnname": "最后一次登录ip", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "now_money", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "用户余额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "brokerage_price", + "type": "DECIMAL_8_2", + "chnname": "佣金金额", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "integral", + "type": "DECIMAL UNSIGNED_8_2", + "chnname": "用户剩余积分", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sign_num", + "type": "INT_10", + "chnname": "连续签到天数", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "BIT_1", + "chnname": "1为正常,0为禁止", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "level", + "type": "TINYINT UNSIGNED_3", + "chnname": "等级", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spread_uid", + "type": "BIGINT UNSIGNED_20", + "chnname": "推广元id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spread_time", + "type": "DATETIME", + "chnname": "推广员关联时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "user_type", + "type": "VARCHAR_32", + "chnname": "用户类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_promoter", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否为推广员", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "pay_count", + "type": "INT UNSIGNED_10", + "chnname": "用户购买次数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "spread_count", + "type": "INT_10", + "chnname": "下级人数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "addres", + "type": "VARCHAR_255", + "chnname": "详细地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "adminid", + "type": "INT UNSIGNED_10", + "chnname": "管理员编号 ", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "login_type", + "type": "VARCHAR_36", + "chnname": "用户登陆类型,h5,wechat,routine", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "wx_profile", + "type": "JSON", + "chnname": "微信用户json信息", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + } + }, + { + "name": "wechat", + "chnname": "微信模块", + "entities": [ + { + "title": "yx_wechat_reply", + "chnname": "微信关键字回复表", + "fields": [ + { + "name": "id", + "type": "MEDIUMINT UNSIGNED_8", + "chnname": "微信关键字回复id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "key", + "type": "VARCHAR_64", + "chnname": "关键字", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_32", + "chnname": "回复类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "data", + "type": "TEXT", + "chnname": "回复数据", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "0=不可用 1 =可用", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "hide", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否隐藏", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_wechat_menu", + "chnname": "微信缓存表", + "fields": [ + { + "name": "key", + "type": "VARCHAR_32", + "chnname": "", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "result", + "type": "TEXT", + "chnname": "缓存数据", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "add_time", + "type": "INT_10", + "chnname": "缓存时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_wechat_media", + "chnname": "微信回复表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "微信视频音频id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_16", + "chnname": "回复类型", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "path", + "type": "VARCHAR_128", + "chnname": "文件路径", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "media_id", + "type": "VARCHAR_64", + "chnname": "微信服务器返回的id", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_256", + "chnname": "地址", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "temporary", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否永久或者临时 0永久1临时", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "add_time", + "type": "INT UNSIGNED_10", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_article", + "chnname": "文章管理表", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "文章管理ID", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "cid", + "type": "VARCHAR_255", + "chnname": "分类id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "title", + "type": "VARCHAR_255", + "chnname": "文章标题", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "author", + "type": "VARCHAR_255", + "chnname": "文章作者", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "image_input", + "type": "VARCHAR_255", + "chnname": "文章图片", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "synopsis", + "type": "VARCHAR_255", + "chnname": "文章简介", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "content", + "type": "TEXT", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "share_title", + "type": "VARCHAR_255", + "chnname": "文章分享标题", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "share_synopsis", + "type": "VARCHAR_255", + "chnname": "文章分享简介", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "visit", + "type": "VARCHAR_255", + "chnname": "浏览次数", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "sort", + "type": "INT UNSIGNED_10", + "chnname": "排序", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_255", + "chnname": "原文链接", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT UNSIGNED_1", + "chnname": "状态", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "hide", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否隐藏", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "admin_id", + "type": "INT UNSIGNED_10", + "chnname": "管理员id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "mer_id", + "type": "INT UNSIGNED_10", + "chnname": "商户id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "INT_10", + "chnname": "产品关联id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_hot", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否热门(小程序)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_banner", + "type": "TINYINT UNSIGNED_1", + "chnname": "是否轮播图(小程序)", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_wechat_template", + "chnname": "微信模板", + "fields": [ + { + "name": "id", + "type": "INT UNSIGNED_10", + "chnname": "模板id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": true, + "defaultValue": "" + }, + { + "name": "tempkey", + "type": "CHAR_50", + "chnname": "模板编号", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "CHAR_100", + "chnname": "模板名", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "content", + "type": "VARCHAR_1000", + "chnname": "回复内容", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "tempid", + "type": "CHAR_100", + "chnname": "模板ID", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "update_time", + "type": "DATETIME", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "status", + "type": "TINYINT_3", + "chnname": "状态", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "VARCHAR_30", + "chnname": "类型:template:模板消息 subscribe:订阅消息", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_wechat_live_goods", + "chnname": "微信直播商品表", + "fields": [ + { + "name": "goods_id", + "type": "BIGINT_19", + "chnname": "直播商品id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "BIGINT_19", + "chnname": "关联商品id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cover_imge_url", + "type": "VARCHAR_255", + "chnname": "商品图片", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "url", + "type": "VARCHAR_64", + "chnname": "商品小程序路径", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price_type", + "type": "VARCHAR_255", + "chnname": "价格类型 1:一口价(只需要传入price,price2不传) 2:价格区间(price字段为左边界,price2字段为右边界,price和price2必传) 3:显示折扣价(price字段为原价,price2字段为现价, price和price2必传)", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price", + "type": "VARCHAR_64", + "chnname": "", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "price2", + "type": "VARCHAR_64", + "chnname": "", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "商品名称", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "third_party_tag", + "type": "VARCHAR_255", + "chnname": "1, 2:表示是为api添加商品,否则是直播控制台添加的商品", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "audit_id", + "type": "BIGINT_19", + "chnname": "审核单id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "audit_status", + "type": "INT UNSIGNED_10", + "chnname": "审核状态 0:未审核,1:审核中,2:审核通过,3审核失败", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + }, + { + "title": "yx_wechat_live", + "chnname": "微信直播表", + "fields": [ + { + "name": "room_id", + "type": "BIGINT_19", + "chnname": "直播间id", + "remark": "", + "pk": true, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "name", + "type": "VARCHAR_255", + "chnname": "直播间标题", + "remark": "", + "pk": false, + "notNull": true, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "cover_imge", + "type": "VARCHAR_255", + "chnname": "背景图", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "share_imge", + "type": "VARCHAR_255", + "chnname": "分享图片", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "live_status", + "type": "INT_10", + "chnname": "直播间状态", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "start_time", + "type": "BIGINT_19", + "chnname": "开始时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "end_time", + "type": "BIGINT_19", + "chnname": "预计结束时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "anchor_name", + "type": "VARCHAR_64", + "chnname": "主播昵称", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "anchor_wechat", + "type": "VARCHAR_32", + "chnname": "主播微信号", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "anchor_imge", + "type": "VARCHAR_255", + "chnname": "主播头像", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "type", + "type": "BIT_1", + "chnname": "直播间类型 1:推流 0:手机直播", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "screen_type", + "type": "BIT_1", + "chnname": "横屏、竖屏 【1:横屏,0:竖屏】", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "close_like", + "type": "BIT_1", + "chnname": "是否关闭点赞 【0:开启,1:关闭】", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "close_comment", + "type": "BIT_1", + "chnname": "是否关闭评论 【0:开启,1:关闭】", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "close_goods", + "type": "BIT_1", + "chnname": "是否关闭货架 【0:开启,1:关闭】", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "product_id", + "type": "VARCHAR_255", + "chnname": "商品id 多个,分割", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "close_replay", + "type": "BIT_1", + "chnname": "是否关闭回放【0:开启,1:关闭】", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "close_share", + "type": "BIT_1", + "chnname": "是否关闭分享【0:开启,1:关闭】", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "close_kf", + "type": "BIT_1", + "chnname": "是否关闭客服【0:开启,1:关闭】", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ] + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + }, + "associations": [] + }, + { + "name": "after_sales", + "chnname": "售后", + "entities": [ + { + "title": "yx_store_after_sales", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "remark": "", + "chnname": "", + "pk": true, + "notNull": true, + "autoIncrement": true + }, + { + "name": "order_code", + "type": "BIGINT UNSIGNED_20", + "remark": "", + "chnname": "订单号" + }, + { + "name": "refund_amount", + "type": "Money", + "remark": "", + "chnname": "退款金额" + }, + { + "name": "service_type", + "type": "YesNo", + "remark": "", + "chnname": "服务类型0仅退款1退货退款" + }, + { + "name": "reasons", + "type": "MiddleString", + "remark": "", + "chnname": "申请原因" + }, + { + "name": "explain", + "type": "LongText", + "remark": "", + "chnname": "说明" + }, + { + "name": "explain_img", + "type": "LongText", + "remark": "", + "chnname": "说明图片->多个用逗号分割" + }, + { + "name": "delivery_sn", + "type": "DefaultString", + "remark": "", + "chnname": "物流单号" + }, + { + "name": "delivery_name", + "type": "DefaultString", + "remark": "", + "chnname": "物流名称" + }, + { + "name": "state", + "type": "DefaultString", + "remark": "", + "chnname": "状态" + }, + { + "name": "create_time", + "type": "DATETIME", + "chnname": "添加时间", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "逻辑删除", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ], + "indexs": [], + "headers": [ + { + "fieldName": "chnname", + "relationNoShow": false + }, + { + "fieldName": "name", + "relationNoShow": false + }, + { + "fieldName": "type", + "relationNoShow": false + }, + { + "fieldName": "dataType", + "relationNoShow": true + }, + { + "fieldName": "remark", + "relationNoShow": true + }, + { + "fieldName": "pk", + "relationNoShow": false + }, + { + "fieldName": "notNull", + "relationNoShow": true + }, + { + "fieldName": "autoIncrement", + "relationNoShow": true + }, + { + "fieldName": "defaultValue", + "relationNoShow": true + }, + { + "fieldName": "relationNoShow", + "relationNoShow": true + }, + { + "fieldName": "uiHint", + "relationNoShow": true + } + ], + "chnname": "售后记录表" + }, + { + "title": "yx_store_after_sales_item", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "remark": "", + "chnname": "主键id", + "pk": true, + "notNull": true, + "autoIncrement": true + }, + { + "name": "store_after_sales_id", + "type": "BIGINT UNSIGNED_20", + "remark": "", + "chnname": "售后id" + }, + { + "name": "product_id", + "type": "BIGINT UNSIGNED_20", + "remark": "", + "chnname": "商品id" + }, + { + "name": "cart_info", + "type": "DefaultString", + "remark": "", + "chnname": "退货东西的详情信息" + }, + { + "name": "is_del", + "type": "BIT_1", + "chnname": "逻辑删除", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + } + ], + "indexs": [], + "headers": [ + { + "fieldName": "chnname", + "relationNoShow": false + }, + { + "fieldName": "name", + "relationNoShow": false + }, + { + "fieldName": "type", + "relationNoShow": false + }, + { + "fieldName": "dataType", + "relationNoShow": true + }, + { + "fieldName": "remark", + "relationNoShow": true + }, + { + "fieldName": "pk", + "relationNoShow": false + }, + { + "fieldName": "notNull", + "relationNoShow": true + }, + { + "fieldName": "autoIncrement", + "relationNoShow": true + }, + { + "fieldName": "defaultValue", + "relationNoShow": true + }, + { + "fieldName": "relationNoShow", + "relationNoShow": true + }, + { + "fieldName": "uiHint", + "relationNoShow": true + } + ], + "chnname": "售后子表" + }, + { + "title": "yx_store_after_sales_status", + "fields": [ + { + "name": "id", + "type": "BIGINT UNSIGNED_20", + "remark": "", + "chnname": "", + "pk": true, + "notNull": true, + "autoIncrement": true + }, + { + "name": "store_after_sales_id", + "type": "BIGINT UNSIGNED_20", + "chnname": "售后id", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "change_type", + "type": "DefaultString", + "chnname": "操作类型", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "change_message", + "type": "ShortString", + "chnname": "操作备注", + "remark": "", + "pk": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "" + }, + { + "name": "change_time", + "type": "DateTime", + "remark": "", + "chnname": "操作时间" + }, + { + "name": "operator", + "type": "DefaultString", + "remark": "", + "chnname": "操作人" + } + ], + "indexs": [], + "headers": [ + { + "fieldName": "chnname", + "relationNoShow": false + }, + { + "fieldName": "name", + "relationNoShow": false + }, + { + "fieldName": "type", + "relationNoShow": false + }, + { + "fieldName": "dataType", + "relationNoShow": true + }, + { + "fieldName": "remark", + "relationNoShow": true + }, + { + "fieldName": "pk", + "relationNoShow": false + }, + { + "fieldName": "notNull", + "relationNoShow": true + }, + { + "fieldName": "autoIncrement", + "relationNoShow": true + }, + { + "fieldName": "defaultValue", + "relationNoShow": true + }, + { + "fieldName": "relationNoShow", + "relationNoShow": true + }, + { + "fieldName": "uiHint", + "relationNoShow": true + } + ], + "chnname": "售后订单操作详情表" + } + ], + "graphCanvas": { + "nodes": [], + "edges": [] + }, + "associations": [] + } + ], + "dataTypeDomains": { + "datatype": [ + { + "name": "默认字串", + "code": "DefaultString", + "apply": { + "JAVA": { + "type": "String" + }, + "MYSQL": { + "type": "VARCHAR(32)" + }, + "ORACLE": { + "type": "NVARCHAR2(32)" + }, + "SQLServer": { + "type": "NVARCHAR(32)" + }, + "PostgreSQL": { + "type": "VARCHAR(32)" + } + } + }, + { + "name": "标识号", + "code": "IdOrKey", + "apply": { + "JAVA": { + "type": "String" + }, + "ORACLE": { + "type": "VARCHAR2(32)" + }, + "MYSQL": { + "type": "VARCHAR(32)" + }, + "SQLServer": { + "type": "VARCHAR(32)" + }, + "PostgreSQL": { + "type": "VARCHAR(32)" + } + } + }, + { + "name": "标识号-长", + "code": "LongKey", + "apply": { + "MYSQL": { + "type": "VARCHAR(64)" + }, + "ORACLE": { + "type": "VARCHAR2(64)" + }, + "JAVA": { + "type": "String" + }, + "SQLServer": { + "type": "VARCHAR(64)" + }, + "PostgreSQL": { + "type": "VARCHAR(64)" + } + } + }, + { + "name": "名称", + "code": "Name", + "apply": { + "JAVA": { + "type": "String" + }, + "MYSQL": { + "type": "VARCHAR(128)" + }, + "ORACLE": { + "type": "NVARCHAR2(128)" + }, + "SQLServer": { + "type": "NVARCHAR(128)" + }, + "PostgreSQL": { + "type": "VARCHAR(128)" + } + } + }, + { + "name": "备注说明", + "code": "Intro", + "apply": { + "JAVA": { + "type": "String" + }, + "MYSQL": { + "type": "VARCHAR(512)" + }, + "ORACLE": { + "type": "NVARCHAR2(512)" + }, + "SQLServer": { + "type": "NVARCHAR(512)" + }, + "PostgreSQL": { + "type": "VARCHAR(512)" + } + } + }, + { + "name": "字串-短", + "code": "ShortString", + "apply": { + "JAVA": { + "type": "String" + }, + "MYSQL": { + "type": "VARCHAR(128)" + }, + "ORACLE": { + "type": "NVARCHAR2(128)" + }, + "SQLServer": { + "type": "NVARCHAR(128)" + }, + "PostgreSQL": { + "type": "VARCHAR(128)" + } + } + }, + { + "name": "字串-中", + "code": "MiddleString", + "apply": { + "JAVA": { + "type": "String" + }, + "MYSQL": { + "type": "VARCHAR(1024)" + }, + "ORACLE": { + "type": "NVARCHAR2(1024)" + }, + "SQLServer": { + "type": "NVARCHAR(1024)" + }, + "PostgreSQL": { + "type": "VARCHAR(1024)" + } + } + }, + { + "name": "字串-长", + "code": "LongString", + "apply": { + "JAVA": { + "type": "String" + }, + "ORACLE": { + "type": "NVARCHAR2(3072)" + }, + "MYSQL": { + "type": "VARCHAR(3072)" + }, + "SQLServer": { + "type": "NVARCHAR(3072)" + }, + "PostgreSQL": { + "type": "VARCHAR(3072)" + } + } + }, + { + "name": "大文本", + "code": "LongText", + "apply": { + "JAVA": { + "type": "String" + }, + "MYSQL": { + "type": "TEXT" + }, + "ORACLE": { + "type": "CLOB" + }, + "SQLServer": { + "type": "NTEXT" + }, + "PostgreSQL": { + "type": "TEXT" + } + } + }, + { + "name": "小数", + "code": "Double", + "apply": { + "JAVA": { + "type": "Double" + }, + "MYSQL": { + "type": "DECIMAL(32,10)" + }, + "ORACLE": { + "type": "NUMBER(32,10)" + }, + "SQLServer": { + "type": "DECIMAL(32,10)" + }, + "PostgreSQL": { + "type": "DECIMAL(32,10)" + } + } + }, + { + "name": "比例", + "code": "Ratio", + "apply": { + "MYSQL": { + "type": "DECIMAL(4,2)" + }, + "JAVA": { + "type": "Double" + }, + "ORACLE": { + "type": "NUMBER(4,2)" + }, + "SQLServer": { + "type": "DECIMAL(4,2)" + }, + "PostgreSQL": { + "type": "DECIMAL(4,2)" + } + } + }, + { + "name": "整数", + "code": "Integer", + "apply": { + "JAVA": { + "type": "Integer" + }, + "MYSQL": { + "type": "INT" + }, + "ORACLE": { + "type": "INT" + }, + "SQLServer": { + "type": "INT" + }, + "PostgreSQL": { + "type": "INT" + } + } + }, + { + "name": "大整数", + "code": "BigInt", + "apply": { + "MYSQL": { + "type": "BIGINT" + }, + "JAVA": { + "type": "Long" + }, + "ORACLE": { + "type": "NUMBER" + }, + "SQLServer": { + "type": "BIGINT" + }, + "PostgreSQL": { + "type": "BIGINT" + } + } + }, + { + "name": "金额", + "code": "Money", + "apply": { + "JAVA": { + "type": "Double" + }, + "MYSQL": { + "type": "DECIMAL(32,8)" + }, + "ORACLE": { + "type": "NUMBER(32,8)" + }, + "SQLServer": { + "type": "DECIMAL(32,8)" + }, + "PostgreSQL": { + "type": "DECIMAL(32,8)" + } + } + }, + { + "name": "是否", + "code": "YesNo", + "apply": { + "JAVA": { + "type": "String" + }, + "MYSQL": { + "type": "VARCHAR(1)" + }, + "ORACLE": { + "type": "VARCHAR2(1)" + }, + "SQLServer": { + "type": "VARCHAR(1)" + }, + "PostgreSQL": { + "type": "VARCHAR(1)" + } + } + }, + { + "name": "数据字典", + "code": "Dict", + "apply": { + "JAVA": { + "type": "String" + }, + "MYSQL": { + "type": "VARCHAR(32)" + }, + "ORACLE": { + "type": "VARCHAR2(32)" + }, + "SQLServer": { + "type": "VARCHAR(32)" + }, + "PostgreSQL": { + "type": "VARCHAR(32)" + } + } + }, + { + "name": "日期", + "code": "Date", + "apply": { + "JAVA": { + "type": "Date" + }, + "MYSQL": { + "type": "DATE" + }, + "ORACLE": { + "type": "DATE" + }, + "SQLServer": { + "type": "DATE" + }, + "PostgreSQL": { + "type": "DATE" + } + } + }, + { + "name": "日期时间", + "code": "DateTime", + "apply": { + "JAVA": { + "type": "Date" + }, + "MYSQL": { + "type": "DATETIME" + }, + "ORACLE": { + "type": "DATE" + }, + "SQLServer": { + "type": "DATE" + }, + "PostgreSQL": { + "type": "DATE" + } + } + }, + { + "name": "单字符", + "code": "Char", + "apply": { + "MYSQL": { + "type": "CHAR(1)" + }, + "ORACLE": { + "type": "CHAR(1)" + }, + "JAVA": { + "type": "String" + }, + "SQLServer": { + "type": "CHAR(1)" + }, + "PostgreSQL": { + "type": "CHAR(1)" + } + } + }, + { + "name": "BIGINT UNSIGNED_20", + "code": "BIGINT UNSIGNED_20", + "apply": { + "MYSQL": { + "type": "BIGINT UNSIGNED(20)" + } + } + }, + { + "name": "BIGINT_19", + "code": "BIGINT_19", + "apply": { + "MYSQL": { + "type": "BIGINT(19)" + } + } + }, + { + "name": "BIT_1", + "code": "BIT_1", + "apply": { + "MYSQL": { + "type": "BIT(1)" + } + } + }, + { + "name": "CHAR_100", + "code": "CHAR_100", + "apply": { + "MYSQL": { + "type": "CHAR(100)" + } + } + }, + { + "name": "CHAR_15", + "code": "CHAR_15", + "apply": { + "MYSQL": { + "type": "CHAR(15)" + } + } + }, + { + "name": "CHAR_2", + "code": "CHAR_2", + "apply": { + "MYSQL": { + "type": "CHAR(2)" + } + } + }, + { + "name": "CHAR_25", + "code": "CHAR_25", + "apply": { + "MYSQL": { + "type": "CHAR(25)" + } + } + }, + { + "name": "CHAR_30", + "code": "CHAR_30", + "apply": { + "MYSQL": { + "type": "CHAR(30)" + } + } + }, + { + "name": "CHAR_32", + "code": "CHAR_32", + "apply": { + "MYSQL": { + "type": "CHAR(32)" + } + } + }, + { + "name": "CHAR_50", + "code": "CHAR_50", + "apply": { + "MYSQL": { + "type": "CHAR(50)" + } + } + }, + { + "name": "DATE", + "code": "DATE", + "apply": { + "MYSQL": { + "type": "DATE" + } + } + }, + { + "name": "DATETIME", + "code": "DATETIME", + "apply": { + "MYSQL": { + "type": "DATETIME" + } + } + }, + { + "name": "DECIMAL UNSIGNED_10_2", + "code": "DECIMAL UNSIGNED_10_2", + "apply": { + "MYSQL": { + "type": "DECIMAL UNSIGNED(10,2)" + } + } + }, + { + "name": "DECIMAL UNSIGNED_8_2", + "code": "DECIMAL UNSIGNED_8_2", + "apply": { + "MYSQL": { + "type": "DECIMAL UNSIGNED(8,2)" + } + } + }, + { + "name": "DECIMAL_10_2", + "code": "DECIMAL_10_2", + "apply": { + "MYSQL": { + "type": "DECIMAL(10,2)" + } + } + }, + { + "name": "DECIMAL_8_2", + "code": "DECIMAL_8_2", + "apply": { + "MYSQL": { + "type": "DECIMAL(8,2)" + } + } + }, + { + "name": "DOUBLE_22", + "code": "DOUBLE_22", + "apply": { + "MYSQL": { + "type": "DOUBLE(22)" + } + } + }, + { + "name": "INT UNSIGNED_10", + "code": "INT UNSIGNED_10", + "apply": { + "MYSQL": { + "type": "INT UNSIGNED(10)" + } + } + }, + { + "name": "INT_10", + "code": "INT_10", + "apply": { + "MYSQL": { + "type": "INT(10)" + } + } + }, + { + "name": "JSON", + "code": "JSON", + "apply": { + "MYSQL": { + "type": "JSON" + } + } + }, + { + "name": "MEDIUMINT UNSIGNED_8", + "code": "MEDIUMINT UNSIGNED_8", + "apply": { + "MYSQL": { + "type": "MEDIUMINT UNSIGNED(8)" + } + } + }, + { + "name": "MEDIUMINT_7", + "code": "MEDIUMINT_7", + "apply": { + "MYSQL": { + "type": "MEDIUMINT(7)" + } + } + }, + { + "name": "SMALLINT UNSIGNED_5", + "code": "SMALLINT UNSIGNED_5", + "apply": { + "MYSQL": { + "type": "SMALLINT UNSIGNED(5)" + } + } + }, + { + "name": "SMALLINT_5", + "code": "SMALLINT_5", + "apply": { + "MYSQL": { + "type": "SMALLINT(5)" + } + } + }, + { + "name": "TEXT", + "code": "TEXT", + "apply": { + "MYSQL": { + "type": "TEXT" + } + } + }, + { + "name": "TINYINT UNSIGNED_1", + "code": "TINYINT UNSIGNED_1", + "apply": { + "MYSQL": { + "type": "TINYINT UNSIGNED(1)" + } + } + }, + { + "name": "TINYINT UNSIGNED_3", + "code": "TINYINT UNSIGNED_3", + "apply": { + "MYSQL": { + "type": "TINYINT UNSIGNED(3)" + } + } + }, + { + "name": "TINYINT_3", + "code": "TINYINT_3", + "apply": { + "MYSQL": { + "type": "TINYINT(3)" + } + } + }, + { + "name": "VARCHAR_100", + "code": "VARCHAR_100", + "apply": { + "MYSQL": { + "type": "VARCHAR(100)" + } + } + }, + { + "name": "VARCHAR_1000", + "code": "VARCHAR_1000", + "apply": { + "MYSQL": { + "type": "VARCHAR(1000)" + } + } + }, + { + "name": "VARCHAR_128", + "code": "VARCHAR_128", + "apply": { + "MYSQL": { + "type": "VARCHAR(128)" + } + } + }, + { + "name": "VARCHAR_15", + "code": "VARCHAR_15", + "apply": { + "MYSQL": { + "type": "VARCHAR(15)" + } + } + }, + { + "name": "VARCHAR_150", + "code": "VARCHAR_150", + "apply": { + "MYSQL": { + "type": "VARCHAR(150)" + } + } + }, + { + "name": "VARCHAR_16", + "code": "VARCHAR_16", + "apply": { + "MYSQL": { + "type": "VARCHAR(16)" + } + } + }, + { + "name": "VARCHAR_18", + "code": "VARCHAR_18", + "apply": { + "MYSQL": { + "type": "VARCHAR(18)" + } + } + }, + { + "name": "VARCHAR_20", + "code": "VARCHAR_20", + "apply": { + "MYSQL": { + "type": "VARCHAR(20)" + } + } + }, + { + "name": "VARCHAR_200", + "code": "VARCHAR_200", + "apply": { + "MYSQL": { + "type": "VARCHAR(200)" + } + } + }, + { + "name": "VARCHAR_2000", + "code": "VARCHAR_2000", + "apply": { + "MYSQL": { + "type": "VARCHAR(2000)" + } + } + }, + { + "name": "VARCHAR_25", + "code": "VARCHAR_25", + "apply": { + "MYSQL": { + "type": "VARCHAR(25)" + } + } + }, + { + "name": "VARCHAR_255", + "code": "VARCHAR_255", + "apply": { + "MYSQL": { + "type": "VARCHAR(255)" + } + } + }, + { + "name": "VARCHAR_256", + "code": "VARCHAR_256", + "apply": { + "MYSQL": { + "type": "VARCHAR(256)" + } + } + }, + { + "name": "VARCHAR_30", + "code": "VARCHAR_30", + "apply": { + "MYSQL": { + "type": "VARCHAR(30)" + } + } + }, + { + "name": "VARCHAR_300", + "code": "VARCHAR_300", + "apply": { + "MYSQL": { + "type": "VARCHAR(300)" + } + } + }, + { + "name": "VARCHAR_32", + "code": "VARCHAR_32", + "apply": { + "MYSQL": { + "type": "VARCHAR(32)" + } + } + }, + { + "name": "VARCHAR_36", + "code": "VARCHAR_36", + "apply": { + "MYSQL": { + "type": "VARCHAR(36)" + } + } + }, + { + "name": "VARCHAR_50", + "code": "VARCHAR_50", + "apply": { + "MYSQL": { + "type": "VARCHAR(50)" + } + } + }, + { + "name": "VARCHAR_500", + "code": "VARCHAR_500", + "apply": { + "MYSQL": { + "type": "VARCHAR(500)" + } + } + }, + { + "name": "VARCHAR_5000", + "code": "VARCHAR_5000", + "apply": { + "MYSQL": { + "type": "VARCHAR(5000)" + } + } + }, + { + "name": "VARCHAR_512", + "code": "VARCHAR_512", + "apply": { + "MYSQL": { + "type": "VARCHAR(512)" + } + } + }, + { + "name": "VARCHAR_64", + "code": "VARCHAR_64", + "apply": { + "MYSQL": { + "type": "VARCHAR(64)" + } + } + } + ], + "database": [ + { + "code": "MYSQL", + "template": "DROP TABLE {{=it.entity.title}};\n$blankline\nCREATE TABLE {{=it.entity.title}}(\n{{ pkList = [] ; }}\n{{~it.entity.fields:field:index}}\n {{? field.pk }}{{ pkList.push(field.name) }}{{?}}\n {{=field.name}} {{=field.type}} {{= field.pk ? 'NOT NULL' : '' }} COMMENT '{{=it.func.join(field.chnname,field.remark,';')}}' {{= index < it.entity.fields.length-1 ? ',' : ( pkList.length>0 ? ',' :'' ) }}\n{{~}}\n{{? pkList.length >0 }}\n PRIMARY KEY ({{~pkList:pkName:i}}{{= pkName }}{{= i0 ? ',' :'' ) }}\n{{~}}\n{{? pkList.length >0 }}\n PRIMARY KEY ({{~pkList:pkName:i}}{{= pkName }}{{= i0 ? ',' :'' ) }}\n{{~}}\n{{? pkList.length >0 }}\n PRIMARY KEY ({{~pkList:pkName:i}}{{= pkName }}{{= i0 ? ',' :'' ) }}\n{{~}}\n{{? pkList.length >0 }}\n PRIMARY KEY ({{~pkList:pkName:i}}{{= pkName }}{{= i0 ? ',' :'' ) }}\n{{~}}\n{{? pkList.length >0 }}\n PRIMARY KEY ({{~pkList:pkName:i}}{{= pkName }}{{= i0 ? ',' :'' ) }}\n{{~}}{{? pkList.length >0 }} PRIMARY KEY ({{~pkList:pkName:i}}{{= pkName }}{{= i0 ? ',' :'' ) }}\n{{~}}\n{{? pkList.length >0 }}\n CONSTRAINT PK_{{=it.entity.title}} PRIMARY KEY CLUSTERED ({{~pkList:pkName:i}}{{= pkName }} ASC {{= i0 ? ',' :'' ) }}\n{{~}}\n{{? pkList.length >0 }}\n PRIMARY KEY ({{~pkList:pkName:i}}{{= pkName }}{{= i0 ? ',' :'' ) }}\n{{~}}\n{{? pkList.length >0 }}\n PRIMARY KEY ({{~pkList:pkName:i}}{{= pkName }}{{= i0 ? ',' :'' ) }}\n{{~}}\n{{? pkList.length >0 }}\n PRIMARY KEY ({{~pkList:pkName:i}}{{= pkName }}{{= i多个用逗号分割', + `shipper_code` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT '物流公司编码', + `delivery_sn` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '物流单号', + `delivery_name` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '物流名称', + `state` tinyint(1) DEFAULT NULL COMMENT '状态 0已提交等待平台审核 1平台已审核 等待用户发货/退款 2 用户已发货 3退款成功', + `sales_state` tinyint(1) DEFAULT NULL COMMENT '售后状态-0正常1用户取消2商家拒绝', + `create_time` datetime DEFAULT NULL COMMENT '添加时间', + `is_del` tinyint(1) DEFAULT NULL COMMENT '逻辑删除', + `user_id` bigint(20) DEFAULT NULL COMMENT '用户id', + `consignee` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT '商家收货人', + `phone_number` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT '商家手机号', + `address` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT '商家地址', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='售后记录表'; + + +DROP TABLE IF EXISTS `alipay_config`; +CREATE TABLE `alipay_config` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', + `app_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '应用ID', + `charset` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '编码', + `format` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型 固定格式json', + `gateway_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '网关地址', + `notify_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '异步回调', + `private_key` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '私钥', + `public_key` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '公钥', + `return_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '回调地址', + `sign_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '签名方式', + `sys_service_provider_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商户号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '支付宝配置类' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of alipay_config +-- ---------------------------- +INSERT INTO `alipay_config` VALUES (1, '2016091700532697', 'utf-8', 'JSON', 'https://openapi.alipaydev.com/gateway.do', 'http://api.auauz.net/api/aliPay/notify', 'MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC5js8sInU10AJ0cAQ8UMMyXrQ+oHZEkVt5lBwsStmTJ7YikVYgbskx1YYEXTojRsWCb+SH/kDmDU4pK/u91SJ4KFCRMF2411piYuXU/jF96zKrADznYh/zAraqT6hvAIVtQAlMHN53nx16rLzZ/8jDEkaSwT7+HvHiS+7sxSojnu/3oV7BtgISoUNstmSe8WpWHOaWv19xyS+Mce9MY4BfseFhzTICUymUQdd/8hXA28/H6osUfAgsnxAKv7Wil3aJSgaJczWuflYOve0dJ3InZkhw5Cvr0atwpk8YKBQjy5CdkoHqvkOcIB+cYHXJKzOE5tqU7inSwVbHzOLQ3XbnAgMBAAECggEAVJp5eT0Ixg1eYSqFs9568WdetUNCSUchNxDBu6wxAbhUgfRUGZuJnnAll63OCTGGck+EGkFh48JjRcBpGoeoHLL88QXlZZbC/iLrea6gcDIhuvfzzOffe1RcZtDFEj9hlotg8dQj1tS0gy9pN9g4+EBH7zeu+fyv+qb2e/v1l6FkISXUjpkD7RLQr3ykjiiEw9BpeKb7j5s7Kdx1NNIzhkcQKNqlk8JrTGDNInbDM6inZfwwIO2R1DHinwdfKWkvOTODTYa2MoAvVMFT9Bec9FbLpoWp7ogv1JMV9svgrcF9XLzANZ/OQvkbe9TV9GWYvIbxN6qwQioKCWO4GPnCAQKBgQDgW5MgfhX8yjXqoaUy/d1VjI8dHeIyw8d+OBAYwaxRSlCfyQ+tieWcR2HdTzPca0T0GkWcKZm0ei5xRURgxt4DUDLXNh26HG0qObbtLJdu/AuBUuCqgOiLqJ2f1uIbrz6OZUHns+bT/jGW2Ws8+C13zTCZkZt9CaQsrp3QOGDx5wKBgQDTul39hp3ZPwGNFeZdkGoUoViOSd5Lhowd5wYMGAEXWRLlU8z+smT5v0POz9JnIbCRchIY2FAPKRdVTICzmPk2EPJFxYTcwaNbVqL6lN7J2IlXXMiit5QbiLauo55w7plwV6LQmKm9KV7JsZs5XwqF7CEovI7GevFzyD3w+uizAQKBgC3LY1eRhOlpWOIAhpjG6qOoohmeXOphvdmMlfSHq6WYFqbWwmV4rS5d/6LNpNdL6fItXqIGd8I34jzql49taCmi+A2nlR/E559j0mvM20gjGDIYeZUz5MOE8k+K6/IcrhcgofgqZ2ZED1ksHdB/E8DNWCswZl16V1FrfvjeWSNnAoGAMrBplCrIW5xz+J0Hm9rZKrs+AkK5D4fUv8vxbK/KgxZ2KaUYbNm0xv39c+PZUYuFRCz1HDGdaSPDTE6WeWjkMQd5mS6ikl9hhpqFRkyh0d0fdGToO9yLftQKOGE/q3XUEktI1XvXF0xyPwNgUCnq0QkpHyGVZPtGFxwXiDvpvgECgYA5PoB+nY8iDiRaJNko9w0hL4AeKogwf+4TbCw+KWVEn6jhuJa4LFTdSqp89PktQaoVpwv92el/AhYjWOl/jVCm122f9b7GyoelbjMNolToDwe5pF5RnSpEuDdLy9MfE8LnE3PlbE7E5BipQ3UjSebkgNboLHH/lNZA5qvEtvbfvQ==', 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAut9evKRuHJ/2QNfDlLwvN/S8l9hRAgPbb0u61bm4AtzaTGsLeMtScetxTWJnVvAVpMS9luhEJjt+Sbk5TNLArsgzzwARgaTKOLMT1TvWAK5EbHyI+eSrc3s7Awe1VYGwcubRFWDm16eQLv0k7iqiw+4mweHSz/wWyvBJVgwLoQ02btVtAQErCfSJCOmt0Q/oJQjj08YNRV4EKzB19+f5A+HQVAKy72dSybTzAK+3FPtTtNen/+b5wGeat7c32dhYHnGorPkPeXLtsqqUTp1su5fMfd4lElNdZaoCI7osZxWWUo17vBCZnyeXc9fk0qwD9mK6yRAxNbrY72Xx5VqIqwIDAQAB', 'http://api.auauz.net/api/aliPay/return', 'RSA2', '2088102176044281'); + +-- ---------------------------- +-- Table structure for column_config +-- ---------------------------- +DROP TABLE IF EXISTS `column_config`; +CREATE TABLE `column_config` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `table_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `column_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `column_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `dict_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `extra` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `form_show` bit(1) NULL DEFAULT NULL, + `form_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `key_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `list_show` bit(1) NULL DEFAULT NULL, + `not_null` bit(1) NULL DEFAULT NULL, + `query_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `date_annotation` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 386 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '代码生成字段信息存储' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of column_config +-- ---------------------------- +INSERT INTO `column_config` VALUES (1, 'gen_test', 'id', 'int', NULL, 'auto_increment', b'0', NULL, 'PRI', b'0', b'1', NULL, 'ID', NULL); +INSERT INTO `column_config` VALUES (2, 'gen_test', 'sex', 'int', NULL, '', b'1', NULL, '', b'1', b'0', 'NotNull', '性别', NULL); +INSERT INTO `column_config` VALUES (3, 'gen_test', 'create_time', 'datetime', NULL, '', b'0', NULL, '', b'1', b'0', 'BetWeen', '', NULL); +INSERT INTO `column_config` VALUES (139, 'users_roles', 'user_id', 'bigint', NULL, '', b'1', NULL, 'PRI', b'1', b'1', NULL, '用户ID', NULL); +INSERT INTO `column_config` VALUES (140, 'users_roles', 'role_id', 'bigint', NULL, '', b'1', NULL, 'PRI', b'1', b'1', NULL, '角色ID', NULL); +INSERT INTO `column_config` VALUES (141, 'user_avatar', 'id', 'bigint', NULL, 'auto_increment', b'1', NULL, 'PRI', b'1', b'0', NULL, '', NULL); +INSERT INTO `column_config` VALUES (142, 'user_avatar', 'real_name', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '真实文件名', NULL); +INSERT INTO `column_config` VALUES (143, 'user_avatar', 'path', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '路径', NULL); +INSERT INTO `column_config` VALUES (144, 'user_avatar', 'size', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '大小', NULL); +INSERT INTO `column_config` VALUES (145, 'user_avatar', 'create_time', 'datetime', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '创建时间', NULL); +INSERT INTO `column_config` VALUES (146, 'yx_material_group', 'id', 'varchar', NULL, '', b'1', NULL, 'PRI', b'1', b'1', NULL, 'PK', NULL); +INSERT INTO `column_config` VALUES (147, 'yx_material_group', 'user_id', 'varchar', NULL, '', b'1', NULL, 'MUL', b'1', b'1', NULL, '所属租户', NULL); +INSERT INTO `column_config` VALUES (148, 'yx_material_group', 'del_flag', 'char', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '逻辑删除标记(0:显示;1:隐藏)', NULL); +INSERT INTO `column_config` VALUES (149, 'yx_material_group', 'create_time', 'datetime', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '创建时间', NULL); +INSERT INTO `column_config` VALUES (150, 'yx_material_group', 'update_time', 'timestamp', NULL, 'on update CURRENT_TIMESTAMP', b'1', NULL, '', b'1', b'1', NULL, '最后更新时间', NULL); +INSERT INTO `column_config` VALUES (151, 'yx_material_group', 'create_id', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '创建者ID', NULL); +INSERT INTO `column_config` VALUES (152, 'yx_material_group', 'name', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '分组名', NULL); +INSERT INTO `column_config` VALUES (153, 'yx_material', 'id', 'varchar', NULL, '', b'1', NULL, 'PRI', b'1', b'1', NULL, 'PK', NULL); +INSERT INTO `column_config` VALUES (154, 'yx_material', 'user_id', 'varchar', NULL, '', b'1', NULL, 'MUL', b'1', b'1', NULL, '所属租户', NULL); +INSERT INTO `column_config` VALUES (155, 'yx_material', 'del_flag', 'char', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '逻辑删除标记(0:显示;1:隐藏)', NULL); +INSERT INTO `column_config` VALUES (156, 'yx_material', 'create_time', 'datetime', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '创建时间', NULL); +INSERT INTO `column_config` VALUES (157, 'yx_material', 'update_time', 'timestamp', NULL, 'on update CURRENT_TIMESTAMP', b'1', NULL, '', b'1', b'1', NULL, '最后更新时间', NULL); +INSERT INTO `column_config` VALUES (158, 'yx_material', 'create_id', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '创建者ID', NULL); +INSERT INTO `column_config` VALUES (159, 'yx_material', 'type', 'char', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '类型1、图片;2、视频', NULL); +INSERT INTO `column_config` VALUES (160, 'yx_material', 'group_id', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '分组ID', NULL); +INSERT INTO `column_config` VALUES (161, 'yx_material', 'name', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '素材名', NULL); +INSERT INTO `column_config` VALUES (162, 'yx_material', 'url', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '素材链接', NULL); +INSERT INTO `column_config` VALUES (163, 'yx_user', 'uid', 'int', NULL, 'auto_increment', b'1', NULL, 'PRI', b'1', b'0', NULL, '用户id', NULL); +INSERT INTO `column_config` VALUES (164, 'yx_user', 'username', 'varchar', NULL, '', b'1', NULL, 'MUL', b'1', b'0', NULL, '用户账户(跟accout一样)', NULL); +INSERT INTO `column_config` VALUES (165, 'yx_user', 'account', 'varchar', NULL, '', b'1', NULL, 'MUL', b'1', b'1', NULL, '用户账号', NULL); +INSERT INTO `column_config` VALUES (166, 'yx_user', 'password', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '用户密码(跟pwd)', NULL); +INSERT INTO `column_config` VALUES (167, 'yx_user', 'pwd', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '用户密码', NULL); +INSERT INTO `column_config` VALUES (168, 'yx_user', 'real_name', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '真实姓名', NULL); +INSERT INTO `column_config` VALUES (169, 'yx_user', 'birthday', 'int', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '生日', NULL); +INSERT INTO `column_config` VALUES (170, 'yx_user', 'card_id', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '身份证号码', NULL); +INSERT INTO `column_config` VALUES (171, 'yx_user', 'mark', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '用户备注', NULL); +INSERT INTO `column_config` VALUES (172, 'yx_user', 'partner_id', 'int', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '合伙人id', NULL); +INSERT INTO `column_config` VALUES (173, 'yx_user', 'group_id', 'int', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '用户分组id', NULL); +INSERT INTO `column_config` VALUES (174, 'yx_user', 'nickname', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '用户昵称', NULL); +INSERT INTO `column_config` VALUES (175, 'yx_user', 'avatar', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '用户头像', NULL); +INSERT INTO `column_config` VALUES (176, 'yx_user', 'phone', 'char', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '手机号码', NULL); +INSERT INTO `column_config` VALUES (177, 'yx_user', 'add_time', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '添加时间', NULL); +INSERT INTO `column_config` VALUES (178, 'yx_user', 'add_ip', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '添加ip', NULL); +INSERT INTO `column_config` VALUES (179, 'yx_user', 'last_time', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '最后一次登录时间', NULL); +INSERT INTO `column_config` VALUES (180, 'yx_user', 'last_ip', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '最后一次登录ip', NULL); +INSERT INTO `column_config` VALUES (181, 'yx_user', 'now_money', 'decimal', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '用户余额', NULL); +INSERT INTO `column_config` VALUES (182, 'yx_user', 'brokerage_price', 'decimal', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '佣金金额', NULL); +INSERT INTO `column_config` VALUES (183, 'yx_user', 'integral', 'decimal', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '用户剩余积分', NULL); +INSERT INTO `column_config` VALUES (184, 'yx_user', 'sign_num', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '连续签到天数', NULL); +INSERT INTO `column_config` VALUES (185, 'yx_user', 'status', 'tinyint', NULL, '', b'1', NULL, 'MUL', b'1', b'1', NULL, '1为正常,0为禁止', NULL); +INSERT INTO `column_config` VALUES (186, 'yx_user', 'level', 'tinyint', NULL, '', b'1', NULL, 'MUL', b'1', b'1', NULL, '等级', NULL); +INSERT INTO `column_config` VALUES (187, 'yx_user', 'spread_uid', 'int', NULL, '', b'1', NULL, 'MUL', b'1', b'1', NULL, '推广元id', NULL); +INSERT INTO `column_config` VALUES (188, 'yx_user', 'spread_time', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '推广员关联时间', NULL); +INSERT INTO `column_config` VALUES (189, 'yx_user', 'user_type', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '用户类型', NULL); +INSERT INTO `column_config` VALUES (190, 'yx_user', 'is_promoter', 'tinyint', NULL, '', b'1', NULL, 'MUL', b'1', b'1', NULL, '是否为推广员', NULL); +INSERT INTO `column_config` VALUES (191, 'yx_user', 'pay_count', 'int', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '用户购买次数', NULL); +INSERT INTO `column_config` VALUES (192, 'yx_user', 'spread_count', 'int', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '下级人数', NULL); +INSERT INTO `column_config` VALUES (193, 'yx_user', 'clean_time', 'int', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '清理会员时间', NULL); +INSERT INTO `column_config` VALUES (194, 'yx_user', 'addres', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '详细地址', NULL); +INSERT INTO `column_config` VALUES (195, 'yx_user', 'adminid', 'int', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '管理员编号 ', NULL); +INSERT INTO `column_config` VALUES (196, 'yx_user', 'login_type', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '用户登陆类型,h5,wechat,routine', NULL); +INSERT INTO `column_config` VALUES (197, 'yx_wechat_media', 'id', 'int', NULL, 'auto_increment', b'1', NULL, 'PRI', b'1', b'0', NULL, '微信视频音频id', NULL); +INSERT INTO `column_config` VALUES (198, 'yx_wechat_media', 'type', 'varchar', NULL, '', b'1', NULL, 'MUL', b'1', b'1', NULL, '回复类型', NULL); +INSERT INTO `column_config` VALUES (199, 'yx_wechat_media', 'path', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '文件路径', NULL); +INSERT INTO `column_config` VALUES (200, 'yx_wechat_media', 'media_id', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '微信服务器返回的id', NULL); +INSERT INTO `column_config` VALUES (201, 'yx_wechat_media', 'url', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '地址', NULL); +INSERT INTO `column_config` VALUES (202, 'yx_wechat_media', 'temporary', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '是否永久或者临时 0永久1临时', NULL); +INSERT INTO `column_config` VALUES (203, 'yx_wechat_media', 'add_time', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '添加时间', NULL); +INSERT INTO `column_config` VALUES (204, 'yx_store_order', 'id', 'int', NULL, 'auto_increment', b'1', NULL, 'PRI', b'1', b'0', NULL, '订单ID', NULL); +INSERT INTO `column_config` VALUES (205, 'yx_store_order', 'order_id', 'varchar', NULL, '', b'1', NULL, 'MUL', b'1', b'1', NULL, '订单号', NULL); +INSERT INTO `column_config` VALUES (206, 'yx_store_order', 'extend_order_id', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '额外订单号', NULL); +INSERT INTO `column_config` VALUES (207, 'yx_store_order', 'uid', 'int', NULL, '', b'1', NULL, 'MUL', b'1', b'1', NULL, '用户id', NULL); +INSERT INTO `column_config` VALUES (208, 'yx_store_order', 'real_name', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '用户姓名', NULL); +INSERT INTO `column_config` VALUES (209, 'yx_store_order', 'user_phone', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '用户电话', NULL); +INSERT INTO `column_config` VALUES (210, 'yx_store_order', 'user_address', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '详细地址', NULL); +INSERT INTO `column_config` VALUES (211, 'yx_store_order', 'cart_id', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '购物车id', NULL); +INSERT INTO `column_config` VALUES (212, 'yx_store_order', 'freight_price', 'decimal', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '运费金额', NULL); +INSERT INTO `column_config` VALUES (213, 'yx_store_order', 'total_num', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '订单商品总数', NULL); +INSERT INTO `column_config` VALUES (214, 'yx_store_order', 'total_price', 'decimal', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '订单总价', NULL); +INSERT INTO `column_config` VALUES (215, 'yx_store_order', 'total_postage', 'decimal', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '邮费', NULL); +INSERT INTO `column_config` VALUES (216, 'yx_store_order', 'pay_price', 'decimal', NULL, '', b'1', NULL, 'MUL', b'1', b'1', NULL, '实际支付金额', NULL); +INSERT INTO `column_config` VALUES (217, 'yx_store_order', 'pay_postage', 'decimal', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '支付邮费', NULL); +INSERT INTO `column_config` VALUES (218, 'yx_store_order', 'deduction_price', 'decimal', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '抵扣金额', NULL); +INSERT INTO `column_config` VALUES (219, 'yx_store_order', 'coupon_id', 'int', NULL, '', b'1', NULL, 'MUL', b'1', b'1', NULL, '优惠券id', NULL); +INSERT INTO `column_config` VALUES (220, 'yx_store_order', 'coupon_price', 'decimal', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '优惠券金额', NULL); +INSERT INTO `column_config` VALUES (221, 'yx_store_order', 'paid', 'tinyint', NULL, '', b'1', NULL, 'MUL', b'1', b'1', NULL, '支付状态', NULL); +INSERT INTO `column_config` VALUES (222, 'yx_store_order', 'pay_time', 'int', NULL, '', b'1', NULL, 'MUL', b'1', b'0', NULL, '支付时间', NULL); +INSERT INTO `column_config` VALUES (223, 'yx_store_order', 'pay_type', 'varchar', NULL, '', b'1', NULL, 'MUL', b'1', b'1', NULL, '支付方式', NULL); +INSERT INTO `column_config` VALUES (224, 'yx_store_order', 'add_time', 'int', NULL, '', b'1', NULL, 'MUL', b'1', b'1', NULL, '创建时间', NULL); +INSERT INTO `column_config` VALUES (225, 'yx_store_order', 'status', 'tinyint', NULL, '', b'1', NULL, 'MUL', b'1', b'1', NULL, '订单状态(-1 : 申请退款 -2 : 退货成功 0:待发货;1:待收货;2:已收货;3:待评价;-1:已退款)', NULL); +INSERT INTO `column_config` VALUES (226, 'yx_store_order', 'refund_status', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '0 未退款 1 申请中 2 已退款', NULL); +INSERT INTO `column_config` VALUES (227, 'yx_store_order', 'refund_reason_wap_img', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '退款图片', NULL); +INSERT INTO `column_config` VALUES (228, 'yx_store_order', 'refund_reason_wap_explain', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '退款用户说明', NULL); +INSERT INTO `column_config` VALUES (229, 'yx_store_order', 'refund_reason_time', 'int', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '退款时间', NULL); +INSERT INTO `column_config` VALUES (230, 'yx_store_order', 'refund_reason_wap', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '前台退款原因', NULL); +INSERT INTO `column_config` VALUES (231, 'yx_store_order', 'refund_reason', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '不退款的理由', NULL); +INSERT INTO `column_config` VALUES (232, 'yx_store_order', 'refund_price', 'decimal', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '退款金额', NULL); +INSERT INTO `column_config` VALUES (233, 'yx_store_order', 'delivery_sn', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '快递公司编号', NULL); +INSERT INTO `column_config` VALUES (234, 'yx_store_order', 'delivery_name', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '快递名称/送货人姓名', NULL); +INSERT INTO `column_config` VALUES (235, 'yx_store_order', 'delivery_type', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '发货类型', NULL); +INSERT INTO `column_config` VALUES (236, 'yx_store_order', 'delivery_id', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '快递单号/手机号', NULL); +INSERT INTO `column_config` VALUES (237, 'yx_store_order', 'gain_integral', 'decimal', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '消费赚取积分', NULL); +INSERT INTO `column_config` VALUES (238, 'yx_store_order', 'use_integral', 'decimal', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '使用积分', NULL); +INSERT INTO `column_config` VALUES (239, 'yx_store_order', 'back_integral', 'decimal', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '给用户退了多少积分', NULL); +INSERT INTO `column_config` VALUES (240, 'yx_store_order', 'mark', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '备注', NULL); +INSERT INTO `column_config` VALUES (241, 'yx_store_order', 'is_del', 'tinyint', NULL, '', b'1', NULL, 'MUL', b'1', b'1', NULL, '是否删除', NULL); +INSERT INTO `column_config` VALUES (242, 'yx_store_order', 'unique', 'char', NULL, '', b'1', NULL, 'UNI', b'1', b'1', NULL, '唯一id(md5加密)类似id', NULL); +INSERT INTO `column_config` VALUES (243, 'yx_store_order', 'remark', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '管理员备注', NULL); +INSERT INTO `column_config` VALUES (244, 'yx_store_order', 'mer_id', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '商户ID', NULL); +INSERT INTO `column_config` VALUES (245, 'yx_store_order', 'is_mer_check', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '', NULL); +INSERT INTO `column_config` VALUES (246, 'yx_store_order', 'combination_id', 'int', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '拼团产品id0一般产品', NULL); +INSERT INTO `column_config` VALUES (247, 'yx_store_order', 'pink_id', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '拼团id 0没有拼团', NULL); +INSERT INTO `column_config` VALUES (248, 'yx_store_order', 'cost', 'decimal', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '成本价', NULL); +INSERT INTO `column_config` VALUES (249, 'yx_store_order', 'seckill_id', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '秒杀产品ID', NULL); +INSERT INTO `column_config` VALUES (250, 'yx_store_order', 'bargain_id', 'int', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '砍价id', NULL); +INSERT INTO `column_config` VALUES (251, 'yx_store_order', 'verify_code', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '核销码', NULL); +INSERT INTO `column_config` VALUES (252, 'yx_store_order', 'store_id', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '门店id', NULL); +INSERT INTO `column_config` VALUES (253, 'yx_store_order', 'shipping_type', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '配送方式 1=快递 ,2=门店自提', NULL); +INSERT INTO `column_config` VALUES (254, 'yx_store_order', 'is_channel', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '支付渠道(0微信公众号1微信小程序)', NULL); +INSERT INTO `column_config` VALUES (255, 'yx_store_order', 'is_remind', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '', NULL); +INSERT INTO `column_config` VALUES (256, 'yx_store_order', 'is_system_del', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '', NULL); +INSERT INTO `column_config` VALUES (257, 'yx_user_recharge', 'id', 'int', NULL, 'auto_increment', b'0', NULL, 'PRI', b'1', b'0', NULL, '', NULL); +INSERT INTO `column_config` VALUES (258, 'yx_user_recharge', 'uid', 'int', NULL, '', b'0', NULL, 'MUL', b'0', b'0', NULL, '充值用户UID', NULL); +INSERT INTO `column_config` VALUES (259, 'yx_user_recharge', 'order_id', 'varchar', NULL, '', b'0', NULL, 'UNI', b'1', b'0', NULL, '订单号', NULL); +INSERT INTO `column_config` VALUES (260, 'yx_user_recharge', 'price', 'decimal', NULL, '', b'0', NULL, '', b'1', b'0', NULL, '充值金额', NULL); +INSERT INTO `column_config` VALUES (261, 'yx_user_recharge', 'recharge_type', 'varchar', NULL, '', b'0', NULL, 'MUL', b'1', b'0', NULL, '充值类型', NULL); +INSERT INTO `column_config` VALUES (262, 'yx_user_recharge', 'paid', 'tinyint', NULL, '', b'0', NULL, 'MUL', b'1', b'0', NULL, '是否充值', NULL); +INSERT INTO `column_config` VALUES (263, 'yx_user_recharge', 'pay_time', 'int', NULL, '', b'0', NULL, '', b'1', b'0', NULL, '充值支付时间', NULL); +INSERT INTO `column_config` VALUES (264, 'yx_user_recharge', 'add_time', 'int', NULL, '', b'0', NULL, '', b'1', b'0', NULL, '充值时间', NULL); +INSERT INTO `column_config` VALUES (265, 'yx_user_recharge', 'refund_price', 'decimal', NULL, '', b'0', NULL, '', b'0', b'0', NULL, '退款金额', NULL); +INSERT INTO `column_config` VALUES (266, 'yx_user_recharge', 'nickname', 'varchar', NULL, '', b'0', NULL, '', b'1', b'0', 'Like', '昵称', NULL); +INSERT INTO `column_config` VALUES (267, 'yx_system_store', 'id', 'int', NULL, 'auto_increment', b'1', NULL, 'PRI', b'1', b'0', NULL, '', NULL); +INSERT INTO `column_config` VALUES (268, 'yx_system_store', 'name', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '门店名称', NULL); +INSERT INTO `column_config` VALUES (269, 'yx_system_store', 'introduction', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '简介', NULL); +INSERT INTO `column_config` VALUES (270, 'yx_system_store', 'phone', 'char', NULL, '', b'1', NULL, 'MUL', b'1', b'1', NULL, '手机号码', NULL); +INSERT INTO `column_config` VALUES (271, 'yx_system_store', 'address', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '省市区', NULL); +INSERT INTO `column_config` VALUES (272, 'yx_system_store', 'detailed_address', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '详细地址', NULL); +INSERT INTO `column_config` VALUES (273, 'yx_system_store', 'image', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '门店logo', NULL); +INSERT INTO `column_config` VALUES (274, 'yx_system_store', 'latitude', 'char', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '纬度', NULL); +INSERT INTO `column_config` VALUES (275, 'yx_system_store', 'longitude', 'char', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '经度', NULL); +INSERT INTO `column_config` VALUES (276, 'yx_system_store', 'valid_time', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '核销有效日期', NULL); +INSERT INTO `column_config` VALUES (277, 'yx_system_store', 'day_time', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '每日营业开关时间', NULL); +INSERT INTO `column_config` VALUES (278, 'yx_system_store', 'add_time', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '添加时间', NULL); +INSERT INTO `column_config` VALUES (279, 'yx_system_store', 'is_show', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '是否显示', NULL); +INSERT INTO `column_config` VALUES (280, 'yx_system_store', 'is_del', 'tinyint', NULL, '', b'1', NULL, '', b'0', b'1', NULL, '是否删除', NULL); +INSERT INTO `column_config` VALUES (281, 'yx_system_store_staff', 'id', 'int', NULL, 'auto_increment', b'1', NULL, 'PRI', b'1', b'0', NULL, '', NULL); +INSERT INTO `column_config` VALUES (282, 'yx_system_store_staff', 'uid', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '微信用户id', NULL); +INSERT INTO `column_config` VALUES (283, 'yx_system_store_staff', 'avatar', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '店员头像', NULL); +INSERT INTO `column_config` VALUES (284, 'yx_system_store_staff', 'store_id', 'int', NULL, '', b'1', 'Select', '', b'1', b'1', NULL, '门店id', NULL); +INSERT INTO `column_config` VALUES (285, 'yx_system_store_staff', 'staff_name', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', 'Like', '店员名称', NULL); +INSERT INTO `column_config` VALUES (286, 'yx_system_store_staff', 'phone', 'char', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '手机号码', NULL); +INSERT INTO `column_config` VALUES (287, 'yx_system_store_staff', 'verify_status', 'tinyint', NULL, '', b'1', 'Radio', '', b'1', b'1', NULL, '核销开关', NULL); +INSERT INTO `column_config` VALUES (288, 'yx_system_store_staff', 'status', 'tinyint', NULL, '', b'1', 'Radio', '', b'1', b'0', NULL, '状态', NULL); +INSERT INTO `column_config` VALUES (289, 'yx_system_store_staff', 'add_time', 'int', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '添加时间', NULL); +INSERT INTO `column_config` VALUES (290, 'yx_system_store_staff', 'nickname', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', 'Like', '微信昵称', NULL); +INSERT INTO `column_config` VALUES (291, 'yx_system_store_staff', 'store_name', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '所属门店', NULL); +INSERT INTO `column_config` VALUES (292, 'yx_wechat_user', 'uid', 'int', NULL, 'auto_increment', b'1', NULL, 'PRI', b'1', b'0', NULL, '微信用户id', NULL); +INSERT INTO `column_config` VALUES (293, 'yx_wechat_user', 'unionid', 'varchar', NULL, '', b'1', NULL, 'MUL', b'1', b'0', NULL, '只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段', NULL); +INSERT INTO `column_config` VALUES (294, 'yx_wechat_user', 'openid', 'varchar', NULL, '', b'1', NULL, 'UNI', b'1', b'0', NULL, '用户的标识,对当前公众号唯一', NULL); +INSERT INTO `column_config` VALUES (295, 'yx_wechat_user', 'routine_openid', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '小程序唯一身份ID', NULL); +INSERT INTO `column_config` VALUES (296, 'yx_wechat_user', 'nickname', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '用户的昵称', NULL); +INSERT INTO `column_config` VALUES (297, 'yx_wechat_user', 'headimgurl', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '用户头像', NULL); +INSERT INTO `column_config` VALUES (298, 'yx_wechat_user', 'sex', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '用户的性别,值为1时是男性,值为2时是女性,值为0时是未知', NULL); +INSERT INTO `column_config` VALUES (299, 'yx_wechat_user', 'city', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '用户所在城市', NULL); +INSERT INTO `column_config` VALUES (300, 'yx_wechat_user', 'language', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '用户的语言,简体中文为zh_CN', NULL); +INSERT INTO `column_config` VALUES (301, 'yx_wechat_user', 'province', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '用户所在省份', NULL); +INSERT INTO `column_config` VALUES (302, 'yx_wechat_user', 'country', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '用户所在国家', NULL); +INSERT INTO `column_config` VALUES (303, 'yx_wechat_user', 'remark', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '公众号运营者对粉丝的备注,公众号运营者可在微信公众平台用户管理界面对粉丝添加备注', NULL); +INSERT INTO `column_config` VALUES (304, 'yx_wechat_user', 'groupid', 'smallint', NULL, '', b'1', NULL, 'MUL', b'1', b'0', NULL, '用户所在的分组ID(兼容旧的用户分组接口)', NULL); +INSERT INTO `column_config` VALUES (305, 'yx_wechat_user', 'tagid_list', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '用户被打上的标签ID列表', NULL); +INSERT INTO `column_config` VALUES (306, 'yx_wechat_user', 'subscribe', 'tinyint', NULL, '', b'1', NULL, 'MUL', b'1', b'0', NULL, '用户是否订阅该公众号标识', NULL); +INSERT INTO `column_config` VALUES (307, 'yx_wechat_user', 'subscribe_time', 'int', NULL, '', b'1', NULL, 'MUL', b'1', b'0', NULL, '关注公众号时间', NULL); +INSERT INTO `column_config` VALUES (308, 'yx_wechat_user', 'add_time', 'int', NULL, '', b'1', NULL, 'MUL', b'1', b'0', NULL, '添加时间', NULL); +INSERT INTO `column_config` VALUES (309, 'yx_wechat_user', 'stair', 'int', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '一级推荐人', NULL); +INSERT INTO `column_config` VALUES (310, 'yx_wechat_user', 'second', 'int', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '二级推荐人', NULL); +INSERT INTO `column_config` VALUES (311, 'yx_wechat_user', 'order_stair', 'int', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '一级推荐人订单', NULL); +INSERT INTO `column_config` VALUES (312, 'yx_wechat_user', 'order_second', 'int', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '二级推荐人订单', NULL); +INSERT INTO `column_config` VALUES (313, 'yx_wechat_user', 'now_money', 'decimal', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '佣金', NULL); +INSERT INTO `column_config` VALUES (314, 'yx_wechat_user', 'session_key', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '小程序用户会话密匙', NULL); +INSERT INTO `column_config` VALUES (315, 'yx_wechat_user', 'user_type', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '用户类型', NULL); +INSERT INTO `column_config` VALUES (316, 'yx_express', 'id', 'mediumint', NULL, 'auto_increment', b'1', NULL, 'PRI', b'1', b'0', NULL, '快递公司id', NULL); +INSERT INTO `column_config` VALUES (317, 'yx_express', 'code', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '快递公司简称', NULL); +INSERT INTO `column_config` VALUES (318, 'yx_express', 'name', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '快递公司全称', NULL); +INSERT INTO `column_config` VALUES (319, 'yx_express', 'sort', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '排序', NULL); +INSERT INTO `column_config` VALUES (320, 'yx_express', 'is_show', 'tinyint', NULL, '', b'1', NULL, 'MUL', b'1', b'1', NULL, '是否显示', NULL); +INSERT INTO `column_config` VALUES (321, 'yx_user_level', 'id', 'int', NULL, 'auto_increment', b'1', NULL, 'PRI', b'1', b'0', NULL, '', NULL); +INSERT INTO `column_config` VALUES (322, 'yx_user_level', 'uid', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '用户uid', NULL); +INSERT INTO `column_config` VALUES (323, 'yx_user_level', 'level_id', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '等级vip', NULL); +INSERT INTO `column_config` VALUES (324, 'yx_user_level', 'grade', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '会员等级', NULL); +INSERT INTO `column_config` VALUES (325, 'yx_user_level', 'valid_time', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '过期时间', NULL); +INSERT INTO `column_config` VALUES (326, 'yx_user_level', 'is_forever', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '是否永久', NULL); +INSERT INTO `column_config` VALUES (327, 'yx_user_level', 'mer_id', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '商户id', NULL); +INSERT INTO `column_config` VALUES (328, 'yx_user_level', 'status', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '0:禁止,1:正常', NULL); +INSERT INTO `column_config` VALUES (329, 'yx_user_level', 'mark', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '备注', NULL); +INSERT INTO `column_config` VALUES (330, 'yx_user_level', 'remind', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '是否已通知', NULL); +INSERT INTO `column_config` VALUES (331, 'yx_user_level', 'is_del', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '是否删除,0=未删除,1=删除', NULL); +INSERT INTO `column_config` VALUES (332, 'yx_user_level', 'add_time', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '添加时间', NULL); +INSERT INTO `column_config` VALUES (333, 'yx_user_level', 'discount', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '享受折扣', NULL); +INSERT INTO `column_config` VALUES (334, 'yx_store_product_rule', 'id', 'int', NULL, 'auto_increment', b'1', NULL, 'PRI', b'1', b'0', NULL, '', NULL); +INSERT INTO `column_config` VALUES (335, 'yx_store_product_rule', 'rule_name', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '规格名称', NULL); +INSERT INTO `column_config` VALUES (336, 'yx_store_product_rule', 'rule_value', 'json', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '规格值', NULL); +INSERT INTO `column_config` VALUES (337, 'yx_store_product_rule', 'create_time', 'datetime', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '', NULL); +INSERT INTO `column_config` VALUES (338, 'yx_store_product_rule', 'update_time', 'datetime', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '', NULL); +INSERT INTO `column_config` VALUES (339, 'yx_store_product_rule', 'is_del', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '', NULL); +INSERT INTO `column_config` VALUES (340, 'yx_shipping_templates', 'id', 'int', NULL, 'auto_increment', b'1', NULL, 'PRI', b'1', b'0', NULL, '模板ID', NULL); +INSERT INTO `column_config` VALUES (341, 'yx_shipping_templates', 'name', 'varchar', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '模板名称', NULL); +INSERT INTO `column_config` VALUES (342, 'yx_shipping_templates', 'type', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '计费方式', NULL); +INSERT INTO `column_config` VALUES (343, 'yx_shipping_templates', 'region_info', 'text', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '地域以及费用', NULL); +INSERT INTO `column_config` VALUES (344, 'yx_shipping_templates', 'appoint', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '指定包邮开关', NULL); +INSERT INTO `column_config` VALUES (345, 'yx_shipping_templates', 'appoint_info', 'text', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '指定包邮内容', NULL); +INSERT INTO `column_config` VALUES (346, 'yx_shipping_templates', 'create_time', 'datetime', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '添加时间', NULL); +INSERT INTO `column_config` VALUES (347, 'yx_shipping_templates', 'update_time', 'datetime', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '', NULL); +INSERT INTO `column_config` VALUES (348, 'yx_shipping_templates', 'is_del', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '', NULL); +INSERT INTO `column_config` VALUES (349, 'yx_shipping_templates', 'sort', 'int', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '排序', NULL); +INSERT INTO `column_config` VALUES (350, 'yx_shipping_templates_region', 'id', 'int', NULL, 'auto_increment', b'1', NULL, 'PRI', b'1', b'0', NULL, '编号', NULL); +INSERT INTO `column_config` VALUES (351, 'yx_shipping_templates_region', 'province_id', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '省ID', NULL); +INSERT INTO `column_config` VALUES (352, 'yx_shipping_templates_region', 'temp_id', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '模板ID', NULL); +INSERT INTO `column_config` VALUES (353, 'yx_shipping_templates_region', 'city_id', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '城市ID', NULL); +INSERT INTO `column_config` VALUES (354, 'yx_shipping_templates_region', 'first', 'decimal', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '首件', NULL); +INSERT INTO `column_config` VALUES (355, 'yx_shipping_templates_region', 'first_price', 'decimal', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '首件运费', NULL); +INSERT INTO `column_config` VALUES (356, 'yx_shipping_templates_region', 'continues', 'decimal', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '续件', NULL); +INSERT INTO `column_config` VALUES (357, 'yx_shipping_templates_region', 'continue_price', 'decimal', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '续件运费', NULL); +INSERT INTO `column_config` VALUES (358, 'yx_shipping_templates_region', 'type', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '计费方式', NULL); +INSERT INTO `column_config` VALUES (359, 'yx_shipping_templates_region', 'uniqid', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '分组唯一值', NULL); +INSERT INTO `column_config` VALUES (360, 'yx_shipping_templates_free', 'id', 'int', NULL, 'auto_increment', b'1', NULL, 'PRI', b'1', b'0', NULL, '编号', NULL); +INSERT INTO `column_config` VALUES (361, 'yx_shipping_templates_free', 'province_id', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '省ID', NULL); +INSERT INTO `column_config` VALUES (362, 'yx_shipping_templates_free', 'temp_id', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '模板ID', NULL); +INSERT INTO `column_config` VALUES (363, 'yx_shipping_templates_free', 'city_id', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '城市ID', NULL); +INSERT INTO `column_config` VALUES (364, 'yx_shipping_templates_free', 'number', 'decimal', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '包邮件数', NULL); +INSERT INTO `column_config` VALUES (365, 'yx_shipping_templates_free', 'price', 'decimal', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '包邮金额', NULL); +INSERT INTO `column_config` VALUES (366, 'yx_shipping_templates_free', 'type', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '计费方式', NULL); +INSERT INTO `column_config` VALUES (367, 'yx_shipping_templates_free', 'uniqid', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '分组唯一值', NULL); +INSERT INTO `column_config` VALUES (368, 'yx_system_city', 'id', 'int', NULL, 'auto_increment', b'1', NULL, 'PRI', b'1', b'0', NULL, '', NULL); +INSERT INTO `column_config` VALUES (369, 'yx_system_city', 'city_id', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '城市id', NULL); +INSERT INTO `column_config` VALUES (370, 'yx_system_city', 'level', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '省市级别', NULL); +INSERT INTO `column_config` VALUES (371, 'yx_system_city', 'parent_id', 'int', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '父级id', NULL); +INSERT INTO `column_config` VALUES (372, 'yx_system_city', 'area_code', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '区号', NULL); +INSERT INTO `column_config` VALUES (373, 'yx_system_city', 'name', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '名称', NULL); +INSERT INTO `column_config` VALUES (374, 'yx_system_city', 'merger_name', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '合并名称', NULL); +INSERT INTO `column_config` VALUES (375, 'yx_system_city', 'lng', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '经度', NULL); +INSERT INTO `column_config` VALUES (376, 'yx_system_city', 'lat', 'varchar', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '纬度', NULL); +INSERT INTO `column_config` VALUES (377, 'yx_system_city', 'is_show', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '是否展示', NULL); +INSERT INTO `column_config` VALUES (378, 'yx_store_product_relation', 'id', 'bigint', NULL, 'auto_increment', b'1', NULL, 'PRI', b'1', b'0', NULL, '', NULL); +INSERT INTO `column_config` VALUES (379, 'yx_store_product_relation', 'uid', 'bigint', NULL, '', b'1', NULL, 'MUL', b'1', b'1', NULL, '用户ID', NULL); +INSERT INTO `column_config` VALUES (380, 'yx_store_product_relation', 'product_id', 'bigint', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '商品ID', NULL); +INSERT INTO `column_config` VALUES (381, 'yx_store_product_relation', 'type', 'varchar', NULL, '', b'1', NULL, 'MUL', b'1', b'0', NULL, '类型(收藏(collect)、点赞(like))', NULL); +INSERT INTO `column_config` VALUES (382, 'yx_store_product_relation', 'category', 'varchar', NULL, '', b'1', NULL, 'MUL', b'1', b'0', NULL, '某种类型的商品(普通商品、秒杀商品)', NULL); +INSERT INTO `column_config` VALUES (383, 'yx_store_product_relation', 'create_time', 'datetime', NULL, '', b'1', NULL, '', b'1', b'1', NULL, '添加时间', NULL); +INSERT INTO `column_config` VALUES (384, 'yx_store_product_relation', 'update_time', 'datetime', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '', NULL); +INSERT INTO `column_config` VALUES (385, 'yx_store_product_relation', 'is_del', 'tinyint', NULL, '', b'1', NULL, '', b'1', b'0', NULL, '', NULL); + +-- ---------------------------- +-- Table structure for dept +-- ---------------------------- +DROP TABLE IF EXISTS `dept`; +CREATE TABLE `dept` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '名称', + `pid` bigint(20) NOT NULL COMMENT '上级部门', + `enabled` bit(1) NOT NULL COMMENT '状态', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建日期', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '部门' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of dept +-- ---------------------------- +INSERT INTO `dept` VALUES (1, 'YSHOP', 0, b'1', '2019-03-01 12:07:37', NULL, 0); +INSERT INTO `dept` VALUES (2, '研发部', 7, b'1', '2019-03-25 09:15:32', NULL, 0); +INSERT INTO `dept` VALUES (5, '运维部', 7, b'1', '2019-03-25 09:20:44', NULL, 0); +INSERT INTO `dept` VALUES (6, '测试部', 8, b'1', '2019-03-25 09:52:18', NULL, 0); +INSERT INTO `dept` VALUES (7, '华南分部', 1, b'1', '2019-03-25 11:04:50', NULL, 0); +INSERT INTO `dept` VALUES (8, '华北分部', 1, b'1', '2019-03-25 11:04:53', NULL, 0); +INSERT INTO `dept` VALUES (11, '人事部', 8, b'1', '2019-03-25 11:07:58', NULL, 0); +INSERT INTO `dept` VALUES (12, '7773', 1, b'1', '2020-05-18 19:43:53', NULL, 0); + +-- ---------------------------- +-- Table structure for dict +-- ---------------------------- +DROP TABLE IF EXISTS `dict`; +CREATE TABLE `dict` ( + `id` bigint(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字典名称', + `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '描述', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建日期', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 18 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '数据字典' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of dict +-- ---------------------------- +INSERT INTO `dict` VALUES (1, 'user_status', '用户状态', '2019-10-27 20:31:36', NULL, 0); +INSERT INTO `dict` VALUES (4, 'dept_status', '部门状态', '2019-10-27 20:31:36', NULL, 0); +INSERT INTO `dict` VALUES (5, 'job_status', '岗位状态', '2019-10-27 20:31:36', NULL, 0); +INSERT INTO `dict` VALUES (6, '33', '3', '2020-05-18 19:55:49', NULL, 0); +INSERT INTO `dict` VALUES (16, 'force_update', '强制升级', '2020-12-09 11:13:21', NULL, 0); +INSERT INTO `dict` VALUES (17, 'is_enable', '是否启用', '2020-12-10 12:02:57', NULL, 0); + +-- ---------------------------- +-- Table structure for dict_detail +-- ---------------------------- +DROP TABLE IF EXISTS `dict_detail`; +CREATE TABLE `dict_detail` ( + `id` bigint(11) NOT NULL AUTO_INCREMENT, + `label` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字典标签', + `value` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字典值', + `sort` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '排序', + `dict_id` bigint(11) NULL DEFAULT NULL COMMENT '字典id', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建日期', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE, + INDEX `FK5tpkputc6d9nboxojdbgnpmyb`(`dict_id`) USING BTREE, + CONSTRAINT `FK5tpkputc6d9nboxojdbgnpmyb` FOREIGN KEY (`dict_id`) REFERENCES `dict` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB AUTO_INCREMENT = 24 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '数据字典详情' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of dict_detail +-- ---------------------------- +INSERT INTO `dict_detail` VALUES (1, '激活', 'true', '1', 1, '2019-10-27 20:31:36', NULL, 0); +INSERT INTO `dict_detail` VALUES (2, '禁用', 'false', '2', 1, NULL, NULL, 0); +INSERT INTO `dict_detail` VALUES (3, '启用', 'true', '1', 4, NULL, NULL, 0); +INSERT INTO `dict_detail` VALUES (4, '停用', 'false', '2', 4, '2019-10-27 20:31:36', NULL, 0); +INSERT INTO `dict_detail` VALUES (5, '启用2', 'true', '1', 5, NULL, NULL, 0); +INSERT INTO `dict_detail` VALUES (6, '停用', 'false', '2', 5, '2019-10-27 20:31:36', NULL, 0); +INSERT INTO `dict_detail` VALUES (7, '8', '8', '999', NULL, '2020-05-18 19:44:05', NULL, 0); +INSERT INTO `dict_detail` VALUES (8, '99', '999', '999', NULL, '2020-05-18 19:44:31', NULL, 0); +INSERT INTO `dict_detail` VALUES (20, '是', '1', '999', 16, '2020-12-09 11:41:30', NULL, 0); +INSERT INTO `dict_detail` VALUES (21, '否', '0', '999', 16, '2020-12-09 11:41:36', NULL, 0); +INSERT INTO `dict_detail` VALUES (22, '是', '1', '999', 17, '2020-12-10 12:03:09', NULL, 0); +INSERT INTO `dict_detail` VALUES (23, '否', '0', '999', 17, '2020-12-10 12:03:16', NULL, 0); + +-- ---------------------------- +-- Table structure for email_config +-- ---------------------------- +DROP TABLE IF EXISTS `email_config`; +CREATE TABLE `email_config` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `from_user` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '收件人', + `host` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮件服务器SMTP地址', + `pass` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '密码', + `port` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '端口', + `user` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '发件者用户名', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '邮箱配置' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of email_config +-- ---------------------------- +INSERT INTO `email_config` VALUES (1, '111@qq.com', '111', '111', '111', '1'); + +-- ---------------------------- +-- Table structure for gen_config +-- ---------------------------- +DROP TABLE IF EXISTS `gen_config`; +CREATE TABLE `gen_config` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `table_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '表名', + `author` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '作者', + `cover` bit(1) NULL DEFAULT NULL COMMENT '是否覆盖', + `module_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模块名称', + `pack` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '至于哪个包下', + `path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '前端代码生成的路径', + `api_path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '前端Api文件路径', + `prefix` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '表前缀', + `api_alias` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '接口名称', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 17 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '代码生成器配置' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of gen_config +-- ---------------------------- +INSERT INTO `gen_config` VALUES (3, 'gen_test', 'Zheng Jie', b'1', 'eladmin-system', 'me.zhengjie.gen', 'E:\\workspace\\me\\front\\eladmin-web\\src\\views\\gen', 'E:\\workspace\\me\\front\\eladmin-web\\src\\api', NULL, '测试生成'); +INSERT INTO `gen_config` VALUES (4, 'yx_material_group', 'hupeng', b'0', 'yshop-shop', 'co.yixiang.modules.shop', 'E:\\output', 'E:\\output\\', NULL, '素材'); +INSERT INTO `gen_config` VALUES (5, 'yx_material', 'hupeng', b'0', 'yshop-shop', 'co.yixiang.modules.shop', 'E:\\output', 'E:\\output\\', NULL, '素材管理'); +INSERT INTO `gen_config` VALUES (6, 'yx_user', 'hupeng', b'0', 'yshop-system', 'co.yixiang.modules', 'aa', 'aa\\', NULL, '用户'); +INSERT INTO `gen_config` VALUES (7, 'yx_wechat_media', 'hupeng', b'0', 'yshop-system', 'co.yixiang.modules', 'E:\\book\\img', 'E:\\book\\img\\', NULL, 'ceshi'); +INSERT INTO `gen_config` VALUES (8, 'yx_user_recharge', 'hupeng', b'0', 'yshop-shop', 'co.yixiang.modules.shop', 'E:\\java\\yxshop-private\\yshop-web\\src\\views\\shop\\recharge', 'E:\\java\\yxshop-private\\yshop-web\\src\\api', '', '充值管理'); +INSERT INTO `gen_config` VALUES (9, 'yx_system_store', 'hupeng', b'0', 'yshop-shop', 'co.yixiang.modules.shop', 'E:\\java\\yxshop-private\\yshop-web\\src\\views\\shop\\store', 'E:\\java\\yxshop-private\\yshop-web\\src\\api', NULL, '门店'); +INSERT INTO `gen_config` VALUES (10, 'yx_system_store_staff', 'hupeng', b'1', 'yshop-shop', 'co.yixiang.modules.shop', 'E:\\java\\yxshop-private\\yshop-web\\src\\views\\shop\\storestaff', 'E:\\java\\yxshop-private\\yshop-web\\src\\api', NULL, '门店店员'); +INSERT INTO `gen_config` VALUES (11, 'yx_store_product_rule', 'hupeng', b'0', 'yshop-mall', 'co.yixiang.modules', 'product', 'product\\', NULL, 'sku规则'); +INSERT INTO `gen_config` VALUES (12, 'yx_shipping_templates', 'hupeng', b'0', 'yshop-mall', 'co.yixiang.modules', 'product', 'product\\', NULL, '运费模板'); +INSERT INTO `gen_config` VALUES (13, 'yx_shipping_templates_region', 'hupeng', b'0', 'yshop-mall', 'co.yixiang.modules', 'product', 'product\\', NULL, '运费模板区域'); +INSERT INTO `gen_config` VALUES (14, 'yx_shipping_templates_free', 'hupeng', b'0', 'yshop-mall', 'co.yixiang.modules', 'product', 'product\\', NULL, '运费模板免费'); +INSERT INTO `gen_config` VALUES (15, 'yx_system_city', 'hupeng', b'0', 'yshop-mall', 'co.yixiang.modules', 'product', 'product\\', NULL, '城市'); +INSERT INTO `gen_config` VALUES (16, 'yx_store_product_relation', 'hupeng', b'0', 'yshop-mall', 'co.yixiang.modules.product', 'd:/', 'd:/', NULL, 'ProductRelation'); + +-- ---------------------------- +-- Table structure for gen_test +-- ---------------------------- +DROP TABLE IF EXISTS `gen_test`; +CREATE TABLE `gen_test` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `sex` int(255) NULL DEFAULT NULL COMMENT '性别', + `create_time` datetime(0) NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '代码生成测试' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of gen_test +-- ---------------------------- + +-- ---------------------------- +-- Table structure for job +-- ---------------------------- +DROP TABLE IF EXISTS `job`; +CREATE TABLE `job` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '岗位名称', + `enabled` bit(1) NOT NULL COMMENT '岗位状态', + `sort` bigint(20) NOT NULL COMMENT '岗位排序', + `dept_id` bigint(20) NULL DEFAULT NULL COMMENT '部门ID', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建日期', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE, + INDEX `FKmvhj0rogastlctflsxf1d6k3i`(`dept_id`) USING BTREE, + CONSTRAINT `FKmvhj0rogastlctflsxf1d6k3i` FOREIGN KEY (`dept_id`) REFERENCES `dept` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '岗位' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of job +-- ---------------------------- +INSERT INTO `job` VALUES (8, '人事专员', b'1', 3, 11, '2019-03-29 14:52:28', NULL, 0); +INSERT INTO `job` VALUES (10, '产品经理', b'1', 4, 2, '2019-03-29 14:55:51', NULL, 0); +INSERT INTO `job` VALUES (11, '全栈开发2', b'1', 2, 2, '2019-03-31 13:39:30', NULL, 0); +INSERT INTO `job` VALUES (12, '软件测试', b'1', 5, 2, '2019-03-31 13:39:43', NULL, 0); + +-- ---------------------------- +-- Table structure for local_storage +-- ---------------------------- +DROP TABLE IF EXISTS `local_storage`; +CREATE TABLE `local_storage` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `real_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件真实的名称', + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件名', + `suffix` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '后缀', + `path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '路径', + `type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型', + `size` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '大小', + `operate` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建日期', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 64 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '本地存储' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of local_storage +-- ---------------------------- +INSERT INTO `local_storage` VALUES (1, 'list_30-20200107120524671.png', 'list_30', 'png', 'E:\\yshop\\file\\图片\\list_30-20200107120524671.png', '图片', '28.57KB ', 'admin', '2020-01-07 12:05:25'); +INSERT INTO `local_storage` VALUES (2, 'list_34-20200109071140374.png', 'list_34', 'png', 'E:\\yshop\\file\\图片\\list_34-20200109071140374.png', '图片', '27.05KB ', 'admin', '2020-01-09 19:11:40'); +INSERT INTO `local_storage` VALUES (3, 'list_22-20200109072256534.png', 'list_22', 'png', 'E:\\yshop\\file\\pic\\list_22-20200109072256534.png', 'pic', '28.23KB ', 'admin', '2020-01-09 19:22:57'); +INSERT INTO `local_storage` VALUES (4, 'list_32-20200109093407741.png', 'list_32', 'png', 'E:\\yshop\\file\\pic\\list_32-20200109093407741.png', 'pic', '27.65KB ', 'admin', '2020-01-09 21:34:08'); +INSERT INTO `local_storage` VALUES (5, 'list_32-20200109094223500.png', 'list_32', 'png', 'E:\\yshop\\file\\pic\\list_32-20200109094223500.png', 'pic', '27.65KB ', 'admin', '2020-01-09 21:42:24'); +INSERT INTO `local_storage` VALUES (6, 'list_32-20200109094413459.png', 'list_32', 'png', 'E:\\yshop\\file\\pic\\list_32-20200109094413459.png', 'pic', '27.65KB ', 'admin', '2020-01-09 21:44:13'); +INSERT INTO `local_storage` VALUES (7, 'list_32-20200109094652138.png', 'list_32', 'png', 'E:\\yshop\\file\\pic\\list_32-20200109094652138.png', 'pic', '27.65KB ', 'admin', '2020-01-09 21:46:52'); +INSERT INTO `local_storage` VALUES (8, 'list_34-20200109095146476.png', 'list_34', 'png', 'E:\\yshop\\file\\pic\\list_34-20200109095146476.png', 'pic', '27.05KB ', 'admin', '2020-01-09 21:51:47'); +INSERT INTO `local_storage` VALUES (9, 'list_32-20200109095700685.png', 'list_32', 'png', 'E:\\yshop\\file\\pic\\list_32-20200109095700685.png', 'pic', '27.65KB ', 'admin', '2020-01-09 21:57:01'); +INSERT INTO `local_storage` VALUES (10, 'list_20-20200109095936988.png', 'list_20', 'png', 'E:\\yshop\\file\\pic\\list_20-20200109095936988.png', 'pic', '22.92KB ', 'admin', '2020-01-09 21:59:37'); +INSERT INTO `local_storage` VALUES (11, 'list_32-20200109100213309.png', 'list_32', 'png', 'E:\\yshop\\file\\pic\\list_32-20200109100213309.png', 'pic', '27.65KB ', 'admin', '2020-01-09 22:02:13'); +INSERT INTO `local_storage` VALUES (12, 'list_30-20200109104513493.png', 'list_30', 'png', 'E:\\yshop\\file\\pic\\list_30-20200109104513493.png', 'pic', '28.57KB ', 'admin', '2020-01-09 22:45:13'); +INSERT INTO `local_storage` VALUES (13, 'list_16-20200110120838173.png', 'list_16', 'png', 'E:\\yshop\\file\\pic\\list_16-20200110120838173.png', 'pic', '28.93KB ', 'admin', '2020-01-10 12:08:38'); +INSERT INTO `local_storage` VALUES (14, 'list_32-20200110035831202.png', 'list_32', 'png', 'E:\\yshop\\file\\pic\\list_32-20200110035831202.png', 'pic', '27.65KB ', 'admin', '2020-01-10 15:58:31'); +INSERT INTO `local_storage` VALUES (15, 'list_32-2020011004054091.png', 'list_32', 'png', 'E:\\yshop\\file\\pic\\list_32-2020011004054091.png', 'pic', '27.65KB ', 'admin', '2020-01-10 16:05:40'); +INSERT INTO `local_storage` VALUES (16, 'list_30-20200110053337209.png', 'list_30', 'png', 'E:\\yshop\\file\\pic\\list_30-20200110053337209.png', 'pic', '28.57KB ', 'admin', '2020-01-10 17:33:37'); +INSERT INTO `local_storage` VALUES (17, 'list_32-20200110064436937.png', 'list_32', 'png', 'E:\\yshop\\file\\pic\\list_32-20200110064436937.png', 'pic', '27.65KB ', 'admin', '2020-01-10 18:44:37'); +INSERT INTO `local_storage` VALUES (18, 'list_22-20200110104217508.png', 'list_22', 'png', 'E:\\yshop\\file\\pic\\list_22-20200110104217508.png', 'pic', '28.23KB ', 'admin', '2020-01-10 22:42:18'); +INSERT INTO `local_storage` VALUES (19, 'list_18-20200111051038569.png', 'list_18', 'png', 'E:\\yshop\\file\\pic\\list_18-20200111051038569.png', 'pic', '29.62KB ', '15136175246', '2020-01-11 17:10:39'); +INSERT INTO `local_storage` VALUES (20, 'list_30-2020011105115469.png', 'list_30', 'png', 'E:\\yshop\\file\\pic\\list_30-2020011105115469.png', 'pic', '28.57KB ', '15136175246', '2020-01-11 17:11:54'); +INSERT INTO `local_storage` VALUES (21, 'list_30-20200111051343335.png', 'list_30', 'png', 'E:\\yshop\\file\\pic\\list_30-20200111051343335.png', 'pic', '28.57KB ', '15136175246', '2020-01-11 17:13:43'); +INSERT INTO `local_storage` VALUES (22, 'list_16-20200111051622984.png', 'list_16', 'png', 'E:\\yshop\\file\\pic\\list_16-20200111051622984.png', 'pic', '28.93KB ', '15136175246', '2020-01-11 17:16:23'); +INSERT INTO `local_storage` VALUES (23, 'list_24-20200111051630227.png', 'list_24', 'png', 'E:\\yshop\\file\\pic\\list_24-20200111051630227.png', 'pic', '27.31KB ', '15136175246', '2020-01-11 17:16:30'); +INSERT INTO `local_storage` VALUES (24, 'logo-20200131103905417.png', 'logo', 'png', 'E:\\yshop\\file\\pic\\logo-20200131103905417.png', 'pic', '48.39KB ', 'admin', '2020-01-31 10:39:05'); +INSERT INTO `local_storage` VALUES (25, 'avatar-20200131103928688.png', 'avatar', 'png', 'E:\\yshop\\file\\pic\\avatar-20200131103928688.png', 'pic', '1.82KB ', 'admin', '2020-01-31 10:39:29'); +INSERT INTO `local_storage` VALUES (26, 'list_13-2020013110394473.png', 'list_13', 'png', 'E:\\yshop\\file\\pic\\list_13-2020013110394473.png', 'pic', '23.05KB ', 'admin', '2020-01-31 10:39:44'); +INSERT INTO `local_storage` VALUES (27, 'list_18-2020013110394988.png', 'list_18', 'png', 'E:\\yshop\\file\\pic\\list_18-2020013110394988.png', 'pic', '29.62KB ', 'admin', '2020-01-31 10:39:49'); +INSERT INTO `local_storage` VALUES (28, 'list_22-20200131103952926.png', 'list_22', 'png', 'E:\\yshop\\file\\pic\\list_22-20200131103952926.png', 'pic', '28.23KB ', 'admin', '2020-01-31 10:39:53'); +INSERT INTO `local_storage` VALUES (29, 'list_26-20200131103956836.png', 'list_26', 'png', 'E:\\yshop\\file\\pic\\list_26-20200131103956836.png', 'pic', '28.36KB ', 'admin', '2020-01-31 10:39:57'); +INSERT INTO `local_storage` VALUES (30, 'list_28-20200131104001169.png', 'list_28', 'png', 'E:\\yshop\\file\\pic\\list_28-20200131104001169.png', 'pic', '28.38KB ', 'admin', '2020-01-31 10:40:01'); +INSERT INTO `local_storage` VALUES (31, 'list_16-20200207061544740.png', 'list_16', 'png', 'E:\\yshop\\file\\pic\\list_16-20200207061544740.png', 'pic', '28.93KB ', 'hupeng', '2020-02-07 18:15:45'); +INSERT INTO `local_storage` VALUES (32, 'list_30-2020020706162996.png', 'list_30', 'png', 'E:\\yshop\\file\\pic\\list_30-2020020706162996.png', 'pic', '28.57KB ', 'hupeng', '2020-02-07 18:16:29'); +INSERT INTO `local_storage` VALUES (33, 'list_16-20200207061714702.png', 'list_16', 'png', 'E:\\yshop\\file\\pic\\list_16-20200207061714702.png', 'pic', '28.93KB ', 'hupeng', '2020-02-07 18:17:15'); +INSERT INTO `local_storage` VALUES (34, 'list_18-20200207061743361.png', 'list_18', 'png', 'E:\\yshop\\file\\pic\\list_18-20200207061743361.png', 'pic', '29.62KB ', 'hupeng', '2020-02-07 18:17:43'); +INSERT INTO `local_storage` VALUES (35, 'list_30-20200207062920744.png', 'list_30', 'png', 'E:\\yshop\\file\\pic\\list_30-20200207062920744.png', 'pic', '28.57KB ', 'hupeng', '2020-02-07 18:29:21'); +INSERT INTO `local_storage` VALUES (36, '05ea40b831858a8cf423aa709840507c-20200228083801500.png', '05ea40b831858a8cf423aa709840507c', 'png', 'E:\\yshop\\file\\pic\\05ea40b831858a8cf423aa709840507c-20200228083801500.png', 'pic', '5.19KB ', 'admin', '2020-02-28 20:38:02'); +INSERT INTO `local_storage` VALUES (37, '05ea40b831858a8cf423aa709840507c-20200311043711341.png', '05ea40b831858a8cf423aa709840507c', 'png', 'E:\\yshop\\file\\pic\\05ea40b831858a8cf423aa709840507c-20200311043711341.png', 'pic', '5.19KB ', 'admin', '2020-03-11 16:37:11'); +INSERT INTO `local_storage` VALUES (38, '秒杀-2020031104371672.png', '秒杀', 'png', 'E:\\yshop\\file\\pic\\秒杀-2020031104371672.png', 'pic', '6.07KB ', 'admin', '2020-03-11 16:37:16'); +INSERT INTO `local_storage` VALUES (39, '砍价-20200311043720679.png', '砍价', 'png', 'E:\\yshop\\file\\pic\\砍价-20200311043720679.png', 'pic', '6.13KB ', 'admin', '2020-03-11 16:37:21'); +INSERT INTO `local_storage` VALUES (40, '优惠券-20200311043724709.png', '优惠券', 'png', 'E:\\yshop\\file\\pic\\优惠券-20200311043724709.png', 'pic', '5.45KB ', 'admin', '2020-03-11 16:37:25'); +INSERT INTO `local_storage` VALUES (41, '资讯-20200311043727918.png', '资讯', 'png', 'E:\\yshop\\file\\pic\\资讯-20200311043727918.png', 'pic', '5.19KB ', 'admin', '2020-03-11 16:37:28'); +INSERT INTO `local_storage` VALUES (42, 'list_16-20200322071324803.png', 'list_16', 'png', 'E:\\yshop\\file\\pic\\list_16-20200322071324803.png', 'pic', '28.93KB ', 'admin', '2020-03-22 19:13:25'); +INSERT INTO `local_storage` VALUES (43, 'list_22-20200322071348844.png', 'list_22', 'png', 'E:\\yshop\\file\\pic\\list_22-20200322071348844.png', 'pic', '28.23KB ', 'admin', '2020-03-22 19:13:49'); +INSERT INTO `local_storage` VALUES (44, 'list_34-2020032207154023.png', 'list_34', 'png', 'E:\\yshop\\file\\pic\\list_34-2020032207154023.png', 'pic', '27.05KB ', 'admin', '2020-03-22 19:15:40'); +INSERT INTO `local_storage` VALUES (45, '钻石-20200328094531898.jpg', '钻石', 'jpg', 'E:\\yshop\\file\\pic\\钻石-20200328094531898.jpg', 'pic', '32.42KB ', 'admin', '2020-03-28 21:45:32'); +INSERT INTO `local_storage` VALUES (46, '20200527164526793230.png', 'list_13', 'png', 'D:\\yshop\\file\\pic\\20200527164526793230.png', 'pic', '23.05KB ', 'admin', '2020-05-27 16:45:27'); +INSERT INTO `local_storage` VALUES (47, '20200527164543489004.png', 'list_18', 'png', 'D:\\yshop\\file\\pic\\20200527164543489004.png', 'pic', '29.62KB ', 'admin', '2020-05-27 16:45:43'); +INSERT INTO `local_storage` VALUES (48, '20200623200105269693.png', 'list_13', 'png', 'D:\\yshop\\file\\pic\\20200623200105269693.png', 'pic', '23.05KB ', 'yshop', '2020-06-23 20:01:05'); +INSERT INTO `local_storage` VALUES (49, '20200623200118648188.png', 'list_18', 'png', 'D:\\yshop\\file\\pic\\20200623200118648188.png', 'pic', '29.62KB ', 'yshop', '2020-06-23 20:01:19'); +INSERT INTO `local_storage` VALUES (50, '20200626110808157592.png', 'list_34', 'png', 'D:\\yshop\\file\\pic\\20200626110808157592.png', 'pic', '27.05KB ', 'yshop', '2020-06-26 11:08:08'); +INSERT INTO `local_storage` VALUES (51, '20200626172220229003.png', 'list_16', 'png', 'D:\\yshop\\file\\pic\\20200626172220229003.png', 'pic', '28.93KB ', 'yshop', '2020-06-26 17:22:20'); +INSERT INTO `local_storage` VALUES (52, '20200626173520849370.png', 'list_18', 'png', 'D:\\yshop\\file\\pic\\20200626173520849370.png', 'pic', '29.62KB ', 'yshop', '2020-06-26 17:35:21'); +INSERT INTO `local_storage` VALUES (53, '20200626173943611335.png', 'list_34', 'png', 'D:\\yshop\\file\\pic\\20200626173943611335.png', 'pic', '27.05KB ', 'yshop', '2020-06-26 17:39:44'); +INSERT INTO `local_storage` VALUES (54, '20200903171003417769.png', 'avatar_default', 'png', '/home/yshop/file/pic/20200903171003417769.png', 'pic', '54.06KB ', 'yshop', '2020-09-03 17:10:03'); +INSERT INTO `local_storage` VALUES (55, '20200903171208889668.png', 'avatar_default', 'png', '/home/yshop/file/pic/20200903171208889668.png', 'pic', '54.06KB ', 'yshop', '2020-09-03 17:12:09'); +INSERT INTO `local_storage` VALUES (56, '20200903171351713145.jpg', '1', 'jpg', '/home/yshop/file/pic/20200903171351713145.jpg', 'pic', '126.59KB ', 'yshop', '2020-09-03 17:13:52'); +INSERT INTO `local_storage` VALUES (57, '20200903171807568739.jpg', '4', 'jpg', '/home/yshop/file/pic/20200903171807568739.jpg', 'pic', '68.57KB ', 'yshop', '2020-09-03 17:18:08'); +INSERT INTO `local_storage` VALUES (58, '20200903171807584910.jpg', '3', 'jpg', '/home/yshop/file/pic/20200903171807584910.jpg', 'pic', '34.32KB ', 'yshop', '2020-09-03 17:18:08'); +INSERT INTO `local_storage` VALUES (59, '20200903171807625149.jpg', '5', 'jpg', '/home/yshop/file/pic/20200903171807625149.jpg', 'pic', '81.55KB ', 'yshop', '2020-09-03 17:18:08'); +INSERT INTO `local_storage` VALUES (60, '20200903171807641535.jpg', '6', 'jpg', '/home/yshop/file/pic/20200903171807641535.jpg', 'pic', '61.97KB ', 'yshop', '2020-09-03 17:18:08'); +INSERT INTO `local_storage` VALUES (61, '20200903171807647067.jpg', '7', 'jpg', '/home/yshop/file/pic/20200903171807647067.jpg', 'pic', '76.04KB ', 'yshop', '2020-09-03 17:18:08'); +INSERT INTO `local_storage` VALUES (62, '20200911093912577832.png', 'avatar_default', 'png', '/home/yshop/file/pic/20200911093912577832.png', 'pic', '54.06KB ', 'admin', '2020-09-11 09:39:13'); +INSERT INTO `local_storage` VALUES (63, '20200915074139926178.jpg', '1600126884(1)', 'jpg', '/home/yshop/file/pic/20200915074139926178.jpg', 'pic', '23.64KB ', 'yshop', '2020-09-15 07:41:40'); + +-- ---------------------------- +-- Table structure for log +-- ---------------------------- +DROP TABLE IF EXISTS `log`; +CREATE TABLE `log` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `create_time` datetime(0) NULL DEFAULT NULL, + `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `exception_detail` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL, + `log_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '', + `method` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `params` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL, + `request_ip` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `time` bigint(20) NULL DEFAULT NULL, + `username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `browser` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `type` int(1) NULL DEFAULT 0, + `uid` bigint(20) NULL DEFAULT NULL, + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 45 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '系统日志' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of log +-- ---------------------------- +INSERT INTO `log` VALUES (1, '2020-12-20 12:20:56', '用户登录', NULL, 'INFO', 'co.yixiang.modules.security.rest.AuthController.login()', '{ authUser: {username=admin, password= ******} request: SecurityContextHolderAwareRequestWrapper[ FirewalledRequest[ org.apache.catalina.connector.RequestFacade@4ee2d4e7]] }', '192.168.31.223', 1725, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (2, '2020-12-20 12:21:07', '查询', NULL, 'INFO', 'co.yixiang.modules.shop.rest.SystemConfigController.getYxSystemConfigs()', '{ criteria: YxSystemConfigQueryCriteria() pageable: Page request [number: 0, size 50, sort: UNSORTED] }', '192.168.31.223', 45, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (3, '2020-12-20 12:21:14', '查询', NULL, 'INFO', 'co.yixiang.modules.shop.rest.SystemConfigController.getYxSystemConfigs()', '{ criteria: YxSystemConfigQueryCriteria() pageable: Page request [number: 0, size 50, sort: UNSORTED] }', '192.168.31.223', 4, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (4, '2020-12-20 12:21:16', '查询wxlive', NULL, 'INFO', 'co.yixiang.modules.wechat.rest.YxWechatLiveController.getYxWechatLives()', '{ criteria: YxWechatLiveQueryCriteria(liveStatus=null) pageable: Page request [number: 0, size 10, sort: room_id: DESC] }', '192.168.31.223', 45, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (5, '2020-12-20 12:21:19', '查询yxWechatLiveGoods', NULL, 'INFO', 'co.yixiang.modules.wechat.rest.YxWechatLiveGoodsController.getYxWechatLiveGoodss()', '{ criteria: YxWechatLiveGoodsQueryCriteria(name=null) pageable: Page request [number: 0, size 10, sort: goods_id: DESC] }', '192.168.31.223', 8, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (6, '2020-12-20 12:21:22', '查询商品分类', NULL, 'INFO', 'co.yixiang.modules.category.rest.StoreCategoryController.getYxStoreCategorys()', '{ criteria: YxStoreCategoryQueryCriteria(cateName=null) pageable: Page request [number: 0, size 10, sort: sort: DESC] }', '192.168.31.223', 19, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (7, '2020-12-20 12:21:23', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=1, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 47, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (8, '2020-12-20 12:21:23', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=0, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 13, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (9, '2020-12-20 12:25:02', '查询素材分组', NULL, 'INFO', 'co.yixiang.modules.shop.rest.MaterialGroupController.getYxMaterialGroups()', '{ criteria: YxMaterialGroupQueryCriteria() pageable: Page request [number: 1, size 100, sort: create_time: DESC] }', '192.168.31.223', 22, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (10, '2020-12-20 12:25:02', '查询素材管理', NULL, 'INFO', 'co.yixiang.modules.shop.rest.MaterialController.getYxMaterials()', '{ criteria: YxMaterialQueryCriteria(groupId=null) pageable: Page request [number: 0, size 12, sort: create_time: DESC] }', '192.168.31.223', 21, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (11, '2020-12-20 12:30:06', '查询拼团', NULL, 'INFO', 'co.yixiang.modules.activity.rest.StoreCombinationController.getYxStoreCombinations()', '{ criteria: YxStoreCombinationQueryCriteria(title=null, isDel=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 13, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (12, '2020-12-20 12:30:08', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=1, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 37, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (13, '2020-12-20 12:30:25', '查询拼团', NULL, 'INFO', 'co.yixiang.modules.activity.rest.StoreCombinationController.getYxStoreCombinations()', '{ criteria: YxStoreCombinationQueryCriteria(title=null, isDel=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 3, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (14, '2020-12-20 12:30:29', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=1, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 28, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (15, '2020-12-20 12:31:43', '列表', NULL, 'INFO', 'co.yixiang.modules.activity.rest.StoreSeckillController.getYxStoreSeckills()', '{ criteria: YxStoreSeckillQueryCriteria(title=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 23, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (16, '2020-12-20 12:31:46', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=1, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 20, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (17, '2020-12-20 12:31:46', '查询数据配置', NULL, 'INFO', 'co.yixiang.modules.shop.rest.SystemGroupDataController.getYxSystemGroupDatas()', '{ criteria: YxSystemGroupDataQueryCriteria(groupName=yshop_seckill_time) pageable: Page request [number: 0, size 20, sort: UNSORTED] }', '192.168.31.223', 21, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (18, '2020-12-20 12:31:55', '查询砍价', NULL, 'INFO', 'co.yixiang.modules.activity.rest.StoreBargainController.getYxStoreBargains()', '{ criteria: YxStoreBargainQueryCriteria() pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 233, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (19, '2020-12-20 12:31:56', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=1, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 17, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (20, '2020-12-20 12:32:15', '查询拼团', NULL, 'INFO', 'co.yixiang.modules.activity.rest.StoreCombinationController.getYxStoreCombinations()', '{ criteria: YxStoreCombinationQueryCriteria(title=null, isDel=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 3, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (21, '2020-12-20 12:32:18', '查询yxWechatLiveGoods', NULL, 'INFO', 'co.yixiang.modules.wechat.rest.YxWechatLiveGoodsController.getYxWechatLiveGoodss()', '{ criteria: YxWechatLiveGoodsQueryCriteria(name=null) pageable: Page request [number: 0, size 10, sort: goods_id: DESC] }', '192.168.31.223', 4, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (22, '2020-12-20 12:32:21', '查询商品分类', NULL, 'INFO', 'co.yixiang.modules.category.rest.StoreCategoryController.getYxStoreCategorys()', '{ criteria: YxStoreCategoryQueryCriteria(cateName=null) pageable: Page request [number: 0, size 10, sort: sort: DESC] }', '192.168.31.223', 3, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (23, '2020-12-20 12:32:21', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=0, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 8, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (24, '2020-12-20 12:32:21', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=1, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 15, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (25, '2020-12-20 20:56:56', '用户登录', NULL, 'INFO', 'co.yixiang.modules.security.rest.AuthController.login()', '{ authUser: {username=admin, password= ******} request: SecurityContextHolderAwareRequestWrapper[ FirewalledRequest[ org.apache.catalina.connector.RequestFacade@4aab466d]] }', '192.168.31.223', 980, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (26, '2020-12-20 20:57:18', '查询商品分类', NULL, 'INFO', 'co.yixiang.modules.category.rest.StoreCategoryController.getYxStoreCategorys()', '{ criteria: YxStoreCategoryQueryCriteria(cateName=null) pageable: Page request [number: 0, size 10, sort: sort: DESC] }', '192.168.31.223', 16, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (27, '2020-12-20 20:57:18', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=1, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 79, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (28, '2020-12-20 20:57:18', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=0, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 11, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (29, '2020-12-20 20:57:22', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=0, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 17, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (30, '2020-12-20 20:57:22', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=1, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 41, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (31, '2020-12-20 20:58:32', '新增/修改商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.create()', '{ storeProductDto: StoreProductDto(id=6, image=https://consoleapi.xinxintuan.co/file/pic/20200903171807641535.jpg, sliderImage=[https://consoleapi.xinxintuan.co/file/pic/20200903171807641535.jpg], storeName=印刷各种印刷, storeInfo=印刷各种印刷, keyword=印刷各种印刷, barCode=, cateId=3, price=11.0, otPrice=null, postage=0.0, unitName=张, sort=1, sales=35, stock=9965, isShow=1, isHot=1, isBenefit=1, isBest=0, isNew=0, description=

印刷各种印刷

, isPostage=0, giveIntegral=1.0, cost=22.0, isGood=0, isSub=0, ficti=1, tempId=34, specType=0, items=[], attrs=[co.yixiang.modules.product.service.dto.ProductFormatDto@e1b7fc1]) }', '192.168.31.223', 71, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (32, '2020-12-20 20:58:33', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=1, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 20, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (33, '2020-12-20 20:58:34', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=0, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 9, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (34, '2020-12-20 20:59:11', '新增/修改商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.create()', '{ storeProductDto: StoreProductDto(id=8, image=https://image.dayouqiantu.cn/5ca081af6183f.jpg, sliderImage=[https://image.dayouqiantu.cn/5ca081af6183f.jpg, https://image.dayouqiantu.cn/5ca081af6183f.jpg, https://image.dayouqiantu.cn/5ca04fa9c08ef.jpg], storeName=多规格商品测试, storeInfo=多规格商品测试, keyword=多规格商品测试, barCode=, cateId=5, price=4.0, otPrice=null, postage=0.0, unitName=张, sort=0, sales=5, stock=501, isShow=1, isHot=1, isBenefit=1, isBest=1, isNew=1, description=


, isPostage=0, giveIntegral=0.0, cost=1.0, isGood=0, isSub=1, ficti=0, tempId=34, specType=1, items=[co.yixiang.modules.product.service.dto.FromatDetailDto@3a1b9d03, co.yixiang.modules.product.service.dto.FromatDetailDto@5fb12695], attrs=[co.yixiang.modules.product.service.dto.ProductFormatDto@1796c183, co.yixiang.modules.product.service.dto.ProductFormatDto@3a45a7cd, co.yixiang.modules.product.service.dto.ProductFormatDto@2d318da6, co.yixiang.modules.product.service.dto.ProductFormatDto@55342aab, co.yixiang.modules.product.service.dto.ProductFormatDto@2ee2163f, co.yixiang.modules.product.service.dto.ProductFormatDto@5c1e7c4f]) }', '192.168.31.223', 33, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (35, '2020-12-20 20:59:13', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=0, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 10, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (36, '2020-12-20 20:59:13', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=1, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 22, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (37, '2020-12-20 21:16:55', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=0, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 14, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (38, '2020-12-20 21:16:55', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=1, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 21, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (39, '2020-12-20 21:17:50', '新增/修改商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.create()', '{ storeProductDto: StoreProductDto(id=8, image=https://image.dayouqiantu.cn/5ca081af6183f.jpg, sliderImage=[https://image.dayouqiantu.cn/5ca081af6183f.jpg, https://image.dayouqiantu.cn/5ca081af6183f.jpg, https://image.dayouqiantu.cn/5ca04fa9c08ef.jpg], storeName=多规格商品测试, storeInfo=多规格商品测试, keyword=多规格商品测试, barCode=, cateId=5, price=4.0, otPrice=null, postage=0.0, unitName=张, sort=0, sales=5, stock=501, isShow=1, isHot=1, isBenefit=1, isBest=1, isNew=1, description=


, isPostage=0, giveIntegral=0.0, cost=1.0, isGood=0, isSub=1, isIntegral=1, ficti=0, tempId=34, specType=1, items=[co.yixiang.modules.product.service.dto.FromatDetailDto@36bccf62, co.yixiang.modules.product.service.dto.FromatDetailDto@7b1f6e6c], attrs=[co.yixiang.modules.product.service.dto.ProductFormatDto@30145eea, co.yixiang.modules.product.service.dto.ProductFormatDto@5527d9d7, co.yixiang.modules.product.service.dto.ProductFormatDto@4a8b9843, co.yixiang.modules.product.service.dto.ProductFormatDto@2d753c48, co.yixiang.modules.product.service.dto.ProductFormatDto@6829cf6a, co.yixiang.modules.product.service.dto.ProductFormatDto@1757112f]) }', '192.168.31.223', 139, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (40, '2020-12-20 21:17:52', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=0, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 56, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (41, '2020-12-20 21:17:52', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=1, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 91, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (42, '2020-12-20 21:18:17', '新增/修改商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.create()', '{ storeProductDto: StoreProductDto(id=8, image=https://image.dayouqiantu.cn/5ca081af6183f.jpg, sliderImage=[https://image.dayouqiantu.cn/5ca081af6183f.jpg, https://image.dayouqiantu.cn/5ca081af6183f.jpg, https://image.dayouqiantu.cn/5ca04fa9c08ef.jpg], storeName=多规格商品测试, storeInfo=多规格商品测试, keyword=多规格商品测试, barCode=, cateId=5, price=4.0, otPrice=null, postage=0.0, unitName=张, sort=0, sales=5, stock=501, isShow=1, isHot=1, isBenefit=1, isBest=1, isNew=1, description=


, isPostage=0, giveIntegral=0.0, cost=1.0, isGood=0, isSub=1, isIntegral=1, ficti=0, tempId=34, specType=1, items=[co.yixiang.modules.product.service.dto.FromatDetailDto@6166fb7a, co.yixiang.modules.product.service.dto.FromatDetailDto@57f40cb6], attrs=[co.yixiang.modules.product.service.dto.ProductFormatDto@314d446d, co.yixiang.modules.product.service.dto.ProductFormatDto@329a3a74, co.yixiang.modules.product.service.dto.ProductFormatDto@17886021, co.yixiang.modules.product.service.dto.ProductFormatDto@69eefe37, co.yixiang.modules.product.service.dto.ProductFormatDto@18f4fa22, co.yixiang.modules.product.service.dto.ProductFormatDto@2dfea217]) }', '192.168.31.223', 26, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (43, '2020-12-20 21:18:18', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=0, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 12, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); +INSERT INTO `log` VALUES (44, '2020-12-20 21:18:18', '查询商品', NULL, 'INFO', 'co.yixiang.modules.product.rest.StoreProductController.getYxStoreProducts()', '{ criteria: YxStoreProductQueryCriteria(storeName=null, isDel=0, isShow=1, cateId=null) pageable: Page request [number: 0, size 10, sort: id: DESC] }', '192.168.31.223', 37, 'admin', ' 局域网', NULL, 0, 1, NULL, 0); + +-- ---------------------------- +-- Table structure for menu +-- ---------------------------- +DROP TABLE IF EXISTS `menu`; +CREATE TABLE `menu` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `i_frame` bit(1) NULL DEFAULT NULL COMMENT '是否外链', + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '菜单名称', + `component` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '组件', + `pid` bigint(20) NOT NULL COMMENT '上级菜单ID', + `sort` bigint(20) NOT NULL COMMENT '排序', + `icon` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图标', + `path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '链接地址', + `cache` bit(1) NULL DEFAULT b'0' COMMENT '缓存', + `hidden` bit(1) NULL DEFAULT b'0' COMMENT '是否隐藏', + `component_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '-' COMMENT '组件名称', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建日期', + `permission` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限', + `type` int(11) NULL DEFAULT NULL COMMENT '类型', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE, + INDEX `FKqcf9gem97gqa5qjm4d3elcqt5`(`pid`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 264 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of menu +-- ---------------------------- +INSERT INTO `menu` VALUES (1, b'0', '系统管理', NULL, 0, 99, 'system', 'system', b'0', b'0', NULL, '2018-12-18 15:11:29', NULL, 1, '2020-07-16 20:05:34', 0); +INSERT INTO `menu` VALUES (2, b'0', '用户管理', 'system/user/index', 1, 2, 'peoples', 'user', b'0', b'0', 'User', '2018-12-18 15:14:44', 'user:list', 1, NULL, 0); +INSERT INTO `menu` VALUES (3, b'0', '角色管理', 'system/role/index', 1, 3, 'role', 'role', b'0', b'0', 'Role', '2018-12-18 15:16:07', 'roles:list', 1, NULL, 0); +INSERT INTO `menu` VALUES (5, b'0', '菜单管理', 'system/menu/index', 1, 5, 'menu', 'menu', b'0', b'0', 'Menu', '2018-12-18 15:17:28', 'menu:list', 1, NULL, 0); +INSERT INTO `menu` VALUES (6, b'0', '系统监控', NULL, 0, 100, 'monitor', 'monitor', b'0', b'0', NULL, '2018-12-18 15:17:48', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (7, b'0', '操作日志', 'monitor/log/index', 6, 11, 'log', 'logs', b'1', b'0', 'Log', '2018-12-18 15:18:26', 'log:list', 1, NULL, 0); +INSERT INTO `menu` VALUES (9, b'0', 'SQL监控', 'monitor/sql/index', 6, 14, 'sqlMonitor', 'druid', b'0', b'0', 'Sql', '2018-12-18 15:19:34', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (14, b'0', '邮件工具', 'tools/email/index', 36, 24, 'email', 'email', b'0', b'0', 'Email', '2018-12-27 10:13:09', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (18, b'0', '存储管理', 'tools/storage/index', 36, 23, 'qiniu', 'storage', b'0', b'0', 'Storage', '2018-12-31 11:12:15', 'storage:list', 1, '2020-08-06 22:57:28', 0); +INSERT INTO `menu` VALUES (19, b'0', '支付宝工具', 'tools/aliPay/index', 36, 27, 'alipay', 'aliPay', b'0', b'0', 'AliPay', '2018-12-31 14:52:38', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (28, b'0', '定时任务', 'system/timing/index', 36, 21, 'timing', 'timing', b'0', b'0', 'Timing', '2019-01-07 20:34:40', 'timing:list', 1, NULL, 0); +INSERT INTO `menu` VALUES (30, b'0', '代码生成', 'generator/index', 36, 22, 'dev', 'generator', b'0', b'0', 'GeneratorIndex', '2019-01-11 15:45:55', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (32, b'0', '异常日志', 'monitor/log/errorLog', 6, 12, 'error', 'errorLog', b'0', b'0', 'ErrorLog', '2019-01-13 13:49:03', 'logError:list,logError:detail', 1, NULL, 0); +INSERT INTO `menu` VALUES (35, b'0', '部门管理', 'system/dept/index', 1, 6, 'dept', 'dept', b'0', b'0', 'Dept', '2019-03-25 09:46:00', 'dept:list', 1, NULL, 0); +INSERT INTO `menu` VALUES (36, b'0', '系统工具', '', 0, 101, 'sys-tools', 'sys-tools', b'0', b'0', NULL, '2019-03-29 10:57:35', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (37, b'0', '岗位管理', 'system/job/index', 1, 7, 'Steve-Jobs', 'job', b'0', b'0', 'Job', '2019-03-29 13:51:18', 'user:list', 1, NULL, 0); +INSERT INTO `menu` VALUES (39, b'0', '字典管理', 'system/dict/index', 1, 8, 'dictionary', 'dict', b'0', b'0', 'Dict', '2019-04-10 11:49:04', 'dict:list', 1, NULL, 0); +INSERT INTO `menu` VALUES (40, b'0', '商品管理', '', 0, 1, 'shop', 'shop', b'1', b'0', '', '2019-10-03 17:40:19', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (41, b'0', '商品分类', 'shop/cate/index', 40, 11, 'icon', 'cate', b'0', b'0', 'Cate', '2019-10-03 17:42:35', 'YXSTORECATEGORY_ALL,YXSTORECATEGORY_SELECT', 1, NULL, 0); +INSERT INTO `menu` VALUES (45, b'0', '管理商品', 'shop/goods/tab', 40, 12, 'develop', 'goods', b'1', b'0', 'Goods', '2019-10-04 15:34:35', 'YXSTOREPRODUCT_SELECT,YXSTORECATEGORY_ALL,YXSTORECATEGORY_SELECT,YXSYSTEMGROUPDATA_SELECT', 1, '2020-08-06 23:01:36', 0); +INSERT INTO `menu` VALUES (46, b'0', '会员管理', '', 0, 2, 'peoples', 'member', b'0', b'0', '', '2019-10-06 16:18:05', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (47, b'0', '会员', 'shop/user/index', 46, 21, 'peoples', 'member', b'0', b'0', 'Member', '2019-10-06 16:20:17', 'YXUSER_SELECT', 1, NULL, 0); +INSERT INTO `menu` VALUES (48, b'0', '微信管理', '', 0, 14, 'weixin', 'wechat', b'0', b'0', '', '2019-10-06 18:28:54', NULL, 1, '2020-06-26 15:18:32', 0); +INSERT INTO `menu` VALUES (49, b'0', '微信菜单', 'wechat/menu/index', 48, 31, 'menu', 'wemenu', b'0', b'0', 'WeMenu', '2019-10-06 18:31:06', 'YxWechatMenu_ALL,YxWechatMenu_SELECT', 1, NULL, 0); +INSERT INTO `menu` VALUES (50, b'0', '图文管理', 'wechat/article/index', 48, 32, 'article', 'wearticle', b'0', b'0', 'WeArticle', '2019-10-07 17:33:45', 'YXARTICLE_ALL,YXARTICLE_SELECT', 1, NULL, 0); +INSERT INTO `menu` VALUES (51, b'0', '自动回复', 'wechat/reply/index', 48, 33, 'reply', 'wereply', b'0', b'0', 'Wereply', '2019-10-10 09:58:31', 'YXWECHATREPLY_ALL', 1, NULL, 0); +INSERT INTO `menu` VALUES (52, b'0', '公众号配置', 'wechat/config/index', 48, 34, 'configure', 'weconfig', b'0', b'0', 'WeConfig', '2019-10-10 15:52:24', 'YXSYSTEMCONFIG_ALL', 1, NULL, 0); +INSERT INTO `menu` VALUES (53, b'0', '订单管理', '', 0, 4, 'lock', 'order', b'0', b'0', '', '2019-10-14 14:35:18', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (54, b'0', '订单', 'shop/order/index', 53, 41, 'order', 'order', b'0', b'0', 'Order', '2019-10-14 14:36:28', 'YXSTOREORDER_SELECT,YXEXPRESS_SELECT', 1, NULL, 0); +INSERT INTO `menu` VALUES (55, b'0', '商城配置', '', 0, 15, 'configure', 'set', b'0', b'0', '', '2019-10-18 15:21:26', NULL, 1, '2020-06-26 15:18:20', 0); +INSERT INTO `menu` VALUES (60, b'0', '热门搜索', 'shop/set/hot', 55, 55, 'search', 'hot', b'0', b'0', 'Hot', '2019-10-26 18:21:54', 'YXSYSTEMGROUPDATA_ALL,YXSYSTEMGROUPDATA_SELECT', 1, NULL, 0); +INSERT INTO `menu` VALUES (61, b'0', '个人中心菜单', 'shop/set/usermenu', 55, 56, 'menu', 'userMenu', b'0', b'0', 'UserMenu', '2019-10-26 18:42:18', 'YXSYSTEMGROUPDATA_ALL,YXSYSTEMGROUPDATA_SELECT', 1, NULL, 0); +INSERT INTO `menu` VALUES (62, b'0', '评论管理', 'shop/reply/index', 53, 42, 'comment', 'reply', b'0', b'0', 'Reply', '2019-11-03 14:39:09', 'YXSTOREPRODUCTREPLY_SELECT', 1, NULL, 0); +INSERT INTO `menu` VALUES (63, b'0', '营销管理', '', 0, 6, 'yingxiao', 'activity', b'0', b'0', '', '2019-11-09 14:17:42', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (64, b'0', '优惠券制作', 'activity/coupon/index', 229, 61, 'coupon', 'coupon', b'0', b'0', 'Coupon', '2019-11-09 14:18:58', 'YXSTORECOUPON_SELECT', 1, '2020-06-26 15:16:40', 0); +INSERT INTO `menu` VALUES (65, b'0', '已发布优惠券', 'activity/couponissue/index', 229, 62, 'coupon2', 'couponissue', b'0', b'0', 'Couponissue', '2019-11-09 14:20:35', 'YXSTORECOUPONISSUE_SELECT', 1, '2020-06-26 15:16:48', 0); +INSERT INTO `menu` VALUES (66, b'0', '优惠券领取记录', 'activity/storecouponuser/index', 229, 63, 'log', 'couponuser', b'0', b'0', 'Couponuser', '2019-11-09 14:21:35', 'YXSTORECOUPONUSER_SELECT,YXSTORECOUPONUSER_SELECT', 1, '2020-08-06 23:11:10', 0); +INSERT INTO `menu` VALUES (68, b'0', '积分配置', 'wechat/config/point', 227, 59, 'configure', 'pointConfig', b'0', b'0', 'PointConfig', '2019-11-10 18:45:55', 'YXSYSTEMCONFIG_SELECT,YXSYSTEMCONFIG_SELECT', 1, '2020-08-06 23:09:31', 0); +INSERT INTO `menu` VALUES (69, b'0', '分销管理', '', 0, 7, 'fenxiao', 'promoter', b'0', b'0', '', '2019-11-11 10:42:16', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (70, b'0', '分销配置', 'wechat/config/promoter', 69, 71, 'configure', 'promoterconfig', b'0', b'0', 'Promoterconfig', '2019-11-11 10:48:37', 'YXSYSTEMCONFIG_SELECT,YXSYSTEMCONFIG_SELECT', 1, '2020-08-06 23:12:31', 0); +INSERT INTO `menu` VALUES (71, b'0', '分销员', 'shop/user/aindex', 69, 72, 'user', 'agent', b'0', b'0', 'Agent', '2019-11-13 18:32:00', 'YXUSER_SELECT', 1, NULL, 1); +INSERT INTO `menu` VALUES (72, b'0', '提现管理', 'activity/extract/index', 176, 81, 'tixian', 'extract', b'0', b'0', 'Extract', '2019-11-14 10:49:39', 'YXUSEREXTRACT_SELECT,YXUSEREXTRACT_SELECT', 1, '2020-08-06 23:07:28', 0); +INSERT INTO `menu` VALUES (73, b'0', '拼团产品', 'activity/combination/index', 63, 64, 'peoples', 'combination', b'0', b'0', 'Combination', '2019-11-18 14:23:04', 'YXSTORECOMBINATION_SELECT', 1, NULL, 0); +INSERT INTO `menu` VALUES (74, b'0', '拼团列表', 'activity/combinlist/index', 63, 65, 'list', 'pink', b'0', b'0', 'Pink', '2019-11-21 19:35:58', 'YXSTOREPINK_SELECT', 1, NULL, 0); +INSERT INTO `menu` VALUES (75, b'0', '微信支付配置', 'wechat/config/pay', 48, 35, 'wxpay', 'wxpayconfig', b'0', b'0', 'Wxpayconfig', '2019-11-28 17:06:22', 'YXSYSTEMCONFIG_ALL', 1, NULL, 0); +INSERT INTO `menu` VALUES (76, b'0', '小程序配置', 'wechat/config/wxapp', 48, 36, 'configure', 'wxapp', b'0', b'0', 'Wxapp', '2019-11-29 15:13:46', 'YXSYSTEMCONFIG_ALL', 1, NULL, 0); +INSERT INTO `menu` VALUES (77, b'0', '会员等级', 'shop/userlevel/index', 46, 22, 'dengji', 'userlevel', b'0', b'0', 'Userlevel', '2019-12-04 16:35:41', 'YXSYSTEMUSERLEVEL_SELECT', 1, NULL, 0); +INSERT INTO `menu` VALUES (78, b'0', '等级任务', 'shop/usertask/index', 46, 23, 'task manege', 'usertask', b'0', b'0', 'Usertask', '2019-12-04 17:26:19', 'YXSYSTEMUSERTASK_SELECT', 1, NULL, 0); +INSERT INTO `menu` VALUES (79, b'0', '签到天数配置', 'shop/set/sign', 227, 61, 'sign2', 'signday', b'0', b'0', 'Signday', '2019-12-05 14:12:16', 'YXSYSTEMGROUPDATA_ALL,YXSYSTEMGROUPDATA_SELECT', 1, '2020-06-26 15:09:25', 0); +INSERT INTO `menu` VALUES (80, b'0', '用户账单', 'shop/user/bill', 46, 24, 'list', 'bill', b'0', b'0', 'Bill', '2019-12-11 17:28:38', 'YXUSERBILL_ALL,YXUSERBILL_SELECT', 1, NULL, 0); +INSERT INTO `menu` VALUES (81, b'0', '物流快递', 'shop/express/index', 53, 43, 'express', 'express', b'0', b'0', 'Express', '2019-12-12 16:36:00', 'YXEXPRESS_SELECT', 1, NULL, 0); +INSERT INTO `menu` VALUES (82, b'0', '微信模板消息', 'wechat/template/index', 48, 35, 'anq', 'template', b'0', b'0', 'Template', '2019-12-13 14:42:50', 'yxWechatTemplate:list', 1, NULL, 0); +INSERT INTO `menu` VALUES (83, b'0', '秒杀产品', 'activity/seckill/index', 63, 66, 'seckill', 'seckill', b'0', b'0', 'Seckill', '2019-12-16 13:06:29', 'YXSTORESECKILL_SELECT', 1, NULL, 0); +INSERT INTO `menu` VALUES (84, b'0', '秒杀配置', 'shop/set/seckill', 63, 67, 'configure', 'seckillconfig', b'0', b'0', 'Seckillconfig', '2019-12-16 16:07:42', 'YXSYSTEMGROUPDATA_SELECT', 1, NULL, 0); +INSERT INTO `menu` VALUES (86, b'0', '砍价产品', 'activity/bargain/index', 63, 956, 'Sign', 'bargain', b'0', b'0', 'Bargain', '2019-12-22 12:25:55', 'YXSTOREBARGAIN_SELECT', 1, NULL, 0); +INSERT INTO `menu` VALUES (87, b'0', '生成配置', 'generator/config', 36, 33, 'dev', 'generator/config/:tableName', b'1', b'1', 'GeneratorConfig', '2019-11-17 20:08:56', '', 1, NULL, 0); +INSERT INTO `menu` VALUES (88, b'0', '生成预览', 'generator/preview', 36, 999, 'java', 'generator/preview/:tableName', b'1', b'1', 'Preview', '2019-11-26 14:54:36', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (116, b'0', '生成配置', 'generator/config', 36, 33, 'dev', 'generator/config/:tableName', b'1', b'1', 'GeneratorConfig', '2019-11-17 20:08:56', '', 1, NULL, 0); +INSERT INTO `menu` VALUES (117, b'0', '图表库', 'components/Echarts', 10, 50, 'chart', 'echarts', b'1', b'0', 'Echarts', '2019-11-21 09:04:32', '', 1, NULL, 0); +INSERT INTO `menu` VALUES (118, b'0', '商品新增', 'shop/goods/form', 40, 1, 'anq', 'goodsAdd', b'0', b'1', 'GoodsAdd', '2019-12-24 13:00:47', 'YXSTOREPRODUCT_EDIT', 1, '2020-07-10 16:45:19', 0); +INSERT INTO `menu` VALUES (119, b'0', '商品修改', 'shop/goods/form', 40, 3, 'anq', 'goodsEdit/:id', b'0', b'1', 'GoodsEdit', '2019-12-24 13:02:23', 'YXSTOREPRODUCT_CREATE', 1, '2020-07-10 16:45:33', 0); +INSERT INTO `menu` VALUES (120, b'0', '商品删除', NULL, 45, 4, NULL, NULL, b'0', b'0', NULL, '2019-12-24 13:03:51', 'YXSTOREPRODUCT_DELETE', 2, '2020-07-10 16:22:51', 0); +INSERT INTO `menu` VALUES (121, b'0', '在线用户', 'monitor/online/index', 6, 10, 'Steve-Jobs', 'online', b'0', b'0', 'OnlineUser', '2020-01-06 22:46:43', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (122, b'0', '浏览记录', 'monitor/log/mlog', 40, 13, 'log', 'viewlog', b'0', b'0', 'Viewlog', '2020-01-07 13:17:21', NULL, 1, NULL, 1); +INSERT INTO `menu` VALUES (123, b'0', '后台接口文档', 'tools/swagger/index', 36, 31, 'swagger', 'swagger2', b'0', b'0', 'Swagger', '2020-01-07 18:05:52', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (124, b'0', '在线会员', 'monitor/online/indext', 46, 25, 'Steve-Jobs', 'onlinet', b'0', b'0', 'OnlineMember', '2020-01-13 10:53:07', 'auth_online', 1, '2020-08-06 22:50:49', 0); +INSERT INTO `menu` VALUES (125, b'0', '邮费配置', 'wechat/config/postage', 55, 58, 'configure', 'postageConfig', b'0', b'0', 'PostageConfig', '2020-02-13 15:38:24', 'YXSYSTEMCONFIG_SELECT', 1, NULL, 1); +INSERT INTO `menu` VALUES (126, b'0', '编辑', NULL, 54, 1, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:05:28', 'YXSTOREORDER_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (127, b'0', '用户新增', NULL, 2, 2, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:12:21', 'user:add', 2, NULL, 0); +INSERT INTO `menu` VALUES (128, b'0', '用户编辑', NULL, 2, 3, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:12:47', 'user:edit', 2, NULL, 0); +INSERT INTO `menu` VALUES (129, b'0', '用户删除', NULL, 2, 4, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:13:08', 'user:del', 2, NULL, 0); +INSERT INTO `menu` VALUES (130, b'0', '角色创建', NULL, 3, 2, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:13:49', 'roles:add', 2, NULL, 0); +INSERT INTO `menu` VALUES (131, b'0', '角色修改', NULL, 3, 3, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:14:11', 'roles:edit', 2, NULL, 0); +INSERT INTO `menu` VALUES (132, b'0', '角色删除', NULL, 3, 999, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:14:38', 'roles:del', 2, NULL, 0); +INSERT INTO `menu` VALUES (133, b'0', '菜单新增', NULL, 5, 2, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:15:05', 'menu:add', 2, NULL, 0); +INSERT INTO `menu` VALUES (134, b'0', '菜单编辑', NULL, 5, 3, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:18:44', 'menu:edit', 2, NULL, 0); +INSERT INTO `menu` VALUES (135, b'0', '菜单删除', NULL, 5, 4, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:19:05', 'menu:del', 2, NULL, 0); +INSERT INTO `menu` VALUES (136, b'0', '部门新增', NULL, 35, 2, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:21:07', 'dept:add', 2, NULL, 0); +INSERT INTO `menu` VALUES (137, b'0', '部门编辑', NULL, 35, 3, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:21:33', 'dept:edit', 2, NULL, 0); +INSERT INTO `menu` VALUES (138, b'0', '部门删除', NULL, 35, 4, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:21:53', 'dept:del', 2, NULL, 0); +INSERT INTO `menu` VALUES (139, b'0', '岗位新增', NULL, 37, 2, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:29:04', 'job:add', 2, NULL, 0); +INSERT INTO `menu` VALUES (140, b'0', '岗位编辑', NULL, 37, 3, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:48:38', 'job:edit', 2, NULL, 0); +INSERT INTO `menu` VALUES (141, b'0', '岗位删除', NULL, 37, 4, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:49:00', 'job:del', 2, NULL, 0); +INSERT INTO `menu` VALUES (142, b'0', '字典新增', NULL, 39, 2, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:49:26', 'dict:add', 2, NULL, 0); +INSERT INTO `menu` VALUES (143, b'0', '字典编辑', NULL, 39, 3, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:49:39', 'dict:edit', 2, NULL, 0); +INSERT INTO `menu` VALUES (144, b'0', '字典删除', NULL, 39, 4, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:49:56', 'dict:del', 2, NULL, 0); +INSERT INTO `menu` VALUES (147, b'0', '上传文件', NULL, 18, 2, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:53:49', 'storage:add', 2, NULL, 0); +INSERT INTO `menu` VALUES (148, b'0', '文件编辑', NULL, 18, 3, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:54:06', 'storage:edit', 2, NULL, 0); +INSERT INTO `menu` VALUES (149, b'0', '文件删除', NULL, 18, 4, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:54:27', 'storage:del', 2, NULL, 0); +INSERT INTO `menu` VALUES (150, b'0', '任务新增', NULL, 28, 2, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:55:58', 'timing:add', 2, NULL, 0); +INSERT INTO `menu` VALUES (151, b'0', '任务编辑', NULL, 28, 3, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:56:54', 'timing:edit', 2, NULL, 0); +INSERT INTO `menu` VALUES (152, b'0', '任务删除', NULL, 28, 4, NULL, NULL, b'0', b'0', NULL, '2020-02-14 21:57:10', 'timing:del', 2, NULL, 0); +INSERT INTO `menu` VALUES (153, b'0', '新增分类', NULL, 41, 2, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:00:41', 'YXSTORECATEGORY_CREATE', 2, NULL, 0); +INSERT INTO `menu` VALUES (154, b'0', '分类编辑', NULL, 41, 3, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:01:15', 'YXSTORECATEGORY_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (155, b'0', '分类删除', NULL, 41, 4, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:01:37', 'YXSTORECATEGORY_DELETE', 2, NULL, 0); +INSERT INTO `menu` VALUES (156, b'0', '修改会员', NULL, 47, 2, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:03:40', 'YXUSER_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (157, b'0', '等级新增', NULL, 77, 2, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:06:55', 'YXSYSTEMUSERLEVEL_CREATE', 2, NULL, 0); +INSERT INTO `menu` VALUES (158, b'0', '等级编辑', NULL, 77, 3, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:08:03', 'YXSYSTEMUSERLEVEL_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (159, b'0', '等级删除', NULL, 77, 4, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:08:41', 'YXSYSTEMUSERLEVEL_DELETE', 2, NULL, 0); +INSERT INTO `menu` VALUES (160, b'0', '编辑任务', NULL, 78, 2, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:10:08', 'YXSYSTEMUSERTASK_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (161, b'0', '评论删除', NULL, 62, 2, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:14:22', 'YXSTOREPRODUCTREPLY_DELETE', 2, NULL, 0); +INSERT INTO `menu` VALUES (162, b'0', '新增物流', NULL, 81, 2, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:15:33', 'YXEXPRESS_CREATE', 2, NULL, 0); +INSERT INTO `menu` VALUES (163, b'0', '编辑物流', NULL, 81, 3, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:15:53', 'YXEXPRESS_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (164, b'0', '删除物流', NULL, 81, 4, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:16:11', 'YXEXPRESS_DELETE', 2, NULL, 0); +INSERT INTO `menu` VALUES (165, b'0', '新增优惠券', NULL, 64, 2, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:18:32', 'YXSTORECOUPON_CREATE', 2, NULL, 0); +INSERT INTO `menu` VALUES (166, b'0', '编辑优惠券', NULL, 64, 3, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:18:50', 'YXSTORECOUPON_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (167, b'0', '删除优惠券', NULL, 64, 4, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:19:10', 'YXSTORECOUPON_DELETE', 2, NULL, 0); +INSERT INTO `menu` VALUES (168, b'0', '编辑已发布', NULL, 65, 2, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:20:23', 'YXSTORECOUPONISSUE_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (169, b'0', '删除已发布', NULL, 65, 3, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:20:42', 'YXSTORECOUPONISSUE_DELETE', 2, NULL, 0); +INSERT INTO `menu` VALUES (170, b'0', '编辑拼团', NULL, 73, 2, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:24:15', 'YXSTORECOMBINATION_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (171, b'0', '删除拼团', NULL, 73, 3, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:24:37', 'YXSTORECOMBINATION_DELETE', 2, NULL, 0); +INSERT INTO `menu` VALUES (172, b'0', '编辑秒杀', NULL, 83, 2, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:25:23', 'YXSTORESECKILL_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (173, b'0', '删除秒杀', NULL, 83, 3, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:25:41', 'YXSTORESECKILL_DELETE', 2, NULL, 0); +INSERT INTO `menu` VALUES (174, b'0', '编辑砍价', NULL, 86, 2, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:26:20', 'YXSTOREBARGAIN_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (175, b'0', '删除砍价', NULL, 86, 999, NULL, NULL, b'0', b'0', NULL, '2020-02-14 22:26:40', 'YXSTOREBARGAIN_DELETE', 2, NULL, 0); +INSERT INTO `menu` VALUES (176, b'0', '财务管理', NULL, 0, 8, 'price', 'price', b'0', b'0', NULL, '2020-03-02 22:30:23', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (177, b'0', '充值管理', 'shop/recharge/index', 176, 82, 'rec', 'recharge', b'0', b'0', 'Recharge', '2020-03-02 23:05:26', 'yxUserRecharge:list', 1, NULL, 0); +INSERT INTO `menu` VALUES (178, b'0', '门店管理', NULL, 0, 9, 'store', 'store', b'0', b'0', NULL, '2020-03-03 17:27:53', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (179, b'0', '门店列表', 'shop/store/index', 178, 92, 'edit', 'storeinfo', b'0', b'0', 'Storeinfo', '2020-03-03 17:29:09', 'yxSystemStore:list', 1, NULL, 0); +INSERT INTO `menu` VALUES (180, b'0', '门店配置', 'shop/store/set', 178, 91, 'configure', 'storeset', b'0', b'0', 'Storeset', '2020-03-04 13:09:54', 'YXSYSTEMCONFIG_SELECT,YXSYSTEMCONFIG_SELECT', 1, '2020-08-06 23:05:23', 0); +INSERT INTO `menu` VALUES (181, b'0', '核销订单', 'shop/order/indext', 178, 95, 'order', 'ordert', b'0', b'0', 'Ordert', '2020-03-05 17:04:12', 'YXSTOREORDER_SELECT', 1, NULL, 0); +INSERT INTO `menu` VALUES (182, b'0', '充值金额配置', 'shop/set/recharge', 176, 83, 'money', 'rechargeset', b'0', b'0', 'Rechargeset', '2020-03-21 14:24:05', 'YXSYSTEMGROUPDATA_ALL,YXSYSTEMGROUPDATA_SELECT', 1, '2020-06-26 15:11:06', 0); +INSERT INTO `menu` VALUES (183, b'0', '店员列表', 'shop/storestaff/index', 178, 94, 'peoples', 'staff', b'0', b'0', 'Staff', '2020-03-22 14:11:36', 'yxSystemStoreStaff:list', 1, NULL, 0); +INSERT INTO `menu` VALUES (184, b'0', '新增菜单', NULL, 49, 0, 'add', NULL, b'0', b'0', NULL, '2020-06-14 20:10:02', 'YxWechatMenu_CREATE', 2, NULL, 0); +INSERT INTO `menu` VALUES (185, b'0', '模板新增', NULL, 82, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-14 20:14:17', 'yxWechatTemplate:add', 2, NULL, 0); +INSERT INTO `menu` VALUES (186, b'0', '模板修改', NULL, 82, 2, NULL, NULL, b'0', b'0', NULL, '2020-06-14 20:14:46', 'yxWechatTemplate:edit', 2, NULL, 0); +INSERT INTO `menu` VALUES (187, b'0', '模板删除', NULL, 82, 3, NULL, NULL, b'0', b'0', NULL, '2020-06-14 20:15:10', 'yxWechatTemplate:del', 2, NULL, 0); +INSERT INTO `menu` VALUES (188, b'0', '新增幻灯片', NULL, 56, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-14 20:33:48', 'YXSYSTEMGROUPDATA_CREATE', 2, NULL, 0); +INSERT INTO `menu` VALUES (189, b'0', '修改幻灯片', NULL, 56, 2, NULL, NULL, b'0', b'0', NULL, '2020-06-14 20:35:11', 'YXSYSTEMGROUPDATA_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (190, b'0', '删除幻灯片', NULL, 56, 3, NULL, NULL, b'0', b'0', NULL, '2020-06-14 20:40:30', 'YXSYSTEMGROUPDATA_DELETE', 2, NULL, 0); +INSERT INTO `menu` VALUES (191, b'0', '新增导航按钮', NULL, 57, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-14 20:42:43', 'YXSYSTEMGROUPDATA_CREATE', 2, NULL, 0); +INSERT INTO `menu` VALUES (192, b'0', '修改导航按钮', NULL, 57, 2, NULL, NULL, b'0', b'0', NULL, '2020-06-14 20:43:53', 'YXSYSTEMGROUPDATA_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (193, b'0', '删除导航按钮', NULL, 57, 3, NULL, NULL, b'0', b'0', NULL, '2020-06-14 20:44:43', 'YXSYSTEMGROUPDATA_DELETE', 2, NULL, 0); +INSERT INTO `menu` VALUES (194, b'0', '新增滚动新闻', NULL, 59, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-14 20:48:32', 'YXSYSTEMGROUPDATA_CREATE', 2, NULL, 0); +INSERT INTO `menu` VALUES (195, b'0', '修改滚动新闻', NULL, 59, 2, NULL, NULL, b'0', b'0', NULL, '2020-06-14 20:48:52', 'YXSYSTEMGROUPDATA_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (196, b'0', '删除滚动新闻', NULL, 59, 3, NULL, NULL, b'0', b'0', NULL, '2020-06-14 20:49:32', 'YXSYSTEMGROUPDATA_DELETE', 2, NULL, 0); +INSERT INTO `menu` VALUES (197, b'0', '新增热门搜索', NULL, 60, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-14 21:14:25', 'YXSYSTEMGROUPDATA_CREATE', 2, NULL, 0); +INSERT INTO `menu` VALUES (198, b'0', '修改热门搜索', NULL, 60, 2, NULL, NULL, b'0', b'0', NULL, '2020-06-14 21:14:55', 'YXSYSTEMGROUPDATA_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (199, b'0', '删除热门搜索', NULL, 60, 3, NULL, NULL, b'0', b'0', NULL, '2020-06-14 21:15:25', 'YXSYSTEMGROUPDATA_DELETE', 2, NULL, 0); +INSERT INTO `menu` VALUES (200, b'0', '新增个人中心菜单', NULL, 61, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-14 21:17:47', 'YXSYSTEMGROUPDATA_CREATE', 2, NULL, 0); +INSERT INTO `menu` VALUES (201, b'0', '修改个人中心菜单', NULL, 61, 2, NULL, NULL, b'0', b'0', NULL, '2020-06-14 21:18:37', 'YXSYSTEMGROUPDATA_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (202, b'0', '删除个人中心菜单', NULL, 61, 3, NULL, NULL, b'0', b'0', NULL, '2020-06-14 21:19:47', 'YXSYSTEMGROUPDATA_DELETE', 2, NULL, 0); +INSERT INTO `menu` VALUES (203, b'0', '新增积分配置', NULL, 68, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-14 21:20:47', 'YXSYSTEMCONFIG_CREATE', 2, NULL, 0); +INSERT INTO `menu` VALUES (204, b'0', '新增签到天数', NULL, 79, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-14 21:26:32', 'YXSYSTEMGROUPDATA_CREATE', 2, NULL, 0); +INSERT INTO `menu` VALUES (205, b'0', '修改签到天数', NULL, 79, 2, NULL, NULL, b'0', b'0', NULL, '2020-06-14 22:26:32', 'YXSYSTEMGROUPDATA_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (206, b'0', '删除签到天数', NULL, 79, 3, NULL, NULL, b'0', b'0', NULL, '2020-06-14 22:26:52', 'YXSYSTEMGROUPDATA_DELETE', 2, NULL, 0); +INSERT INTO `menu` VALUES (207, b'0', '新增邮费配置', NULL, 125, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-14 21:29:20', 'YXSYSTEMCONFIG_CREATE', 2, NULL, 1); +INSERT INTO `menu` VALUES (208, b'0', '新增充值金额', NULL, 182, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-14 21:30:59', 'YXSYSTEMGROUPDATA_CREATE', 2, NULL, 0); +INSERT INTO `menu` VALUES (209, b'0', '修改充值金额', NULL, 182, 2, NULL, NULL, b'0', b'0', NULL, '2020-06-14 22:30:30', 'YXSYSTEMGROUPDATA_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (210, b'0', '删除充值金额', NULL, 182, 3, NULL, NULL, b'0', b'0', NULL, '2020-06-14 22:30:59', 'YXSYSTEMGROUPDATA_DELETE', 2, NULL, 0); +INSERT INTO `menu` VALUES (211, b'0', '新增秒杀配置', NULL, 84, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-14 21:43:36', 'YXSYSTEMGROUPDATA_CREATE', 2, NULL, 0); +INSERT INTO `menu` VALUES (212, b'0', '修改秒杀配置', NULL, 84, 2, NULL, NULL, b'0', b'0', NULL, '2020-06-14 21:43:56', 'YXSYSTEMGROUPDATA_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (213, b'0', '删除秒杀配置', NULL, 84, 3, NULL, NULL, b'0', b'0', NULL, '2020-06-14 22:23:36', 'YXSYSTEMGROUPDATA_DELETE', 2, NULL, 0); +INSERT INTO `menu` VALUES (214, b'0', '新增分销配置', NULL, 70, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-14 21:46:46', 'YXSYSTEMCONFIG_CREATE', 2, NULL, 0); +INSERT INTO `menu` VALUES (215, b'0', '提现审核', NULL, 72, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-14 21:56:11', 'YXUSEREXTRACT_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (216, b'0', '删除充值', NULL, 177, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-14 21:59:11', 'yxUserRecharge:del', 2, NULL, 0); +INSERT INTO `menu` VALUES (217, b'0', '导出充值', NULL, 177, 2, NULL, NULL, b'0', b'0', NULL, '2020-06-14 21:59:54', 'yxUserRecharge:list', 2, NULL, 0); +INSERT INTO `menu` VALUES (218, b'0', '新增门店', NULL, 179, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-14 22:01:57', 'yxSystemStore:add', 2, NULL, 0); +INSERT INTO `menu` VALUES (219, b'0', '修改门店', NULL, 179, 2, NULL, NULL, b'0', b'0', NULL, '2020-06-14 22:02:30', 'yxSystemStore:edit', 2, NULL, 0); +INSERT INTO `menu` VALUES (220, b'0', '删除门店', NULL, 179, 3, NULL, NULL, b'0', b'0', NULL, '2020-06-14 22:02:57', 'yxSystemStore:del', 2, NULL, 0); +INSERT INTO `menu` VALUES (221, b'0', '新增门店配置', NULL, 180, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-14 22:04:25', 'YXSYSTEMCONFIG_CREATE', 2, NULL, 0); +INSERT INTO `menu` VALUES (222, b'0', '编辑核销订单', NULL, 181, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-14 22:07:26', 'YXSTOREORDER_EDIT', 2, NULL, 0); +INSERT INTO `menu` VALUES (223, b'0', '新增店员', NULL, 183, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-14 22:11:13', 'yxSystemStoreStaff:add', 2, NULL, 0); +INSERT INTO `menu` VALUES (224, b'0', '修改店员', NULL, 183, 2, NULL, NULL, b'0', b'0', NULL, '2020-06-14 22:11:37', 'yxSystemStoreStaff:edit', 2, NULL, 0); +INSERT INTO `menu` VALUES (225, b'0', '删除店员', NULL, 183, 3, NULL, NULL, b'0', b'0', NULL, '2020-06-14 22:11:59', 'yxSystemStoreStaff:del', 2, NULL, 0); +INSERT INTO `menu` VALUES (226, b'0', '分销记录', 'shop/user/brobill', 69, 72, 'log', 'prolog', b'0', b'0', 'Prolog', '2020-06-26 14:52:30', 'YXUSERBILL_ALL,YXUSERBILL_SELECT,YXUSERBILL_SELECT', 1, '2020-08-06 23:12:57', 0); +INSERT INTO `menu` VALUES (227, b'0', '积分管理', NULL, 0, 10, 'Sign', 'syspoints', b'0', b'0', '-', '2020-06-26 15:00:59', NULL, 1, '2020-06-26 15:06:11', 0); +INSERT INTO `menu` VALUES (228, b'0', '积分记录', 'shop/user/pobill', 227, 60, 'log', 'pobill', b'0', b'0', 'Pobill', '2020-06-26 15:04:17', 'YXUSERBILL_ALL,YXUSERBILL_SELECT,YXUSERBILL_SELECT', 1, '2020-08-06 23:09:57', 0); +INSERT INTO `menu` VALUES (229, b'0', '电子券管理', NULL, 0, 5, 'coupon', 'syscoupon', b'0', b'0', '', '2020-06-26 15:15:47', NULL, 1, '2020-06-26 15:22:16', 0); +INSERT INTO `menu` VALUES (230, b'0', '商城系统配置', 'wechat/config/shop', 55, 59, 'shop', 'shopconfig', b'0', b'0', 'Shopconfig', '2020-06-26 15:45:32', 'YXSYSTEMCONFIG_SELECT', 1, '2020-07-04 18:50:34', 0); +INSERT INTO `menu` VALUES (231, b'0', '阿里云短信', 'wechat/config/sms', 55, 60, 'sys-tools', 'smsconfig', b'0', b'0', 'Smsconfig', '2020-06-26 16:06:08', 'YXSYSTEMCONFIG_SELECT', 1, NULL, 0); +INSERT INTO `menu` VALUES (232, b'0', '快递鸟配置', 'wechat/config/express', 55, 61, 'news', 'expressconfig', b'0', b'0', 'Expressconfig', '2020-06-26 16:08:10', 'YXSYSTEMCONFIG_SELECT', 1, NULL, 0); +INSERT INTO `menu` VALUES (233, b'0', '商品规格', 'shop/storeProductRule/index', 40, 13, 'mnt', 'productRule', b'0', b'0', 'ProductRule', '2020-06-28 16:35:00', 'yxStoreProductRule:list', 1, '2020-07-10 16:21:48', 0); +INSERT INTO `menu` VALUES (234, b'0', '运费模板', 'shop/shippingTemplates/index', 40, 14, 'exit-fullscreen', 'shippingTemplates', b'0', b'0', 'ShippingTemplates', '2020-06-29 17:16:06', 'yxShippingTemplates:list', 1, '2020-07-10 16:57:13', 0); +INSERT INTO `menu` VALUES (235, b'0', '图文添加', 'wechat/article/form', 48, 36, 'article', 'artadd', b'0', b'1', 'Artadd', '2020-07-01 18:50:35', NULL, 1, '2020-07-02 11:24:45', 0); +INSERT INTO `menu` VALUES (236, b'0', '图文编辑', 'wechat/article/form', 48, 37, 'alipay', 'artadd/:id', b'0', b'1', 'Editadd', '2020-07-02 11:24:39', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (237, b'0', '规格新增、修改', NULL, 233, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-28 16:35:00', 'yxStoreProductRule:add,yxStoreProductRule:edit', 2, '2020-07-16 20:09:03', 0); +INSERT INTO `menu` VALUES (238, b'0', '规格删除', NULL, 233, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-28 16:35:00', 'yxStoreProductRule:del', 2, '2020-07-16 20:08:57', 0); +INSERT INTO `menu` VALUES (240, b'0', '新增、修改模板', NULL, 234, 1, NULL, NULL, b'0', b'0', NULL, '2020-06-29 17:16:06', 'yxShippingTemplates:add', 2, '2020-07-16 20:09:11', 0); +INSERT INTO `menu` VALUES (241, b'0', '删除模板', NULL, 234, 2, NULL, NULL, b'0', b'0', NULL, '2020-06-29 17:16:06', 'yxShippingTemplates:del', 2, '2020-07-16 20:09:16', 0); +INSERT INTO `menu` VALUES (242, b'0', '直播管理', 'wechat/live/index', 48, 999, 'weixin', 'wxlive', b'0', b'0', 'Wxlive', '2020-08-10 17:20:54', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (243, b'0', '直播商品管理', 'wechat/goods/index', 48, 999, 'weixin', 'wxlivegoods', b'0', b'0', 'WxliveGoods', '2020-08-10 17:20:54', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (244, b'0', '拼团商品添加', 'activity/combination/form', 63, 999, NULL, 'combinationAdd', b'0', b'1', 'CombinationAdd', '2020-08-13 21:28:45', 'YXSTORECOMBINATION_EDIT', 1, '2020-08-13 21:31:26', 0); +INSERT INTO `menu` VALUES (245, b'0', '拼团商品修改', 'activity/combination/form', 63, 3, 'anq', 'combinationEdit/:id', b'0', b'1', 'CombinationEdit', '2019-12-24 13:02:23', 'YXSTORECOMBINATION_EDIT', 1, '2020-07-10 16:45:33', 0); +INSERT INTO `menu` VALUES (246, b'0', '秒杀商品添加', 'activity/seckill/form', 63, 999, NULL, 'secKillAdd', b'0', b'1', 'SecKillAdd', '2020-08-13 21:28:45', 'YXSTORESECKILL_EDIT', 1, '2020-08-13 21:31:26', 0); +INSERT INTO `menu` VALUES (247, b'0', '秒杀商品修改', 'activity/seckill/form', 63, 3, 'anq', 'secKillEdit/:id', b'0', b'1', 'SecKillEdit', '2019-12-24 13:02:23', 'YXSTORESECKILL_EDIT', 1, '2020-07-10 16:45:33', 0); +INSERT INTO `menu` VALUES (248, b'0', '多级菜单', NULL, 0, 999, 'menu', 'nested', b'0', b'0', '-', '2020-08-19 11:31:10', NULL, 0, NULL, 0); +INSERT INTO `menu` VALUES (249, b'0', '二级菜单1', 'nested/menu1/index', 248, 999, 'menu', 'menu1', b'0', b'0', '-', '2020-08-19 11:34:34', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (250, b'0', '三级菜单1', 'nested/menu1/menu1-1', 249, 999, 'menu', 'menu1-1', b'0', b'0', '-', '2020-08-19 11:35:52', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (251, b'0', '三级菜单2', 'nested/menu1/menu1-2', 249, 999, 'menu', 'menu1-2', b'0', b'0', '-', '2020-08-19 11:37:48', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (252, b'0', '二级菜单2', 'nested/menu2/index', 248, 999, 'menu', 'menu2', b'0', b'0', '-', '2020-08-19 11:38:35', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (253, b'0', '浏览记录', 'monitor/log/mlog', 40, 15, 'log', 'viewlog', b'0', b'0', 'Viewlog', '2020-07-31 09:47:11', 'log:list', 1, '2020-07-31 09:49:39', 0); +INSERT INTO `menu` VALUES (256, b'0', '商品收藏', 'shop/collect/index', 40, 16, 'menu', 'productRelation', b'0', b'0', 'ProductRelation', '2020-09-03 14:32:49', 'yxStoreProductRelation:list', 1, '2020-09-03 16:21:08', 0); +INSERT INTO `menu` VALUES (257, b'0', '用户足迹', 'shop/foot/index', 40, 17, 'list', 'footRelation', b'0', b'0', 'FootRelation', '2020-09-03 16:20:21', 'yxStoreProductRelation:list', 1, '2020-09-03 16:21:16', 0); +INSERT INTO `menu` VALUES (258, b'0', '订单详情', 'shop/order/detail', 53, 999, 'sqlMonitor', 'detail/:id', b'0', b'1', 'Detail', '2020-09-10 07:29:34', NULL, 1, '2020-09-10 08:52:09', 0); +INSERT INTO `menu` VALUES (259, b'0', 'App版本', 'shop/appVersion/index', 55, 999, 'app', 'appVersion', b'0', b'0', '', '2020-12-09 11:04:33', 'yxAppVersion:list', 1, '2020-12-09 11:07:13', 0); +INSERT INTO `menu` VALUES (260, b'0', '订单消息管理', 'shop/customer/index', 55, 4, 'peoples', 'storeCustomer', b'0', b'0', 'msgInfo', '2020-04-02 14:16:43', 'yxStoreCustomer:list', 1, '2020-12-10 11:44:49', 0); +INSERT INTO `menu` VALUES (261, b'0', '添加人员', NULL, 260, 1, NULL, NULL, b'0', b'0', NULL, '2020-04-02 14:18:30', 'yxStoreCustomer:add', 2, NULL, 0); +INSERT INTO `menu` VALUES (262, b'0', '编辑人员', NULL, 260, 2, NULL, NULL, b'0', b'0', NULL, '2020-04-02 14:18:47', 'yxStoreCustomer:edit', 2, NULL, 0); +INSERT INTO `menu` VALUES (263, b'0', '删除人员', NULL, 260, 3, NULL, NULL, b'0', b'0', NULL, '2020-04-02 14:19:07', 'yxStoreCustomer:del', 2, NULL, 0); +INSERT INTO `menu` VALUES (264, b'0', '终端装修', NULL, 0, 0, 'theme', 'theme', b'0', b'0', '--', '2021-02-25 19:33:17', '', 1, '2021-02-25 19:33:32', 0); +INSERT INTO `menu` VALUES (265, b'0', '商城装修', 'theme/container/index', 264, 999, 'theme', 'container', b'0', b'0', 'Container', '2021-02-25 19:35:13', NULL, 1, NULL, 0); +INSERT INTO `menu` VALUES (266, b'0', '售后', 'shop/afterSeals/index', 53, 44, 'order', 'afterSeals', b'0', b'0', 'AfterSeals', '2021-06-30 15:23:38', 'yxStoreAfterSales:list', 1, '2021-06-30 15:33:14', 0); +INSERT INTO `menu` VALUES (267, b'0', '新增', NULL, 266, 999, NULL, NULL, b'0', b'0', '-', '2021-06-30 15:34:17', 'yxStoreAfterSales:add', 2, NULL, 0); +INSERT INTO `menu` VALUES (268, b'0', '修改', NULL, 266, 999, NULL, NULL, b'0', b'0', '-', '2021-06-30 15:34:39', 'yxStoreAfterSales:edit', 2, NULL, 0); +INSERT INTO `menu` VALUES (269, b'0', '删除', NULL, 266, 999, NULL, NULL, b'0', b'0', '-', '2021-06-30 15:34:55', 'yxStoreAfterSales:del', 2, NULL, 0); +-- ---------------------------- +-- Table structure for monitor_server +-- ---------------------------- +DROP TABLE IF EXISTS `monitor_server`; +CREATE TABLE `monitor_server` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `cpu_core` int(11) NULL DEFAULT NULL COMMENT 'CPU内核数', + `cpu_rate` double NULL DEFAULT NULL COMMENT 'CPU使用率', + `disk_total` double NULL DEFAULT NULL COMMENT '磁盘总量', + `disk_used` double NULL DEFAULT NULL COMMENT '磁盘使用量', + `mem_total` double NULL DEFAULT NULL COMMENT '内存总数', + `mem_used` double NULL DEFAULT NULL COMMENT '内存使用量', + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '名称', + `port` int(11) NULL DEFAULT NULL COMMENT '访问端口', + `sort` int(11) NULL DEFAULT NULL COMMENT '排序', + `state` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '状态', + `swap_total` double NULL DEFAULT NULL COMMENT '交换区总量', + `swap_used` double NULL DEFAULT NULL COMMENT '交换区使用量', + `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '服务地址', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '服务监控' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of monitor_server +-- ---------------------------- +INSERT INTO `monitor_server` VALUES (1, 8, 0.05924018, 465.12402, 91.66521, 7.849415, 7.6052284, '本地', 8777, 999, '0', 14.599415, 11.263367, 'localhost'); + +-- ---------------------------- +-- Table structure for picture +-- ---------------------------- +DROP TABLE IF EXISTS `picture`; +CREATE TABLE `picture` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '上传日期', + `delete_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '删除的URL', + `filename` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片名称', + `height` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片高度', + `size` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片大小', + `url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片地址', + `username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名称', + `width` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片宽度', + `md5code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件的MD5值', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'Sm.Ms图床' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of picture +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qiniu_config +-- ---------------------------- +DROP TABLE IF EXISTS `qiniu_config`; +CREATE TABLE `qiniu_config` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `access_key` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT 'accessKey', + `bucket` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Bucket 识别符', + `host` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '外链域名', + `secret_key` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT 'secretKey', + `type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '空间类型', + `zone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '机房', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '七牛云配置' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of qiniu_config +-- ---------------------------- +INSERT INTO `qiniu_config` VALUES (1, 'OJou_rI3QATSsY0MMqkpq0FPvAXpEjs1o4KHuvCx', 'yixiang', 'https://image.dayouqiantu.cn', 'XwNNqLeAnXP754LhkJYmBM6nu1djcc1LUXTDYylY', '公开', '华东'); + +-- ---------------------------- +-- Table structure for qiniu_content +-- ---------------------------- +DROP TABLE IF EXISTS `qiniu_content`; +CREATE TABLE `qiniu_content` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `bucket` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Bucket 识别符', + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件名称', + `size` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件大小', + `type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件类型:私有或公开', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '上传或同步的时间', + `url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件url', + `suffix` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 28 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '七牛云文件存储' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of qiniu_content +-- ---------------------------- +INSERT INTO `qiniu_content` VALUES (1, 'yixiang', 'list_34', '27.05KB ', '公开', '2020-01-07 12:05:41', 'https://pic.dayouqiantu.cn/list_34.png', 'png'); +INSERT INTO `qiniu_content` VALUES (2, 'yixiang', 'list_32', '27.65KB ', '公开', '2020-01-07 12:11:15', 'https://pic.dayouqiantu.cn/list_32.png', 'png'); +INSERT INTO `qiniu_content` VALUES (3, 'yixiang', 'list_30', '28.57KB ', '公开', '2020-01-07 12:13:26', 'https://image.dayouqiantu.cn/list_30.png', 'png'); +INSERT INTO `qiniu_content` VALUES (4, 'yixiang', 'list_34', '27.05KB ', '公开', '2020-01-07 12:32:15', 'https://image.dayouqiantu.cn/list_34.png', 'png'); +INSERT INTO `qiniu_content` VALUES (5, 'yixiang', 'list_32', '27.65KB ', '公开', '2020-01-07 12:53:11', 'https://image.dayouqiantu.cn/list_32.png', 'png'); +INSERT INTO `qiniu_content` VALUES (6, 'yixiang', 'list_34', '27.05KB ', '公开', '2020-01-07 13:05:55', 'https://image.dayouqiantu.cn/list_34.png', 'png'); +INSERT INTO `qiniu_content` VALUES (7, 'yixiang', 'list_32', '27.65KB ', '公开', '2020-01-07 13:08:32', 'https://image.dayouqiantu.cn/list_32.png', 'png'); +INSERT INTO `qiniu_content` VALUES (8, 'yixiang', 'list_22', '28.23KB ', '公开', '2020-01-07 13:08:38', 'https://image.dayouqiantu.cn/list_22.png', 'png'); +INSERT INTO `qiniu_content` VALUES (9, 'yixiang', 'list_32', '27.65KB ', '公开', '2020-01-07 13:08:49', 'https://image.dayouqiantu.cn/list_32.png', 'png'); +INSERT INTO `qiniu_content` VALUES (10, 'yixiang', 'list_34', '27.05KB ', '公开', '2020-01-10 12:02:24', 'https://image.dayouqiantu.cn/list_34.png', 'png'); +INSERT INTO `qiniu_content` VALUES (11, 'yixiang', 'list_32', '27.65KB ', '公开', '2020-01-10 16:49:48', 'https://image.dayouqiantu.cn/list_32.png', 'png'); +INSERT INTO `qiniu_content` VALUES (12, 'yixiang', 'list_20', '22.92KB ', '公开', '2020-01-10 22:43:47', 'https://image.dayouqiantu.cn/list_20.png', 'png'); +INSERT INTO `qiniu_content` VALUES (13, 'yixiang', 'list_24', '27.31KB ', '公开', '2020-01-10 22:44:21', 'https://image.dayouqiantu.cn/list_24.png', 'png'); +INSERT INTO `qiniu_content` VALUES (14, 'yixiang', 'list_28', '28.38KB ', '公开', '2020-01-11 17:06:00', 'https://image.dayouqiantu.cn/list_28.png', 'png'); +INSERT INTO `qiniu_content` VALUES (15, 'yixiang', 'goods', '2.82KB ', '公开', '2020-06-26 18:20:58', 'https://image.dayouqiantu.cn/goods.png', 'png'); +INSERT INTO `qiniu_content` VALUES (16, 'yixiang', 'coupon', '2.92KB ', '公开', '2020-06-26 18:20:58', 'https://image.dayouqiantu.cn/coupon.png', 'png'); +INSERT INTO `qiniu_content` VALUES (17, 'yixiang', 'buy', '2.59KB ', '公开', '2020-06-26 18:20:58', 'https://image.dayouqiantu.cn/buy.png', 'png'); +INSERT INTO `qiniu_content` VALUES (18, 'yixiang', 'collect', '3.65KB ', '公开', '2020-06-26 18:20:58', 'https://image.dayouqiantu.cn/collect.png', 'png'); +INSERT INTO `qiniu_content` VALUES (19, 'yixiang', 'bargin', '3.39KB ', '公开', '2020-06-26 18:24:51', 'https://image.dayouqiantu.cn/bargin.png', 'png'); +INSERT INTO `qiniu_content` VALUES (20, 'yixiang', 'add', '3.17KB ', '公开', '2020-06-26 18:24:51', 'https://image.dayouqiantu.cn/add.png', 'png'); +INSERT INTO `qiniu_content` VALUES (21, 'yixiang', 'sign', '2.63KB ', '公开', '2020-06-26 18:25:07', 'https://image.dayouqiantu.cn/sign.png', 'png'); +INSERT INTO `qiniu_content` VALUES (22, 'yixiang', 'sekill', '3.54KB ', '公开', '2020-06-26 18:25:07', 'https://image.dayouqiantu.cn/sekill.png', 'png'); +INSERT INTO `qiniu_content` VALUES (23, 'yixiang', 'pink', '3.25KB ', '公开', '2020-06-26 18:25:07', 'https://image.dayouqiantu.cn/pink.png', 'png'); +INSERT INTO `qiniu_content` VALUES (24, 'yixiang', 'news', '2.70KB ', '公开', '2020-06-26 18:25:07', 'https://image.dayouqiantu.cn/news.png', 'png'); +INSERT INTO `qiniu_content` VALUES (25, 'yixiang', '5ca04fa9c08ef', '314.06KB ', '公开', '2020-06-26 18:25:23', 'https://image.dayouqiantu.cn/5ca04fa9c08ef.jpg', 'jpg'); +INSERT INTO `qiniu_content` VALUES (26, 'yixiang', '5ca0786c5d2c1', '388.24KB ', '公开', '2020-06-26 18:25:23', 'https://image.dayouqiantu.cn/5ca0786c5d2c1.jpg', 'jpg'); +INSERT INTO `qiniu_content` VALUES (27, 'yixiang', '5ca081af6183f', '339.37KB ', '公开', '2020-06-26 18:25:23', 'https://image.dayouqiantu.cn/5ca081af6183f.jpg', 'jpg'); + +-- ---------------------------- +-- Table structure for quartz_job +-- ---------------------------- +DROP TABLE IF EXISTS `quartz_job`; +CREATE TABLE `quartz_job` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `bean_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Spring Bean名称', + `cron_expression` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'cron 表达式', + `is_pause` bit(1) NULL DEFAULT NULL COMMENT '状态:1暂停、0启用', + `job_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '任务名称', + `method_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '方法名称', + `params` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '参数', + `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建日期', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '定时任务' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of quartz_job +-- ---------------------------- +INSERT INTO `quartz_job` VALUES (1, 'visitsTask', '0 0 0 * * ?', b'0', '更新访客记录', 'run', NULL, '每日0点创建新的访客记录', '2019-01-08 14:53:31', NULL, 0); +INSERT INTO `quartz_job` VALUES (2, 'testTask', '0/5 * * * * ?', b'1', '测试1', 'run1', 'test', '带参测试,多参使用json', '2019-08-22 14:08:29', NULL, 0); +INSERT INTO `quartz_job` VALUES (3, 'testTask', '0/5 * * * * ?', b'1', '测试43', 'run', '44', '不带参测试', '2019-09-26 16:44:39', NULL, 0); + +-- ---------------------------- +-- Table structure for quartz_log +-- ---------------------------- +DROP TABLE IF EXISTS `quartz_log`; +CREATE TABLE `quartz_log` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `baen_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `create_time` datetime(0) NULL DEFAULT NULL, + `cron_expression` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `exception_detail` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL, + `is_success` bit(1) NULL DEFAULT NULL, + `job_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `method_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `params` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `time` bigint(20) NULL DEFAULT NULL, + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '定时任务日志' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of quartz_log +-- ---------------------------- +INSERT INTO `quartz_log` VALUES (1, 'visitsTask', '2020-01-10 00:00:00', '0 0 0 * * ?', NULL, b'1', '更新访客记录', 'run', NULL, 160, NULL, 0); +INSERT INTO `quartz_log` VALUES (2, 'visitsTask', '2020-03-10 00:00:00', '0 0 0 * * ?', NULL, b'1', '更新访客记录', 'run', NULL, 42, NULL, 0); +INSERT INTO `quartz_log` VALUES (3, 'visitsTask', '2020-04-02 00:00:00', '0 0 0 * * ?', NULL, b'1', '更新访客记录', 'run', NULL, 60, NULL, 0); +INSERT INTO `quartz_log` VALUES (4, 'visitsTask', '2020-09-01 00:00:00', '0 0 0 * * ?', NULL, b'1', '更新访客记录', 'run', NULL, 36, NULL, 0); +INSERT INTO `quartz_log` VALUES (5, 'visitsTask', '2020-09-02 00:00:00', '0 0 0 * * ?', NULL, b'1', '更新访客记录', 'run', NULL, 19, NULL, 0); +INSERT INTO `quartz_log` VALUES (6, 'visitsTask', '2020-09-03 00:00:00', '0 0 0 * * ?', NULL, b'1', '更新访客记录', 'run', NULL, 39, NULL, 0); +INSERT INTO `quartz_log` VALUES (7, 'visitsTask', '2020-09-04 00:00:00', '0 0 0 * * ?', NULL, b'1', '更新访客记录', 'run', NULL, 30, NULL, 0); +INSERT INTO `quartz_log` VALUES (8, 'visitsTask', '2020-09-05 00:00:00', '0 0 0 * * ?', NULL, b'1', '更新访客记录', 'run', NULL, 23, NULL, 0); +INSERT INTO `quartz_log` VALUES (9, 'visitsTask', '2020-09-06 00:00:00', '0 0 0 * * ?', NULL, b'1', '更新访客记录', 'run', NULL, 70, NULL, 0); +INSERT INTO `quartz_log` VALUES (10, 'visitsTask', '2020-09-07 00:00:00', '0 0 0 * * ?', NULL, b'1', '更新访客记录', 'run', NULL, 18, NULL, 0); +INSERT INTO `quartz_log` VALUES (11, 'visitsTask', '2020-09-08 00:00:00', '0 0 0 * * ?', NULL, b'1', '更新访客记录', 'run', NULL, 14, NULL, 0); +INSERT INTO `quartz_log` VALUES (12, 'visitsTask', '2020-09-09 00:00:00', '0 0 0 * * ?', NULL, b'1', '更新访客记录', 'run', NULL, 31, NULL, 0); +INSERT INTO `quartz_log` VALUES (13, 'visitsTask', '2020-09-10 00:00:00', '0 0 0 * * ?', NULL, b'1', '更新访客记录', 'run', NULL, 40, NULL, 0); +INSERT INTO `quartz_log` VALUES (14, 'visitsTask', '2020-09-11 00:00:00', '0 0 0 * * ?', NULL, b'1', '更新访客记录', 'run', NULL, 20, NULL, 0); +INSERT INTO `quartz_log` VALUES (15, 'visitsTask', '2020-09-12 00:00:00', '0 0 0 * * ?', NULL, b'1', '更新访客记录', 'run', NULL, 39, NULL, 0); +INSERT INTO `quartz_log` VALUES (16, 'visitsTask', '2020-09-13 00:00:00', '0 0 0 * * ?', NULL, b'1', '更新访客记录', 'run', NULL, 15, NULL, 0); +INSERT INTO `quartz_log` VALUES (17, 'visitsTask', '2020-09-14 00:00:00', '0 0 0 * * ?', NULL, b'1', '更新访客记录', 'run', NULL, 15, NULL, 0); +INSERT INTO `quartz_log` VALUES (18, 'visitsTask', '2020-09-15 00:00:00', '0 0 0 * * ?', NULL, b'1', '更新访客记录', 'run', NULL, 35, NULL, 0); + +-- ---------------------------- +-- Table structure for role +-- ---------------------------- +DROP TABLE IF EXISTS `role`; +CREATE TABLE `role` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '名称', + `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + `data_scope` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据权限', + `level` int(255) NULL DEFAULT NULL COMMENT '角色级别', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建日期', + `permission` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '功能权限', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色表' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of role +-- ---------------------------- +INSERT INTO `role` VALUES (1, '超级管理员', '-', '全部', 1, '2018-11-23 11:04:37', 'admin', NULL, 0); +INSERT INTO `role` VALUES (2, '普通用户', '-', '本级', 2, '2018-11-23 13:09:06', 'common', NULL, 0); +INSERT INTO `role` VALUES (3, '管理员2', '222', '全部', 3, '2020-01-31 16:53:25', '22', NULL, 0); + +-- ---------------------------- +-- Table structure for roles_depts +-- ---------------------------- +DROP TABLE IF EXISTS `roles_depts`; +CREATE TABLE `roles_depts` ( + `role_id` bigint(20) NOT NULL, + `dept_id` bigint(20) NOT NULL, + PRIMARY KEY (`role_id`, `dept_id`) USING BTREE, + INDEX `FK7qg6itn5ajdoa9h9o78v9ksur`(`dept_id`) USING BTREE, + CONSTRAINT `FK7qg6itn5ajdoa9h9o78v9ksur` FOREIGN KEY (`dept_id`) REFERENCES `dept` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, + CONSTRAINT `FKrg1ci4cxxfbja0sb0pddju7k` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色部门关联' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of roles_depts +-- ---------------------------- + +-- ---------------------------- +-- Table structure for roles_menus +-- ---------------------------- +DROP TABLE IF EXISTS `roles_menus`; +CREATE TABLE `roles_menus` ( + `menu_id` bigint(20) NOT NULL COMMENT '菜单ID', + `role_id` bigint(20) NOT NULL COMMENT '角色ID', + PRIMARY KEY (`menu_id`, `role_id`) USING BTREE, + INDEX `FKcngg2qadojhi3a651a5adkvbq`(`role_id`) USING BTREE, + CONSTRAINT `FKo7wsmlrrxb2osfaoavp46rv2r` FOREIGN KEY (`menu_id`) REFERENCES `menu` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, + CONSTRAINT `FKtag324maketmxffly3pdyh193` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色菜单关联' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of roles_menus +-- ---------------------------- +INSERT INTO `roles_menus` VALUES (1, 1); +INSERT INTO `roles_menus` VALUES (2, 1); +INSERT INTO `roles_menus` VALUES (3, 1); +INSERT INTO `roles_menus` VALUES (5, 1); +INSERT INTO `roles_menus` VALUES (6, 1); +INSERT INTO `roles_menus` VALUES (7, 1); +INSERT INTO `roles_menus` VALUES (9, 1); +INSERT INTO `roles_menus` VALUES (14, 1); +INSERT INTO `roles_menus` VALUES (18, 1); +INSERT INTO `roles_menus` VALUES (19, 1); +INSERT INTO `roles_menus` VALUES (28, 1); +INSERT INTO `roles_menus` VALUES (30, 1); +INSERT INTO `roles_menus` VALUES (32, 1); +INSERT INTO `roles_menus` VALUES (35, 1); +INSERT INTO `roles_menus` VALUES (36, 1); +INSERT INTO `roles_menus` VALUES (37, 1); +INSERT INTO `roles_menus` VALUES (39, 1); +INSERT INTO `roles_menus` VALUES (40, 1); +INSERT INTO `roles_menus` VALUES (41, 1); +INSERT INTO `roles_menus` VALUES (45, 1); +INSERT INTO `roles_menus` VALUES (46, 1); +INSERT INTO `roles_menus` VALUES (47, 1); +INSERT INTO `roles_menus` VALUES (48, 1); +INSERT INTO `roles_menus` VALUES (49, 1); +INSERT INTO `roles_menus` VALUES (50, 1); +INSERT INTO `roles_menus` VALUES (51, 1); +INSERT INTO `roles_menus` VALUES (52, 1); +INSERT INTO `roles_menus` VALUES (53, 1); +INSERT INTO `roles_menus` VALUES (54, 1); +INSERT INTO `roles_menus` VALUES (55, 1); +INSERT INTO `roles_menus` VALUES (56, 1); +INSERT INTO `roles_menus` VALUES (57, 1); +INSERT INTO `roles_menus` VALUES (59, 1); +INSERT INTO `roles_menus` VALUES (60, 1); +INSERT INTO `roles_menus` VALUES (61, 1); +INSERT INTO `roles_menus` VALUES (62, 1); +INSERT INTO `roles_menus` VALUES (63, 1); +INSERT INTO `roles_menus` VALUES (64, 1); +INSERT INTO `roles_menus` VALUES (65, 1); +INSERT INTO `roles_menus` VALUES (66, 1); +INSERT INTO `roles_menus` VALUES (68, 1); +INSERT INTO `roles_menus` VALUES (69, 1); +INSERT INTO `roles_menus` VALUES (70, 1); +INSERT INTO `roles_menus` VALUES (72, 1); +INSERT INTO `roles_menus` VALUES (73, 1); +INSERT INTO `roles_menus` VALUES (74, 1); +INSERT INTO `roles_menus` VALUES (75, 1); +INSERT INTO `roles_menus` VALUES (76, 1); +INSERT INTO `roles_menus` VALUES (77, 1); +INSERT INTO `roles_menus` VALUES (78, 1); +INSERT INTO `roles_menus` VALUES (79, 1); +INSERT INTO `roles_menus` VALUES (80, 1); +INSERT INTO `roles_menus` VALUES (81, 1); +INSERT INTO `roles_menus` VALUES (82, 1); +INSERT INTO `roles_menus` VALUES (83, 1); +INSERT INTO `roles_menus` VALUES (84, 1); +INSERT INTO `roles_menus` VALUES (86, 1); +INSERT INTO `roles_menus` VALUES (87, 1); +INSERT INTO `roles_menus` VALUES (88, 1); +INSERT INTO `roles_menus` VALUES (116, 1); +INSERT INTO `roles_menus` VALUES (118, 1); +INSERT INTO `roles_menus` VALUES (119, 1); +INSERT INTO `roles_menus` VALUES (120, 1); +INSERT INTO `roles_menus` VALUES (121, 1); +INSERT INTO `roles_menus` VALUES (123, 1); +INSERT INTO `roles_menus` VALUES (124, 1); +INSERT INTO `roles_menus` VALUES (126, 1); +INSERT INTO `roles_menus` VALUES (127, 1); +INSERT INTO `roles_menus` VALUES (128, 1); +INSERT INTO `roles_menus` VALUES (129, 1); +INSERT INTO `roles_menus` VALUES (130, 1); +INSERT INTO `roles_menus` VALUES (131, 1); +INSERT INTO `roles_menus` VALUES (132, 1); +INSERT INTO `roles_menus` VALUES (133, 1); +INSERT INTO `roles_menus` VALUES (134, 1); +INSERT INTO `roles_menus` VALUES (135, 1); +INSERT INTO `roles_menus` VALUES (136, 1); +INSERT INTO `roles_menus` VALUES (137, 1); +INSERT INTO `roles_menus` VALUES (138, 1); +INSERT INTO `roles_menus` VALUES (139, 1); +INSERT INTO `roles_menus` VALUES (140, 1); +INSERT INTO `roles_menus` VALUES (141, 1); +INSERT INTO `roles_menus` VALUES (142, 1); +INSERT INTO `roles_menus` VALUES (143, 1); +INSERT INTO `roles_menus` VALUES (144, 1); +INSERT INTO `roles_menus` VALUES (147, 1); +INSERT INTO `roles_menus` VALUES (148, 1); +INSERT INTO `roles_menus` VALUES (149, 1); +INSERT INTO `roles_menus` VALUES (150, 1); +INSERT INTO `roles_menus` VALUES (151, 1); +INSERT INTO `roles_menus` VALUES (152, 1); +INSERT INTO `roles_menus` VALUES (153, 1); +INSERT INTO `roles_menus` VALUES (154, 1); +INSERT INTO `roles_menus` VALUES (155, 1); +INSERT INTO `roles_menus` VALUES (156, 1); +INSERT INTO `roles_menus` VALUES (157, 1); +INSERT INTO `roles_menus` VALUES (158, 1); +INSERT INTO `roles_menus` VALUES (159, 1); +INSERT INTO `roles_menus` VALUES (160, 1); +INSERT INTO `roles_menus` VALUES (161, 1); +INSERT INTO `roles_menus` VALUES (162, 1); +INSERT INTO `roles_menus` VALUES (163, 1); +INSERT INTO `roles_menus` VALUES (164, 1); +INSERT INTO `roles_menus` VALUES (165, 1); +INSERT INTO `roles_menus` VALUES (166, 1); +INSERT INTO `roles_menus` VALUES (167, 1); +INSERT INTO `roles_menus` VALUES (168, 1); +INSERT INTO `roles_menus` VALUES (169, 1); +INSERT INTO `roles_menus` VALUES (170, 1); +INSERT INTO `roles_menus` VALUES (171, 1); +INSERT INTO `roles_menus` VALUES (172, 1); +INSERT INTO `roles_menus` VALUES (173, 1); +INSERT INTO `roles_menus` VALUES (174, 1); +INSERT INTO `roles_menus` VALUES (175, 1); +INSERT INTO `roles_menus` VALUES (176, 1); +INSERT INTO `roles_menus` VALUES (177, 1); +INSERT INTO `roles_menus` VALUES (178, 1); +INSERT INTO `roles_menus` VALUES (179, 1); +INSERT INTO `roles_menus` VALUES (180, 1); +INSERT INTO `roles_menus` VALUES (181, 1); +INSERT INTO `roles_menus` VALUES (182, 1); +INSERT INTO `roles_menus` VALUES (183, 1); +INSERT INTO `roles_menus` VALUES (184, 1); +INSERT INTO `roles_menus` VALUES (185, 1); +INSERT INTO `roles_menus` VALUES (186, 1); +INSERT INTO `roles_menus` VALUES (187, 1); +INSERT INTO `roles_menus` VALUES (188, 1); +INSERT INTO `roles_menus` VALUES (189, 1); +INSERT INTO `roles_menus` VALUES (190, 1); +INSERT INTO `roles_menus` VALUES (191, 1); +INSERT INTO `roles_menus` VALUES (192, 1); +INSERT INTO `roles_menus` VALUES (193, 1); +INSERT INTO `roles_menus` VALUES (194, 1); +INSERT INTO `roles_menus` VALUES (195, 1); +INSERT INTO `roles_menus` VALUES (196, 1); +INSERT INTO `roles_menus` VALUES (197, 1); +INSERT INTO `roles_menus` VALUES (198, 1); +INSERT INTO `roles_menus` VALUES (199, 1); +INSERT INTO `roles_menus` VALUES (200, 1); +INSERT INTO `roles_menus` VALUES (201, 1); +INSERT INTO `roles_menus` VALUES (202, 1); +INSERT INTO `roles_menus` VALUES (203, 1); +INSERT INTO `roles_menus` VALUES (204, 1); +INSERT INTO `roles_menus` VALUES (205, 1); +INSERT INTO `roles_menus` VALUES (206, 1); +INSERT INTO `roles_menus` VALUES (208, 1); +INSERT INTO `roles_menus` VALUES (209, 1); +INSERT INTO `roles_menus` VALUES (210, 1); +INSERT INTO `roles_menus` VALUES (211, 1); +INSERT INTO `roles_menus` VALUES (212, 1); +INSERT INTO `roles_menus` VALUES (213, 1); +INSERT INTO `roles_menus` VALUES (214, 1); +INSERT INTO `roles_menus` VALUES (215, 1); +INSERT INTO `roles_menus` VALUES (216, 1); +INSERT INTO `roles_menus` VALUES (217, 1); +INSERT INTO `roles_menus` VALUES (218, 1); +INSERT INTO `roles_menus` VALUES (219, 1); +INSERT INTO `roles_menus` VALUES (220, 1); +INSERT INTO `roles_menus` VALUES (221, 1); +INSERT INTO `roles_menus` VALUES (222, 1); +INSERT INTO `roles_menus` VALUES (223, 1); +INSERT INTO `roles_menus` VALUES (224, 1); +INSERT INTO `roles_menus` VALUES (225, 1); +INSERT INTO `roles_menus` VALUES (226, 1); +INSERT INTO `roles_menus` VALUES (227, 1); +INSERT INTO `roles_menus` VALUES (228, 1); +INSERT INTO `roles_menus` VALUES (229, 1); +INSERT INTO `roles_menus` VALUES (230, 1); +INSERT INTO `roles_menus` VALUES (231, 1); +INSERT INTO `roles_menus` VALUES (232, 1); +INSERT INTO `roles_menus` VALUES (233, 1); +INSERT INTO `roles_menus` VALUES (234, 1); +INSERT INTO `roles_menus` VALUES (235, 1); +INSERT INTO `roles_menus` VALUES (236, 1); +INSERT INTO `roles_menus` VALUES (237, 1); +INSERT INTO `roles_menus` VALUES (238, 1); +INSERT INTO `roles_menus` VALUES (240, 1); +INSERT INTO `roles_menus` VALUES (241, 1); +INSERT INTO `roles_menus` VALUES (242, 1); +INSERT INTO `roles_menus` VALUES (243, 1); +INSERT INTO `roles_menus` VALUES (244, 1); +INSERT INTO `roles_menus` VALUES (245, 1); +INSERT INTO `roles_menus` VALUES (246, 1); +INSERT INTO `roles_menus` VALUES (247, 1); +INSERT INTO `roles_menus` VALUES (248, 1); +INSERT INTO `roles_menus` VALUES (249, 1); +INSERT INTO `roles_menus` VALUES (250, 1); +INSERT INTO `roles_menus` VALUES (251, 1); +INSERT INTO `roles_menus` VALUES (252, 1); +INSERT INTO `roles_menus` VALUES (253, 1); +INSERT INTO `roles_menus` VALUES (256, 1); +INSERT INTO `roles_menus` VALUES (257, 1); +INSERT INTO `roles_menus` VALUES (258, 1); +INSERT INTO `roles_menus` VALUES (259, 1); +INSERT INTO `roles_menus` VALUES (260, 1); +INSERT INTO `roles_menus` VALUES (261, 1); +INSERT INTO `roles_menus` VALUES (262, 1); +INSERT INTO `roles_menus` VALUES (263, 1); +INSERT INTO `roles_menus` VALUES (264, 1); +INSERT INTO `roles_menus` VALUES (265, 1); + + +-- ---------------------------- +-- Table structure for user +-- ---------------------------- +DROP TABLE IF EXISTS `user`; +CREATE TABLE `user` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `avatar_id` bigint(20) NULL DEFAULT NULL COMMENT '头像', + `email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱', + `enabled` bigint(20) NULL DEFAULT NULL COMMENT '状态:1启用、0禁用', + `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '密码', + `username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名', + `dept_id` bigint(20) NULL DEFAULT NULL COMMENT '部门名称', + `phone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机号码', + `job_id` bigint(20) NULL DEFAULT NULL COMMENT '岗位名称', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建日期', + `last_password_reset_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改密码的日期', + `nick_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `sex` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `UK_kpubos9gc2cvtkb0thktkbkes`(`email`) USING BTREE, + UNIQUE INDEX `username`(`username`) USING BTREE, + INDEX `FK5rwmryny6jthaaxkogownknqp`(`dept_id`) USING BTREE, + INDEX `FKfftoc2abhot8f2wu6cl9a5iky`(`job_id`) USING BTREE, + INDEX `FKpq2dhypk2qgt68nauh2by22jb`(`avatar_id`) USING BTREE, + CONSTRAINT `FK5rwmryny6jthaaxkogownknqp` FOREIGN KEY (`dept_id`) REFERENCES `dept` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, + CONSTRAINT `FKfftoc2abhot8f2wu6cl9a5iky` FOREIGN KEY (`job_id`) REFERENCES `job` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, + CONSTRAINT `FKpq2dhypk2qgt68nauh2by22jb` FOREIGN KEY (`avatar_id`) REFERENCES `user_avatar` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '系统用户' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of user +-- ---------------------------- +INSERT INTO `user` VALUES (1, 1, 'yshop@qq.com', 1, '$2a$10$fP.426qKaTmix50Oln8L.uav55gELhAd0Eg66Av4oG86u8km7D/Ky', 'admin', 2, '18888888888', 11, '2018-08-23 09:11:56', '2019-05-18 17:34:21', '管理员', '男', '2020-06-27 12:05:56', 0); +INSERT INTO `user` VALUES (3, NULL, 'test@yshopnet', 1, '$2a$10$HhxyGZy.ulf3RvAwaHUGb.k.2i9PBpv4YbLMJWp8pES7pPhTyRCF.', 'test', 2, '17777777777', 12, '2018-12-27 20:05:26', '2019-04-01 09:15:24', '测试', '男', NULL, 0); +INSERT INTO `user` VALUES (4, NULL, 'test2@qq.com', 1, '$2a$10$IjehtV8MiXb8ni.Qz0wBteE7FjVn49cEcsSj2.ZBUqqHjnC3umSh.', 'test2', 2, '15136175247', 11, '2020-02-15 20:39:16', NULL, 'test2', '男', NULL, 0); +INSERT INTO `user` VALUES (5, NULL, '444@qq.com', 0, '$2a$10$f/VH35NBOBszycV9KEA1HenQ0qVjazDm8LacQU9PO.A4UizFxLMuq', 'qqqqq', 11, '15136175249', 8, '2020-02-17 11:12:01', NULL, 'eeeeee', '男', NULL, 0); +INSERT INTO `user` VALUES (6, NULL, '666@qq.com', 0, '$2a$10$3Vlo24eOmHHW7.3vAjqPSusfIINNo4JiujzxgqsaoWLx/d5de/jEm', '7777', 8, '15136175246', 8, '2020-05-18 19:43:30', NULL, '777', '男', NULL, 0); + +-- ---------------------------- +-- Table structure for user_avatar +-- ---------------------------- +DROP TABLE IF EXISTS `user_avatar`; +CREATE TABLE `user_avatar` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `real_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '真实文件名', + `path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '路径', + `size` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '大小', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '系统用户头像' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of user_avatar +-- ---------------------------- +INSERT INTO `user_avatar` VALUES (1, '20200627120555818410.png', 'D:\\yshop\\avatar\\20200627120555818410.png', '12.93KB ', '2020-06-27 12:05:56'); + +-- ---------------------------- +-- Table structure for users_roles +-- ---------------------------- +DROP TABLE IF EXISTS `users_roles`; +CREATE TABLE `users_roles` ( + `user_id` bigint(20) NOT NULL COMMENT '用户ID', + `role_id` bigint(20) NOT NULL COMMENT '角色ID', + PRIMARY KEY (`user_id`, `role_id`) USING BTREE, + INDEX `FKq4eq273l04bpu4efj0jd0jb98`(`role_id`) USING BTREE, + CONSTRAINT `FKgd3iendaoyh04b95ykqise6qh` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, + CONSTRAINT `FKt4v0rrweyk393bdgt107vdx0x` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户角色关联' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of users_roles +-- ---------------------------- +INSERT INTO `users_roles` VALUES (1, 1); +INSERT INTO `users_roles` VALUES (3, 2); +INSERT INTO `users_roles` VALUES (4, 2); +INSERT INTO `users_roles` VALUES (5, 2); +INSERT INTO `users_roles` VALUES (6, 2); + +-- ---------------------------- +-- Table structure for verification_code +-- ---------------------------- +DROP TABLE IF EXISTS `verification_code`; +CREATE TABLE `verification_code` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '验证码', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建日期', + `status` bit(1) NULL DEFAULT NULL COMMENT '状态:1有效、0过期', + `type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '验证码类型:email或者短信', + `value` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '接收邮箱或者手机号码', + `scenes` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '业务名称:如重置邮箱、重置密码等', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '验证码' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of verification_code +-- ---------------------------- + +-- ---------------------------- +-- Table structure for visits +-- ---------------------------- +DROP TABLE IF EXISTS `visits`; +CREATE TABLE `visits` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `create_time` datetime(0) NULL DEFAULT NULL, + `date` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `ip_counts` bigint(20) NULL DEFAULT NULL, + `pv_counts` bigint(20) NULL DEFAULT NULL, + `week_day` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `UK_11aksgq87euk9bcyeesfs4vtp`(`date`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1266934639347150881 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '访客记录' ROW_FORMAT = COMPACT; + +-- ---------------------------- +-- Records of visits +-- ---------------------------- +INSERT INTO `visits` VALUES (1265104717297319937, '2020-05-26 10:17:24', '2020-05-26', 1, 1, 'Tue'); +INSERT INTO `visits` VALUES (1265104717297319938, '2020-05-27 16:32:32', '2020-05-27', 1, 2, 'Wed'); +INSERT INTO `visits` VALUES (1265104717297319939, '2020-05-29 14:18:55', '2020-05-29', 1, 1, 'Fri'); +INSERT INTO `visits` VALUES (1266934639347150849, '2020-05-31 11:28:51', '2020-05-31', 1, 1, 'Sun'); +INSERT INTO `visits` VALUES (1266934639347150850, '2020-06-01 15:37:07', '2020-06-01', 1, 1, 'Mon'); +INSERT INTO `visits` VALUES (1266934639347150851, '2020-06-09 11:52:36', '2020-06-09', 1, 2, 'Tue'); +INSERT INTO `visits` VALUES (1266934639347150852, '2020-06-12 16:23:50', '2020-06-12', 1, 2, 'Fri'); +INSERT INTO `visits` VALUES (1266934639347150853, '2020-06-13 16:49:12', '2020-06-13', 1, 1, 'Sat'); +INSERT INTO `visits` VALUES (1266934639347150854, '2020-06-25 16:12:58', '2020-06-25', 1, 8, 'Thu'); +INSERT INTO `visits` VALUES (1266934639347150855, '2020-06-26 10:15:43', '2020-06-26', 2, 7, 'Fri'); +INSERT INTO `visits` VALUES (1266934639347150856, '2020-06-27 11:38:14', '2020-06-27', 1, 5, 'Sat'); +INSERT INTO `visits` VALUES (1266934639347150857, '2020-06-28 15:59:08', '2020-06-28', 1, 6, 'Sun'); +INSERT INTO `visits` VALUES (1266934639347150858, '2020-06-29 09:19:53', '2020-06-29', 1, 4, 'Mon'); +INSERT INTO `visits` VALUES (1266934639347150859, '2020-06-30 09:55:25', '2020-06-30', 1, 5, 'Tue'); +INSERT INTO `visits` VALUES (1266934639347150860, '2020-07-01 10:02:51', '2020-07-01', 1, 9, 'Wed'); +INSERT INTO `visits` VALUES (1266934639347150861, '2020-07-02 10:55:09', '2020-07-02', 1, 7, 'Thu'); +INSERT INTO `visits` VALUES (1266934639347150862, '2020-07-03 10:40:46', '2020-07-03', 1, 8, 'Fri'); +INSERT INTO `visits` VALUES (1266934639347150863, '2020-07-04 10:03:30', '2020-07-04', 1, 4, 'Sat'); +INSERT INTO `visits` VALUES (1266934639347150864, '2020-07-05 09:56:06', '2020-07-05', 1, 4, 'Sun'); +INSERT INTO `visits` VALUES (1266934639347150865, '2020-07-06 14:35:25', '2020-07-06', 1, 2, 'Mon'); +INSERT INTO `visits` VALUES (1266934639347150866, '2020-09-01 00:00:00', '2020-09-01', 4, 4, 'Tue'); +INSERT INTO `visits` VALUES (1266934639347150867, '2020-09-02 00:00:00', '2020-09-02', 1, 4, 'Wed'); +INSERT INTO `visits` VALUES (1266934639347150868, '2020-09-03 00:00:00', '2020-09-03', 1, 2, 'Thu'); +INSERT INTO `visits` VALUES (1266934639347150869, '2020-09-04 00:00:00', '2020-09-04', 1, 3, 'Fri'); +INSERT INTO `visits` VALUES (1266934639347150870, '2020-09-05 00:00:00', '2020-09-05', 5, 2, 'Sat'); +INSERT INTO `visits` VALUES (1266934639347150871, '2020-09-06 00:00:00', '2020-09-06', 4, 2, 'Sun'); +INSERT INTO `visits` VALUES (1266934639347150872, '2020-09-07 00:00:00', '2020-09-07', 5, 3, 'Mon'); +INSERT INTO `visits` VALUES (1266934639347150873, '2020-09-08 00:00:00', '2020-09-08', 7, 15, 'Tue'); +INSERT INTO `visits` VALUES (1266934639347150874, '2020-09-09 00:00:00', '2020-09-09', 5, 3, 'Wed'); +INSERT INTO `visits` VALUES (1266934639347150875, '2020-09-10 00:00:00', '2020-09-10', 2, 4, 'Thu'); +INSERT INTO `visits` VALUES (1266934639347150876, '2020-09-11 00:00:00', '2020-09-11', 12, 5, 'Fri'); +INSERT INTO `visits` VALUES (1266934639347150877, '2020-09-12 00:00:00', '2020-09-12', 3, 4, 'Sat'); +INSERT INTO `visits` VALUES (1266934639347150878, '2020-09-13 00:00:00', '2020-09-13', 10, 4, 'Sun'); +INSERT INTO `visits` VALUES (1266934639347150879, '2020-09-14 00:00:00', '2020-09-14', 1, 1, 'Mon'); +INSERT INTO `visits` VALUES (1266934639347150880, '2020-09-15 00:00:00', '2020-09-15', 1, 1, 'Tue'); + +-- ---------------------------- +-- Table structure for yx_app_version +-- ---------------------------- +DROP TABLE IF EXISTS `yx_app_version`; +CREATE TABLE `yx_app_version` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `version_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '版本code', + `version_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '版本名称', + `version_info` varchar(600) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '版本描述', + `ios_url` varchar(10000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'ios store应用商店链接', + `android_url` varchar(10000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '安卓下载链接', + `force_update` tinyint(4) NULL DEFAULT NULL COMMENT '是否强制升级', + `create_time` datetime(0) NULL DEFAULT NULL, + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'app版本' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_app_version +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_article +-- ---------------------------- +DROP TABLE IF EXISTS `yx_article`; +CREATE TABLE `yx_article` ( + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '文章管理ID', + `cid` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '1' COMMENT '分类id', + `title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '文章标题', + `author` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文章作者', + `image_input` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '文章图片', + `synopsis` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文章简介', + `content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL, + `share_title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文章分享标题', + `share_synopsis` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文章分享简介', + `visit` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '浏览次数', + `sort` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '排序', + `url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '原文链接', + `status` tinyint(1) UNSIGNED NULL DEFAULT NULL COMMENT '状态', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + `hide` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '是否隐藏', + `admin_id` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '管理员id', + `mer_id` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '商户id', + `product_id` int(10) NULL DEFAULT 0 COMMENT '产品关联id', + `is_hot` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '是否热门(小程序)', + `is_banner` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '是否轮播图(小程序)', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '文章管理表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_article +-- ---------------------------- +INSERT INTO `yx_article` VALUES (2, '', 'yshop2版本上线了', 'yshop', 'http://127.0.0.1:8000/file/pic/20200527164526793230.png', 'yshop1.3版本上线了', '

yshop1.3版本上线了

', '', '', '8', NULL, '', NULL, '2019-08-22 12:26:00', '2020-06-25 19:12:53', 0, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `yx_article` VALUES (3, '', '44', '444', 'http://127.0.0.1:8000/file/pic/20200527164543489004.png', '4444', '

55555

', '', '', '', 0, '', NULL, '2020-06-25 19:12:35', NULL, 1, 0, 0, 0, 0, 0, 0); +INSERT INTO `yx_article` VALUES (4, '', 'yshop3.0', 'yshop', 'https://image.dayouqiantu.cn/news.png', 'yshop3.0', '


yshop3.0

', '', '', '3', 0, '', NULL, '2020-07-02 12:15:13', '2020-07-03 17:58:19', 0, 0, 0, 0, 0, 0, 0); + +-- ---------------------------- +-- Table structure for yx_express +-- ---------------------------- +DROP TABLE IF EXISTS `yx_express`; +CREATE TABLE `yx_express` ( + `id` mediumint(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '快递公司id', + `code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '快递公司简称', + `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '快递公司全称', + `sort` int(11) NOT NULL DEFAULT 0 COMMENT '排序', + `is_show` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否显示', + `create_time` datetime(0) NULL DEFAULT NULL, + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(255) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE, + INDEX `is_show`(`is_show`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 433 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '快递公司表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_express +-- ---------------------------- +INSERT INTO `yx_express` VALUES (426, 'STO', '申通快递', 0, 0, NULL, NULL, 0); +INSERT INTO `yx_express` VALUES (427, 'SF', '顺丰速运', 0, 0, NULL, NULL, 0); +INSERT INTO `yx_express` VALUES (428, 'ZTO', '中通快递', 0, 0, NULL, NULL, 0); +INSERT INTO `yx_express` VALUES (429, 'YTO', '圆通速递', 0, 0, NULL, '2020-09-06 09:59:36', 0); +INSERT INTO `yx_express` VALUES (430, '555', '555555', 0, 0, NULL, NULL, 1); +INSERT INTO `yx_express` VALUES (431, '555', '5555', 0, 0, NULL, NULL, 1); +INSERT INTO `yx_express` VALUES (432, '555', '555', 0, 0, '2020-06-26 12:29:48', NULL, 1); + +-- ---------------------------- +-- Table structure for yx_material +-- ---------------------------- +DROP TABLE IF EXISTS `yx_material`; +CREATE TABLE `yx_material` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'PK', + `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', + `create_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者ID', + `type` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '类型1、图片;2、视频', + `group_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '分组ID', + `name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '素材名', + `url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '素材链接', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '素材库' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_material +-- ---------------------------- +INSERT INTO `yx_material` VALUES ('05bf470c271f73fe2f572cad60b356f4', '2020-09-03 17:13:52', 'admin', '1', NULL, '1.jpg', 'https://consoleapi.xinxintuan.co/file/pic/20200903171351713145.jpg', NULL, 0); +INSERT INTO `yx_material` VALUES ('1888a13fdeca0d85dcc6bef413c531b9', '2020-06-26 17:22:21', 'admin', '1', NULL, 'list_16.png', 'http://127.0.0.1:8000/file/pic/20200626172220229003.png', NULL, 1); +INSERT INTO `yx_material` VALUES ('353760137dad5526444c01074f9490e0', '2020-09-03 17:18:08', 'admin', '1', NULL, '3.jpg', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807584910.jpg', NULL, 0); +INSERT INTO `yx_material` VALUES ('3e2aa47438e059b06eea6327ae2260ec', '2020-06-26 18:25:07', 'admin', '1', 'd9b1b9d69f5b72cda63e26dc9f087623', 'news.png', 'https://image.dayouqiantu.cn/news.png', NULL, 0); +INSERT INTO `yx_material` VALUES ('612f4f924840739f0ebdfbdce21d878b', '2020-06-26 18:25:07', 'admin', '1', 'd9b1b9d69f5b72cda63e26dc9f087623', 'sign.png', 'https://image.dayouqiantu.cn/sign.png', NULL, 0); +INSERT INTO `yx_material` VALUES ('658cff7a98834617e46adfd105db0a3c', '2020-05-27 16:45:44', 'admin', '1', NULL, 'list_18.png', 'http://127.0.0.1:8000/file/pic/20200527164543489004.png', NULL, 1); +INSERT INTO `yx_material` VALUES ('6d2c5511b87631ffa6c5eecb9e4d736f', '2020-06-26 18:25:23', 'admin', '1', '8cc5996f6c4b54fcf5c0f2845a5d9afa', '5ca04fa9c08ef.jpg', 'https://image.dayouqiantu.cn/5ca04fa9c08ef.jpg', NULL, 0); +INSERT INTO `yx_material` VALUES ('6d4adf87cbb42bac277edf212dcbf2a7', '2020-06-26 18:20:58', 'admin', '1', 'd9b1b9d69f5b72cda63e26dc9f087623', 'collect.png', 'https://image.dayouqiantu.cn/collect.png', NULL, 0); +INSERT INTO `yx_material` VALUES ('700a8cade3e6ff35a5e0d12b55849735', '2020-09-03 17:18:08', 'admin', '1', NULL, '7.jpg', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807647067.jpg', NULL, 0); +INSERT INTO `yx_material` VALUES ('7492896114a45879b88c08f02ef88a3e', '2020-06-26 18:25:07', 'admin', '1', 'd9b1b9d69f5b72cda63e26dc9f087623', 'pink.png', 'https://image.dayouqiantu.cn/pink.png', NULL, 0); +INSERT INTO `yx_material` VALUES ('77b45342d9861a25323f284b155c4c9d', '2020-09-03 17:18:08', 'admin', '1', NULL, '6.jpg', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807641535.jpg', NULL, 0); +INSERT INTO `yx_material` VALUES ('7cc18f371ebcfaeb63d95f734251453b', '2020-06-26 18:25:24', 'admin', '1', '8cc5996f6c4b54fcf5c0f2845a5d9afa', '5ca0786c5d2c1.jpg', 'https://image.dayouqiantu.cn/5ca0786c5d2c1.jpg', NULL, 1); +INSERT INTO `yx_material` VALUES ('80116a9fea6f899d4530e82bc4d9b97b', '2020-09-03 17:12:09', 'admin', '1', NULL, 'avatar_default.png', 'https://consoleapi.xinxintuan.co/file/pic/20200903171208889668.png', NULL, 0); +INSERT INTO `yx_material` VALUES ('808cbc928e818b2c0d12f5919042cdc2', '2020-06-26 11:08:09', 'admin', '1', NULL, 'list_34.png', 'http://127.0.0.1:8000/file/pic/20200626110808157592.png', NULL, 1); +INSERT INTO `yx_material` VALUES ('8a599a4721469bfcd1c313241c88bee0', '2020-06-26 18:20:58', 'admin', '1', 'd9b1b9d69f5b72cda63e26dc9f087623', 'buy.png', 'https://image.dayouqiantu.cn/buy.png', NULL, 0); +INSERT INTO `yx_material` VALUES ('8e19af4d16b717574d863e6316cf15e4', '2020-06-26 18:24:51', 'admin', '1', 'd9b1b9d69f5b72cda63e26dc9f087623', 'add.png', 'https://image.dayouqiantu.cn/add.png', NULL, 0); +INSERT INTO `yx_material` VALUES ('9ddc310b8b6e224cd1ee2f27f1d19017', '2020-06-26 18:25:07', 'admin', '1', 'd9b1b9d69f5b72cda63e26dc9f087623', 'sekill.png', 'https://image.dayouqiantu.cn/sekill.png', NULL, 0); +INSERT INTO `yx_material` VALUES ('a0fc29a301a72712802ef38efe011fc4', '2020-09-11 09:39:13', 'admin', '1', 'd9b1b9d69f5b72cda63e26dc9f087623', 'avatar_default.png', 'https://consoleapi.xinxintuan.co/file/pic/20200911093912577832.png', NULL, 0); +INSERT INTO `yx_material` VALUES ('a961d6c0f255083294c27bed47330ad9', '2020-05-27 16:45:27', 'admin', '1', '83ee56004ff88fd1ecdde5a43469ef2e', 'list_13.png', 'http://127.0.0.1:8000/file/pic/20200527164526793230.png', NULL, 1); +INSERT INTO `yx_material` VALUES ('b36ab3797cd310a210f5d3dec2d05349', '2020-09-03 17:18:08', 'admin', '1', NULL, '5.jpg', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807625149.jpg', NULL, 0); +INSERT INTO `yx_material` VALUES ('bd6c9dc5a3373fe377b4aeb0579ed1bb', '2020-06-26 17:35:22', 'admin', '1', NULL, 'list_18.png', 'http://127.0.0.1:8009/api/api/file/pic/20200626173520849370.png', NULL, 1); +INSERT INTO `yx_material` VALUES ('c246328a65ecb0170b67334e8ef4683e', '2020-06-26 18:20:58', 'admin', '1', 'd9b1b9d69f5b72cda63e26dc9f087623', 'goods.png', 'https://image.dayouqiantu.cn/goods.png', NULL, 0); +INSERT INTO `yx_material` VALUES ('c48c27553f32321e5b5e6cdc2b934484', '2020-09-15 07:41:40', 'admin', '1', NULL, '1600126884(1).jpg', 'https://consoleapi.xinxintuan.co/file/pic/20200915074139926178.jpg', NULL, 0); +INSERT INTO `yx_material` VALUES ('c83bb0d55e101f6ab525acb1f524b10b', '2020-06-26 17:39:44', 'admin', '1', NULL, 'list_34.png', 'http://127.0.0.1:8000/file/pic/20200626173943611335.png', NULL, 1); +INSERT INTO `yx_material` VALUES ('d63a722c0a0e55e73126ff9411ae1224', '2020-06-26 18:20:58', 'admin', '1', 'd9b1b9d69f5b72cda63e26dc9f087623', 'coupon.png', 'https://image.dayouqiantu.cn/coupon.png', NULL, 0); +INSERT INTO `yx_material` VALUES ('d98b9f8ad2daa9e9a7567b3ae31b81d7', '2020-06-26 18:24:51', 'admin', '1', 'd9b1b9d69f5b72cda63e26dc9f087623', 'bargin.png', 'https://image.dayouqiantu.cn/bargin.png', NULL, 0); +INSERT INTO `yx_material` VALUES ('eb8aa8d0846009f5b685e9f07a05c836', '2020-09-03 17:10:04', 'admin', '1', NULL, 'avatar_default.png', 'https://consoleapi.xinxintuan.co/file/pic/20200903171003417769.png', NULL, 0); +INSERT INTO `yx_material` VALUES ('f04dcbf4b61ab35d0f08f85a27ee92ff', '2020-06-26 18:25:24', 'admin', '1', '8cc5996f6c4b54fcf5c0f2845a5d9afa', '5ca081af6183f.jpg', 'https://image.dayouqiantu.cn/5ca081af6183f.jpg', NULL, 0); +INSERT INTO `yx_material` VALUES ('f0e8dddf88c587f638e5a7859d8cc7a3', '2020-09-03 17:18:08', 'admin', '1', NULL, '4.jpg', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807568739.jpg', NULL, 0); + +-- ---------------------------- +-- Table structure for yx_material_group +-- ---------------------------- +DROP TABLE IF EXISTS `yx_material_group`; +CREATE TABLE `yx_material_group` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'PK', + `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', + `create_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者ID', + `name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '分组名', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '素材分组' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_material_group +-- ---------------------------- +INSERT INTO `yx_material_group` VALUES ('83ee56004ff88fd1ecdde5a43469ef2e', '2020-05-27 16:45:08', NULL, 'test', '2020-06-26 18:20:00', 0); +INSERT INTO `yx_material_group` VALUES ('8cc5996f6c4b54fcf5c0f2845a5d9afa', '2020-06-26 11:07:26', NULL, '商品', '2020-06-26 18:20:14', 0); +INSERT INTO `yx_material_group` VALUES ('d9b1b9d69f5b72cda63e26dc9f087623', '2020-06-26 18:20:19', NULL, 'icon', NULL, 0); +INSERT INTO `yx_material_group` VALUES ('fe2e32c3ce27983c298ab344c6e1c4fa', '2020-05-27 16:45:13', NULL, 'bb', NULL, 1); + +-- ---------------------------- +-- Table structure for yx_shipping_templates +-- ---------------------------- +DROP TABLE IF EXISTS `yx_shipping_templates`; +CREATE TABLE `yx_shipping_templates` ( + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '模板ID', + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模板名称', + `type` tinyint(1) NULL DEFAULT NULL COMMENT '计费方式', + `region_info` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '地域以及费用', + `appoint` tinyint(1) NULL DEFAULT NULL COMMENT '指定包邮开关', + `appoint_info` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '指定包邮内容', + `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + `sort` int(11) NULL DEFAULT NULL COMMENT '排序', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 37 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '运费模板表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_shipping_templates +-- ---------------------------- +INSERT INTO `yx_shipping_templates` VALUES (32, '9999', 1, '[{\"_continue\":\"1\",\"continue_price\":\"0\",\"first\":\"1\",\"price\":\"0\",\"region\":[{\"city_id\":\"0\",\"name\":\"默认全国\"}],\"regionName\":\"默认全国\"}]', 0, '[]', '2020-07-01 14:03:59', NULL, 1, 0); +INSERT INTO `yx_shipping_templates` VALUES (33, '8888', 1, '[{\"_continue\":\"1\",\"continue_price\":\"0\",\"first\":\"1\",\"price\":\"0\",\"region\":[{\"city_id\":\"0\",\"name\":\"默认全国\"}],\"regionName\":\"默认全国\"}]', 0, '[]', '2020-07-01 14:08:19', NULL, 1, 0); +INSERT INTO `yx_shipping_templates` VALUES (34, '默认全国运费模板', 1, '[{\"_continue\":\"1\",\"continue_price\":\"2\",\"first\":\"1\",\"price\":\"1\",\"region\":[{\"city_id\":\"0\",\"name\":\"默认全国\"}],\"regionName\":\"默认全国\"}]', 0, '[]', '2020-07-01 15:20:44', '2020-07-05 17:06:47', 0, 0); +INSERT INTO `yx_shipping_templates` VALUES (35, '包邮湖北省,河南省特例', 1, '[{\"_continue\":\"1\",\"continue_price\":\"1\",\"first\":\"1\",\"price\":\"1\",\"region\":[{\"city_id\":\"0\",\"name\":\"默认全国\"}],\"regionName\":\"默认全国\"},{\"_continue\":\"1\",\"continue_price\":\"5\",\"first\":\"1\",\"price\":\"2\",\"region\":[{\"children\":[{\"city_id\":\"367396\"},{\"city_id\":\"370304\"},{\"city_id\":\"372971\"},{\"city_id\":\"376365\"},{\"city_id\":\"379245\"},{\"city_id\":\"382878\"},{\"city_id\":\"383890\"},{\"city_id\":\"387707\"},{\"city_id\":\"389719\"},{\"city_id\":\"392737\"},{\"city_id\":\"395254\"},{\"city_id\":\"396611\"},{\"city_id\":\"398169\"},{\"city_id\":\"403311\"},{\"city_id\":\"408287\"},{\"city_id\":\"411925\"},{\"city_id\":\"417174\"},{\"city_id\":\"420258\"}],\"city_id\":\"367395\",\"name\":\"河南省\"}],\"regionName\":\"河南省\"}]', 1, '[{\"a_num\":\"2\",\"a_price\":\"100\",\"place\":[{\"children\":[{\"city_id\":\"420825\"},{\"city_id\":\"424449\"},{\"city_id\":\"425508\"},{\"city_id\":\"427710\"},{\"city_id\":\"429501\"},{\"city_id\":\"432415\"},{\"city_id\":\"432829\"},{\"city_id\":\"434548\"},{\"city_id\":\"437779\"},{\"city_id\":\"440639\"},{\"city_id\":\"445040\"},{\"city_id\":\"446212\"},{\"city_id\":\"447268\"},{\"city_id\":\"449865\"}],\"city_id\":\"420824\",\"name\":\"湖北省\"}],\"placeName\":\"湖北省\"}]', '2020-07-01 15:26:38', '2020-07-05 17:08:39', 0, 0); +INSERT INTO `yx_shipping_templates` VALUES (36, '8888', 1, '[{\"_continue\":\"1\",\"continue_price\":\"1\",\"first\":\"1\",\"price\":\"1\",\"region\":[{\"city_id\":\"0\",\"name\":\"默认全国\"}],\"regionName\":\"默认全国\"}]', 1, '[]', '2020-07-01 16:04:28', '2020-07-01 16:07:31', 1, 0); + +-- ---------------------------- +-- Table structure for yx_shipping_templates_free +-- ---------------------------- +DROP TABLE IF EXISTS `yx_shipping_templates_free`; +CREATE TABLE `yx_shipping_templates_free` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '编号', + `province_id` int(11) NOT NULL DEFAULT 0 COMMENT '省ID', + `temp_id` int(11) NOT NULL DEFAULT 0 COMMENT '模板ID', + `city_id` int(11) NOT NULL DEFAULT 0 COMMENT '城市ID', + `number` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '包邮件数', + `price` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '包邮金额', + `type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '计费方式', + `uniqid` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '分组唯一值', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 198 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_shipping_templates_free +-- ---------------------------- +INSERT INTO `yx_shipping_templates_free` VALUES (158, 13267, 36, 13268, 1.00, 1.00, 1, 'ddd9604e6fb54edab5ced2e32c41db61'); +INSERT INTO `yx_shipping_templates_free` VALUES (159, 13267, 36, 18128, 1.00, 1.00, 1, 'ddd9604e6fb54edab5ced2e32c41db61'); +INSERT INTO `yx_shipping_templates_free` VALUES (160, 13267, 36, 24371, 1.00, 1.00, 1, 'ddd9604e6fb54edab5ced2e32c41db61'); +INSERT INTO `yx_shipping_templates_free` VALUES (161, 13267, 36, 26779, 1.00, 1.00, 1, 'ddd9604e6fb54edab5ced2e32c41db61'); +INSERT INTO `yx_shipping_templates_free` VALUES (162, 13267, 36, 32688, 1.00, 1.00, 1, 'ddd9604e6fb54edab5ced2e32c41db61'); +INSERT INTO `yx_shipping_templates_free` VALUES (163, 13267, 36, 38160, 1.00, 1.00, 1, 'ddd9604e6fb54edab5ced2e32c41db61'); +INSERT INTO `yx_shipping_templates_free` VALUES (164, 13267, 36, 44570, 1.00, 1.00, 1, 'ddd9604e6fb54edab5ced2e32c41db61'); +INSERT INTO `yx_shipping_templates_free` VALUES (165, 13267, 36, 49190, 1.00, 1.00, 1, 'ddd9604e6fb54edab5ced2e32c41db61'); +INSERT INTO `yx_shipping_templates_free` VALUES (166, 13267, 36, 52018, 1.00, 1.00, 1, 'ddd9604e6fb54edab5ced2e32c41db61'); +INSERT INTO `yx_shipping_templates_free` VALUES (167, 13267, 36, 58247, 1.00, 1.00, 1, 'ddd9604e6fb54edab5ced2e32c41db61'); +INSERT INTO `yx_shipping_templates_free` VALUES (168, 13267, 36, 61804, 1.00, 1.00, 1, 'ddd9604e6fb54edab5ced2e32c41db61'); +INSERT INTO `yx_shipping_templates_free` VALUES (169, 13267, 36, 66813, 1.00, 1.00, 1, 'ddd9604e6fb54edab5ced2e32c41db61'); +INSERT INTO `yx_shipping_templates_free` VALUES (184, 420824, 35, 420825, 2.00, 100.00, 1, '5a3c9a0dbe084d568b6f70e19e28c695'); +INSERT INTO `yx_shipping_templates_free` VALUES (185, 420824, 35, 424449, 2.00, 100.00, 1, '5a3c9a0dbe084d568b6f70e19e28c695'); +INSERT INTO `yx_shipping_templates_free` VALUES (186, 420824, 35, 425508, 2.00, 100.00, 1, '5a3c9a0dbe084d568b6f70e19e28c695'); +INSERT INTO `yx_shipping_templates_free` VALUES (187, 420824, 35, 427710, 2.00, 100.00, 1, '5a3c9a0dbe084d568b6f70e19e28c695'); +INSERT INTO `yx_shipping_templates_free` VALUES (188, 420824, 35, 429501, 2.00, 100.00, 1, '5a3c9a0dbe084d568b6f70e19e28c695'); +INSERT INTO `yx_shipping_templates_free` VALUES (189, 420824, 35, 432415, 2.00, 100.00, 1, '5a3c9a0dbe084d568b6f70e19e28c695'); +INSERT INTO `yx_shipping_templates_free` VALUES (190, 420824, 35, 432829, 2.00, 100.00, 1, '5a3c9a0dbe084d568b6f70e19e28c695'); +INSERT INTO `yx_shipping_templates_free` VALUES (191, 420824, 35, 434548, 2.00, 100.00, 1, '5a3c9a0dbe084d568b6f70e19e28c695'); +INSERT INTO `yx_shipping_templates_free` VALUES (192, 420824, 35, 437779, 2.00, 100.00, 1, '5a3c9a0dbe084d568b6f70e19e28c695'); +INSERT INTO `yx_shipping_templates_free` VALUES (193, 420824, 35, 440639, 2.00, 100.00, 1, '5a3c9a0dbe084d568b6f70e19e28c695'); +INSERT INTO `yx_shipping_templates_free` VALUES (194, 420824, 35, 445040, 2.00, 100.00, 1, '5a3c9a0dbe084d568b6f70e19e28c695'); +INSERT INTO `yx_shipping_templates_free` VALUES (195, 420824, 35, 446212, 2.00, 100.00, 1, '5a3c9a0dbe084d568b6f70e19e28c695'); +INSERT INTO `yx_shipping_templates_free` VALUES (196, 420824, 35, 447268, 2.00, 100.00, 1, '5a3c9a0dbe084d568b6f70e19e28c695'); +INSERT INTO `yx_shipping_templates_free` VALUES (197, 420824, 35, 449865, 2.00, 100.00, 1, '5a3c9a0dbe084d568b6f70e19e28c695'); + +-- ---------------------------- +-- Table structure for yx_shipping_templates_region +-- ---------------------------- +DROP TABLE IF EXISTS `yx_shipping_templates_region`; +CREATE TABLE `yx_shipping_templates_region` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '编号', + `province_id` int(11) NOT NULL DEFAULT 0 COMMENT '省ID', + `temp_id` int(11) NOT NULL DEFAULT 0 COMMENT '模板ID', + `city_id` int(11) NOT NULL DEFAULT 0 COMMENT '城市ID', + `first` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '首件', + `first_price` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '首件运费', + `continues` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '续件', + `continue_price` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '续件运费', + `type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '计费方式', + `uniqid` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '分组唯一值', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 250 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_shipping_templates_region +-- ---------------------------- +INSERT INTO `yx_shipping_templates_region` VALUES (175, 0, 32, 0, 1.00, 0.00, 1.00, 0.00, 1, 'da4f15807a2e47b880d8db454a350a5e'); +INSERT INTO `yx_shipping_templates_region` VALUES (176, 0, 33, 0, 1.00, 0.00, 1.00, 0.00, 1, '6ddd27e504e3451aad294cfb9e105fa2'); +INSERT INTO `yx_shipping_templates_region` VALUES (210, 0, 36, 0, 1.00, 1.00, 1.00, 1.00, 1, '14e3da43097248c29ed0d41eded5d9c0'); +INSERT INTO `yx_shipping_templates_region` VALUES (211, 0, 34, 0, 1.00, 1.00, 1.00, 2.00, 1, '2c8ea986f1a149329a72951c7670e9b4'); +INSERT INTO `yx_shipping_templates_region` VALUES (231, 0, 35, 0, 1.00, 1.00, 1.00, 1.00, 1, 'cc8ca17c6a7145adbf78498b2bdc07fe'); +INSERT INTO `yx_shipping_templates_region` VALUES (232, 367395, 35, 367396, 1.00, 2.00, 1.00, 5.00, 1, 'f883508219224a6d8a10ccbf99c0e9ba'); +INSERT INTO `yx_shipping_templates_region` VALUES (233, 367395, 35, 370304, 1.00, 2.00, 1.00, 5.00, 1, 'f883508219224a6d8a10ccbf99c0e9ba'); +INSERT INTO `yx_shipping_templates_region` VALUES (234, 367395, 35, 372971, 1.00, 2.00, 1.00, 5.00, 1, 'f883508219224a6d8a10ccbf99c0e9ba'); +INSERT INTO `yx_shipping_templates_region` VALUES (235, 367395, 35, 376365, 1.00, 2.00, 1.00, 5.00, 1, 'f883508219224a6d8a10ccbf99c0e9ba'); +INSERT INTO `yx_shipping_templates_region` VALUES (236, 367395, 35, 379245, 1.00, 2.00, 1.00, 5.00, 1, 'f883508219224a6d8a10ccbf99c0e9ba'); +INSERT INTO `yx_shipping_templates_region` VALUES (237, 367395, 35, 382878, 1.00, 2.00, 1.00, 5.00, 1, 'f883508219224a6d8a10ccbf99c0e9ba'); +INSERT INTO `yx_shipping_templates_region` VALUES (238, 367395, 35, 383890, 1.00, 2.00, 1.00, 5.00, 1, 'f883508219224a6d8a10ccbf99c0e9ba'); +INSERT INTO `yx_shipping_templates_region` VALUES (239, 367395, 35, 387707, 1.00, 2.00, 1.00, 5.00, 1, 'f883508219224a6d8a10ccbf99c0e9ba'); +INSERT INTO `yx_shipping_templates_region` VALUES (240, 367395, 35, 389719, 1.00, 2.00, 1.00, 5.00, 1, 'f883508219224a6d8a10ccbf99c0e9ba'); +INSERT INTO `yx_shipping_templates_region` VALUES (241, 367395, 35, 392737, 1.00, 2.00, 1.00, 5.00, 1, 'f883508219224a6d8a10ccbf99c0e9ba'); +INSERT INTO `yx_shipping_templates_region` VALUES (242, 367395, 35, 395254, 1.00, 2.00, 1.00, 5.00, 1, 'f883508219224a6d8a10ccbf99c0e9ba'); +INSERT INTO `yx_shipping_templates_region` VALUES (243, 367395, 35, 396611, 1.00, 2.00, 1.00, 5.00, 1, 'f883508219224a6d8a10ccbf99c0e9ba'); +INSERT INTO `yx_shipping_templates_region` VALUES (244, 367395, 35, 398169, 1.00, 2.00, 1.00, 5.00, 1, 'f883508219224a6d8a10ccbf99c0e9ba'); +INSERT INTO `yx_shipping_templates_region` VALUES (245, 367395, 35, 403311, 1.00, 2.00, 1.00, 5.00, 1, 'f883508219224a6d8a10ccbf99c0e9ba'); +INSERT INTO `yx_shipping_templates_region` VALUES (246, 367395, 35, 408287, 1.00, 2.00, 1.00, 5.00, 1, 'f883508219224a6d8a10ccbf99c0e9ba'); +INSERT INTO `yx_shipping_templates_region` VALUES (247, 367395, 35, 411925, 1.00, 2.00, 1.00, 5.00, 1, 'f883508219224a6d8a10ccbf99c0e9ba'); +INSERT INTO `yx_shipping_templates_region` VALUES (248, 367395, 35, 417174, 1.00, 2.00, 1.00, 5.00, 1, 'f883508219224a6d8a10ccbf99c0e9ba'); +INSERT INTO `yx_shipping_templates_region` VALUES (249, 367395, 35, 420258, 1.00, 2.00, 1.00, 5.00, 1, 'f883508219224a6d8a10ccbf99c0e9ba'); + +-- ---------------------------- +-- Table structure for yx_store_bargain +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_bargain`; +CREATE TABLE `yx_store_bargain` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '砍价产品ID', + `product_id` bigint(20) UNSIGNED NOT NULL COMMENT '关联产品ID', + `title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '砍价活动名称', + `image` varchar(150) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '砍价活动图片', + `unit_name` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '单位名称', + `stock` int(11) UNSIGNED NULL DEFAULT NULL COMMENT '库存', + `sales` int(11) UNSIGNED NULL DEFAULT NULL COMMENT '销量', + `images` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '砍价产品轮播图', + `start_time` datetime(0) NOT NULL COMMENT '砍价开启时间', + `stop_time` datetime(0) NOT NULL COMMENT '砍价结束时间', + `store_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '砍价产品名称', + `price` decimal(8, 2) UNSIGNED NULL DEFAULT NULL COMMENT '砍价金额', + `min_price` decimal(8, 2) UNSIGNED NULL DEFAULT NULL COMMENT '砍价商品最低价', + `num` int(11) UNSIGNED NULL DEFAULT NULL COMMENT '每次购买的砍价产品数量', + `bargain_max_price` decimal(8, 2) UNSIGNED NULL DEFAULT NULL COMMENT '用户每次砍价的最大金额', + `bargain_min_price` decimal(8, 2) UNSIGNED NULL DEFAULT NULL COMMENT '用户每次砍价的最小金额', + `bargain_num` int(11) UNSIGNED NOT NULL DEFAULT 1 COMMENT '用户每次砍价的次数', + `status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '砍价状态 0(到砍价时间不自动开启) 1(到砍价时间自动开启时间)', + `description` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '砍价详情', + `give_integral` decimal(10, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '反多少积分', + `info` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '砍价活动简介', + `cost` decimal(8, 2) UNSIGNED NULL DEFAULT NULL COMMENT '成本价', + `sort` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序', + `is_hot` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否推荐0不推荐1推荐', + `is_del` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否删除 0未删除 1删除', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_postage` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '是否包邮 0不包邮 1包邮', + `postage` decimal(10, 2) UNSIGNED NULL DEFAULT NULL COMMENT '邮费', + `rule` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '砍价规则', + `look` int(11) UNSIGNED NULL DEFAULT 0 COMMENT '砍价产品浏览量', + `share` int(11) UNSIGNED NULL DEFAULT 0 COMMENT '砍价产品分享量', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '砍价表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_bargain +-- ---------------------------- +INSERT INTO `yx_store_bargain` VALUES (12, 7, '专属测试商品', 'https://consoleapi.xinxintuan.co/file/pic/20200903171208889668.png', '张', 7, 3, 'https://image.dayouqiantu.cn/5ca04fa9c08ef.jpg,https://image.dayouqiantu.cn/5ca04fa9c08ef.jpg,https://image.dayouqiantu.cn/5ca081af6183f.jpg', '2020-09-12 18:20:56', '2020-09-30 00:00:00', NULL, 100.00, 1.00, 1, 10.00, 1.00, 1, 1, '


', 0.00, '结算', 110.00, 0, 0, 0, '2020-09-12 18:22:14', NULL, 1, 0.00, '

1、规则1

2、规则2

', 40, 23); + +-- ---------------------------- +-- Table structure for yx_store_bargain_user +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_bargain_user`; +CREATE TABLE `yx_store_bargain_user` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '用户参与砍价表ID', + `uid` bigint(20) UNSIGNED NULL DEFAULT NULL COMMENT '用户ID', + `bargain_id` bigint(20) UNSIGNED NULL DEFAULT NULL COMMENT '砍价产品id', + `bargain_price_min` decimal(8, 2) UNSIGNED NULL DEFAULT NULL COMMENT '砍价的最低价', + `bargain_price` decimal(8, 2) NULL DEFAULT NULL COMMENT '砍价金额', + `price` decimal(8, 2) UNSIGNED NULL DEFAULT NULL COMMENT '砍掉的价格', + `status` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '状态 1参与中 2 活动结束参与失败 3活动结束参与成功', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '参与时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否取消', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户参与砍价表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_bargain_user +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_store_bargain_user_help +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_bargain_user_help`; +CREATE TABLE `yx_store_bargain_user_help` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '砍价用户帮助表ID', + `uid` bigint(20) UNSIGNED NULL DEFAULT NULL COMMENT '帮助的用户id', + `bargain_id` bigint(20) UNSIGNED NULL DEFAULT NULL COMMENT '砍价产品ID', + `bargain_user_id` bigint(20) UNSIGNED NULL DEFAULT NULL COMMENT '用户参与砍价表id', + `price` decimal(8, 2) UNSIGNED NULL DEFAULT NULL COMMENT '帮助砍价多少金额', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '砍价用户帮助表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_bargain_user_help +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_store_cart +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_cart`; +CREATE TABLE `yx_store_cart` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '购物车表ID', + `uid` bigint(20) UNSIGNED NOT NULL COMMENT '用户ID', + `type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'product' COMMENT '类型', + `product_id` bigint(20) UNSIGNED NOT NULL COMMENT '商品ID', + `product_attr_unique` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '商品属性', + `cart_num` smallint(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT '商品数量', + `create_time` datetime(0) NOT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_pay` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0 = 未购买 1 = 已购买', + `is_del` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除', + `is_new` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否为立即购买', + `combination_id` int(11) UNSIGNED NULL DEFAULT 0 COMMENT '拼团id', + `seckill_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '秒杀产品ID', + `bargain_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '砍价id', + PRIMARY KEY (`id`) USING BTREE, + INDEX `user_id`(`uid`) USING BTREE, + INDEX `goods_id`(`product_id`) USING BTREE, + INDEX `uid`(`uid`, `is_pay`) USING BTREE, + INDEX `uid_2`(`uid`, `is_del`) USING BTREE, + INDEX `uid_3`(`uid`, `is_new`) USING BTREE, + INDEX `type`(`type`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 150 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '购物车表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_cart +-- ---------------------------- +INSERT INTO `yx_store_cart` VALUES (86, 40, 'product', 6, '91d12632e2c047d7b34dab48cfc5a34e', 1, '2020-09-12 14:54:08', '2020-09-12 14:54:45', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (87, 43, 'product', 7, '789984b858bb489bb6313107e11fdc15', 1, '2020-09-12 17:04:12', '2020-09-12 17:06:04', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (88, 43, 'product', 7, '789984b858bb489bb6313107e11fdc15', 1, '2020-09-12 17:06:54', '2020-09-12 17:07:00', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (89, 43, 'product', 7, '789984b858bb489bb6313107e11fdc15', 1, '2020-09-12 17:07:53', '2020-09-12 17:07:57', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (90, 43, 'product', 8, '2f7ee7305cfe43f782ea28c0235256db', 1, '2020-09-12 17:27:03', '2020-09-12 17:27:24', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (91, 43, 'product', 8, '183fcbaffb3849c48de2e87a226209b9', 1, '2020-09-12 17:48:03', '2020-09-12 17:48:14', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (92, 43, 'product', 7, '789984b858bb489bb6313107e11fdc15', 1, '2020-09-12 17:54:50', NULL, 0, 0, 0, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (93, 43, 'product', 8, '67138eee0bed408abe7d32b0ab2060b0', 1, '2020-09-12 17:56:08', NULL, 0, 0, 0, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (94, 43, 'product', 7, '789984b858bb489bb6313107e11fdc15', 1, '2020-09-12 18:10:27', NULL, 0, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (95, 43, 'product', 8, '183fcbaffb3849c48de2e87a226209b9', 1, '2020-09-12 18:10:44', '2020-09-12 18:11:05', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (96, 43, 'product', 8, 'f25af180071742458622febf7dde528b', 1, '2020-09-12 18:18:27', '2020-09-12 18:18:37', 1, 0, 1, 10, 0, 0); +INSERT INTO `yx_store_cart` VALUES (97, 42, 'product', 3, 'b951f8e2ed4641f08be1bce99b716a6d', 1, '2020-09-12 19:27:31', NULL, 0, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (98, 42, 'product', 8, '013f89ec740f478d8144f052909c0807', 1, '2020-09-12 19:42:36', NULL, 0, 0, 1, 10, 0, 0); +INSERT INTO `yx_store_cart` VALUES (99, 40, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-12 23:18:58', '2020-09-13 15:01:09', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (100, 53, 'product', 5, '4dd9ea6fb9f1414aabf18b713f0f6832', 1, '2020-09-13 02:29:15', '2020-09-13 02:29:37', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (101, 53, 'product', 8, '013f89ec740f478d8144f052909c0807', 1, '2020-09-13 03:54:24', '2020-09-13 03:54:28', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (102, 42, 'product', 8, '8112da382da7420f961203372f7c1d31', 1, '2020-09-13 06:59:31', NULL, 0, 0, 1, 0, 7, 0); +INSERT INTO `yx_store_cart` VALUES (103, 44, 'product', 5, '040fb7ab2a8b4ff3b6c9d1c78ea3e889', 1, '2020-09-13 10:15:35', '2020-09-13 10:18:02', 1, 0, 1, 0, 6, 0); +INSERT INTO `yx_store_cart` VALUES (104, 53, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-13 10:41:44', '2020-09-13 10:41:49', 1, 0, 1, 5, 0, 0); +INSERT INTO `yx_store_cart` VALUES (105, 53, 'product', 5, '040fb7ab2a8b4ff3b6c9d1c78ea3e889', 1, '2020-09-13 10:42:37', '2020-09-13 10:42:42', 1, 0, 1, 0, 6, 0); +INSERT INTO `yx_store_cart` VALUES (106, 53, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-13 10:58:02', '2020-09-13 11:04:18', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (107, 42, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-13 11:04:15', '2020-09-14 10:59:22', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (108, 53, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-13 11:05:22', '2020-09-13 11:05:26', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (109, 53, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-13 11:06:59', '2020-09-13 11:07:03', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (110, 53, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-13 11:07:24', '2020-09-13 11:07:29', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (111, 53, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-13 11:08:49', '2020-09-13 11:08:53', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (112, 53, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-13 11:09:01', '2020-09-13 11:09:05', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (113, 53, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-13 11:11:33', '2020-09-13 11:11:38', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (114, 53, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-13 11:18:03', '2020-09-13 11:18:06', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (115, 53, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-13 11:42:10', '2020-09-13 11:42:13', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (116, 53, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-13 11:43:03', '2020-09-13 11:43:09', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (117, 53, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-13 11:46:23', '2020-09-13 11:46:28', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (118, 53, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-13 11:56:22', '2020-09-13 11:56:24', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (119, 53, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-13 11:57:35', '2020-09-13 11:57:38', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (120, 53, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-13 12:00:39', '2020-09-13 12:00:42', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (121, 53, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-13 20:00:13', '2020-09-13 20:00:16', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (122, 53, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-13 20:01:24', '2020-09-13 20:01:49', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (123, 42, 'product', 2, '04e9d586cef8464aaee0a45439f12520', 1, '2020-09-13 21:32:46', '2020-09-13 21:33:38', 1, 0, 1, 16, 0, 0); +INSERT INTO `yx_store_cart` VALUES (124, 42, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-13 21:33:49', '2020-09-13 21:33:51', 1, 0, 1, 5, 0, 0); +INSERT INTO `yx_store_cart` VALUES (125, 54, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-13 22:04:08', '2020-09-13 22:05:10', 1, 0, 1, 5, 0, 0); +INSERT INTO `yx_store_cart` VALUES (126, 50, 'product', 3, 'b951f8e2ed4641f08be1bce99b716a6d', 1, '2020-09-13 22:04:30', '2020-09-13 22:04:52', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (127, 50, 'product', 4, '6a1919d9178b48f3a75fe4640e51693e', 1, '2020-09-13 22:12:38', '2020-09-13 22:12:44', 1, 0, 1, 7, 0, 0); +INSERT INTO `yx_store_cart` VALUES (128, 49, 'product', 5, '040fb7ab2a8b4ff3b6c9d1c78ea3e889', 1, '2020-09-13 23:59:44', '2020-09-14 00:01:07', 1, 0, 1, 6, 0, 0); +INSERT INTO `yx_store_cart` VALUES (129, 49, 'product', 5, '040fb7ab2a8b4ff3b6c9d1c78ea3e889', 1, '2020-09-14 00:02:41', '2020-09-14 00:02:42', 1, 0, 1, 6, 0, 0); +INSERT INTO `yx_store_cart` VALUES (130, 49, 'product', 5, '040fb7ab2a8b4ff3b6c9d1c78ea3e889', 1, '2020-09-14 00:02:48', '2020-09-14 00:02:50', 1, 0, 1, 6, 0, 0); +INSERT INTO `yx_store_cart` VALUES (131, 59, 'product', 5, '040fb7ab2a8b4ff3b6c9d1c78ea3e889', 1, '2020-09-14 00:03:19', '2020-09-14 00:04:08', 1, 0, 1, 6, 0, 0); +INSERT INTO `yx_store_cart` VALUES (132, 49, 'product', 5, '040fb7ab2a8b4ff3b6c9d1c78ea3e889', 1, '2020-09-14 00:03:36', '2020-09-14 00:03:39', 1, 0, 1, 6, 0, 0); +INSERT INTO `yx_store_cart` VALUES (133, 55, 'product', 5, '040fb7ab2a8b4ff3b6c9d1c78ea3e889', 1, '2020-09-14 00:18:43', NULL, 0, 0, 1, 6, 0, 0); +INSERT INTO `yx_store_cart` VALUES (134, 42, 'product', 3, '43cdbd1043474b4e97a1cffffa18071c', 1, '2020-09-14 08:40:57', '2020-09-14 08:41:02', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (135, 42, 'product', 3, '43cdbd1043474b4e97a1cffffa18071c', 1, '2020-09-14 08:41:11', '2020-09-14 08:41:17', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (136, 42, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-14 09:56:15', NULL, 0, 0, 1, 5, 0, 0); +INSERT INTO `yx_store_cart` VALUES (137, 61, 'product', 2, '04e9d586cef8464aaee0a45439f12520', 1, '2020-09-14 10:01:46', '2020-09-14 10:02:55', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (138, 61, 'product', 2, '04e9d586cef8464aaee0a45439f12520', 1, '2020-09-14 10:08:05', '2020-09-14 10:08:07', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (139, 40, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-14 10:13:05', '2020-09-14 10:13:17', 1, 0, 1, 5, 0, 0); +INSERT INTO `yx_store_cart` VALUES (140, 42, 'product', 1, 'd4ce8cd4bda84d479c11348e060afb8e', 1, '2020-09-14 10:18:05', '2020-09-14 10:18:12', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (141, 42, 'product', 1, 'd4ce8cd4bda84d479c11348e060afb8e', 1, '2020-09-14 10:20:20', '2020-09-14 10:20:24', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (142, 42, 'product', 1, 'd4ce8cd4bda84d479c11348e060afb8e', 1, '2020-09-14 10:22:06', '2020-09-14 10:22:12', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (143, 42, 'product', 4, '6a1919d9178b48f3a75fe4640e51693e', 1, '2020-09-14 10:50:38', '2020-09-14 10:50:44', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (144, 42, 'product', 3, '43cdbd1043474b4e97a1cffffa18071c', 1, '2020-09-14 11:00:30', '2020-09-14 11:00:36', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (145, 71, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-14 12:52:02', '2020-09-14 12:53:06', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (146, 71, 'product', 5, '040fb7ab2a8b4ff3b6c9d1c78ea3e889', 1, '2020-09-14 13:16:45', '2020-09-14 13:16:46', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (147, 76, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-14 22:20:51', NULL, 0, 0, 0, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (148, 76, 'product', 6, '90babee9cea24645870c6027fc420d42', 1, '2020-09-14 22:20:55', '2020-09-14 22:21:11', 1, 0, 1, 0, 0, 0); +INSERT INTO `yx_store_cart` VALUES (149, 54, 'product', 2, '04e9d586cef8464aaee0a45439f12520', 1, '2020-09-14 22:34:54', '2020-09-14 22:34:59', 1, 0, 1, 0, 0, 0); + +-- ---------------------------- +-- Table structure for yx_store_category +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_category`; +CREATE TABLE `yx_store_category` ( + `id` mediumint(11) NOT NULL AUTO_INCREMENT COMMENT '商品分类表ID', + `pid` mediumint(11) NOT NULL COMMENT '父id', + `cate_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '分类名称', + `sort` mediumint(11) NULL DEFAULT NULL COMMENT '排序', + `pic` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '图标', + `is_show` tinyint(1) NULL DEFAULT 1 COMMENT '是否推荐', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '删除状态', + PRIMARY KEY (`id`) USING BTREE, + INDEX `pid`(`pid`) USING BTREE, + INDEX `is_base`(`is_show`) USING BTREE, + INDEX `sort`(`sort`) USING BTREE, + INDEX `add_time`(`create_time`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商品分类表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_category +-- ---------------------------- +INSERT INTO `yx_store_category` VALUES (1, 0, '图文广告', 1, '', 1, '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_store_category` VALUES (2, 1, '写真', 1, 'http://localhost:8000/file/pic/资讯-20200311043727918.png', 1, '2020-06-25 18:54:35', NULL, 1); +INSERT INTO `yx_store_category` VALUES (3, 1, '平面设计', 1, 'https://consoleapi.xinxintuan.co/file/pic/20200903171807584910.jpg', 1, '2020-06-25 18:54:35', '2020-09-09 21:00:17', 0); +INSERT INTO `yx_store_category` VALUES (5, 1, '名片', 1, 'https://consoleapi.xinxintuan.co/file/pic/20200903171807647067.jpg', 1, '2020-06-25 18:54:35', '2020-09-09 21:00:32', 0); +INSERT INTO `yx_store_category` VALUES (6, 0, '666', 1, '', 1, '2020-06-25 18:54:35', NULL, 1); +INSERT INTO `yx_store_category` VALUES (7, 0, '99995', 1, '', 1, '2020-06-25 18:54:35', NULL, 1); +INSERT INTO `yx_store_category` VALUES (8, 7, '8888', 1, 'http://localhost:8000/file/pic/钻石-20200328094531898.jpg', 1, '2020-06-25 18:54:35', NULL, 1); +INSERT INTO `yx_store_category` VALUES (9, 0, '3333', 1, '', 1, '2020-06-25 17:11:45', NULL, 1); + +-- ---------------------------- +-- Table structure for yx_store_combination +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_combination`; +CREATE TABLE `yx_store_combination` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `product_id` bigint(20) UNSIGNED NOT NULL COMMENT '商品id', + `mer_id` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '商户id', + `image` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '推荐图', + `images` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '轮播图', + `title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '活动标题', + `attr` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '活动属性', + `people` int(2) UNSIGNED NOT NULL COMMENT '参团人数', + `info` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '简介', + `price` decimal(10, 2) UNSIGNED NULL DEFAULT NULL COMMENT '价格', + `product_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '商品原价', + `sort` int(10) UNSIGNED NOT NULL COMMENT '排序', + `sales` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '销量', + `stock` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '库存', + `create_time` datetime(0) NOT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_host` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '推荐', + `is_show` tinyint(1) UNSIGNED NOT NULL COMMENT '产品状态', + `is_del` tinyint(1) UNSIGNED NOT NULL DEFAULT 0, + `combination` tinyint(1) UNSIGNED NOT NULL DEFAULT 1, + `mer_use` tinyint(1) UNSIGNED NULL DEFAULT NULL COMMENT '商户是否可用1可用0不可用', + `description` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '拼团内容', + `start_time` datetime(0) NOT NULL COMMENT '拼团开始时间', + `stop_time` datetime(0) NOT NULL COMMENT '拼团结束时间', + `effective_time` int(11) NOT NULL DEFAULT 0 COMMENT '拼团订单有效时间', + `cost` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '拼团产品成本', + `browse` int(11) NULL DEFAULT 0 COMMENT '浏览量', + `unit_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '单位名', + `spec_type` tinyint(1) NULL DEFAULT NULL COMMENT '规格 0单 1多', + `temp_id` int(10) NULL DEFAULT NULL COMMENT '运费模板ID', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '拼团产品表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_combination +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_store_coupon +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_coupon`; +CREATE TABLE `yx_store_coupon` ( + `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '优惠券表ID', + `title` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '优惠券名称', + `integral` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '兑换消耗积分值', + `coupon_price` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '兑换的优惠券面值', + `use_min_price` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '最低消费多少金额可用优惠券', + `coupon_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠券有效期限(单位:天)', + `sort` int(11) UNSIGNED NOT NULL DEFAULT 1 COMMENT '排序', + `status` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '状态(0:关闭,1:开启)', + `product_id` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商品ids', + `type` tinyint(255) NULL DEFAULT 0 COMMENT '优惠券类型 0-通用 1-商品券', + `create_time` datetime(0) NOT NULL COMMENT '兑换项目添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE, + INDEX `state`(`status`) USING BTREE, + INDEX `add_time`(`create_time`) USING BTREE, + INDEX `coupon_time`(`coupon_time`) USING BTREE, + INDEX `is_del`(`is_del`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '优惠券表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_coupon +-- ---------------------------- +INSERT INTO `yx_store_coupon` VALUES (6, '全场通用', 0, 1.00, 10.00, 100, 0, 1, '', 0, '2020-09-12 17:57:02', NULL, 0); +INSERT INTO `yx_store_coupon` VALUES (7, '多规格商品券', 0, 1.00, 5.00, 100, 0, 1, '8', 1, '2020-09-12 17:57:46', NULL, 0); + +-- ---------------------------- +-- Table structure for yx_store_coupon_issue +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_coupon_issue`; +CREATE TABLE `yx_store_coupon_issue` ( + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `cname` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '', + `cid` int(10) NULL DEFAULT NULL COMMENT '优惠券ID', + `ctype` tinyint(1) NULL DEFAULT NULL COMMENT '优惠券类型 0-通用 1-商品券', + `start_time` datetime(0) NULL DEFAULT NULL COMMENT '优惠券领取开启时间', + `end_time` datetime(0) NULL DEFAULT NULL COMMENT '优惠券领取结束时间', + `total_count` int(10) NULL DEFAULT NULL COMMENT '优惠券领取数量', + `remain_count` int(10) NULL DEFAULT NULL COMMENT '优惠券剩余领取数量', + `is_permanent` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否无限张数', + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '1 正常 0 未开启 -1 已无效', + `is_del` tinyint(1) UNSIGNED NOT NULL DEFAULT 0, + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '优惠券添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE, + INDEX `cid`(`cid`) USING BTREE, + INDEX `start_time`(`start_time`, `end_time`) USING BTREE, + INDEX `remain_count`(`remain_count`) USING BTREE, + INDEX `status`(`status`) USING BTREE, + INDEX `is_del`(`is_del`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '优惠券前台领取表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_coupon_issue +-- ---------------------------- +INSERT INTO `yx_store_coupon_issue` VALUES (6, '多规格商品券', 7, 1, '2020-09-12 18:07:10', '2020-09-30 00:00:00', 100, 99, 0, 1, 0, '2020-09-12 18:07:19', NULL); +INSERT INTO `yx_store_coupon_issue` VALUES (7, '全场通用', 6, 0, '2020-09-12 18:07:25', '2020-09-29 00:00:00', 100, 100, 0, 1, 0, '2020-09-12 18:07:34', NULL); + +-- ---------------------------- +-- Table structure for yx_store_coupon_issue_user +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_coupon_issue_user`; +CREATE TABLE `yx_store_coupon_issue_user` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `uid` bigint(20) NULL DEFAULT NULL COMMENT '领取优惠券用户ID', + `issue_coupon_id` int(10) NULL DEFAULT NULL COMMENT '优惠券前台领取ID', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '领取时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `uid`(`uid`, `issue_coupon_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '优惠券前台用户领取记录表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_coupon_issue_user +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_store_coupon_user +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_coupon_user`; +CREATE TABLE `yx_store_coupon_user` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '优惠券发放记录id', + `cid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '兑换的项目id', + `uid` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠券所属用户', + `coupon_title` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '优惠券名称', + `coupon_price` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '优惠券的面值', + `use_min_price` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '最低消费多少金额可用优惠券', + `create_time` datetime(0) NOT NULL COMMENT '优惠券创建时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `end_time` datetime(0) NOT NULL COMMENT '优惠券结束时间', + `use_time` datetime(0) NULL DEFAULT NULL COMMENT '使用时间', + `type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'send' COMMENT '获取方式', + `status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '状态(0:未使用,1:已使用, 2:已过期)', + `is_fail` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否有效', + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE, + INDEX `cid`(`cid`) USING BTREE, + INDEX `uid`(`uid`) USING BTREE, + INDEX `add_time`(`create_time`) USING BTREE, + INDEX `end_time`(`end_time`) USING BTREE, + INDEX `status`(`status`) USING BTREE, + INDEX `is_fail`(`is_fail`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '优惠券发放记录表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_coupon_user +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_store_customer +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_customer`; +CREATE TABLE `yx_store_customer` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', + `nick_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户昵称', + `open_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'openId', + `remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间', + `is_del` tinyint(1) NULL DEFAULT 0, + `is_enable` tinyint(1) NULL DEFAULT 1 COMMENT '是否启用', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 88 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单通知用户表 接收订单通知的用户' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_customer +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_store_order +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_order`; +CREATE TABLE `yx_store_order` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '订单ID', + `order_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '订单号', + `extend_order_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '额外订单号', + `uid` bigint(20) UNSIGNED NOT NULL COMMENT '用户id', + `real_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户姓名', + `user_phone` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户电话', + `user_address` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '详细地址', + `cart_id` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '[]' COMMENT '购物车id', + `freight_price` decimal(8, 2) NOT NULL DEFAULT 0.00 COMMENT '运费金额', + `total_num` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '订单商品总数', + `total_price` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '订单总价', + `total_postage` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '邮费', + `pay_price` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '实际支付金额', + `pay_postage` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '支付邮费', + `deduction_price` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '抵扣金额', + `coupon_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠券id', + `coupon_price` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '优惠券金额', + `paid` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '支付状态', + `pay_time` datetime(0) NULL DEFAULT NULL COMMENT '支付时间', + `pay_type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '支付方式', + `create_time` datetime(0) NOT NULL COMMENT '创建时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '订单状态(-1 : 申请退款 -2 : 退货成功 0:待发货;1:待收货;2:已收货;3:已完成;-1:已退款)', + `refund_status` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '0 未退款 1 申请中 2 已退款', + `refund_reason_wap_img` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '退款图片', + `refund_reason_wap_explain` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '退款用户说明', + `refund_reason_time` datetime(0) NULL DEFAULT NULL COMMENT '退款时间', + `refund_reason_wap` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '前台退款原因', + `refund_reason` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '不退款的理由', + `refund_price` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '退款金额', + `delivery_sn` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '快递公司编号', + `delivery_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '快递名称/送货人姓名', + `delivery_type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '发货类型', + `delivery_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '快递单号/手机号', + `gain_integral` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '消费赚取积分', + `use_integral` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '使用积分', + `pay_integral` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '实际支付积分', + `back_integral` decimal(8, 2) UNSIGNED NULL DEFAULT 0.00 COMMENT '给用户退了多少积分', + `mark` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '备注', + `is_del` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否删除', + `unique` char(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '唯一id(md5加密)类似id', + `remark` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '管理员备注', + `mer_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID', + `is_mer_check` tinyint(3) UNSIGNED NOT NULL DEFAULT 0, + `combination_id` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '拼团产品id0一般产品', + `pink_id` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '拼团id 0没有拼团', + `cost` decimal(8, 2) UNSIGNED NOT NULL COMMENT '成本价', + `seckill_id` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '秒杀产品ID', + `bargain_id` int(11) UNSIGNED NULL DEFAULT 0 COMMENT '砍价id', + `verify_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '核销码', + `store_id` int(11) NOT NULL DEFAULT 0 COMMENT '门店id', + `shipping_type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '配送方式 1=快递 ,2=门店自提', + `is_channel` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '支付渠道(0微信公众号1微信小程序)', + `is_remind` tinyint(1) UNSIGNED NULL DEFAULT 0, + `is_system_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `order_id_2`(`order_id`, `uid`) USING BTREE, + UNIQUE INDEX `unique`(`unique`) USING BTREE, + INDEX `uid`(`uid`) USING BTREE, + INDEX `add_time`(`create_time`) USING BTREE, + INDEX `pay_price`(`pay_price`) USING BTREE, + INDEX `paid`(`paid`) USING BTREE, + INDEX `pay_time`(`pay_time`) USING BTREE, + INDEX `pay_type`(`pay_type`) USING BTREE, + INDEX `status`(`status`) USING BTREE, + INDEX `is_del`(`is_del`) USING BTREE, + INDEX `coupon_id`(`coupon_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '订单表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_order +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_store_order_cart_info +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_order_cart_info`; +CREATE TABLE `yx_store_order_cart_info` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `oid` bigint(20) UNSIGNED NOT NULL COMMENT '订单id', + `cart_id` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '购物车id', + `product_id` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '商品ID', + `cart_info` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '购买东西的详细信息', + `unique` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '唯一id', + `is_after_sales` tinyint(1) DEFAULT '0' COMMENT '是否能售后0不能1能', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `oid`(`oid`, `unique`) USING BTREE, + INDEX `cart_id`(`cart_id`) USING BTREE, + INDEX `product_id`(`product_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '订单购物详情表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_order_cart_info +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_store_order_status +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_order_status`; +CREATE TABLE `yx_store_order_status` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `oid` bigint(20) UNSIGNED NOT NULL COMMENT '订单id', + `change_type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '操作类型', + `change_message` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '操作备注', + `change_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '操作时间', + PRIMARY KEY (`id`) USING BTREE, + INDEX `oid`(`oid`) USING BTREE, + INDEX `change_type`(`change_type`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '订单操作记录表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_order_status +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_store_pink +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_pink`; +CREATE TABLE `yx_store_pink` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `uid` bigint(20) UNSIGNED NOT NULL COMMENT '用户id', + `order_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '订单id 生成', + `order_id_key` int(10) UNSIGNED NOT NULL COMMENT '订单id 数据库', + `total_num` int(10) UNSIGNED NOT NULL COMMENT '购买商品个数', + `total_price` decimal(10, 2) UNSIGNED NOT NULL COMMENT '购买总金额', + `cid` bigint(20) UNSIGNED NOT NULL COMMENT '拼团产品id', + `pid` bigint(20) UNSIGNED NOT NULL COMMENT '产品id', + `people` int(10) UNSIGNED NOT NULL COMMENT '拼团总人数', + `price` decimal(10, 2) UNSIGNED NOT NULL COMMENT '拼团产品单价', + `create_time` datetime(0) NOT NULL COMMENT '开始时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `stop_time` datetime(0) NULL DEFAULT NULL, + `k_id` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '团长id 0为团长', + `is_tpl` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否发送模板消息0未发送1已发送', + `is_refund` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否退款 0未退款 1已退款', + `status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态1进行中2已完成3未完成', + `is_del` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除1删除 0否', + `unique_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '库存唯一值', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '拼团表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_pink +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_store_product +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_product`; +CREATE TABLE `yx_store_product` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '商品id', + `mer_id` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)', + `image` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '商品图片', + `slider_image` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '轮播图', + `store_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '商品名称', + `store_info` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '商品简介', + `keyword` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '关键字', + `bar_code` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '产品条码(一维码)', + `cate_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '分类id', + `price` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '商品价格', + `vip_price` decimal(8, 2) UNSIGNED NULL DEFAULT 0.00 COMMENT '会员价格', + `ot_price` decimal(8, 2) UNSIGNED NULL DEFAULT 0.00 COMMENT '市场价', + `postage` decimal(8, 2) UNSIGNED NULL DEFAULT 0.00 COMMENT '邮费', + `unit_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '单位名', + `sort` smallint(11) NULL DEFAULT 0 COMMENT '排序', + `sales` mediumint(11) UNSIGNED NULL DEFAULT 0 COMMENT '销量', + `stock` mediumint(11) UNSIGNED NULL DEFAULT 0 COMMENT '库存', + `is_show` tinyint(1) NULL DEFAULT 1 COMMENT '状态(0:未上架,1:上架)', + `is_hot` tinyint(1) NULL DEFAULT 0 COMMENT '是否热卖', + `is_benefit` tinyint(1) NULL DEFAULT 0 COMMENT '是否优惠', + `is_best` tinyint(1) NULL DEFAULT 0 COMMENT '是否精品', + `is_new` tinyint(1) NULL DEFAULT 0 COMMENT '是否新品', + `description` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '产品描述', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_postage` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '是否包邮', + `is_del` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '是否删除', + `mer_use` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '商户是否代理 0不可代理1可代理', + `give_integral` decimal(8, 2) UNSIGNED NULL DEFAULT NULL COMMENT '获得积分', + `cost` decimal(8, 2) UNSIGNED NULL DEFAULT NULL COMMENT '成本价', + `is_seckill` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '秒杀状态 0 未开启 1已开启', + `is_bargain` tinyint(1) UNSIGNED NULL DEFAULT NULL COMMENT '砍价状态 0未开启 1开启', + `is_good` tinyint(1) NULL DEFAULT 0 COMMENT '是否优品推荐', + `ficti` mediumint(11) NULL DEFAULT 100 COMMENT '虚拟销量', + `browse` int(11) NULL DEFAULT 0 COMMENT '浏览量', + `code_path` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '产品二维码地址(用户小程序海报)', + `is_sub` tinyint(1) NULL DEFAULT 0 COMMENT '是否单独分佣', + `temp_id` int(10) NULL DEFAULT NULL COMMENT '运费模板ID', + `spec_type` tinyint(1) NULL DEFAULT 0 COMMENT '规格 0单 1多', + `is_integral` tinyint(1) UNSIGNED ZEROFILL NULL DEFAULT NULL COMMENT '是开启积分兑换', + `integral` int(11) NULL DEFAULT 0 COMMENT '需要多少积分兑换 只在开启积分兑换时生效', + PRIMARY KEY (`id`) USING BTREE, + INDEX `is_hot`(`is_hot`) USING BTREE, + INDEX `is_benefit`(`is_benefit`) USING BTREE, + INDEX `is_best`(`is_best`) USING BTREE, + INDEX `is_new`(`is_new`) USING BTREE, + INDEX `toggle_on_sale, is_del`(`is_del`) USING BTREE, + INDEX `price`(`price`) USING BTREE, + INDEX `is_show`(`is_show`) USING BTREE, + INDEX `sort`(`sort`) USING BTREE, + INDEX `sales`(`sales`) USING BTREE, + INDEX `add_time`(`create_time`) USING BTREE, + INDEX `is_postage`(`is_postage`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商品表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_product +-- ---------------------------- +INSERT INTO `yx_store_product` VALUES (1, 0, 'https://image.dayouqiantu.cn/5ca04fa9c08ef.jpg', 'https://image.dayouqiantu.cn/5ca081af6183f.jpg,https://image.dayouqiantu.cn/5ca04fa9c08ef.jpg', '照片打印', '照片打印', '照片打印', '', '5', 2.00, 0.00, 1.00, 0.00, '张', 0, 8, 992, 1, 0, 0, 0, 0, '


', '2020-09-04 17:41:30', '2020-09-05 20:57:49', 0, 0, 0, 0.00, 3.00, 0, NULL, 0, 0, 3, '', 0, 34, 0, 0,0); +INSERT INTO `yx_store_product` VALUES (2, 0, 'https://consoleapi.xinxintuan.co/file/pic/20200903171807584910.jpg', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807584910.jpg,https://consoleapi.xinxintuan.co/file/pic/20200903171807647067.jpg,https://consoleapi.xinxintuan.co/file/pic/20200903171807641535.jpg', 'X型展架', 'X型展架', 'X型展架', '', '3', 10.00, 0.00, 12.00, 0.00, '张', 0, 20, 3310, 1, 1, 1, 0, 0, '


', '2020-09-04 17:55:16', '2020-09-05 20:57:41', 0, 0, 0, 0.00, 11.00, 0, NULL, 0, 69, 25, '', 0, 34, 1, 0,0); +INSERT INTO `yx_store_product` VALUES (3, 0, 'https://consoleapi.xinxintuan.co/file/pic/20200903171807647067.jpg', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807647067.jpg', '彩色复印-量大有优惠', '彩色复印', '彩色复印', '', '3', 2.00, 0.00, 1.00, 0.00, '张', 0, 8, 9996, 1, 1, 1, 0, 0, '

1111

', '2020-09-07 13:14:50', '2020-09-13 22:18:46', 0, 0, 0, 0.00, 1.00, 0, NULL, 0, 0, 43, '', 0, 34, 0, 0,0); +INSERT INTO `yx_store_product` VALUES (4, 0, 'https://consoleapi.xinxintuan.co/file/pic/20200903171807625149.jpg', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807625149.jpg', '户外写真背胶', '户外写真背胶', '户外写真背胶', '', '3', 2.00, 0.00, 1.00, 0.00, '米', 0, 24, 87, 1, 1, 1, 0, 0, '

户外写真背胶

', '2020-09-07 13:16:02', NULL, 0, 0, 0, 0.00, 1.00, 0, NULL, 0, 0, 32, '', 0, 34, 0, 0,0); +INSERT INTO `yx_store_product` VALUES (5, 0, 'https://consoleapi.xinxintuan.co/file/pic/20200903171807568739.jpg', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807568739.jpg', '广告版定制', '广告版定制', '广告版定制', '', '3', 2.00, 0.00, 11.00, 0.00, '米', 0, 16, 2, 1, 1, 1, 1, 1, '

广告版定制

', '2020-09-07 13:17:49', '2020-09-12 00:14:32', 0, 0, 0, 0.00, 1.00, 0, NULL, 0, 0, 26, '', 0, 34, 0, 0,0); +INSERT INTO `yx_store_product` VALUES (6, 0, 'https://consoleapi.xinxintuan.co/file/pic/20200903171807641535.jpg', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807641535.jpg', '印刷各种印刷', '印刷各种印刷', '印刷各种印刷', '', '3', 11.00, 0.00, 33.00, 0.00, '张', 1, 35, 9989, 1, 1, 1, 0, 0, '

印刷各种印刷

', '2020-09-07 13:18:45', '2020-12-20 20:58:32', 0, 0, 0, 1.00, 22.00, 0, NULL, 0, 1, 139, '', 0, 34, 0, 0,0); +INSERT INTO `yx_store_product` VALUES (7, 0, 'https://consoleapi.xinxintuan.co/file/pic/20200903171208889668.png', 'https://image.dayouqiantu.cn/5ca04fa9c08ef.jpg,https://image.dayouqiantu.cn/5ca04fa9c08ef.jpg,https://image.dayouqiantu.cn/5ca081af6183f.jpg', '专属测试商品', '', '专属测试商品', '', '3', 100.00, 0.00, 120.00, 0.00, '张', 0, 3, 7, 1, 0, 0, 0, 0, '


', '2020-09-12 16:11:05', '2020-09-12 17:03:58', 0, 0, 0, 10.00, 110.00, 0, NULL, 0, 9, 9, '', 0, 34, 0, 0,0); + +-- ---------------------------- +-- Table structure for yx_store_product_attr +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_product_attr`; +CREATE TABLE `yx_store_product_attr` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `product_id` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '商品ID', + `attr_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '属性名', + `attr_values` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '属性值', + PRIMARY KEY (`id`) USING BTREE, + INDEX `store_id`(`product_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 78 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商品属性表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_product_attr +-- ---------------------------- +INSERT INTO `yx_store_product_attr` VALUES (32, 1, '规格', '默认'); +INSERT INTO `yx_store_product_attr` VALUES (55, 4, '规格', '默认'); +INSERT INTO `yx_store_product_attr` VALUES (57, 2, '纸张', 'A4,A3'); +INSERT INTO `yx_store_product_attr` VALUES (58, 2, '颜色', '白色,红色'); +INSERT INTO `yx_store_product_attr` VALUES (59, 0, '规格', '默认'); +INSERT INTO `yx_store_product_attr` VALUES (62, 7, '规格', '默认'); +INSERT INTO `yx_store_product_attr` VALUES (69, 5, '规格', '默认'); +INSERT INTO `yx_store_product_attr` VALUES (70, 3, '规格', '默认'); +INSERT INTO `yx_store_product_attr` VALUES (71, 6, '规格', '默认'); +INSERT INTO `yx_store_product_attr` VALUES (76, 8, '纸张', 'A4,A3,A5'); +INSERT INTO `yx_store_product_attr` VALUES (77, 8, '颜色', '白色,红色'); + +-- ---------------------------- +-- Table structure for yx_store_product_attr_result +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_product_attr_result`; +CREATE TABLE `yx_store_product_attr_result` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `product_id` bigint(20) UNSIGNED NOT NULL COMMENT '商品ID', + `result` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '商品属性参数', + `change_time` datetime(0) NOT NULL COMMENT '上次修改时间', + PRIMARY KEY (`id`) USING BTREE, + INDEX `product_id`(`product_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 60 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商品属性详情表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_product_attr_result +-- ---------------------------- +INSERT INTO `yx_store_product_attr_result` VALUES (26, 1, '{\"attr\":[{\"attrHidden\":\"\",\"detail\":[\"默认\"],\"detailValue\":\"\",\"value\":\"规格\"}],\"value\":[{\"barCode\":\"00005\",\"brokerage\":0.0,\"brokerageTwo\":0.0,\"cost\":3.0,\"detail\":{\"规格\":\"默认\"},\"otPrice\":1.0,\"pic\":\"\",\"pinkPrice\":0.1,\"pinkStock\":100,\"price\":2.0,\"seckillPrice\":0.2,\"seckillStock\":100,\"stock\":999,\"value1\":\"规格\",\"value2\":\"\",\"volume\":0.0,\"weight\":0.0,\"integral\":0}]}', '2020-09-08 21:18:03'); +INSERT INTO `yx_store_product_attr_result` VALUES (44, 4, '{\"attr\":[{\"attrHidden\":\"\",\"detail\":[\"默认\"],\"detailValue\":\"\",\"value\":\"规格\"}],\"value\":[{\"barCode\":\"\",\"brokerage\":0.0,\"brokerageTwo\":0.0,\"cost\":0.0,\"detail\":{\"规格\":\"默认\"},\"otPrice\":0.0,\"pic\":\"https://consoleapi.xinxintuan.co/file/pic/20200903171807584910.jpg\",\"pinkPrice\":22.0,\"pinkStock\":18,\"price\":0.0,\"seckillPrice\":0.0,\"seckillStock\":0,\"stock\":93,\"value1\":\"规格\",\"volume\":0.0,\"weight\":0.0,\"integral\":0}]}', '2020-09-12 15:55:17'); +INSERT INTO `yx_store_product_attr_result` VALUES (54, 5, '{\"attr\":[{\"attrHidden\":\"\",\"detail\":[\"默认\"],\"detailValue\":\"\",\"value\":\"规格\"}],\"value\":[{\"barCode\":\"1231321\",\"brokerage\":0.0,\"brokerageTwo\":0.0,\"cost\":1.0,\"detail\":{\"规格\":\"默认\"},\"otPrice\":11.0,\"pic\":\"https://consoleapi.xinxintuan.co/file/pic/20200903171807641535.jpg\",\"pinkPrice\":29.0,\"pinkStock\":10,\"price\":2.0,\"seckillPrice\":11.99,\"seckillStock\":10,\"stock\":11,\"value1\":\"规格\",\"volume\":1.0,\"weight\":1.0,\"integral\":0}]}', '2020-09-13 10:15:24'); +INSERT INTO `yx_store_product_attr_result` VALUES (55, 3, '{\"attr\":[{\"attrHidden\":\"\",\"detail\":[\"默认\"],\"detailValue\":\"\",\"value\":\"规格\"}],\"value\":[{\"barCode\":\"\",\"brokerage\":0.0,\"brokerageTwo\":0.0,\"cost\":1.0,\"detail\":{\"规格\":\"默认\"},\"otPrice\":1.0,\"pic\":\"https://consoleapi.xinxintuan.co/file/pic/20200903171807647067.jpg\",\"pinkPrice\":119.99,\"pinkStock\":10,\"price\":2.0,\"seckillPrice\":0.0,\"seckillStock\":0,\"stock\":9999,\"value1\":\"规格\",\"volume\":0.0,\"weight\":0.0,\"integral\":0}]}', '2020-09-13 22:18:46'); +INSERT INTO `yx_store_product_attr_result` VALUES (59, 6, '{\"attr\":[{\"attrHidden\":\"\",\"detail\":[\"默认\"],\"detailValue\":\"\",\"value\":\"规格\"}],\"value\":[{\"barCode\":\"00002\",\"brokerage\":0.0,\"brokerageTwo\":0.0,\"cost\":22.0,\"detail\":{\"规格\":\"默认\"},\"otPrice\":33.0,\"pic\":\"https://consoleapi.xinxintuan.co/file/pic/20200903171807641535.jpg\",\"pinkPrice\":19.9,\"pinkStock\":99,\"price\":11.0,\"seckillPrice\":22.98,\"seckillStock\":2000,\"stock\":9989,\"value1\":\"规格\",\"volume\":1.0,\"weight\":1.0,\"integral\":0}]}', '2020-10-13 17:09:28'); +INSERT INTO `yx_store_product_attr_result` VALUES (60, 7, '{\"attr\":[{\"attrHidden\":\"\",\"detail\":[\"默认\"],\"detailValue\":\"\",\"value\":\"规格\"}],\"value\":[{\"barCode\":\"\",\"brokerage\":0.0,\"brokerageTwo\":0.0,\"cost\":110.0,\"detail\":{\"规格\":\"默认\"},\"otPrice\":120.0,\"pic\":\"https://consoleapi.xinxintuan.co/file/pic/20200911093912577832.png\",\"pinkPrice\":1.0,\"pinkStock\":10,\"price\":100.0,\"seckillPrice\":0.0,\"seckillStock\":0,\"stock\":10,\"value1\":\"规格\",\"volume\":0.0,\"weight\":0.0,\"integral\":0}]}', '2020-11-17 11:49:09'); + +-- ---------------------------- +-- Table structure for yx_store_product_attr_value +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_product_attr_value`; +CREATE TABLE `yx_store_product_attr_value` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `product_id` bigint(20) UNSIGNED NOT NULL COMMENT '商品ID', + `sku` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '商品属性索引值 (attr_value|attr_value[|....])', + `stock` int(10) UNSIGNED NOT NULL COMMENT '属性对应的库存', + `sales` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '销量', + `price` decimal(8, 2) UNSIGNED NOT NULL COMMENT '属性金额', + `image` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片', + `unique` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '唯一值', + `cost` decimal(8, 2) UNSIGNED NOT NULL COMMENT '成本价', + `bar_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商品条码', + `ot_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '原价', + `weight` decimal(8, 2) NOT NULL DEFAULT 0.00 COMMENT '重量', + `volume` decimal(8, 2) NOT NULL DEFAULT 0.00 COMMENT '体积', + `brokerage` decimal(8, 2) NOT NULL DEFAULT 0.00 COMMENT '一级返佣', + `brokerage_two` decimal(8, 2) NOT NULL DEFAULT 0.00 COMMENT '二级返佣', + `pink_price` decimal(8, 2) NOT NULL DEFAULT 0.00 COMMENT '拼团价', + `pink_stock` int(10) NOT NULL DEFAULT 0 COMMENT '拼团库存', + `seckill_price` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '秒杀价', + `seckill_stock` int(10) NOT NULL DEFAULT 0 COMMENT '秒杀库存', + `integral` int(10) UNSIGNED ZEROFILL NULL DEFAULT 0000000000 COMMENT '需要多少积分兑换', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `unique`(`unique`, `sku`) USING BTREE, + INDEX `store_id`(`product_id`, `sku`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 126 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商品属性值表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_product_attr_value +-- ---------------------------- +INSERT INTO `yx_store_product_attr_value` VALUES (44, 1, '默认', 993, 6, 2.00, 'https://consoleapi.xinxintuan.co/file/pic/20200903171807584910.jpg', 'd4ce8cd4bda84d479c11348e060afb8e', 3.00, '00005', 1.00, 0.00, 0.00, 0.00, 0.00, 0.10, 100, 0.20, 97, NULL); +INSERT INTO `yx_store_product_attr_value` VALUES (77, 4, '默认', 91, 2, 0.00, 'https://consoleapi.xinxintuan.co/file/pic/20200903171807584910.jpg', '6a1919d9178b48f3a75fe4640e51693e', 0.00, '', 0.00, 0.00, 0.00, 0.00, 0.00, 22.00, 17, 0.00, 0, NULL); +INSERT INTO `yx_store_product_attr_value` VALUES (79, 2, 'A4,白色', 987, 4, 10.00, 'https://consoleapi.xinxintuan.co/file/pic/20200903171807584910.jpg', '04e9d586cef8464aaee0a45439f12520', 11.00, '00001', 12.00, 0.00, 0.00, 0.00, 0.00, 11.09, 99, 1.00, 100, NULL); +INSERT INTO `yx_store_product_attr_value` VALUES (80, 2, 'A4,红色', 661, 0, 11.00, 'https://consoleapi.xinxintuan.co/file/pic/20200903171807584910.jpg', '3d1ffa92e6064c36b614d3046c268968', 11.00, '00002', 12.00, 0.00, 0.00, 0.00, 0.00, 22.88, 99, 2.00, 100, NULL); +INSERT INTO `yx_store_product_attr_value` VALUES (81, 2, 'A3,白色', 995, 0, 12.00, 'https://consoleapi.xinxintuan.co/file/pic/20200903171807584910.jpg', '344f3a0e9d644845ae483c8b9a84a112', 11.00, '00003', 12.00, 0.00, 0.00, 0.00, 0.00, 33.89, 99, 3.00, 100, NULL); +INSERT INTO `yx_store_product_attr_value` VALUES (82, 2, 'A3,红色', 665, 0, 13.00, 'https://consoleapi.xinxintuan.co/file/pic/20200903171807584910.jpg', '4a9ca8587855412ea7be9ba53f829052', 11.00, '00004', 12.00, 0.00, 0.00, 0.00, 0.00, 45.66, 100, 4.00, 100, NULL); +INSERT INTO `yx_store_product_attr_value` VALUES (83, 0, '默认', 10, 0, 100.00, 'https://consoleapi.xinxintuan.co/file/pic/20200911093912577832.png', 'bbdc071ff67c4892839eac9f62e7eb18', 110.00, '', 120.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0, 0.00, 0, NULL); +INSERT INTO `yx_store_product_attr_value` VALUES (86, 7, '默认', 7, 3, 100.00, 'https://consoleapi.xinxintuan.co/file/pic/20200911093912577832.png', '789984b858bb489bb6313107e11fdc15', 110.00, '', 120.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0, 0.00, 0, NULL); +INSERT INTO `yx_store_product_attr_value` VALUES (105, 5, '默认', 3, 8, 2.00, 'https://consoleapi.xinxintuan.co/file/pic/20200903171807641535.jpg', '040fb7ab2a8b4ff3b6c9d1c78ea3e889', 1.00, '1231321', 11.00, 1.00, 1.00, 0.00, 0.00, 29.00, 5, 11.99, 8, NULL); +INSERT INTO `yx_store_product_attr_value` VALUES (106, 3, '默认', 9996, 3, 2.00, 'https://consoleapi.xinxintuan.co/file/pic/20200903171807647067.jpg', '43cdbd1043474b4e97a1cffffa18071c', 1.00, '', 1.00, 0.00, 0.00, 0.00, 0.00, 119.99, 10, 0.00, 0, NULL); +INSERT INTO `yx_store_product_attr_value` VALUES (107, 6, '默认', 9989, 0, 11.00, 'https://consoleapi.xinxintuan.co/file/pic/20200903171807641535.jpg', '4dcb457a13924be7b246f72f03ea7931', 22.00, '00002', 33.00, 1.00, 1.00, 0.00, 0.00, 19.90, 99, 22.98, 2000, 0000000000); +INSERT INTO `yx_store_product_attr_value` VALUES (120, 8, 'A4,白色', 95, 0, 9.00, 'https://image.dayouqiantu.cn/5ca081af6183f.jpg', '9306b671348a41d2966392578a31e00b', 1.00, '', 12.00, 0.00, 0.00, 1.00, 1.00, 1.00, 9, 1.00, 10, 0000000100); +INSERT INTO `yx_store_product_attr_value` VALUES (121, 8, 'A4,红色', 99, 0, 8.00, 'https://image.dayouqiantu.cn/5ca081af6183f.jpg', 'e3fc8496d4a0484a9946d84b03a78eee', 1.00, '', 9.00, 0.00, 0.00, 1.00, 1.00, 2.00, 10, 1.00, 10, 0000000200); +INSERT INTO `yx_store_product_attr_value` VALUES (122, 8, 'A3,白色', 88, 0, 7.00, 'https://image.dayouqiantu.cn/5ca081af6183f.jpg', 'a05ff262758548edbef5fda9e6dc26de', 1.00, '', 9.00, 0.00, 0.00, 1.00, 1.00, 0.50, 10, 0.10, 10, 0000000300); +INSERT INTO `yx_store_product_attr_value` VALUES (123, 8, 'A3,红色', 88, 0, 6.00, 'https://image.dayouqiantu.cn/5ca081af6183f.jpg', 'dc866a081e2b4a72b2ee9468ad7ba171', 1.00, '', 9.00, 0.00, 0.00, 1.00, 1.00, 1.00, 9, 0.10, 9, 0000000400); +INSERT INTO `yx_store_product_attr_value` VALUES (124, 8, 'A5,白色', 65, 0, 5.00, 'https://image.dayouqiantu.cn/5ca081af6183f.jpg', '094a42db903648acb275c868af2bd6ba', 1.00, '', 9.00, 0.00, 0.00, 1.00, 1.00, 2.00, 9, 0.10, 9, 0000000500); +INSERT INTO `yx_store_product_attr_value` VALUES (125, 8, 'A5,红色', 66, 0, 4.00, 'https://image.dayouqiantu.cn/5ca081af6183f.jpg', 'c35190bdfb5248ba9a219481adef9b1b', 1.00, '', 9.00, 0.00, 0.00, 1.00, 1.00, 3.00, 9, 0.10, 9, 0000069090); + +-- ---------------------------- +-- Table structure for yx_store_product_relation +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_product_relation`; +CREATE TABLE `yx_store_product_relation` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `uid` bigint(20) UNSIGNED NOT NULL COMMENT '用户ID', + `product_id` bigint(20) UNSIGNED NOT NULL COMMENT '商品ID', + `type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型(收藏(collect)、点赞(like))', + `category` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '某种类型的商品(普通商品、秒杀商品)', + `create_time` datetime(0) NOT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `uid`(`uid`, `product_id`, `type`, `category`) USING BTREE, + INDEX `type`(`type`) USING BTREE, + INDEX `category`(`category`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商品点赞和收藏表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_product_relation +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_store_product_reply +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_product_reply`; +CREATE TABLE `yx_store_product_reply` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '评论ID', + `uid` bigint(20) NOT NULL COMMENT '用户ID', + `oid` bigint(20) NOT NULL COMMENT '订单ID', + `unique` char(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '唯一id', + `product_id` bigint(20) NOT NULL COMMENT '产品id', + `reply_type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'product' COMMENT '某种商品类型(普通商品、秒杀商品)', + `product_score` tinyint(1) NOT NULL COMMENT '商品分数', + `service_score` tinyint(1) NOT NULL COMMENT '服务分数', + `comment` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '评论内容', + `pics` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '评论图片', + `create_time` datetime(0) NOT NULL COMMENT '评论时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `merchant_reply_content` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '管理员回复内容', + `merchant_reply_time` datetime(0) NULL DEFAULT NULL COMMENT '管理员回复时间', + `is_del` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '0未删除1已删除', + `is_reply` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0未回复1已回复', + PRIMARY KEY (`id`) USING BTREE, + INDEX `add_time`(`create_time`) USING BTREE, + INDEX `parent_id`(`reply_type`) USING BTREE, + INDEX `is_del`(`is_del`) USING BTREE, + INDEX `product_score`(`product_score`) USING BTREE, + INDEX `service_score`(`service_score`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '评论表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_product_reply +-- ---------------------------- +INSERT INTO `yx_store_product_reply` VALUES (3, 43, 67, 'c1907f2efeff48168c119ee28ddcac42', 8, 'product', 5, 5, '棒棒哒', '', '2020-09-12 17:45:11', NULL, NULL, NULL, 0, 0); + +-- ---------------------------- +-- Table structure for yx_store_product_rule +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_product_rule`; +CREATE TABLE `yx_store_product_rule` ( + `id` int(10) NOT NULL AUTO_INCREMENT, + `rule_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '规格名称', + `rule_value` json NOT NULL COMMENT '规格值', + `create_time` datetime(0) NULL DEFAULT NULL, + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 25 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商品规则值(规格)表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_product_rule +-- ---------------------------- +INSERT INTO `yx_store_product_rule` VALUES (10, '图文', '[{\"value\": \"纸张\", \"detail\": [\"A4\", \"A3\"]}, {\"value\": \"颜色\", \"detail\": [\"白色\", \"红色\"]}]', '2020-06-29 13:46:52', '2020-06-29 15:57:28', 0); +INSERT INTO `yx_store_product_rule` VALUES (24, '手机', '[{\"value\": \"颜色\", \"detail\": [\"黑色\", \"白色\"]}, {\"value\": \"尺寸\", \"detail\": [\"5寸\", \"7寸\"]}]', '2020-06-29 15:55:51', '2020-07-04 19:50:14', 0); + +-- ---------------------------- +-- Table structure for yx_store_seckill +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_seckill`; +CREATE TABLE `yx_store_seckill` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '商品秒杀产品表id', + `product_id` bigint(20) UNSIGNED NOT NULL COMMENT '商品id', + `image` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '推荐图', + `images` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '轮播图', + `title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '活动标题', + `info` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '简介', + `price` decimal(10, 2) UNSIGNED NULL DEFAULT NULL COMMENT '价格', + `cost` decimal(8, 2) UNSIGNED NULL DEFAULT 0.00 COMMENT '成本', + `ot_price` decimal(10, 2) UNSIGNED NULL DEFAULT NULL COMMENT '原价', + `give_integral` decimal(10, 2) UNSIGNED NULL DEFAULT NULL COMMENT '返多少积分', + `sort` int(10) UNSIGNED NOT NULL COMMENT '排序', + `stock` int(10) UNSIGNED NOT NULL COMMENT '库存', + `sales` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '销量', + `unit_name` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '单位名', + `postage` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '邮费', + `description` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '内容', + `start_time` date NOT NULL COMMENT '开始时间', + `stop_time` date NOT NULL COMMENT '结束时间', + `create_time` datetime(0) NOT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `status` tinyint(1) UNSIGNED NOT NULL COMMENT '产品状态', + `is_postage` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否包邮', + `is_hot` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '热门推荐', + `is_del` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除 0未删除1已删除', + `num` int(11) UNSIGNED NOT NULL COMMENT '最多秒杀几个', + `is_show` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '显示', + `time_id` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '时间段id', + `spec_type` tinyint(1) NULL DEFAULT NULL COMMENT '规格 0单 1多', + `temp_id` int(10) NULL DEFAULT NULL COMMENT '运费模板id', + PRIMARY KEY (`id`) USING BTREE, + INDEX `product_id`(`product_id`) USING BTREE, + INDEX `start_time`(`start_time`, `stop_time`) USING BTREE, + INDEX `is_del`(`is_del`) USING BTREE, + INDEX `is_hot`(`is_hot`) USING BTREE, + INDEX `is_show`(`status`) USING BTREE, + INDEX `add_time`(`create_time`) USING BTREE, + INDEX `sort`(`sort`) USING BTREE, + INDEX `is_postage`(`is_postage`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商品秒杀产品表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_seckill +-- ---------------------------- +INSERT INTO `yx_store_seckill` VALUES (5, 6, 'https://consoleapi.xinxintuan.co/file/pic/20200903171807641535.jpg', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807641535.jpg,https://consoleapi.xinxintuan.co/file/pic/20200903171807641535.jpg', '印刷各种印刷', '印刷各种印刷', 11.00, 22.00, 33.00, NULL, 1, 2000, 12, '张', 22.98, '

印刷各种印刷


', '2020-09-12', '2020-09-30', '2020-09-12 16:11:31', NULL, 1, 0, 0, 0, 2, 1, 211, 0, 34); +INSERT INTO `yx_store_seckill` VALUES (6, 5, 'https://consoleapi.xinxintuan.co/file/pic/20200903171807568739.jpg', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807568739.jpg', '广告版定制', '广告版定制', 2.00, 1.00, 11.00, NULL, 0, 8, 9, '米', 11.99, '

广告版定制

', '2020-09-12', '2020-09-30', '2020-09-12 16:13:22', '2020-09-13 10:15:24', 1, 0, 0, 0, 2, 1, 212, 0, 34); +INSERT INTO `yx_store_seckill` VALUES (7, 8, 'https://image.dayouqiantu.cn/5ca081af6183f.jpg', 'https://image.dayouqiantu.cn/5ca081af6183f.jpg,https://image.dayouqiantu.cn/5ca081af6183f.jpg,https://image.dayouqiantu.cn/5ca04fa9c08ef.jpg', '多规格商品测试', '多规格商品测试', 4.00, 1.00, 9.00, NULL, 0, 57, 4, '张', 0.10, '


', '2020-09-10', '2020-09-30', '2020-09-12 18:23:33', NULL, 1, 0, 0, 0, 1, 1, 215, 1, 34); + +-- ---------------------------- +-- Table structure for yx_store_visit +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_visit`; +CREATE TABLE `yx_store_visit` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `product_id` bigint(20) NULL DEFAULT NULL COMMENT '产品ID', + `product_type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品类型', + `cate_id` int(11) NULL DEFAULT NULL COMMENT '产品分类ID', + `type` char(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品类型', + `uid` bigint(20) NULL DEFAULT NULL COMMENT '用户ID', + `count` int(11) NULL DEFAULT NULL COMMENT '访问次数', + `content` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注描述', + `add_time` int(11) NULL DEFAULT NULL COMMENT '添加时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '产品浏览分析表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_store_visit +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_system_attachment +-- ---------------------------- +DROP TABLE IF EXISTS `yx_system_attachment`; +CREATE TABLE `yx_system_attachment` ( + `att_id` bigint(20) NOT NULL AUTO_INCREMENT, + `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '附件名称', + `att_dir` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '附件路径', + `satt_dir` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '压缩图片路径', + `att_size` char(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '附件大小', + `att_type` char(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '附件类型', + `pid` int(10) NOT NULL DEFAULT 0 COMMENT '分类ID0编辑器,1产品图片,2拼团图片,3砍价图片,4秒杀图片,5文章图片,6组合数据图', + `image_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '图片上传类型 1本地 2七牛云 3OSS 4COS ', + `module_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '图片上传模块类型 1 后台上传 2 用户生成', + `uid` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '用户id', + `invite_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '邀请码', + `create_time` datetime(0) NULL DEFAULT NULL, + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`att_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 121 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '附件管理表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_system_attachment +-- ---------------------------- +INSERT INTO `yx_system_attachment` VALUES (113, '12_55_wechat_bargain_share_wap.jpg', '/home/yshop/file/qrcode/12_55_wechat_bargain_share_wap.jpg', 'qrcode/12_55_wechat_bargain_share_wap.jpg', '3897220', 'image/jpeg', 0, 1, 1, 0, '', '2020-09-14 13:38:52', NULL, 0); +INSERT INTO `yx_system_attachment` VALUES (114, '12_55_wechat_bargain_user_spread.jpg', '/home/yshop/file/qrcode/12_55_wechat_bargain_user_spread.jpg', 'qrcode/12_55_wechat_bargain_user_spread.jpg', '43231', 'image/jpeg', 0, 1, 1, 0, '', '2020-09-14 13:38:53', NULL, 0); +INSERT INTO `yx_system_attachment` VALUES (115, '4_59_uniappH5_product_detail_wap.jpg', '/home/yshop/file/qrcode/4_59_uniappH5_product_detail_wap.jpg', 'qrcode/4_59_uniappH5_product_detail_wap.jpg', '3904929', 'image/jpeg', 0, 1, 1, 0, '', '2020-09-14 13:43:20', NULL, 0); +INSERT INTO `yx_system_attachment` VALUES (116, '4_59_uniappH5_product_user_spread.jpg', '/home/yshop/file/qrcode/4_59_uniappH5_product_user_spread.jpg', 'qrcode/4_59_uniappH5_product_user_spread.jpg', '113247', 'image/jpeg', 0, 1, 1, 0, '', '2020-09-14 13:43:20', NULL, 0); +INSERT INTO `yx_system_attachment` VALUES (117, '4_75_uniappH5_product_detail_wap.jpg', '/home/yshop/file/qrcode/4_75_uniappH5_product_detail_wap.jpg', 'qrcode/4_75_uniappH5_product_detail_wap.jpg', '4025717', 'image/jpeg', 0, 1, 1, 0, '', '2020-09-14 17:25:11', NULL, 0); +INSERT INTO `yx_system_attachment` VALUES (118, '4_75_uniappH5_product_user_spread.jpg', '/home/yshop/file/qrcode/4_75_uniappH5_product_user_spread.jpg', 'qrcode/4_75_uniappH5_product_user_spread.jpg', '113146', 'image/jpeg', 0, 1, 1, 0, '', '2020-09-14 17:25:11', NULL, 0); +INSERT INTO `yx_system_attachment` VALUES (119, '915891458048_yshop.jpg', '/home/yshop/file/qrcode/915891458048_yshop.jpg', 'qrcode/915891458048_yshop.jpg', '4148444', 'image/jpeg', 0, 1, 1, 0, '', '2020-09-14 22:21:17', NULL, 0); +INSERT INTO `yx_system_attachment` VALUES (120, '915891458048_yshop.jpg', '/home/yshop/file/qrcode/915891458048_yshop.jpg', 'qrcode/915891458048_yshop.jpg', '4148444', 'image/jpeg', 0, 1, 1, 0, '', '2020-09-14 22:21:17', NULL, 0); + +-- ---------------------------- +-- Table structure for yx_system_city +-- ---------------------------- +DROP TABLE IF EXISTS `yx_system_city`; +CREATE TABLE `yx_system_city` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `city_id` int(11) NOT NULL DEFAULT 0 COMMENT '城市id', + `level` int(11) NOT NULL DEFAULT 0 COMMENT '省市级别', + `parent_id` int(11) NOT NULL DEFAULT 0 COMMENT '父级id', + `area_code` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '区号', + `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '名称', + `merger_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '合并名称', + `lng` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '经度', + `lat` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '纬度', + `is_show` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否展示', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 3971 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '城市表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_system_city +-- ---------------------------- +INSERT INTO `yx_system_city` VALUES (1, 1, 0, 0, '110000000000', '北京市', '北京', '116.407526', '39.904030', 1); +INSERT INTO `yx_system_city` VALUES (2, 7362, 0, 0, '120000000000', '天津市', '天津', '117.200983', '39.084158', 1); +INSERT INTO `yx_system_city` VALUES (3, 13267, 0, 0, '130000000000', '河北省', '河北', '114.468664', '38.037057', 1); +INSERT INTO `yx_system_city` VALUES (4, 67747, 0, 0, '140000000000', '山西省', '山西', '112.562398', '37.873531', 1); +INSERT INTO `yx_system_city` VALUES (5, 99537, 0, 0, '150000000000', '内蒙古自治区', '内蒙古', '111.765617', '40.817498', 1); +INSERT INTO `yx_system_city` VALUES (6, 115224, 0, 0, '210000000000', '辽宁省', '辽宁', '123.429440', '41.835441', 1); +INSERT INTO `yx_system_city` VALUES (7, 133208, 0, 0, '220000000000', '吉林省', '吉林', '125.325990', '43.896536', 1); +INSERT INTO `yx_system_city` VALUES (8, 145665, 0, 0, '230000000000', '黑龙江省', '黑龙江', '126.661669', '45.742347', 1); +INSERT INTO `yx_system_city` VALUES (9, 161792, 0, 0, '310000000000', '上海市', '上海', '121.473701', '31.230416', 1); +INSERT INTO `yx_system_city` VALUES (10, 167904, 0, 0, '320000000000', '江苏省', '江苏', '118.763232', '32.061707', 1); +INSERT INTO `yx_system_city` VALUES (11, 191019, 0, 0, '330000000000', '浙江省', '浙江', '120.152791', '30.267446', 1); +INSERT INTO `yx_system_city` VALUES (12, 224649, 0, 0, '340000000000', '安徽省', '安徽', '117.284922', '31.861184', 1); +INSERT INTO `yx_system_city` VALUES (13, 244377, 0, 0, '350000000000', '福建省', '福建', '119.295144', '26.100779', 1); +INSERT INTO `yx_system_city` VALUES (14, 262698, 0, 0, '360000000000', '江西省', '江西', '115.909228', '28.675696', 1); +INSERT INTO `yx_system_city` VALUES (15, 285860, 0, 0, '370000000000', '山东省', '山东', '117.020359', '36.668530', 1); +INSERT INTO `yx_system_city` VALUES (16, 367395, 0, 0, '410000000000', '河南省', '河南', '113.753602', '34.765515', 1); +INSERT INTO `yx_system_city` VALUES (17, 420824, 0, 0, '420000000000', '湖北省', '湖北', '114.341861', '30.546498', 1); +INSERT INTO `yx_system_city` VALUES (18, 452123, 0, 0, '430000000000', '湖南省', '湖南', '112.983810', '28.112444', 1); +INSERT INTO `yx_system_city` VALUES (19, 483250, 0, 0, '440000000000', '广东省', '广东', '113.266530', '23.132191', 1); +INSERT INTO `yx_system_city` VALUES (20, 511462, 0, 0, '450000000000', '广西壮族自治区', '广西', '108.327546', '22.815478', 1); +INSERT INTO `yx_system_city` VALUES (21, 529344, 0, 0, '460000000000', '海南省', '海南', '110.349228', '20.017377', 1); +INSERT INTO `yx_system_city` VALUES (22, 533328, 0, 0, '500000000000', '重庆市', '重庆', '106.551556', '29.563009', 1); +INSERT INTO `yx_system_city` VALUES (23, 545532, 0, 0, '510000000000', '四川省', '四川', '104.075931', '30.651651', 1); +INSERT INTO `yx_system_city` VALUES (24, 604131, 0, 0, '520000000000', '贵州省', '贵州', '106.707410', '26.598194', 1); +INSERT INTO `yx_system_city` VALUES (25, 624372, 0, 0, '530000000000', '云南省', '云南', '102.710002', '25.045806', 1); +INSERT INTO `yx_system_city` VALUES (26, 640332, 0, 0, '540000000000', '西藏自治区', '西藏', '91.117212', '29.646922', 1); +INSERT INTO `yx_system_city` VALUES (27, 646578, 0, 0, '610000000000', '陕西省', '陕西', '108.954239', '34.265472', 1); +INSERT INTO `yx_system_city` VALUES (28, 671119, 0, 0, '620000000000', '甘肃省', '甘肃', '103.826308', '36.059421', 1); +INSERT INTO `yx_system_city` VALUES (29, 690094, 0, 0, '630000000000', '青海省', '青海', '101.780199', '36.620901', 1); +INSERT INTO `yx_system_city` VALUES (30, 695259, 0, 0, '640000000000', '宁夏回族自治区', '宁夏', '106.258754', '38.471317', 1); +INSERT INTO `yx_system_city` VALUES (31, 698440, 0, 0, '650000000000', '新疆维吾尔自治区', '新疆', '87.627704', '43.793026', 1); +INSERT INTO `yx_system_city` VALUES (32, 714368, 0, 0, '0', '香港特别行政区', '香港', '114.173355', '22.320048', 1); +INSERT INTO `yx_system_city` VALUES (33, 714390, 0, 0, '0', '澳门特别行政区', '澳门', '113.549090', '22.198951', 1); +INSERT INTO `yx_system_city` VALUES (34, 714401, 0, 0, '0', '台湾', '台湾', '121.509062', '25.044332', 1); +INSERT INTO `yx_system_city` VALUES (35, 2, 1, 1, '110100000000', '北京市', '北京', '116.407526', '39.904030', 1); +INSERT INTO `yx_system_city` VALUES (36, 7363, 1, 7362, '120100000000', '天津市', '天津', '117.200983', '39.084158', 1); +INSERT INTO `yx_system_city` VALUES (37, 13268, 1, 13267, '130100000000', '石家庄市', '河北,石家庄', '114.514859', '38.042306', 1); +INSERT INTO `yx_system_city` VALUES (38, 18128, 1, 13267, '130200000000', '唐山市', '河北,唐山', '118.180193', '39.630867', 1); +INSERT INTO `yx_system_city` VALUES (39, 24371, 1, 13267, '130300000000', '秦皇岛市', '河北,秦皇岛', '119.600492', '39.935385', 1); +INSERT INTO `yx_system_city` VALUES (40, 26779, 1, 13267, '130400000000', '邯郸市', '河北,邯郸', '114.538961', '36.625657', 1); +INSERT INTO `yx_system_city` VALUES (41, 32688, 1, 13267, '130500000000', '邢台市', '河北,邢台', '114.504844', '37.070589', 1); +INSERT INTO `yx_system_city` VALUES (42, 38160, 1, 13267, '130600000000', '保定市', '河北,保定', '115.464806', '38.873891', 1); +INSERT INTO `yx_system_city` VALUES (43, 44570, 1, 13267, '130700000000', '张家口市', '河北,张家口', '114.887543', '40.824418', 1); +INSERT INTO `yx_system_city` VALUES (44, 49190, 1, 13267, '130800000000', '承德市', '河北,承德', '117.962410', '40.954071', 1); +INSERT INTO `yx_system_city` VALUES (45, 52018, 1, 13267, '130900000000', '沧州市', '河北,沧州', '116.838834', '38.304477', 1); +INSERT INTO `yx_system_city` VALUES (46, 58247, 1, 13267, '131000000000', '廊坊市', '河北,廊坊', '116.683752', '39.538047', 1); +INSERT INTO `yx_system_city` VALUES (47, 61804, 1, 13267, '131100000000', '衡水市', '河北,衡水', '115.670177', '37.738920', 1); +INSERT INTO `yx_system_city` VALUES (48, 66813, 1, 13267, '139000000000', '直辖县', '河北', '114.468664', '38.037057', 1); +INSERT INTO `yx_system_city` VALUES (49, 67748, 1, 67747, '140100000000', '太原市', '山西,太原', '112.548879', '37.870590', 1); +INSERT INTO `yx_system_city` VALUES (50, 69390, 1, 67747, '140200000000', '大同市', '山西,大同', '113.612440', '40.040295', 1); +INSERT INTO `yx_system_city` VALUES (51, 71850, 1, 67747, '140300000000', '阳泉市', '山西,阳泉', '113.580519', '37.856971', 1); +INSERT INTO `yx_system_city` VALUES (52, 72975, 1, 67747, '140400000000', '长治市', '山西,长治', '113.116255', '36.195386', 1); +INSERT INTO `yx_system_city` VALUES (53, 76726, 1, 67747, '140500000000', '晋城市', '山西,晋城', '112.851831', '35.490701', 1); +INSERT INTO `yx_system_city` VALUES (54, 79163, 1, 67747, '140600000000', '朔州市', '山西,朔州', '112.432825', '39.331595', 1); +INSERT INTO `yx_system_city` VALUES (55, 81000, 1, 67747, '140700000000', '晋中市', '山西,晋中', '112.752694', '37.687024', 1); +INSERT INTO `yx_system_city` VALUES (56, 84092, 1, 67747, '140800000000', '运城市', '山西,运城', '111.007528', '35.026412', 1); +INSERT INTO `yx_system_city` VALUES (57, 87613, 1, 67747, '140900000000', '忻州市', '山西,忻州', '112.734174', '38.416663', 1); +INSERT INTO `yx_system_city` VALUES (58, 92738, 1, 67747, '141000000000', '临汾市', '山西,临汾', '111.518976', '36.088005', 1); +INSERT INTO `yx_system_city` VALUES (59, 96064, 1, 67747, '141100000000', '吕梁市', '山西,吕梁', '111.144319', '37.518314', 1); +INSERT INTO `yx_system_city` VALUES (60, 99538, 1, 99537, '150100000000', '呼和浩特市', '内蒙古,呼和浩特', '111.749180', '40.842585', 1); +INSERT INTO `yx_system_city` VALUES (61, 100904, 1, 99537, '150200000000', '包头市', '内蒙古,包头', '109.840347', '40.657449', 1); +INSERT INTO `yx_system_city` VALUES (62, 101772, 1, 99537, '150300000000', '乌海市', '内蒙古,乌海', '106.794249', '39.655388', 1); +INSERT INTO `yx_system_city` VALUES (63, 101884, 1, 99537, '150400000000', '赤峰市', '内蒙古,赤峰', '118.886856', '42.257817', 1); +INSERT INTO `yx_system_city` VALUES (64, 104457, 1, 99537, '150500000000', '通辽市', '内蒙古,通辽', '122.243444', '43.652890', 1); +INSERT INTO `yx_system_city` VALUES (65, 107065, 1, 99537, '150600000000', '鄂尔多斯市', '内蒙古,鄂尔多斯', '109.781327', '39.608266', 1); +INSERT INTO `yx_system_city` VALUES (66, 108166, 1, 99537, '150700000000', '呼伦贝尔市', '内蒙古,呼伦贝尔', '119.765744', '49.211574', 1); +INSERT INTO `yx_system_city` VALUES (67, 109847, 1, 99537, '150800000000', '巴彦淖尔市', '内蒙古,巴彦淖尔', '107.387657', '40.743213', 1); +INSERT INTO `yx_system_city` VALUES (68, 110889, 1, 99537, '150900000000', '乌兰察布市', '内蒙古,乌兰察布', '113.132585', '40.994785', 1); +INSERT INTO `yx_system_city` VALUES (69, 112552, 1, 99537, '152200000000', '兴安盟', '内蒙古,兴安', '122.067042', '46.077561', 1); +INSERT INTO `yx_system_city` VALUES (70, 113777, 1, 99537, '152500000000', '锡林郭勒盟', '内蒙古,锡林郭勒', '116.048222', '43.933454', 1); +INSERT INTO `yx_system_city` VALUES (71, 114940, 1, 99537, '152900000000', '阿拉善盟', '内蒙古,阿拉善', '105.728969', '38.851892', 1); +INSERT INTO `yx_system_city` VALUES (72, 115225, 1, 115224, '210100000000', '沈阳市', '辽宁,沈阳', '123.431474', '41.805698', 1); +INSERT INTO `yx_system_city` VALUES (73, 117932, 1, 115224, '210200000000', '大连市', '辽宁,大连', '121.614682', '38.914003', 1); +INSERT INTO `yx_system_city` VALUES (74, 119789, 1, 115224, '210300000000', '鞍山市', '辽宁,鞍山', '122.994329', '41.108647', 1); +INSERT INTO `yx_system_city` VALUES (75, 121081, 1, 115224, '210400000000', '抚顺市', '辽宁,抚顺', '123.957208', '41.880872', 1); +INSERT INTO `yx_system_city` VALUES (76, 122142, 1, 115224, '210500000000', '本溪市', '辽宁,本溪', '123.766485', '41.294175', 1); +INSERT INTO `yx_system_city` VALUES (77, 122730, 1, 115224, '210600000000', '丹东市', '辽宁,丹东', '124.354706', '40.000499', 1); +INSERT INTO `yx_system_city` VALUES (78, 123698, 1, 115224, '210700000000', '锦州市', '辽宁,锦州', '121.127003', '41.095119', 1); +INSERT INTO `yx_system_city` VALUES (79, 125249, 1, 115224, '210800000000', '营口市', '辽宁,营口', '122.235417', '40.667012', 1); +INSERT INTO `yx_system_city` VALUES (80, 126156, 1, 115224, '210900000000', '阜新市', '辽宁,阜新', '121.670323', '42.021619', 1); +INSERT INTO `yx_system_city` VALUES (81, 127070, 1, 115224, '211000000000', '辽阳市', '辽宁,辽阳', '123.236944', '41.267244', 1); +INSERT INTO `yx_system_city` VALUES (82, 127834, 1, 115224, '211100000000', '盘锦市', '辽宁,盘锦', '122.070714', '41.119997', 1); +INSERT INTO `yx_system_city` VALUES (83, 128421, 1, 115224, '211200000000', '铁岭市', '辽宁,铁岭', '123.726166', '42.223769', 1); +INSERT INTO `yx_system_city` VALUES (84, 129977, 1, 115224, '211300000000', '朝阳市', '辽宁,朝阳', '120.389862', '41.497767', 1); +INSERT INTO `yx_system_city` VALUES (85, 131738, 1, 115224, '211400000000', '葫芦岛市', '辽宁,葫芦岛', '120.836932', '40.711052', 1); +INSERT INTO `yx_system_city` VALUES (86, 133209, 1, 133208, '220100000000', '长春市', '吉林,长春', '125.323544', '43.817071', 1); +INSERT INTO `yx_system_city` VALUES (87, 135392, 1, 133208, '220200000000', '吉林市', '吉林,吉林', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (88, 137206, 1, 133208, '220300000000', '四平市', '吉林,四平', '124.350398', '43.166419', 1); +INSERT INTO `yx_system_city` VALUES (89, 138721, 1, 133208, '220400000000', '辽源市', '吉林,辽源', '125.143532', '42.887918', 1); +INSERT INTO `yx_system_city` VALUES (90, 139340, 1, 133208, '220500000000', '通化市', '吉林,通化', '125.939697', '41.728401', 1); +INSERT INTO `yx_system_city` VALUES (91, 140601, 1, 133208, '220600000000', '白山市', '吉林,白山', '126.423587', '41.939994', 1); +INSERT INTO `yx_system_city` VALUES (92, 141361, 1, 133208, '220700000000', '松原市', '吉林,松原', '124.825117', '45.141789', 1); +INSERT INTO `yx_system_city` VALUES (93, 142786, 1, 133208, '220800000000', '白城市', '吉林,白城', '122.839024', '45.619641', 1); +INSERT INTO `yx_system_city` VALUES (94, 143990, 1, 133208, '222400000000', '延边朝鲜族自治州', '吉林,延边', '129.508946', '42.891253', 1); +INSERT INTO `yx_system_city` VALUES (95, 145666, 1, 145665, '230100000000', '哈尔滨市', '黑龙江,哈尔滨', '126.534967', '45.803775', 1); +INSERT INTO `yx_system_city` VALUES (96, 149079, 1, 145665, '230200000000', '齐齐哈尔市', '黑龙江,齐齐哈尔', '123.918186', '47.354348', 1); +INSERT INTO `yx_system_city` VALUES (97, 150915, 1, 145665, '230300000000', '鸡西市', '黑龙江,鸡西', '130.969333', '45.295075', 1); +INSERT INTO `yx_system_city` VALUES (98, 151830, 1, 145665, '230400000000', '鹤岗市', '黑龙江,鹤岗', '130.297964', '47.349916', 1); +INSERT INTO `yx_system_city` VALUES (99, 152413, 1, 145665, '230500000000', '双鸭山市', '黑龙江,双鸭山', '131.159133', '46.646508', 1); +INSERT INTO `yx_system_city` VALUES (100, 153313, 1, 145665, '230600000000', '大庆市', '黑龙江,大庆', '125.103784', '46.589309', 1); +INSERT INTO `yx_system_city` VALUES (101, 154201, 1, 145665, '230700000000', '伊春市', '黑龙江,伊春', '128.841147', '47.727536', 1); +INSERT INTO `yx_system_city` VALUES (102, 155076, 1, 145665, '230800000000', '佳木斯市', '黑龙江,佳木斯', '130.318917', '46.799922', 1); +INSERT INTO `yx_system_city` VALUES (103, 156713, 1, 145665, '230900000000', '七台河市', '黑龙江,七台河', '131.003138', '45.771726', 1); +INSERT INTO `yx_system_city` VALUES (104, 157130, 1, 145665, '231000000000', '牡丹江市', '黑龙江,牡丹江', '129.633168', '44.551653', 1); +INSERT INTO `yx_system_city` VALUES (105, 158623, 1, 145665, '231100000000', '黑河市', '黑龙江,黑河', '127.528560', '50.245329', 1); +INSERT INTO `yx_system_city` VALUES (106, 159769, 1, 145665, '231200000000', '绥化市', '黑龙江,绥化', '126.968887', '46.653845', 1); +INSERT INTO `yx_system_city` VALUES (107, 161651, 1, 145665, '232700000000', '大兴安岭地区', '黑龙江,大兴安岭', '124.711080', '52.335206', 1); +INSERT INTO `yx_system_city` VALUES (108, 161793, 1, 161792, '310100000000', '上海市', '上海', '121.473701', '31.230416', 1); +INSERT INTO `yx_system_city` VALUES (109, 167905, 1, 167904, '320100000000', '南京市', '江苏,南京', '118.796877', '32.060255', 1); +INSERT INTO `yx_system_city` VALUES (110, 169375, 1, 167904, '320200000000', '无锡市', '江苏,无锡', '120.311910', '31.491169', 1); +INSERT INTO `yx_system_city` VALUES (111, 170724, 1, 167904, '320300000000', '徐州市', '江苏,徐州', '117.284124', '34.205768', 1); +INSERT INTO `yx_system_city` VALUES (112, 173635, 1, 167904, '320400000000', '常州市', '江苏,常州', '119.973987', '31.810689', 1); +INSERT INTO `yx_system_city` VALUES (113, 174764, 1, 167904, '320500000000', '苏州市', '江苏,苏州', '120.585315', '31.298886', 1); +INSERT INTO `yx_system_city` VALUES (114, 176920, 1, 167904, '320600000000', '南通市', '江苏,南通', '120.894291', '31.980171', 1); +INSERT INTO `yx_system_city` VALUES (115, 178999, 1, 167904, '320700000000', '连云港市', '江苏,连云港', '119.221611', '34.596653', 1); +INSERT INTO `yx_system_city` VALUES (116, 180743, 1, 167904, '320800000000', '淮安市', '江苏,淮安', '119.015285', '33.610353', 1); +INSERT INTO `yx_system_city` VALUES (117, 182538, 1, 167904, '320900000000', '盐城市', '江苏,盐城', '120.163561', '33.347382', 1); +INSERT INTO `yx_system_city` VALUES (118, 185201, 1, 167904, '321000000000', '扬州市', '江苏,扬州', '119.412966', '32.394210', 1); +INSERT INTO `yx_system_city` VALUES (119, 186657, 1, 167904, '321100000000', '镇江市', '江苏,镇江', '119.425836', '32.187849', 1); +INSERT INTO `yx_system_city` VALUES (120, 187441, 1, 167904, '321200000000', '泰州市', '江苏,泰州', '119.923116', '32.455778', 1); +INSERT INTO `yx_system_city` VALUES (121, 189402, 1, 167904, '321300000000', '宿迁市', '江苏,宿迁', '118.275198', '33.963232', 1); +INSERT INTO `yx_system_city` VALUES (122, 191020, 1, 191019, '330100000000', '杭州市', '浙江,杭州', '120.155070', '30.274084', 1); +INSERT INTO `yx_system_city` VALUES (123, 194395, 1, 191019, '330200000000', '宁波市', '浙江,宁波', '121.550357', '29.874556', 1); +INSERT INTO `yx_system_city` VALUES (124, 197850, 1, 191019, '330300000000', '温州市', '浙江,温州', '120.699366', '27.994267', 1); +INSERT INTO `yx_system_city` VALUES (125, 203852, 1, 191019, '330400000000', '嘉兴市', '浙江,嘉兴', '120.755486', '30.746129', 1); +INSERT INTO `yx_system_city` VALUES (126, 205101, 1, 191019, '330500000000', '湖州市', '浙江,湖州', '120.086823', '30.894348', 1); +INSERT INTO `yx_system_city` VALUES (127, 206438, 1, 191019, '330600000000', '绍兴市', '浙江,绍兴', '120.580232', '30.029752', 1); +INSERT INTO `yx_system_city` VALUES (128, 209250, 1, 191019, '330700000000', '金华市', '浙江,金华', '119.647444', '29.079059', 1); +INSERT INTO `yx_system_city` VALUES (129, 214260, 1, 191019, '330800000000', '衢州市', '浙江,衢州', '118.859457', '28.970079', 1); +INSERT INTO `yx_system_city` VALUES (130, 215955, 1, 191019, '330900000000', '舟山市', '浙江,舟山', '122.207215', '29.985295', 1); +INSERT INTO `yx_system_city` VALUES (131, 216449, 1, 191019, '331000000000', '台州市', '浙江,台州', '121.420757', '28.656386', 1); +INSERT INTO `yx_system_city` VALUES (132, 221610, 1, 191019, '331100000000', '丽水市', '浙江,丽水', '119.922796', '28.467630', 1); +INSERT INTO `yx_system_city` VALUES (133, 224650, 1, 224649, '340100000000', '合肥市', '安徽,合肥', '117.227239', '31.820586', 1); +INSERT INTO `yx_system_city` VALUES (134, 226469, 1, 224649, '340200000000', '芜湖市', '安徽,芜湖', '118.432941', '31.352859', 1); +INSERT INTO `yx_system_city` VALUES (135, 227482, 1, 224649, '340300000000', '蚌埠市', '安徽,蚌埠', '117.389719', '32.916287', 1); +INSERT INTO `yx_system_city` VALUES (136, 228630, 1, 224649, '340400000000', '淮南市', '安徽,淮南', '116.999932', '32.625478', 1); +INSERT INTO `yx_system_city` VALUES (137, 229844, 1, 224649, '340500000000', '马鞍山市', '安徽,马鞍山', '118.506759', '31.670452', 1); +INSERT INTO `yx_system_city` VALUES (138, 230476, 1, 224649, '340600000000', '淮北市', '安徽,淮北', '116.798265', '33.955844', 1); +INSERT INTO `yx_system_city` VALUES (139, 230981, 1, 224649, '340700000000', '铜陵市', '安徽,铜陵', '117.812079', '30.945429', 1); +INSERT INTO `yx_system_city` VALUES (140, 231499, 1, 224649, '340800000000', '安庆市', '安徽,安庆', '117.063754', '30.543494', 1); +INSERT INTO `yx_system_city` VALUES (141, 233236, 1, 224649, '341000000000', '黄山市', '安徽,黄山', '118.337481', '29.714655', 1); +INSERT INTO `yx_system_city` VALUES (142, 234109, 1, 224649, '341100000000', '滁州市', '安徽,滁州', '118.317106', '32.301556', 1); +INSERT INTO `yx_system_city` VALUES (143, 235483, 1, 224649, '341200000000', '阜阳市', '安徽,阜阳', '115.814204', '32.890124', 1); +INSERT INTO `yx_system_city` VALUES (144, 237607, 1, 224649, '341300000000', '宿州市', '安徽,宿州', '116.964356', '33.646373', 1); +INSERT INTO `yx_system_city` VALUES (145, 239084, 1, 224649, '341500000000', '六安市', '安徽,六安', '116.521854', '31.733699', 1); +INSERT INTO `yx_system_city` VALUES (146, 241180, 1, 224649, '341600000000', '亳州市', '安徽,亳州', '115.778676', '33.844582', 1); +INSERT INTO `yx_system_city` VALUES (147, 242634, 1, 224649, '341700000000', '池州市', '安徽,池州', '117.491568', '30.664800', 1); +INSERT INTO `yx_system_city` VALUES (148, 243399, 1, 224649, '341800000000', '宣城市', '安徽,宣城', '118.758816', '30.940718', 1); +INSERT INTO `yx_system_city` VALUES (149, 244378, 1, 244377, '350100000000', '福州市', '福建,福州', '119.296494', '26.074507', 1); +INSERT INTO `yx_system_city` VALUES (150, 247478, 1, 244377, '350200000000', '厦门市', '福建,厦门', '118.089425', '24.479833', 1); +INSERT INTO `yx_system_city` VALUES (151, 248059, 1, 244377, '350300000000', '莆田市', '福建,莆田', '119.007777', '25.454084', 1); +INSERT INTO `yx_system_city` VALUES (152, 249098, 1, 244377, '350400000000', '三明市', '福建,三明', '117.638678', '26.263406', 1); +INSERT INTO `yx_system_city` VALUES (153, 251197, 1, 244377, '350500000000', '泉州市', '福建,泉州', '118.675675', '24.874132', 1); +INSERT INTO `yx_system_city` VALUES (154, 253905, 1, 244377, '350600000000', '漳州市', '福建,漳州', '117.647481', '24.512948', 1); +INSERT INTO `yx_system_city` VALUES (155, 256112, 1, 244377, '350700000000', '南平市', '福建,南平', '118.177708', '26.641768', 1); +INSERT INTO `yx_system_city` VALUES (156, 258160, 1, 244377, '350800000000', '龙岩市', '福建,龙岩', '117.017536', '25.075123', 1); +INSERT INTO `yx_system_city` VALUES (157, 260230, 1, 244377, '350900000000', '宁德市', '福建,宁德', '119.547932', '26.665617', 1); +INSERT INTO `yx_system_city` VALUES (158, 262699, 1, 262698, '360100000000', '南昌市', '江西,南昌', '115.858197', '28.682892', 1); +INSERT INTO `yx_system_city` VALUES (159, 264862, 1, 262698, '360200000000', '景德镇市', '江西,景德镇', '117.178419', '29.268835', 1); +INSERT INTO `yx_system_city` VALUES (160, 265677, 1, 262698, '360300000000', '萍乡市', '江西,萍乡', '113.854556', '27.622768', 1); +INSERT INTO `yx_system_city` VALUES (161, 266521, 1, 262698, '360400000000', '九江市', '江西,九江', '116.001930', '29.705077', 1); +INSERT INTO `yx_system_city` VALUES (162, 269107, 1, 262698, '360500000000', '新余市', '江西,新余', '114.917346', '27.817808', 1); +INSERT INTO `yx_system_city` VALUES (163, 269654, 1, 262698, '360600000000', '鹰潭市', '江西,鹰潭', '117.069202', '28.260189', 1); +INSERT INTO `yx_system_city` VALUES (164, 270222, 1, 262698, '360700000000', '赣州市', '江西,赣州', '114.935029', '25.831829', 1); +INSERT INTO `yx_system_city` VALUES (165, 274444, 1, 262698, '360800000000', '吉安市', '江西,吉安', '114.992509', '27.113443', 1); +INSERT INTO `yx_system_city` VALUES (166, 277615, 1, 262698, '360900000000', '宜春市', '江西,宜春', '114.416778', '27.815619', 1); +INSERT INTO `yx_system_city` VALUES (167, 280562, 1, 262698, '361000000000', '抚州市', '江西,抚州', '116.358181', '27.949217', 1); +INSERT INTO `yx_system_city` VALUES (168, 282841, 1, 262698, '361100000000', '上饶市', '江西,上饶', '117.943433', '28.454862', 1); +INSERT INTO `yx_system_city` VALUES (169, 285861, 1, 285860, '370100000000', '济南市', '山东,济南', '117.119999', '36.651216', 1); +INSERT INTO `yx_system_city` VALUES (170, 291235, 1, 285860, '370200000000', '青岛市', '山东,青岛', '120.382639', '36.067082', 1); +INSERT INTO `yx_system_city` VALUES (171, 298025, 1, 285860, '370300000000', '淄博市', '山东,淄博', '118.054927', '36.813487', 1); +INSERT INTO `yx_system_city` VALUES (172, 301711, 1, 285860, '370400000000', '枣庄市', '山东,枣庄', '117.323725', '34.810487', 1); +INSERT INTO `yx_system_city` VALUES (173, 304309, 1, 285860, '370500000000', '东营市', '山东,东营', '118.674767', '37.434751', 1); +INSERT INTO `yx_system_city` VALUES (174, 306339, 1, 285860, '370600000000', '烟台市', '山东,烟台', '121.447935', '37.463822', 1); +INSERT INTO `yx_system_city` VALUES (175, 313063, 1, 285860, '370700000000', '潍坊市', '山东,潍坊', '119.161755', '36.706774', 1); +INSERT INTO `yx_system_city` VALUES (176, 320179, 1, 285860, '370800000000', '济宁市', '山东,济宁', '116.587098', '35.414921', 1); +INSERT INTO `yx_system_city` VALUES (177, 326706, 1, 285860, '370900000000', '泰安市', '山东,泰安', '117.087614', '36.200252', 1); +INSERT INTO `yx_system_city` VALUES (178, 330547, 1, 285860, '371000000000', '威海市', '山东,威海', '122.120419', '37.513068', 1); +INSERT INTO `yx_system_city` VALUES (179, 333140, 1, 285860, '371100000000', '日照市', '山东,日照', '119.526888', '35.416377', 1); +INSERT INTO `yx_system_city` VALUES (180, 336050, 1, 285860, '371200000000', '莱芜市', '山东,莱芜', '117.676723', '36.213813', 1); +INSERT INTO `yx_system_city` VALUES (181, 337144, 1, 285860, '371300000000', '临沂市', '山东,临沂', '118.356448', '35.104672', 1); +INSERT INTO `yx_system_city` VALUES (182, 344133, 1, 285860, '371400000000', '德州市', '山东,德州', '116.357464', '37.434092', 1); +INSERT INTO `yx_system_city` VALUES (183, 349382, 1, 285860, '371500000000', '聊城市', '山东,聊城', '115.985371', '36.456703', 1); +INSERT INTO `yx_system_city` VALUES (184, 355972, 1, 285860, '371600000000', '滨州市', '山东,滨州', '117.970703', '37.381990', 1); +INSERT INTO `yx_system_city` VALUES (185, 361375, 1, 285860, '371700000000', '菏泽市', '山东,菏泽', '115.480656', '35.233750', 1); +INSERT INTO `yx_system_city` VALUES (186, 367396, 1, 367395, '410100000000', '郑州市', '河南,郑州', '113.625368', '34.746599', 1); +INSERT INTO `yx_system_city` VALUES (187, 370304, 1, 367395, '410200000000', '开封市', '河南,开封', '114.307581', '34.797239', 1); +INSERT INTO `yx_system_city` VALUES (188, 372971, 1, 367395, '410300000000', '洛阳市', '河南,洛阳', '112.454040', '34.619682', 1); +INSERT INTO `yx_system_city` VALUES (189, 376365, 1, 367395, '410400000000', '平顶山市', '河南,平顶山', '113.192661', '33.766169', 1); +INSERT INTO `yx_system_city` VALUES (190, 379245, 1, 367395, '410500000000', '安阳市', '河南,安阳', '114.392392', '36.097577', 1); +INSERT INTO `yx_system_city` VALUES (191, 382878, 1, 367395, '410600000000', '鹤壁市', '河南,鹤壁', '114.297272', '35.747225', 1); +INSERT INTO `yx_system_city` VALUES (192, 383890, 1, 367395, '410700000000', '新乡市', '河南,新乡', '113.926800', '35.303004', 1); +INSERT INTO `yx_system_city` VALUES (193, 387707, 1, 367395, '410800000000', '焦作市', '河南,焦作', '113.241823', '35.215892', 1); +INSERT INTO `yx_system_city` VALUES (194, 389719, 1, 367395, '410900000000', '濮阳市', '河南,濮阳', '115.029215', '35.761829', 1); +INSERT INTO `yx_system_city` VALUES (195, 392737, 1, 367395, '411000000000', '许昌市', '河南,许昌', '113.852640', '34.035506', 1); +INSERT INTO `yx_system_city` VALUES (196, 395254, 1, 367395, '411100000000', '漯河市', '河南,漯河', '114.016539', '33.581412', 1); +INSERT INTO `yx_system_city` VALUES (197, 396611, 1, 367395, '411200000000', '三门峡市', '河南,三门峡', '111.200135', '34.772493', 1); +INSERT INTO `yx_system_city` VALUES (198, 398169, 1, 367395, '411300000000', '南阳市', '河南,南阳', '112.528321', '32.990833', 1); +INSERT INTO `yx_system_city` VALUES (199, 403311, 1, 367395, '411400000000', '商丘市', '河南,商丘', '115.656370', '34.414172', 1); +INSERT INTO `yx_system_city` VALUES (200, 408287, 1, 367395, '411500000000', '信阳市', '河南,信阳', '114.091023', '32.146983', 1); +INSERT INTO `yx_system_city` VALUES (201, 411925, 1, 367395, '411600000000', '周口市', '河南,周口', '114.696951', '33.626149', 1); +INSERT INTO `yx_system_city` VALUES (202, 417174, 1, 367395, '411700000000', '驻马店市', '河南,驻马店', '114.022298', '33.011529', 1); +INSERT INTO `yx_system_city` VALUES (203, 420258, 1, 367395, '419000000000', '直辖县', '河南', '113.753602', '34.765515', 1); +INSERT INTO `yx_system_city` VALUES (204, 420825, 1, 420824, '420100000000', '武汉市', '湖北,武汉', '114.305392', '30.593098', 1); +INSERT INTO `yx_system_city` VALUES (205, 424449, 1, 420824, '420200000000', '黄石市', '湖北,黄石', '115.038520', '30.199652', 1); +INSERT INTO `yx_system_city` VALUES (206, 425508, 1, 420824, '420300000000', '十堰市', '湖北,十堰', '110.797990', '32.629397', 1); +INSERT INTO `yx_system_city` VALUES (207, 427710, 1, 420824, '420500000000', '宜昌市', '湖北,宜昌', '111.286471', '30.691967', 1); +INSERT INTO `yx_system_city` VALUES (208, 429501, 1, 420824, '420600000000', '襄阳市', '湖北,襄阳', '112.122414', '32.008986', 1); +INSERT INTO `yx_system_city` VALUES (209, 432415, 1, 420824, '420700000000', '鄂州市', '湖北,鄂州', '114.894843', '30.391940', 1); +INSERT INTO `yx_system_city` VALUES (210, 432829, 1, 420824, '420800000000', '荆门市', '湖北,荆门', '112.199265', '31.035423', 1); +INSERT INTO `yx_system_city` VALUES (211, 434548, 1, 420824, '420900000000', '孝感市', '湖北,孝感', '113.916902', '30.924568', 1); +INSERT INTO `yx_system_city` VALUES (212, 437779, 1, 420824, '421000000000', '荆州市', '湖北,荆州', '112.239741', '30.335165', 1); +INSERT INTO `yx_system_city` VALUES (213, 440639, 1, 420824, '421100000000', '黄冈市', '湖北,黄冈', '114.872316', '30.453905', 1); +INSERT INTO `yx_system_city` VALUES (214, 445040, 1, 420824, '421200000000', '咸宁市', '湖北,咸宁', '114.322492', '29.841443', 1); +INSERT INTO `yx_system_city` VALUES (215, 446212, 1, 420824, '421300000000', '随州市', '湖北,随州', '113.382458', '31.690215', 1); +INSERT INTO `yx_system_city` VALUES (216, 447268, 1, 420824, '422800000000', '恩施土家族苗族自治州', '湖北,恩施', '109.488172', '30.272156', 1); +INSERT INTO `yx_system_city` VALUES (217, 449865, 1, 420824, '429000000000', '直辖县', '湖北', '114.341861', '30.546498', 1); +INSERT INTO `yx_system_city` VALUES (218, 452124, 1, 452123, '430100000000', '长沙市', '湖南,长沙', '112.938814', '28.228209', 1); +INSERT INTO `yx_system_city` VALUES (219, 453799, 1, 452123, '430200000000', '株洲市', '湖南,株洲', '113.134002', '27.827550', 1); +INSERT INTO `yx_system_city` VALUES (220, 455283, 1, 452123, '430300000000', '湘潭市', '湖南,湘潭', '112.944049', '27.829738', 1); +INSERT INTO `yx_system_city` VALUES (221, 456303, 1, 452123, '430400000000', '衡阳市', '湖南,衡阳', '112.571997', '26.893230', 1); +INSERT INTO `yx_system_city` VALUES (222, 459251, 1, 452123, '430500000000', '邵阳市', '湖南,邵阳', '111.467791', '27.238892', 1); +INSERT INTO `yx_system_city` VALUES (223, 463141, 1, 452123, '430600000000', '岳阳市', '湖南,岳阳', '113.128958', '29.357104', 1); +INSERT INTO `yx_system_city` VALUES (224, 465105, 1, 452123, '430700000000', '常德市', '湖南,常德', '111.698497', '29.031673', 1); +INSERT INTO `yx_system_city` VALUES (225, 467562, 1, 452123, '430800000000', '张家界市', '湖南,张家界', '110.479191', '29.117096', 1); +INSERT INTO `yx_system_city` VALUES (226, 468660, 1, 452123, '430900000000', '益阳市', '湖南,益阳', '112.355180', '28.553860', 1); +INSERT INTO `yx_system_city` VALUES (227, 470123, 1, 452123, '431000000000', '郴州市', '湖南,郴州', '113.014717', '25.770509', 1); +INSERT INTO `yx_system_city` VALUES (228, 472709, 1, 452123, '431100000000', '永州市', '湖南,永州', '111.613445', '26.420394', 1); +INSERT INTO `yx_system_city` VALUES (229, 476148, 1, 452123, '431200000000', '怀化市', '湖南,怀化', '109.998488', '27.554978', 1); +INSERT INTO `yx_system_city` VALUES (230, 479103, 1, 452123, '431300000000', '娄底市', '湖南,娄底', '111.993497', '27.700062', 1); +INSERT INTO `yx_system_city` VALUES (231, 481319, 1, 452123, '433100000000', '湘西土家族苗族自治州', '湖南,湘西', '109.739172', '28.311947', 1); +INSERT INTO `yx_system_city` VALUES (232, 483251, 1, 483250, '440100000000', '广州市', '广东,广州', '113.264434', '23.129162', 1); +INSERT INTO `yx_system_city` VALUES (233, 486129, 1, 483250, '440200000000', '韶关市', '广东,韶关', '113.597522', '24.810403', 1); +INSERT INTO `yx_system_city` VALUES (234, 487721, 1, 483250, '440300000000', '深圳市', '广东,深圳', '114.057868', '22.543099', 1); +INSERT INTO `yx_system_city` VALUES (235, 488589, 1, 483250, '440400000000', '珠海市', '广东,珠海', '113.576726', '22.270715', 1); +INSERT INTO `yx_system_city` VALUES (236, 488954, 1, 483250, '440500000000', '汕头市', '广东,汕头', '116.681972', '23.354091', 1); +INSERT INTO `yx_system_city` VALUES (237, 490106, 1, 483250, '440600000000', '佛山市', '广东,佛山', '113.121416', '23.021548', 1); +INSERT INTO `yx_system_city` VALUES (238, 490919, 1, 483250, '440700000000', '江门市', '广东,江门', '113.081901', '22.578738', 1); +INSERT INTO `yx_system_city` VALUES (239, 492341, 1, 483250, '440800000000', '湛江市', '广东,湛江', '110.359377', '21.270707', 1); +INSERT INTO `yx_system_city` VALUES (240, 494394, 1, 483250, '440900000000', '茂名市', '广东,茂名', '110.925456', '21.662999', 1); +INSERT INTO `yx_system_city` VALUES (241, 496438, 1, 483250, '441200000000', '肇庆市', '广东,肇庆', '112.465091', '23.047191', 1); +INSERT INTO `yx_system_city` VALUES (242, 498104, 1, 483250, '441300000000', '惠州市', '广东,惠州', '114.416196', '23.111847', 1); +INSERT INTO `yx_system_city` VALUES (243, 499489, 1, 483250, '441400000000', '梅州市', '广东,梅州', '116.122238', '24.288615', 1); +INSERT INTO `yx_system_city` VALUES (244, 501867, 1, 483250, '441500000000', '汕尾市', '广东,汕尾', '115.375278', '22.786211', 1); +INSERT INTO `yx_system_city` VALUES (245, 502828, 1, 483250, '441600000000', '河源市', '广东,河源', '114.700447', '23.743538', 1); +INSERT INTO `yx_system_city` VALUES (246, 504366, 1, 483250, '441700000000', '阳江市', '广东,阳江', '111.982232', '21.857958', 1); +INSERT INTO `yx_system_city` VALUES (247, 505298, 1, 483250, '441800000000', '清远市', '广东,清远', '113.056031', '23.681763', 1); +INSERT INTO `yx_system_city` VALUES (248, 506616, 1, 483250, '441900000000', '东莞市', '广东,东莞', '113.751765', '23.020536', 1); +INSERT INTO `yx_system_city` VALUES (249, 507255, 1, 483250, '442000000000', '中山市', '广东,中山', '113.392782', '22.517645', 1); +INSERT INTO `yx_system_city` VALUES (250, 507557, 1, 483250, '445100000000', '潮州市', '广东,潮州', '116.622603', '23.656950', 1); +INSERT INTO `yx_system_city` VALUES (251, 508648, 1, 483250, '445200000000', '揭阳市', '广东,揭阳', '116.372831', '23.549993', 1); +INSERT INTO `yx_system_city` VALUES (252, 510408, 1, 483250, '445300000000', '云浮市', '广东,云浮', '112.044491', '22.915094', 1); +INSERT INTO `yx_system_city` VALUES (253, 511463, 1, 511462, '450100000000', '南宁市', '广西,南宁', '108.366543', '22.817002', 1); +INSERT INTO `yx_system_city` VALUES (254, 513434, 1, 511462, '450200000000', '柳州市', '广西,柳州', '109.415953', '24.325502', 1); +INSERT INTO `yx_system_city` VALUES (255, 514790, 1, 511462, '450300000000', '桂林市', '广西,桂林', '110.290194', '25.273566', 1); +INSERT INTO `yx_system_city` VALUES (256, 516858, 1, 511462, '450400000000', '梧州市', '广西,梧州', '111.279115', '23.476962', 1); +INSERT INTO `yx_system_city` VALUES (257, 517933, 1, 511462, '450500000000', '北海市', '广西,北海', '109.119927', '21.481254', 1); +INSERT INTO `yx_system_city` VALUES (258, 518407, 1, 511462, '450600000000', '防城港市', '广西,防城港', '108.353846', '21.686860', 1); +INSERT INTO `yx_system_city` VALUES (259, 518808, 1, 511462, '450700000000', '钦州市', '广西,钦州', '108.654146', '21.979933', 1); +INSERT INTO `yx_system_city` VALUES (260, 519929, 1, 511462, '450800000000', '贵港市', '广西,贵港', '109.598926', '23.111530', 1); +INSERT INTO `yx_system_city` VALUES (261, 521166, 1, 511462, '450900000000', '玉林市', '广西,玉林', '110.164756', '22.636379', 1); +INSERT INTO `yx_system_city` VALUES (262, 522786, 1, 511462, '451000000000', '百色市', '广西,百色', '106.618201', '23.902333', 1); +INSERT INTO `yx_system_city` VALUES (263, 524814, 1, 511462, '451100000000', '贺州市', '广西,贺州', '111.566694', '24.403582', 1); +INSERT INTO `yx_system_city` VALUES (264, 525638, 1, 511462, '451200000000', '河池市', '广西,河池', '108.085261', '24.692931', 1); +INSERT INTO `yx_system_city` VALUES (265, 527443, 1, 511462, '451300000000', '来宾市', '广西,来宾', '109.221465', '23.750306', 1); +INSERT INTO `yx_system_city` VALUES (266, 528339, 1, 511462, '451400000000', '崇左市', '广西,崇左', '107.364711', '22.376532', 1); +INSERT INTO `yx_system_city` VALUES (267, 529345, 1, 529344, '460100000000', '海口市', '海南,海口', '110.198293', '20.044001', 1); +INSERT INTO `yx_system_city` VALUES (268, 529878, 1, 529344, '460200000000', '三亚市', '海南,三亚', '109.511909', '18.252847', 1); +INSERT INTO `yx_system_city` VALUES (269, 530060, 1, 529344, '460300000000', '三沙市', '海南,三沙', '112.338695', '16.831839', 1); +INSERT INTO `yx_system_city` VALUES (270, 530070, 1, 529344, '460400000000', '儋州市', '海南,儋州', '110.349228', '20.017377', 1); +INSERT INTO `yx_system_city` VALUES (271, 530468, 1, 529344, '469000000000', '省直辖县级行政区域', '海南', '110.349228', '20.017377', 1); +INSERT INTO `yx_system_city` VALUES (272, 533329, 1, 533328, '500100000000', '重庆市', '重庆', '106.551556', '29.563009', 1); +INSERT INTO `yx_system_city` VALUES (273, 540700, 1, 533328, '500200000000', '县', '重庆', '106.551556', '29.563009', 1); +INSERT INTO `yx_system_city` VALUES (274, 545533, 1, 545532, '510100000000', '成都市', '四川,成都', '104.066541', '30.572269', 1); +INSERT INTO `yx_system_city` VALUES (275, 550275, 1, 545532, '510300000000', '自贡市', '四川,自贡', '104.778442', '29.339030', 1); +INSERT INTO `yx_system_city` VALUES (276, 551809, 1, 545532, '510400000000', '攀枝花市', '四川,攀枝花', '101.718637', '26.582347', 1); +INSERT INTO `yx_system_city` VALUES (277, 552358, 1, 545532, '510500000000', '泸州市', '四川,泸州', '105.442258', '28.871810', 1); +INSERT INTO `yx_system_city` VALUES (278, 554142, 1, 545532, '510600000000', '德阳市', '四川,德阳', '104.397894', '31.126855', 1); +INSERT INTO `yx_system_city` VALUES (279, 556077, 1, 545532, '510700000000', '绵阳市', '四川,绵阳', '104.679114', '31.467450', 1); +INSERT INTO `yx_system_city` VALUES (280, 560191, 1, 545532, '510800000000', '广元市', '四川,广元', '105.843357', '32.435435', 1); +INSERT INTO `yx_system_city` VALUES (281, 563242, 1, 545532, '510900000000', '遂宁市', '四川,遂宁', '105.592898', '30.532847', 1); +INSERT INTO `yx_system_city` VALUES (282, 565735, 1, 545532, '511000000000', '内江市', '四川,内江', '105.058433', '29.580228', 1); +INSERT INTO `yx_system_city` VALUES (283, 568202, 1, 545532, '511100000000', '乐山市', '四川,乐山', '103.765568', '29.552106', 1); +INSERT INTO `yx_system_city` VALUES (284, 570733, 1, 545532, '511300000000', '南充市', '四川,南充', '106.110698', '30.837793', 1); +INSERT INTO `yx_system_city` VALUES (285, 576992, 1, 545532, '511400000000', '眉山市', '四川,眉山', '103.848538', '30.075439', 1); +INSERT INTO `yx_system_city` VALUES (286, 578485, 1, 545532, '511500000000', '宜宾市', '四川,宜宾', '104.643215', '28.751768', 1); +INSERT INTO `yx_system_city` VALUES (287, 581870, 1, 545532, '511600000000', '广安市', '四川,广安', '106.633212', '30.455961', 1); +INSERT INTO `yx_system_city` VALUES (288, 585049, 1, 545532, '511700000000', '达州市', '四川,达州', '107.468023', '31.209571', 1); +INSERT INTO `yx_system_city` VALUES (289, 588538, 1, 545532, '511800000000', '雅安市', '四川,雅安', '103.013261', '29.980537', 1); +INSERT INTO `yx_system_city` VALUES (290, 589779, 1, 545532, '511900000000', '巴中市', '四川,巴中', '106.747477', '31.867903', 1); +INSERT INTO `yx_system_city` VALUES (291, 592598, 1, 545532, '512000000000', '资阳市', '四川,资阳', '104.627636', '30.128901', 1); +INSERT INTO `yx_system_city` VALUES (292, 594864, 1, 545532, '513200000000', '阿坝藏族羌族自治州', '四川,阿坝', '102.224653', '31.899413', 1); +INSERT INTO `yx_system_city` VALUES (293, 596525, 1, 545532, '513300000000', '甘孜藏族自治州', '四川,甘孜', '101.962310', '30.049520', 1); +INSERT INTO `yx_system_city` VALUES (294, 599659, 1, 545532, '513400000000', '凉山彝族自治州', '四川,凉山', '102.267335', '27.881610', 1); +INSERT INTO `yx_system_city` VALUES (295, 604132, 1, 604131, '520100000000', '贵阳市', '贵州,贵阳', '106.630153', '26.647661', 1); +INSERT INTO `yx_system_city` VALUES (296, 605834, 1, 604131, '520200000000', '六盘水市', '贵州,六盘水', '104.830359', '26.592666', 1); +INSERT INTO `yx_system_city` VALUES (297, 607029, 1, 604131, '520300000000', '遵义市', '贵州,遵义', '106.927389', '27.725654', 1); +INSERT INTO `yx_system_city` VALUES (298, 609309, 1, 604131, '520400000000', '安顺市', '贵州,安顺', '105.947593', '26.253072', 1); +INSERT INTO `yx_system_city` VALUES (299, 610607, 1, 604131, '520500000000', '毕节市', '贵州,毕节', '105.283992', '27.302589', 1); +INSERT INTO `yx_system_city` VALUES (300, 614530, 1, 604131, '520600000000', '铜仁市', '贵州,铜仁', '109.189598', '27.731514', 1); +INSERT INTO `yx_system_city` VALUES (301, 617670, 1, 604131, '522300000000', '黔西南布依族苗族自治州', '贵州,黔西南', '104.906396', '25.087825', 1); +INSERT INTO `yx_system_city` VALUES (302, 619017, 1, 604131, '522600000000', '黔东南苗族侗族自治州', '贵州,黔东南', '107.982859', '26.583442', 1); +INSERT INTO `yx_system_city` VALUES (303, 622734, 1, 604131, '522700000000', '黔南布依族苗族自治州', '贵州,黔南', '107.522097', '26.254092', 1); +INSERT INTO `yx_system_city` VALUES (304, 624373, 1, 624372, '530100000000', '昆明市', '云南,昆明', '102.832891', '24.880095', 1); +INSERT INTO `yx_system_city` VALUES (305, 626181, 1, 624372, '530300000000', '曲靖市', '云南,曲靖', '103.796167', '25.489999', 1); +INSERT INTO `yx_system_city` VALUES (306, 627981, 1, 624372, '530400000000', '玉溪市', '云南,玉溪', '102.546543', '24.352036', 1); +INSERT INTO `yx_system_city` VALUES (307, 628776, 1, 624372, '530500000000', '保山市', '云南,保山', '99.161761', '25.112046', 1); +INSERT INTO `yx_system_city` VALUES (308, 629781, 1, 624372, '530600000000', '昭通市', '云南,昭通', '103.717465', '27.338257', 1); +INSERT INTO `yx_system_city` VALUES (309, 631276, 1, 624372, '530700000000', '丽江市', '云南,丽江', '100.227750', '26.855047', 1); +INSERT INTO `yx_system_city` VALUES (310, 631811, 1, 624372, '530800000000', '普洱市', '云南,普洱', '100.966512', '22.825065', 1); +INSERT INTO `yx_system_city` VALUES (311, 632971, 1, 624372, '530900000000', '临沧市', '云南,临沧', '100.079583', '23.877573', 1); +INSERT INTO `yx_system_city` VALUES (312, 634006, 1, 624372, '532300000000', '楚雄彝族自治州', '云南,楚雄', '101.528069', '25.045532', 1); +INSERT INTO `yx_system_city` VALUES (313, 635219, 1, 624372, '532500000000', '红河哈尼族彝族自治州', '云南,红河', '103.374799', '23.363130', 1); +INSERT INTO `yx_system_city` VALUES (314, 636688, 1, 624372, '532600000000', '文山壮族苗族自治州', '云南,文山', '104.216248', '23.400734', 1); +INSERT INTO `yx_system_city` VALUES (315, 637778, 1, 624372, '532800000000', '西双版纳傣族自治州', '云南,西双版纳', '100.797777', '22.007351', 1); +INSERT INTO `yx_system_city` VALUES (316, 638092, 1, 624372, '532900000000', '大理白族自治州', '云南,大理', '100.267639', '25.606485', 1); +INSERT INTO `yx_system_city` VALUES (317, 639368, 1, 624372, '533100000000', '德宏傣族景颇族自治州', '云南,德宏', '98.584895', '24.433353', 1); +INSERT INTO `yx_system_city` VALUES (318, 639802, 1, 624372, '533300000000', '怒江傈僳族自治州', '云南,怒江', '98.853097', '25.852547', 1); +INSERT INTO `yx_system_city` VALUES (319, 640107, 1, 624372, '533400000000', '迪庆藏族自治州', '云南,迪庆', '99.702234', '27.818882', 1); +INSERT INTO `yx_system_city` VALUES (320, 640333, 1, 640332, '540100000000', '拉萨市', '西藏,拉萨', '91.140856', '29.645554', 1); +INSERT INTO `yx_system_city` VALUES (321, 640675, 1, 640332, '540200000000', '日喀则市', '西藏,日喀则', '88.880583', '29.266869', 1); +INSERT INTO `yx_system_city` VALUES (322, 642571, 1, 640332, '540300000000', '昌都市', '西藏,昌都', '97.172020', '31.140969', 1); +INSERT INTO `yx_system_city` VALUES (323, 643863, 1, 640332, '540400000000', '林芝市', '西藏,林芝', '94.361490', '29.649128', 1); +INSERT INTO `yx_system_city` VALUES (324, 644423, 1, 640332, '540500000000', '山南市', '西藏,山南', '91.117212', '29.646922', 1); +INSERT INTO `yx_system_city` VALUES (325, 645076, 1, 640332, '542400000000', '那曲地区', '西藏,那曲', '92.051239', '31.476202', 1); +INSERT INTO `yx_system_city` VALUES (326, 646392, 1, 640332, '542500000000', '阿里地区', '西藏,阿里', '80.105804', '32.501111', 1); +INSERT INTO `yx_system_city` VALUES (327, 646579, 1, 646578, '610100000000', '西安市', '陕西,西安', '108.940174', '34.341568', 1); +INSERT INTO `yx_system_city` VALUES (328, 649979, 1, 646578, '610200000000', '铜川市', '陕西,铜川', '108.945233', '34.896756', 1); +INSERT INTO `yx_system_city` VALUES (329, 650575, 1, 646578, '610300000000', '宝鸡市', '陕西,宝鸡', '107.237974', '34.361979', 1); +INSERT INTO `yx_system_city` VALUES (330, 652581, 1, 646578, '610400000000', '咸阳市', '陕西,咸阳', '108.708991', '34.329605', 1); +INSERT INTO `yx_system_city` VALUES (331, 655295, 1, 646578, '610500000000', '渭南市', '陕西,渭南', '109.509786', '34.499995', 1); +INSERT INTO `yx_system_city` VALUES (332, 657848, 1, 646578, '610600000000', '延安市', '陕西,延安', '109.489727', '36.585455', 1); +INSERT INTO `yx_system_city` VALUES (333, 660643, 1, 646578, '610700000000', '汉中市', '陕西,汉中', '107.023323', '33.067480', 1); +INSERT INTO `yx_system_city` VALUES (334, 663046, 1, 646578, '610800000000', '榆林市', '陕西,榆林', '109.734589', '38.285390', 1); +INSERT INTO `yx_system_city` VALUES (335, 667681, 1, 646578, '610900000000', '安康市', '陕西,安康', '109.029022', '32.684714', 1); +INSERT INTO `yx_system_city` VALUES (336, 669707, 1, 646578, '611000000000', '商洛市', '陕西,商洛', '109.940477', '33.870422', 1); +INSERT INTO `yx_system_city` VALUES (337, 671120, 1, 671119, '620100000000', '兰州市', '甘肃,兰州', '103.834303', '36.061089', 1); +INSERT INTO `yx_system_city` VALUES (338, 672330, 1, 671119, '620200000000', '嘉峪关市', '甘肃,嘉峪关', '98.289152', '39.773130', 1); +INSERT INTO `yx_system_city` VALUES (339, 672385, 1, 671119, '620300000000', '金昌市', '甘肃,金昌', '102.188043', '38.520089', 1); +INSERT INTO `yx_system_city` VALUES (340, 672577, 1, 671119, '620400000000', '白银市', '甘肃,白银', '104.138559', '36.544756', 1); +INSERT INTO `yx_system_city` VALUES (341, 673463, 1, 671119, '620500000000', '天水市', '甘肃,天水', '105.724947', '34.580863', 1); +INSERT INTO `yx_system_city` VALUES (342, 676215, 1, 671119, '620600000000', '武威市', '甘肃,武威', '102.638011', '37.928264', 1); +INSERT INTO `yx_system_city` VALUES (343, 677568, 1, 671119, '620700000000', '张掖市', '甘肃,张掖', '100.449818', '38.925875', 1); +INSERT INTO `yx_system_city` VALUES (344, 678560, 1, 671119, '620800000000', '平凉市', '甘肃,平凉', '106.665240', '35.543051', 1); +INSERT INTO `yx_system_city` VALUES (345, 680191, 1, 671119, '620900000000', '酒泉市', '甘肃,酒泉', '98.494483', '39.732410', 1); +INSERT INTO `yx_system_city` VALUES (346, 680815, 1, 671119, '621000000000', '庆阳市', '甘肃,庆阳', '107.643631', '35.709077', 1); +INSERT INTO `yx_system_city` VALUES (347, 682322, 1, 671119, '621100000000', '定西市', '甘肃,定西', '104.626282', '35.580662', 1); +INSERT INTO `yx_system_city` VALUES (348, 684415, 1, 671119, '621200000000', '陇南市', '甘肃,陇南', '104.921841', '33.400684', 1); +INSERT INTO `yx_system_city` VALUES (349, 687916, 1, 671119, '622900000000', '临夏回族自治州', '甘肃,临夏', '103.210538', '35.601182', 1); +INSERT INTO `yx_system_city` VALUES (350, 689265, 1, 671119, '623000000000', '甘南藏族自治州', '甘肃,甘南', '102.911027', '34.983385', 1); +INSERT INTO `yx_system_city` VALUES (351, 690095, 1, 690094, '630100000000', '西宁市', '青海,西宁', '101.778228', '36.617144', 1); +INSERT INTO `yx_system_city` VALUES (352, 691278, 1, 690094, '630200000000', '海东市', '青海,海东', '102.104287', '36.502039', 1); +INSERT INTO `yx_system_city` VALUES (353, 693040, 1, 690094, '632200000000', '海北藏族自治州', '青海,海北', '100.900997', '36.954413', 1); +INSERT INTO `yx_system_city` VALUES (354, 693342, 1, 690094, '632300000000', '黄南藏族自治州', '青海,黄南', '102.015248', '35.519548', 1); +INSERT INTO `yx_system_city` VALUES (355, 693672, 1, 690094, '632500000000', '海南藏族自治州', '青海,海南', '101.780199', '36.620901', 1); +INSERT INTO `yx_system_city` VALUES (356, 694220, 1, 690094, '632600000000', '果洛藏族自治州', '青海,果洛', '100.244808', '34.471431', 1); +INSERT INTO `yx_system_city` VALUES (357, 694478, 1, 690094, '632700000000', '玉树藏族自治州', '青海,玉树', '97.091934', '33.011674', 1); +INSERT INTO `yx_system_city` VALUES (358, 694846, 1, 690094, '632800000000', '海西蒙古族藏族自治州', '青海,海西', '97.369751', '37.377139', 1); +INSERT INTO `yx_system_city` VALUES (359, 695260, 1, 695259, '640100000000', '银川市', '宁夏,银川', '106.230909', '38.487193', 1); +INSERT INTO `yx_system_city` VALUES (360, 695883, 1, 695259, '640200000000', '石嘴山市', '宁夏,石嘴山', '106.383303', '38.983236', 1); +INSERT INTO `yx_system_city` VALUES (361, 696252, 1, 695259, '640300000000', '吴忠市', '宁夏,吴忠', '106.198393', '37.997460', 1); +INSERT INTO `yx_system_city` VALUES (362, 696928, 1, 695259, '640400000000', '固原市', '宁夏,固原', '106.242610', '36.015855', 1); +INSERT INTO `yx_system_city` VALUES (363, 697887, 1, 695259, '640500000000', '中卫市', '宁夏,中卫', '105.196902', '37.499972', 1); +INSERT INTO `yx_system_city` VALUES (364, 698441, 1, 698440, '650100000000', '乌鲁木齐市', '新疆,乌鲁木齐', '87.616848', '43.825592', 1); +INSERT INTO `yx_system_city` VALUES (365, 699583, 1, 698440, '650200000000', '克拉玛依市', '新疆,克拉玛依', '84.889207', '45.579888', 1); +INSERT INTO `yx_system_city` VALUES (366, 699773, 1, 698440, '650400000000', '吐鲁番市', '新疆,吐鲁番', '89.189655', '42.951384', 1); +INSERT INTO `yx_system_city` VALUES (367, 700070, 1, 698440, '650500000000', '哈密市', '新疆,哈密', '93.514916', '42.818501', 1); +INSERT INTO `yx_system_city` VALUES (368, 700489, 1, 698440, '652300000000', '昌吉回族自治州', '新疆,昌吉', '87.308224', '44.011182', 1); +INSERT INTO `yx_system_city` VALUES (369, 701559, 1, 698440, '652700000000', '博尔塔拉蒙古自治州', '新疆,博尔塔拉', '82.066159', '44.905588', 1); +INSERT INTO `yx_system_city` VALUES (370, 702104, 1, 698440, '652800000000', '巴音郭楞蒙古自治州', '新疆,巴音郭楞', '86.145298', '41.764115', 1); +INSERT INTO `yx_system_city` VALUES (371, 703119, 1, 698440, '652900000000', '阿克苏地区', '新疆,阿克苏', '80.260605', '41.168779', 1); +INSERT INTO `yx_system_city` VALUES (372, 704779, 1, 698440, '653000000000', '克孜勒苏柯尔克孜自治州', '新疆,克孜勒苏', '76.167819', '39.714526', 1); +INSERT INTO `yx_system_city` VALUES (373, 705145, 1, 698440, '653100000000', '喀什地区', '新疆,喀什', '75.989755', '39.470400', 1); +INSERT INTO `yx_system_city` VALUES (374, 708117, 1, 698440, '653200000000', '和田地区', '新疆,和田', '79.922211', '37.114157', 1); +INSERT INTO `yx_system_city` VALUES (375, 709792, 1, 698440, '654000000000', '伊犁哈萨克自治州', '新疆,伊犁', '81.324136', '43.916823', 1); +INSERT INTO `yx_system_city` VALUES (376, 711218, 1, 698440, '654200000000', '塔城地区', '新疆,塔城', '82.980316', '46.745364', 1); +INSERT INTO `yx_system_city` VALUES (377, 712893, 1, 698440, '654300000000', '阿勒泰地区', '新疆,阿勒泰', '88.141253', '47.844924', 1); +INSERT INTO `yx_system_city` VALUES (378, 713697, 1, 698440, '659000000000', '直辖县', '新疆', '87.627704', '43.793026', 1); +INSERT INTO `yx_system_city` VALUES (385, 714402, 1, 714401, '0', '彰化县', '台湾,彰化', '120.416000', '24.000000', 1); +INSERT INTO `yx_system_city` VALUES (386, 717531, 1, 714401, '0', '新北市', '台湾,新北', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (387, 719868, 1, 714401, '0', '澎湖县', '台湾,澎湖', '119.566417', '23.569733', 1); +INSERT INTO `yx_system_city` VALUES (388, 720118, 1, 714401, '0', '屏东县', '台湾,屏东', '120.487928', '22.682802', 1); +INSERT INTO `yx_system_city` VALUES (389, 722024, 1, 714401, '0', '臺中市', '台湾,臺中', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (390, 725488, 1, 714401, '0', '臺南市', '台湾,臺南', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (391, 727730, 1, 714401, '0', '臺北市', '台湾,臺北', '121.517057', '25.048074', 1); +INSERT INTO `yx_system_city` VALUES (392, 729928, 1, 714401, '0', '臺东县', '台湾,臺东', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (393, 730843, 1, 714401, '0', '桃园市', '台湾,桃园', '121.083000', '25.000000', 1); +INSERT INTO `yx_system_city` VALUES (394, 734179, 1, 714401, '0', '宜兰县', '台湾,宜兰', '121.500000', '24.600000', 1); +INSERT INTO `yx_system_city` VALUES (395, 736051, 1, 714401, '0', '南投县', '台湾,南投', '120.830000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (396, 737856, 1, 714401, '0', '南海岛', '台湾,南海岛', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (397, 737861, 1, 714401, '0', '苗栗县', '台湾,苗栗', '120.818985', '24.561601', 1); +INSERT INTO `yx_system_city` VALUES (398, 739957, 1, 714401, '0', '嘉义市', '台湾,嘉义', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (399, 740510, 1, 714401, '0', '嘉义县', '台湾,嘉义', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (400, 742126, 1, 714401, '0', '新竹市', '台湾,新竹', '120.968798', '24.806738', 1); +INSERT INTO `yx_system_city` VALUES (401, 742636, 1, 714401, '0', '新竹县', '台湾,新竹', '120.968798', '24.806738', 1); +INSERT INTO `yx_system_city` VALUES (402, 743938, 1, 714401, '0', '花莲县', '台湾,花莲', '121.300000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (403, 745674, 1, 714401, '0', '高雄市', '台湾,高雄', '120.311922', '22.620856', 1); +INSERT INTO `yx_system_city` VALUES (404, 748553, 1, 714401, '0', '基隆市', '台湾,基隆', '121.746248', '25.130741', 1); +INSERT INTO `yx_system_city` VALUES (405, 749571, 1, 714401, '0', '金门县', '台湾,金门', '118.317089', '24.432706', 1); +INSERT INTO `yx_system_city` VALUES (406, 749930, 1, 714401, '0', '连江县', '台湾,连江', '119.539704', '26.197364', 1); +INSERT INTO `yx_system_city` VALUES (407, 749957, 1, 714401, '0', '云林县', '台湾,云林', '120.527173', '23.696887', 1); +INSERT INTO `yx_system_city` VALUES (408, 3, 2, 2, '110101000000', '东城区', '北京,东城', '116.416357', '39.928353', 1); +INSERT INTO `yx_system_city` VALUES (409, 203, 2, 2, '110102000000', '西城区', '北京,西城', '116.365868', '39.912289', 1); +INSERT INTO `yx_system_city` VALUES (410, 480, 2, 2, '110105000000', '朝阳区', '北京,朝阳', '116.443108', '39.921470', 1); +INSERT INTO `yx_system_city` VALUES (411, 1122, 2, 2, '110106000000', '丰台区', '北京,丰台', '116.287149', '39.858427', 1); +INSERT INTO `yx_system_city` VALUES (412, 1533, 2, 2, '110107000000', '石景山区', '北京,石景山', '116.222982', '39.906611', 1); +INSERT INTO `yx_system_city` VALUES (413, 1692, 2, 2, '110108000000', '海淀区', '北京,海淀', '116.298056', '39.959912', 1); +INSERT INTO `yx_system_city` VALUES (414, 2376, 2, 2, '110109000000', '门头沟区', '北京,门头沟', '116.102009', '39.940646', 1); +INSERT INTO `yx_system_city` VALUES (415, 2689, 2, 2, '110111000000', '房山区', '北京,房山', '116.143267', '39.749144', 1); +INSERT INTO `yx_system_city` VALUES (416, 3324, 2, 2, '110112000000', '通州区', '北京,通州', '116.656435', '39.909946', 1); +INSERT INTO `yx_system_city` VALUES (417, 3927, 2, 2, '110113000000', '顺义区', '北京,顺义', '116.654651', '40.130347', 1); +INSERT INTO `yx_system_city` VALUES (418, 4498, 2, 2, '110114000000', '昌平区', '北京,昌平', '116.231204', '40.220660', 1); +INSERT INTO `yx_system_city` VALUES (419, 5042, 2, 2, '110115000000', '大兴区', '北京,大兴', '116.341395', '39.726929', 1); +INSERT INTO `yx_system_city` VALUES (420, 5800, 2, 2, '110116000000', '怀柔区', '北京,怀柔', '116.642349', '40.315704', 1); +INSERT INTO `yx_system_city` VALUES (421, 6138, 2, 2, '110117000000', '平谷区', '北京,平谷', '117.121383', '40.140701', 1); +INSERT INTO `yx_system_city` VALUES (422, 6466, 2, 2, '110118000000', '密云区', '北京,密云', '116.843177', '40.376834', 1); +INSERT INTO `yx_system_city` VALUES (423, 6921, 2, 2, '110119000000', '延庆区', '北京,延庆', '115.974848', '40.456951', 1); +INSERT INTO `yx_system_city` VALUES (424, 7364, 2, 7363, '120101000000', '和平区', '天津,和平', '117.214510', '39.116949', 1); +INSERT INTO `yx_system_city` VALUES (425, 7434, 2, 7363, '120102000000', '河东区', '天津,河东', '117.251587', '39.128291', 1); +INSERT INTO `yx_system_city` VALUES (426, 7607, 2, 7363, '120103000000', '河西区', '天津,河西', '117.223372', '39.109563', 1); +INSERT INTO `yx_system_city` VALUES (427, 7763, 2, 7363, '120104000000', '南开区', '天津,南开', '117.150738', '39.138203', 1); +INSERT INTO `yx_system_city` VALUES (428, 7954, 2, 7363, '120105000000', '河北区', '天津,河北', '117.200983', '39.084158', 1); +INSERT INTO `yx_system_city` VALUES (429, 8079, 2, 7363, '120106000000', '红桥区', '天津,红桥', '117.151533', '39.167345', 1); +INSERT INTO `yx_system_city` VALUES (430, 8298, 2, 7363, '120110000000', '东丽区', '天津,东丽', '117.314324', '39.086569', 1); +INSERT INTO `yx_system_city` VALUES (431, 8563, 2, 7363, '120111000000', '西青区', '天津,西青', '117.008827', '39.141152', 1); +INSERT INTO `yx_system_city` VALUES (432, 8835, 2, 7363, '120112000000', '津南区', '天津,津南', '117.357260', '38.937928', 1); +INSERT INTO `yx_system_city` VALUES (433, 9102, 2, 7363, '120113000000', '北辰区', '天津,北辰', '117.135488', '39.224792', 1); +INSERT INTO `yx_system_city` VALUES (434, 9378, 2, 7363, '120114000000', '武清区', '天津,武清', '117.044388', '39.384119', 1); +INSERT INTO `yx_system_city` VALUES (435, 10143, 2, 7363, '120115000000', '宝坻区', '天津,宝坻', '117.309863', '39.717379', 1); +INSERT INTO `yx_system_city` VALUES (436, 10983, 2, 7363, '120116000000', '滨海新区', '天津,滨海', '117.517969', '38.719936', 1); +INSERT INTO `yx_system_city` VALUES (437, 11454, 2, 7363, '120117000000', '宁河区', '天津,宁河', '117.826625', '39.329858', 1); +INSERT INTO `yx_system_city` VALUES (438, 11795, 2, 7363, '120118000000', '静海区', '天津,静海', '116.974130', '38.947512', 1); +INSERT INTO `yx_system_city` VALUES (439, 12251, 2, 7363, '120119000000', '蓟州区', '天津,蓟州', '117.200983', '39.084158', 1); +INSERT INTO `yx_system_city` VALUES (440, 13269, 2, 13268, '130101000000', '市辖区', '河北,石家庄', '114.514859', '38.042306', 1); +INSERT INTO `yx_system_city` VALUES (441, 13270, 2, 13268, '130102000000', '长安区', '河北,石家庄,长安', '114.539060', '38.036654', 1); +INSERT INTO `yx_system_city` VALUES (442, 13444, 2, 13268, '130104000000', '桥西区', '河北,石家庄,桥西', '114.461154', '38.004043', 1); +INSERT INTO `yx_system_city` VALUES (443, 13601, 2, 13268, '130105000000', '新华区', '河北,石家庄,新华', '114.463347', '38.051060', 1); +INSERT INTO `yx_system_city` VALUES (444, 13728, 2, 13268, '130107000000', '井陉矿区', '河北,石家庄,井陉', '114.145240', '38.032148', 1); +INSERT INTO `yx_system_city` VALUES (445, 13788, 2, 13268, '130108000000', '裕华区', '河北,石家庄,裕华', '114.531362', '38.006453', 1); +INSERT INTO `yx_system_city` VALUES (446, 13895, 2, 13268, '130109000000', '藁城区', '河北,石家庄,藁城', '114.847075', '38.021567', 1); +INSERT INTO `yx_system_city` VALUES (447, 14142, 2, 13268, '130110000000', '鹿泉区', '河北,石家庄,鹿泉', '114.313724', '38.085958', 1); +INSERT INTO `yx_system_city` VALUES (448, 14377, 2, 13268, '130111000000', '栾城区', '河北,石家庄,栾城', '114.648318', '37.900200', 1); +INSERT INTO `yx_system_city` VALUES (449, 14562, 2, 13268, '130121000000', '井陉县', '河北,石家庄,井陉', '114.145240', '38.032148', 1); +INSERT INTO `yx_system_city` VALUES (450, 14902, 2, 13268, '130123000000', '正定县', '河北,石家庄,正定', '114.570941', '38.146445', 1); +INSERT INTO `yx_system_city` VALUES (451, 15100, 2, 13268, '130125000000', '行唐县', '河北,石家庄,行唐', '114.552692', '38.438411', 1); +INSERT INTO `yx_system_city` VALUES (452, 15447, 2, 13268, '130126000000', '灵寿县', '河北,石家庄,灵寿', '114.382645', '38.308628', 1); +INSERT INTO `yx_system_city` VALUES (453, 15747, 2, 13268, '130127000000', '高邑县', '河北,石家庄,高邑', '114.611433', '37.615159', 1); +INSERT INTO `yx_system_city` VALUES (454, 15860, 2, 13268, '130128000000', '深泽县', '河北,石家庄,深泽', '115.200910', '38.184072', 1); +INSERT INTO `yx_system_city` VALUES (455, 15993, 2, 13268, '130129000000', '赞皇县', '河北,石家庄,赞皇', '114.386155', '37.665576', 1); +INSERT INTO `yx_system_city` VALUES (456, 16218, 2, 13268, '130130000000', '无极县', '河北,石家庄,无极', '114.976337', '38.179141', 1); +INSERT INTO `yx_system_city` VALUES (457, 16447, 2, 13268, '130131000000', '平山县', '河北,石家庄,平山', '114.199134', '38.247144', 1); +INSERT INTO `yx_system_city` VALUES (458, 17188, 2, 13268, '130132000000', '元氏县', '河北,石家庄,元氏', '114.525580', '37.766651', 1); +INSERT INTO `yx_system_city` VALUES (459, 17417, 2, 13268, '130133000000', '赵县', '河北,石家庄,赵县', '114.776187', '37.756498', 1); +INSERT INTO `yx_system_city` VALUES (460, 17710, 2, 13268, '130183000000', '晋州市', '河北,石家庄,晋州', '115.044185', '38.033629', 1); +INSERT INTO `yx_system_city` VALUES (461, 17945, 2, 13268, '130184000000', '新乐市', '河北,石家庄,新乐', '114.684014', '38.343296', 1); +INSERT INTO `yx_system_city` VALUES (462, 18129, 2, 18128, '130201000000', '市辖区', '河北,唐山', '118.180193', '39.630867', 1); +INSERT INTO `yx_system_city` VALUES (463, 18130, 2, 18128, '130202000000', '路南区', '河北,唐山,路南', '118.154354', '39.625059', 1); +INSERT INTO `yx_system_city` VALUES (464, 18297, 2, 18128, '130203000000', '路北区', '河北,唐山,路北', '118.200692', '39.624437', 1); +INSERT INTO `yx_system_city` VALUES (465, 18542, 2, 18128, '130204000000', '古冶区', '河北,唐山,古冶', '118.447635', '39.733578', 1); +INSERT INTO `yx_system_city` VALUES (466, 18754, 2, 18128, '130205000000', '开平区', '河北,唐山,开平', '118.261842', '39.671001', 1); +INSERT INTO `yx_system_city` VALUES (467, 18938, 2, 18128, '130207000000', '丰南区', '河北,唐山,丰南', '118.085169', '39.576031', 1); +INSERT INTO `yx_system_city` VALUES (468, 19436, 2, 18128, '130208000000', '丰润区', '河北,唐山,丰润', '118.162216', '39.832582', 1); +INSERT INTO `yx_system_city` VALUES (469, 19987, 2, 18128, '130209000000', '曹妃甸区', '河北,唐山,曹妃甸', '118.460379', '39.273070', 1); +INSERT INTO `yx_system_city` VALUES (470, 20152, 2, 18128, '130223000000', '滦县', '河北,唐山,滦县', '118.703598', '39.740593', 1); +INSERT INTO `yx_system_city` VALUES (471, 20696, 2, 18128, '130224000000', '滦南县', '河北,唐山,滦南', '118.682379', '39.518997', 1); +INSERT INTO `yx_system_city` VALUES (472, 21321, 2, 18128, '130225000000', '乐亭县', '河北,唐山,乐亭', '118.912571', '39.425608', 1); +INSERT INTO `yx_system_city` VALUES (473, 21825, 2, 18128, '130227000000', '迁西县', '河北,唐山,迁西', '118.314715', '40.141500', 1); +INSERT INTO `yx_system_city` VALUES (474, 22273, 2, 18128, '130229000000', '玉田县', '河北,唐山,玉田', '117.738658', '39.900401', 1); +INSERT INTO `yx_system_city` VALUES (475, 23067, 2, 18128, '130281000000', '遵化市', '河北,唐山,遵化', '117.965892', '40.189202', 1); +INSERT INTO `yx_system_city` VALUES (476, 23787, 2, 18128, '130283000000', '迁安市', '河北,唐山,迁安', '118.701144', '39.999175', 1); +INSERT INTO `yx_system_city` VALUES (477, 24372, 2, 24371, '130301000000', '市辖区', '河北,秦皇岛', '119.600492', '39.935385', 1); +INSERT INTO `yx_system_city` VALUES (478, 24373, 2, 24371, '130302000000', '海港区', '河北,秦皇岛,海港', '119.564962', '39.947560', 1); +INSERT INTO `yx_system_city` VALUES (479, 24760, 2, 24371, '130303000000', '山海关区', '河北,秦皇岛,山海关', '119.775799', '39.978849', 1); +INSERT INTO `yx_system_city` VALUES (480, 24891, 2, 24371, '130304000000', '北戴河区', '河北,秦皇岛,北戴河', '119.488914', '39.834751', 1); +INSERT INTO `yx_system_city` VALUES (481, 24951, 2, 24371, '130306000000', '抚宁区', '河北,秦皇岛,抚宁', '119.244848', '39.876254', 1); +INSERT INTO `yx_system_city` VALUES (482, 25332, 2, 24371, '130321000000', '青龙满族自治县', '河北,秦皇岛,青龙', '118.949684', '40.407578', 1); +INSERT INTO `yx_system_city` VALUES (483, 25758, 2, 24371, '130322000000', '昌黎县', '河北,秦皇岛,昌黎', '119.162694', '39.712813', 1); +INSERT INTO `yx_system_city` VALUES (484, 26216, 2, 24371, '130324000000', '卢龙县', '河北,秦皇岛,卢龙', '118.892986', '39.891947', 1); +INSERT INTO `yx_system_city` VALUES (485, 26780, 2, 26779, '130401000000', '市辖区', '河北,邯郸', '114.538961', '36.625657', 1); +INSERT INTO `yx_system_city` VALUES (486, 26781, 2, 26779, '130402000000', '邯山区', '河北,邯郸,邯山', '114.490431', '36.580358', 1); +INSERT INTO `yx_system_city` VALUES (487, 26877, 2, 26779, '130403000000', '丛台区', '河北,邯郸,丛台', '114.492897', '36.636410', 1); +INSERT INTO `yx_system_city` VALUES (488, 27018, 2, 26779, '130404000000', '复兴区', '河北,邯郸,复兴', '114.462058', '36.639022', 1); +INSERT INTO `yx_system_city` VALUES (489, 27135, 2, 26779, '130406000000', '峰峰矿区', '河北,邯郸,峰峰', '114.214634', '36.472281', 1); +INSERT INTO `yx_system_city` VALUES (490, 27372, 2, 26779, '130421000000', '邯郸县', '河北,邯郸,邯郸', '114.530925', '36.593881', 1); +INSERT INTO `yx_system_city` VALUES (491, 27538, 2, 26779, '130423000000', '临漳县', '河北,邯郸,临漳', '114.619544', '36.335300', 1); +INSERT INTO `yx_system_city` VALUES (492, 27978, 2, 26779, '130424000000', '成安县', '河北,邯郸,成安', '114.670032', '36.444317', 1); +INSERT INTO `yx_system_city` VALUES (493, 28222, 2, 26779, '130425000000', '大名县', '河北,邯郸,大名', '115.147814', '36.285616', 1); +INSERT INTO `yx_system_city` VALUES (494, 28894, 2, 26779, '130426000000', '涉县', '河北,邯郸,涉县', '113.691401', '36.584995', 1); +INSERT INTO `yx_system_city` VALUES (495, 29226, 2, 26779, '130427000000', '磁县', '河北,邯郸,磁县', '114.373947', '36.374012', 1); +INSERT INTO `yx_system_city` VALUES (496, 29613, 2, 26779, '130428000000', '肥乡县', '河北,邯郸,肥乡', '114.800166', '36.548132', 1); +INSERT INTO `yx_system_city` VALUES (497, 29888, 2, 26779, '130429000000', '永年县', '河北,邯郸,永年', '114.543804', '36.744120', 1); +INSERT INTO `yx_system_city` VALUES (498, 30335, 2, 26779, '130430000000', '邱县', '河北,邯郸,邱县', '115.186792', '36.811133', 1); +INSERT INTO `yx_system_city` VALUES (499, 30568, 2, 26779, '130431000000', '鸡泽县', '河北,邯郸,鸡泽', '114.878299', '36.920350', 1); +INSERT INTO `yx_system_city` VALUES (500, 30747, 2, 26779, '130432000000', '广平县', '河北,邯郸,广平', '114.948607', '36.483484', 1); +INSERT INTO `yx_system_city` VALUES (501, 30924, 2, 26779, '130433000000', '馆陶县', '河北,邯郸,馆陶', '115.282468', '36.547557', 1); +INSERT INTO `yx_system_city` VALUES (502, 31210, 2, 26779, '130434000000', '魏县', '河北,邯郸,魏县', '114.938921', '36.359869', 1); +INSERT INTO `yx_system_city` VALUES (503, 31793, 2, 26779, '130435000000', '曲周县', '河北,邯郸,曲周', '114.945113', '36.780175', 1); +INSERT INTO `yx_system_city` VALUES (504, 32146, 2, 26779, '130481000000', '武安市', '河北,邯郸,武安', '114.203697', '36.696506', 1); +INSERT INTO `yx_system_city` VALUES (505, 32689, 2, 32688, '130501000000', '市辖区', '河北,邢台', '114.504844', '37.070589', 1); +INSERT INTO `yx_system_city` VALUES (506, 32690, 2, 32688, '130502000000', '桥东区', '河北,邢台,桥东', '114.507254', '37.068017', 1); +INSERT INTO `yx_system_city` VALUES (507, 32795, 2, 32688, '130503000000', '桥西区', '河北,邢台,桥西', '114.468435', '37.059882', 1); +INSERT INTO `yx_system_city` VALUES (508, 32922, 2, 32688, '130521000000', '邢台县', '河北,邢台,邢台', '114.561132', '37.050730', 1); +INSERT INTO `yx_system_city` VALUES (509, 33459, 2, 32688, '130522000000', '临城县', '河北,邢台,临城', '114.498762', '37.444499', 1); +INSERT INTO `yx_system_city` VALUES (510, 33688, 2, 32688, '130523000000', '内丘县', '河北,邢台,内丘', '114.512128', '37.286669', 1); +INSERT INTO `yx_system_city` VALUES (511, 34011, 2, 32688, '130524000000', '柏乡县', '河北,邢台,柏乡', '114.693426', '37.482423', 1); +INSERT INTO `yx_system_city` VALUES (512, 34139, 2, 32688, '130525000000', '隆尧县', '河北,邢台,隆尧', '114.770419', '37.350173', 1); +INSERT INTO `yx_system_city` VALUES (513, 34431, 2, 32688, '130526000000', '任县', '河北,邢台,任县', '114.671936', '37.120983', 1); +INSERT INTO `yx_system_city` VALUES (514, 34635, 2, 32688, '130527000000', '南和县', '河北,邢台,南和', '114.683762', '37.005041', 1); +INSERT INTO `yx_system_city` VALUES (515, 34866, 2, 32688, '130528000000', '宁晋县', '河北,邢台,宁晋', '114.919301', '37.619886', 1); +INSERT INTO `yx_system_city` VALUES (516, 35240, 2, 32688, '130529000000', '巨鹿县', '河北,邢台,巨鹿', '115.037478', '37.221112', 1); +INSERT INTO `yx_system_city` VALUES (517, 35542, 2, 32688, '130530000000', '新河县', '河北,邢台,新河', '115.242070', '37.528719', 1); +INSERT INTO `yx_system_city` VALUES (518, 35718, 2, 32688, '130531000000', '广宗县', '河北,邢台,广宗', '115.142607', '37.074660', 1); +INSERT INTO `yx_system_city` VALUES (519, 35940, 2, 32688, '130532000000', '平乡县', '河北,邢台,平乡', '115.030076', '37.063148', 1); +INSERT INTO `yx_system_city` VALUES (520, 36202, 2, 32688, '130533000000', '威县', '河北,邢台,威县', '115.266780', '36.975377', 1); +INSERT INTO `yx_system_city` VALUES (521, 36748, 2, 32688, '130534000000', '清河县', '河北,邢台,清河', '115.667576', '37.040087', 1); +INSERT INTO `yx_system_city` VALUES (522, 37086, 2, 32688, '130535000000', '临西县', '河北,邢台,临西', '115.501048', '36.870813', 1); +INSERT INTO `yx_system_city` VALUES (523, 37403, 2, 32688, '130581000000', '南宫市', '河北,邢台,南宫', '115.408748', '37.359264', 1); +INSERT INTO `yx_system_city` VALUES (524, 37883, 2, 32688, '130582000000', '沙河市', '河北,邢台,沙河', '114.503335', '36.854922', 1); +INSERT INTO `yx_system_city` VALUES (525, 38161, 2, 38160, '130601000000', '市辖区', '河北,保定', '115.464806', '38.873891', 1); +INSERT INTO `yx_system_city` VALUES (526, 38162, 2, 38160, '130602000000', '竞秀区', '河北,保定,竞秀', '115.458669', '38.877561', 1); +INSERT INTO `yx_system_city` VALUES (527, 38327, 2, 38160, '130606000000', '莲池区', '河北,保定,莲池', '115.497342', '38.883209', 1); +INSERT INTO `yx_system_city` VALUES (528, 38578, 2, 38160, '130607000000', '满城区', '河北,保定,满城', '115.322351', '38.948955', 1); +INSERT INTO `yx_system_city` VALUES (529, 38786, 2, 38160, '130608000000', '清苑区', '河北,保定,清苑', '115.489968', '38.765041', 1); +INSERT INTO `yx_system_city` VALUES (530, 39082, 2, 38160, '130609000000', '徐水区', '河北,保定,徐水', '115.655778', '39.018737', 1); +INSERT INTO `yx_system_city` VALUES (531, 39426, 2, 38160, '130623000000', '涞水县', '河北,保定,涞水', '115.713905', '39.394317', 1); +INSERT INTO `yx_system_city` VALUES (532, 39736, 2, 38160, '130624000000', '阜平县', '河北,保定,阜平', '114.195104', '38.849152', 1); +INSERT INTO `yx_system_city` VALUES (533, 39960, 2, 38160, '130626000000', '定兴县', '河北,保定,定兴', '115.808175', '39.263018', 1); +INSERT INTO `yx_system_city` VALUES (534, 40258, 2, 38160, '130627000000', '唐县', '河北,保定,唐县', '114.982972', '38.748204', 1); +INSERT INTO `yx_system_city` VALUES (535, 40632, 2, 38160, '130628000000', '高阳县', '河北,保定,高阳', '115.778965', '38.700088', 1); +INSERT INTO `yx_system_city` VALUES (536, 40825, 2, 38160, '130629000000', '容城县', '河北,保定,容城', '115.861657', '39.042784', 1); +INSERT INTO `yx_system_city` VALUES (537, 40961, 2, 38160, '130630000000', '涞源县', '河北,保定,涞源', '114.694284', '39.360247', 1); +INSERT INTO `yx_system_city` VALUES (538, 41272, 2, 38160, '130631000000', '望都县', '河北,保定,望都', '115.154511', '38.695736', 1); +INSERT INTO `yx_system_city` VALUES (539, 41433, 2, 38160, '130632000000', '安新县', '河北,保定,安新', '115.935603', '38.935369', 1); +INSERT INTO `yx_system_city` VALUES (540, 41658, 2, 38160, '130633000000', '易县', '河北,保定,易县', '115.497457', '39.349393', 1); +INSERT INTO `yx_system_city` VALUES (541, 42155, 2, 38160, '130634000000', '曲阳县', '河北,保定,曲阳', '114.744926', '38.622244', 1); +INSERT INTO `yx_system_city` VALUES (542, 42550, 2, 38160, '130635000000', '蠡县', '河北,保定,蠡县', '115.583855', '38.488056', 1); +INSERT INTO `yx_system_city` VALUES (543, 42802, 2, 38160, '130636000000', '顺平县', '河北,保定,顺平', '115.135470', '38.837487', 1); +INSERT INTO `yx_system_city` VALUES (544, 43054, 2, 38160, '130637000000', '博野县', '河北,保定,博野', '115.464380', '38.457364', 1); +INSERT INTO `yx_system_city` VALUES (545, 43196, 2, 38160, '130638000000', '雄县', '河北,保定,雄县', '116.108650', '38.994550', 1); +INSERT INTO `yx_system_city` VALUES (546, 43441, 2, 38160, '130681000000', '涿州市', '河北,保定,涿州', '115.974422', '39.485283', 1); +INSERT INTO `yx_system_city` VALUES (547, 43905, 2, 38160, '130683000000', '安国市', '河北,保定,安国', '115.326647', '38.418440', 1); +INSERT INTO `yx_system_city` VALUES (548, 44124, 2, 38160, '130684000000', '高碑店市', '河北,保定,高碑店', '115.873758', '39.326521', 1); +INSERT INTO `yx_system_city` VALUES (549, 44571, 2, 44570, '130701000000', '市辖区', '河北,张家口', '114.887543', '40.824418', 1); +INSERT INTO `yx_system_city` VALUES (550, 44572, 2, 44570, '130702000000', '桥东区', '河北,张家口,桥东', '114.894341', '40.788457', 1); +INSERT INTO `yx_system_city` VALUES (551, 44634, 2, 44570, '130703000000', '桥西区', '河北,张家口,桥西', '114.869407', '40.819564', 1); +INSERT INTO `yx_system_city` VALUES (552, 44704, 2, 44570, '130705000000', '宣化区', '河北,张家口,宣化', '115.099510', '40.608726', 1); +INSERT INTO `yx_system_city` VALUES (553, 45133, 2, 44570, '130706000000', '下花园区', '河北,张家口,下花园', '115.287352', '40.502652', 1); +INSERT INTO `yx_system_city` VALUES (554, 45197, 2, 44570, '130708000000', '万全区', '河北,张家口,万全', '114.740560', '40.766898', 1); +INSERT INTO `yx_system_city` VALUES (555, 45395, 2, 44570, '130709000000', '崇礼区', '河北,张家口,崇礼', '115.282669', '40.974676', 1); +INSERT INTO `yx_system_city` VALUES (556, 45623, 2, 44570, '130722000000', '张北县', '河北,张家口,张北', '114.720086', '41.158557', 1); +INSERT INTO `yx_system_city` VALUES (557, 46018, 2, 44570, '130723000000', '康保县', '河北,张家口,康保', '114.600404', '41.852368', 1); +INSERT INTO `yx_system_city` VALUES (558, 46371, 2, 44570, '130724000000', '沽源县', '河北,张家口,沽源', '115.688692', '41.669668', 1); +INSERT INTO `yx_system_city` VALUES (559, 46619, 2, 44570, '130725000000', '尚义县', '河北,张家口,尚义', '113.969619', '41.076227', 1); +INSERT INTO `yx_system_city` VALUES (560, 46812, 2, 44570, '130726000000', '蔚县', '河北,张家口,蔚县', '114.588903', '39.840843', 1); +INSERT INTO `yx_system_city` VALUES (561, 47396, 2, 44570, '130727000000', '阳原县', '河北,张家口,阳原', '114.150388', '40.103742', 1); +INSERT INTO `yx_system_city` VALUES (562, 47718, 2, 44570, '130728000000', '怀安县', '河北,张家口,怀安', '114.385791', '40.674193', 1); +INSERT INTO `yx_system_city` VALUES (563, 48013, 2, 44570, '130730000000', '怀来县', '河北,张家口,怀来', '115.517862', '40.415343', 1); +INSERT INTO `yx_system_city` VALUES (564, 48331, 2, 44570, '130731000000', '涿鹿县', '河北,张家口,涿鹿', '115.205345', '40.379563', 1); +INSERT INTO `yx_system_city` VALUES (565, 48731, 2, 44570, '130732000000', '赤城县', '河北,张家口,赤城', '115.831499', '40.912921', 1); +INSERT INTO `yx_system_city` VALUES (566, 49191, 2, 49190, '130801000000', '市辖区', '河北,承德', '117.962410', '40.954071', 1); +INSERT INTO `yx_system_city` VALUES (567, 49192, 2, 49190, '130802000000', '双桥区', '河北,承德,双桥', '117.943348', '40.974650', 1); +INSERT INTO `yx_system_city` VALUES (568, 49328, 2, 49190, '130803000000', '双滦区', '河北,承德,双滦', '117.799912', '40.959196', 1); +INSERT INTO `yx_system_city` VALUES (569, 49425, 2, 49190, '130804000000', '鹰手营子矿区', '河北,承德,鹰手营子', '117.663471', '40.546436', 1); +INSERT INTO `yx_system_city` VALUES (570, 49456, 2, 49190, '130821000000', '承德县', '河北,承德,承德', '118.173825', '40.768238', 1); +INSERT INTO `yx_system_city` VALUES (571, 49866, 2, 49190, '130822000000', '兴隆县', '河北,承德,兴隆', '117.500558', '40.417358', 1); +INSERT INTO `yx_system_city` VALUES (572, 50185, 2, 49190, '130823000000', '平泉县', '河北,承德,平泉', '118.701951', '41.018405', 1); +INSERT INTO `yx_system_city` VALUES (573, 50455, 2, 49190, '130824000000', '滦平县', '河北,承德,滦平', '117.332801', '40.941482', 1); +INSERT INTO `yx_system_city` VALUES (574, 50690, 2, 49190, '130825000000', '隆化县', '河北,承德,隆化', '117.738938', '41.313791', 1); +INSERT INTO `yx_system_city` VALUES (575, 51081, 2, 49190, '130826000000', '丰宁满族自治县', '河北,承德,丰宁', '117.962410', '40.954071', 1); +INSERT INTO `yx_system_city` VALUES (576, 51428, 2, 49190, '130827000000', '宽城满族自治县', '河北,承德,宽城', '118.485313', '40.611391', 1); +INSERT INTO `yx_system_city` VALUES (577, 51657, 2, 49190, '130828000000', '围场满族蒙古族自治县', '河北,承德,围场', '117.760159', '41.938529', 1); +INSERT INTO `yx_system_city` VALUES (578, 52019, 2, 52018, '130901000000', '市辖区', '河北,沧州', '116.838834', '38.304477', 1); +INSERT INTO `yx_system_city` VALUES (579, 52020, 2, 52018, '130902000000', '新华区', '河北,沧州,新华', '116.866284', '38.314416', 1); +INSERT INTO `yx_system_city` VALUES (580, 52086, 2, 52018, '130903000000', '运河区', '河北,沧州,运河', '116.832276', '38.310143', 1); +INSERT INTO `yx_system_city` VALUES (581, 52214, 2, 52018, '130921000000', '沧县', '河北,沧州,沧县', '117.007478', '38.219856', 1); +INSERT INTO `yx_system_city` VALUES (582, 52753, 2, 52018, '130922000000', '青县', '河北,沧州,青县', '116.804306', '38.583021', 1); +INSERT INTO `yx_system_city` VALUES (583, 53128, 2, 52018, '130923000000', '东光县', '河北,沧州,东光', '116.537067', '37.888248', 1); +INSERT INTO `yx_system_city` VALUES (584, 53595, 2, 52018, '130924000000', '海兴县', '河北,沧州,海兴', '117.496606', '38.141582', 1); +INSERT INTO `yx_system_city` VALUES (585, 53810, 2, 52018, '130925000000', '盐山县', '河北,沧州,盐山', '117.230603', '38.058088', 1); +INSERT INTO `yx_system_city` VALUES (586, 54277, 2, 52018, '130926000000', '肃宁县', '河北,沧州,肃宁', '115.829758', '38.422802', 1); +INSERT INTO `yx_system_city` VALUES (587, 54547, 2, 52018, '130927000000', '南皮县', '河北,沧州,南皮', '116.708104', '38.038584', 1); +INSERT INTO `yx_system_city` VALUES (588, 54875, 2, 52018, '130928000000', '吴桥县', '河北,沧州,吴桥', '116.391508', '37.627661', 1); +INSERT INTO `yx_system_city` VALUES (589, 55369, 2, 52018, '130929000000', '献县', '河北,沧州,献县', '116.122802', '38.190144', 1); +INSERT INTO `yx_system_city` VALUES (590, 55902, 2, 52018, '130930000000', '孟村回族自治县', '河北,沧州,孟村', '117.104298', '38.053409', 1); +INSERT INTO `yx_system_city` VALUES (591, 56037, 2, 52018, '130981000000', '泊头市', '河北,沧州,泊头', '116.578368', '38.083437', 1); +INSERT INTO `yx_system_city` VALUES (592, 56764, 2, 52018, '130982000000', '任丘市', '河北,沧州,任丘', '116.082918', '38.683592', 1); +INSERT INTO `yx_system_city` VALUES (593, 57238, 2, 52018, '130983000000', '黄骅市', '河北,沧州,黄骅', '117.330048', '38.371383', 1); +INSERT INTO `yx_system_city` VALUES (594, 57596, 2, 52018, '130984000000', '河间市', '河北,沧州,河间', '116.099518', '38.446624', 1); +INSERT INTO `yx_system_city` VALUES (595, 58248, 2, 58247, '131001000000', '市辖区', '河北,廊坊', '116.683752', '39.538047', 1); +INSERT INTO `yx_system_city` VALUES (596, 58249, 2, 58247, '131002000000', '安次区', '河北,廊坊,安次', '116.694544', '39.502569', 1); +INSERT INTO `yx_system_city` VALUES (597, 58567, 2, 58247, '131003000000', '广阳区', '河北,廊坊,广阳', '116.710690', '39.522786', 1); +INSERT INTO `yx_system_city` VALUES (598, 58789, 2, 58247, '131022000000', '固安县', '河北,廊坊,固安', '116.298657', '39.438214', 1); +INSERT INTO `yx_system_city` VALUES (599, 59228, 2, 58247, '131023000000', '永清县', '河北,廊坊,永清', '116.499028', '39.321794', 1); +INSERT INTO `yx_system_city` VALUES (600, 59639, 2, 58247, '131024000000', '香河县', '河北,廊坊,香河', '117.006093', '39.761424', 1); +INSERT INTO `yx_system_city` VALUES (601, 59963, 2, 58247, '131025000000', '大城县', '河北,廊坊,大城', '116.653794', '38.705449', 1); +INSERT INTO `yx_system_city` VALUES (602, 60378, 2, 58247, '131026000000', '文安县', '河北,廊坊,文安', '116.457858', '38.873281', 1); +INSERT INTO `yx_system_city` VALUES (603, 60784, 2, 58247, '131028000000', '大厂回族自治县', '河北,廊坊,大厂', '116.970154', '39.897785', 1); +INSERT INTO `yx_system_city` VALUES (604, 60904, 2, 58247, '131081000000', '霸州市', '河北,廊坊,霸州', '116.391386', '39.125898', 1); +INSERT INTO `yx_system_city` VALUES (605, 61311, 2, 58247, '131082000000', '三河市', '河北,廊坊,三河', '117.078295', '39.982718', 1); +INSERT INTO `yx_system_city` VALUES (606, 61805, 2, 61804, '131101000000', '市辖区', '河北,衡水', '115.670177', '37.738920', 1); +INSERT INTO `yx_system_city` VALUES (607, 61806, 2, 61804, '131102000000', '桃城区', '河北,衡水,桃城', '115.675422', '37.735369', 1); +INSERT INTO `yx_system_city` VALUES (608, 62086, 2, 61804, '131103000000', '冀州区', '河北,衡水,冀州', '115.670177', '37.738920', 1); +INSERT INTO `yx_system_city` VALUES (609, 62479, 2, 61804, '131121000000', '枣强县', '河北,衡水,枣强', '115.724260', '37.513417', 1); +INSERT INTO `yx_system_city` VALUES (610, 63050, 2, 61804, '131122000000', '武邑县', '河北,衡水,武邑', '115.887655', '37.801658', 1); +INSERT INTO `yx_system_city` VALUES (611, 63584, 2, 61804, '131123000000', '武强县', '河北,衡水,武强', '115.982461', '38.041368', 1); +INSERT INTO `yx_system_city` VALUES (612, 63832, 2, 61804, '131124000000', '饶阳县', '河北,衡水,饶阳', '115.725833', '38.235892', 1); +INSERT INTO `yx_system_city` VALUES (613, 64040, 2, 61804, '131125000000', '安平县', '河北,衡水,安平', '115.519216', '38.234510', 1); +INSERT INTO `yx_system_city` VALUES (614, 64281, 2, 61804, '131126000000', '故城县', '河北,衡水,故城', '115.965874', '37.347410', 1); +INSERT INTO `yx_system_city` VALUES (615, 64833, 2, 61804, '131127000000', '景县', '河北,衡水,景县', '116.270648', '37.692290', 1); +INSERT INTO `yx_system_city` VALUES (616, 65702, 2, 61804, '131128000000', '阜城县', '河北,衡水,阜城', '116.144418', '37.868872', 1); +INSERT INTO `yx_system_city` VALUES (617, 66323, 2, 61804, '131182000000', '深州市', '河北,衡水,深州', '115.559574', '38.001536', 1); +INSERT INTO `yx_system_city` VALUES (618, 66814, 2, 66813, '139001000000', '定州市', '河北,定州', '114.990159', '38.516174', 1); +INSERT INTO `yx_system_city` VALUES (619, 67371, 2, 66813, '139002000000', '辛集市', '河北,辛集', '115.218057', '37.943315', 1); +INSERT INTO `yx_system_city` VALUES (620, 67749, 2, 67748, '140101000000', '市辖区', '山西,太原', '112.548879', '37.870590', 1); +INSERT INTO `yx_system_city` VALUES (621, 67750, 2, 67748, '140105000000', '小店区', '山西,太原,小店', '112.565659', '37.736526', 1); +INSERT INTO `yx_system_city` VALUES (622, 67921, 2, 67748, '140106000000', '迎泽区', '山西,太原,迎泽', '112.563400', '37.863451', 1); +INSERT INTO `yx_system_city` VALUES (623, 68043, 2, 67748, '140107000000', '杏花岭区', '山西,太原,杏花岭', '112.570605', '37.893955', 1); +INSERT INTO `yx_system_city` VALUES (624, 68203, 2, 67748, '140108000000', '尖草坪区', '山西,太原,尖草坪', '112.486691', '37.940387', 1); +INSERT INTO `yx_system_city` VALUES (625, 68368, 2, 67748, '140109000000', '万柏林区', '山西,太原,万柏林', '112.515748', '37.859447', 1); +INSERT INTO `yx_system_city` VALUES (626, 68542, 2, 67748, '140110000000', '晋源区', '山西,太原,晋源', '112.477940', '37.715193', 1); +INSERT INTO `yx_system_city` VALUES (627, 68671, 2, 67748, '140121000000', '清徐县', '山西,太原,清徐', '112.358667', '37.607443', 1); +INSERT INTO `yx_system_city` VALUES (628, 68893, 2, 67748, '140122000000', '阳曲县', '山西,太原,阳曲', '112.672953', '38.058489', 1); +INSERT INTO `yx_system_city` VALUES (629, 69032, 2, 67748, '140123000000', '娄烦县', '山西,太原,娄烦', '111.797083', '38.067932', 1); +INSERT INTO `yx_system_city` VALUES (630, 69190, 2, 67748, '140181000000', '古交市', '山西,太原,古交', '112.175875', '37.907109', 1); +INSERT INTO `yx_system_city` VALUES (631, 69391, 2, 69390, '140201000000', '市辖区', '山西,大同', '113.612440', '40.040295', 1); +INSERT INTO `yx_system_city` VALUES (632, 69392, 2, 69390, '140202000000', '城区', '山西,大同,城区', '113.298027', '40.075667', 1); +INSERT INTO `yx_system_city` VALUES (633, 69546, 2, 69390, '140203000000', '矿区', '山西,大同,矿区', '113.612440', '40.040295', 1); +INSERT INTO `yx_system_city` VALUES (634, 69691, 2, 69390, '140211000000', '南郊区', '山西,大同,南郊', '113.149693', '40.005405', 1); +INSERT INTO `yx_system_city` VALUES (635, 69891, 2, 69390, '140212000000', '新荣区', '山西,大同,新荣', '113.140005', '40.255866', 1); +INSERT INTO `yx_system_city` VALUES (636, 70045, 2, 69390, '140221000000', '阳高县', '山西,大同,阳高', '113.748945', '40.361060', 1); +INSERT INTO `yx_system_city` VALUES (637, 70336, 2, 69390, '140222000000', '天镇县', '山西,大同,天镇', '114.090867', '40.420237', 1); +INSERT INTO `yx_system_city` VALUES (638, 70582, 2, 69390, '140223000000', '广灵县', '山西,大同,广灵', '114.282758', '39.760281', 1); +INSERT INTO `yx_system_city` VALUES (639, 70778, 2, 69390, '140224000000', '灵丘县', '山西,大同,灵丘', '114.234350', '39.442406', 1); +INSERT INTO `yx_system_city` VALUES (640, 71059, 2, 69390, '140225000000', '浑源县', '山西,大同,浑源', '113.699475', '39.693407', 1); +INSERT INTO `yx_system_city` VALUES (641, 71402, 2, 69390, '140226000000', '左云县', '山西,大同,左云', '112.703008', '40.013442', 1); +INSERT INTO `yx_system_city` VALUES (642, 71649, 2, 69390, '140227000000', '大同县', '山西,大同,大同', '113.397170', '40.067276', 1); +INSERT INTO `yx_system_city` VALUES (643, 71851, 2, 71850, '140301000000', '市辖区', '山西,阳泉', '113.580519', '37.856971', 1); +INSERT INTO `yx_system_city` VALUES (644, 71852, 2, 71850, '140302000000', '城区', '山西,阳泉,城区', '113.600670', '37.847437', 1); +INSERT INTO `yx_system_city` VALUES (645, 71905, 2, 71850, '140303000000', '矿区', '山西,阳泉,矿区', '113.580519', '37.856971', 1); +INSERT INTO `yx_system_city` VALUES (646, 71950, 2, 71850, '140311000000', '郊区', '山西,阳泉,郊区', '113.594164', '37.944679', 1); +INSERT INTO `yx_system_city` VALUES (647, 72145, 2, 71850, '140321000000', '平定县', '山西,阳泉,平定', '113.657841', '37.786653', 1); +INSERT INTO `yx_system_city` VALUES (648, 72497, 2, 71850, '140322000000', '盂县', '山西,阳泉,盂县', '113.412330', '38.085619', 1); +INSERT INTO `yx_system_city` VALUES (649, 72976, 2, 72975, '140401000000', '市辖区', '山西,长治', '113.116255', '36.195386', 1); +INSERT INTO `yx_system_city` VALUES (650, 72977, 2, 72975, '140402000000', '城区', '山西,长治,城区', '113.123085', '36.203519', 1); +INSERT INTO `yx_system_city` VALUES (651, 73071, 2, 72975, '140411000000', '郊区', '山西,长治,郊区', '113.101211', '36.218388', 1); +INSERT INTO `yx_system_city` VALUES (652, 73222, 2, 72975, '140421000000', '长治县', '山西,长治,长治', '113.051407', '36.052858', 1); +INSERT INTO `yx_system_city` VALUES (653, 73495, 2, 72975, '140423000000', '襄垣县', '山西,长治,襄垣', '113.051491', '36.535817', 1); +INSERT INTO `yx_system_city` VALUES (654, 73840, 2, 72975, '140424000000', '屯留县', '山西,长治,屯留', '112.892151', '36.315929', 1); +INSERT INTO `yx_system_city` VALUES (655, 74151, 2, 72975, '140425000000', '平顺县', '山西,长治,平顺', '113.435961', '36.200179', 1); +INSERT INTO `yx_system_city` VALUES (656, 74429, 2, 72975, '140426000000', '黎城县', '山西,长治,黎城', '113.387155', '36.502328', 1); +INSERT INTO `yx_system_city` VALUES (657, 74694, 2, 72975, '140427000000', '壶关县', '山西,长治,壶关', '113.207049', '36.115449', 1); +INSERT INTO `yx_system_city` VALUES (658, 75101, 2, 72975, '140428000000', '长子县', '山西,长治,长子', '112.877900', '36.122334', 1); +INSERT INTO `yx_system_city` VALUES (659, 75515, 2, 72975, '140429000000', '武乡县', '山西,长治,武乡', '112.864562', '36.837625', 1); +INSERT INTO `yx_system_city` VALUES (660, 75911, 2, 72975, '140430000000', '沁县', '山西,长治,沁县', '112.699226', '36.756064', 1); +INSERT INTO `yx_system_city` VALUES (661, 76237, 2, 72975, '140431000000', '沁源县', '山西,长治,沁源', '112.337446', '36.500200', 1); +INSERT INTO `yx_system_city` VALUES (662, 76512, 2, 72975, '140481000000', '潞城市', '山西,长治,潞城', '113.228852', '36.334104', 1); +INSERT INTO `yx_system_city` VALUES (663, 76727, 2, 76726, '140501000000', '市辖区', '山西,晋城', '112.851831', '35.490701', 1); +INSERT INTO `yx_system_city` VALUES (664, 76728, 2, 76726, '140502000000', '城区', '山西,晋城,城区', '112.853555', '35.501572', 1); +INSERT INTO `yx_system_city` VALUES (665, 76874, 2, 76726, '140521000000', '沁水县', '山西,晋城,沁水', '112.186739', '35.690141', 1); +INSERT INTO `yx_system_city` VALUES (666, 77140, 2, 76726, '140522000000', '阳城县', '山西,晋城,阳城', '112.414738', '35.486029', 1); +INSERT INTO `yx_system_city` VALUES (667, 77632, 2, 76726, '140524000000', '陵川县', '山西,晋城,陵川', '113.280688', '35.775685', 1); +INSERT INTO `yx_system_city` VALUES (668, 78024, 2, 76726, '140525000000', '泽州县', '山西,晋城,泽州', '112.899137', '35.617221', 1); +INSERT INTO `yx_system_city` VALUES (669, 78678, 2, 76726, '140581000000', '高平市', '山西,晋城,高平', '112.923920', '35.797997', 1); +INSERT INTO `yx_system_city` VALUES (670, 79164, 2, 79163, '140601000000', '市辖区', '山西,朔州', '112.432825', '39.331595', 1); +INSERT INTO `yx_system_city` VALUES (671, 79165, 2, 79163, '140602000000', '朔城区', '山西,朔州,朔城', '112.432250', '39.318940', 1); +INSERT INTO `yx_system_city` VALUES (672, 79533, 2, 79163, '140603000000', '平鲁区', '山西,朔州,平鲁', '112.288331', '39.512155', 1); +INSERT INTO `yx_system_city` VALUES (673, 79843, 2, 79163, '140621000000', '山阴县', '山西,朔州,山阴', '112.816600', '39.526227', 1); +INSERT INTO `yx_system_city` VALUES (674, 80134, 2, 79163, '140622000000', '应县', '山西,朔州,应县', '113.191099', '39.554247', 1); +INSERT INTO `yx_system_city` VALUES (675, 80454, 2, 79163, '140623000000', '右玉县', '山西,朔州,右玉', '112.466989', '39.989064', 1); +INSERT INTO `yx_system_city` VALUES (676, 80799, 2, 79163, '140624000000', '怀仁县', '山西,朔州,怀仁', '113.099958', '39.827916', 1); +INSERT INTO `yx_system_city` VALUES (677, 81001, 2, 81000, '140701000000', '市辖区', '山西,晋中', '112.752694', '37.687024', 1); +INSERT INTO `yx_system_city` VALUES (678, 81002, 2, 81000, '140702000000', '榆次区', '山西,晋中,榆次', '112.708241', '37.697792', 1); +INSERT INTO `yx_system_city` VALUES (679, 81361, 2, 81000, '140721000000', '榆社县', '山西,晋中,榆社', '112.975287', '37.070788', 1); +INSERT INTO `yx_system_city` VALUES (680, 81649, 2, 81000, '140722000000', '左权县', '山西,晋中,左权', '113.379372', '37.082681', 1); +INSERT INTO `yx_system_city` VALUES (681, 81872, 2, 81000, '140723000000', '和顺县', '山西,晋中,和顺', '113.570438', '37.329664', 1); +INSERT INTO `yx_system_city` VALUES (682, 82183, 2, 81000, '140724000000', '昔阳县', '山西,晋中,昔阳', '113.706875', '37.611210', 1); +INSERT INTO `yx_system_city` VALUES (683, 82535, 2, 81000, '140725000000', '寿阳县', '山西,晋中,寿阳', '113.176434', '37.895325', 1); +INSERT INTO `yx_system_city` VALUES (684, 82765, 2, 81000, '140726000000', '太谷县', '山西,晋中,太谷', '112.551357', '37.421308', 1); +INSERT INTO `yx_system_city` VALUES (685, 82986, 2, 81000, '140727000000', '祁县', '山西,晋中,祁县', '112.335297', '37.358317', 1); +INSERT INTO `yx_system_city` VALUES (686, 83165, 2, 81000, '140728000000', '平遥县', '山西,晋中,平遥', '112.176273', '37.189559', 1); +INSERT INTO `yx_system_city` VALUES (687, 83472, 2, 81000, '140729000000', '灵石县', '山西,晋中,灵石', '111.778685', '36.847860', 1); +INSERT INTO `yx_system_city` VALUES (688, 83810, 2, 81000, '140781000000', '介休市', '山西,晋中,介休', '111.916712', '37.026945', 1); +INSERT INTO `yx_system_city` VALUES (689, 84093, 2, 84092, '140801000000', '市辖区', '山西,运城', '111.007528', '35.026412', 1); +INSERT INTO `yx_system_city` VALUES (690, 84094, 2, 84092, '140802000000', '盐湖区', '山西,运城,盐湖', '111.007528', '35.026412', 1); +INSERT INTO `yx_system_city` VALUES (691, 84483, 2, 84092, '140821000000', '临猗县', '山西,运城,临猗', '110.774547', '35.144277', 1); +INSERT INTO `yx_system_city` VALUES (692, 84893, 2, 84092, '140822000000', '万荣县', '山西,运城,万荣', '110.838024', '35.415254', 1); +INSERT INTO `yx_system_city` VALUES (693, 85194, 2, 84092, '140823000000', '闻喜县', '山西,运城,闻喜', '111.224720', '35.356644', 1); +INSERT INTO `yx_system_city` VALUES (694, 85569, 2, 84092, '140824000000', '稷山县', '山西,运城,稷山', '110.983333', '35.604025', 1); +INSERT INTO `yx_system_city` VALUES (695, 85780, 2, 84092, '140825000000', '新绛县', '山西,运城,新绛', '111.224778', '35.616288', 1); +INSERT INTO `yx_system_city` VALUES (696, 86023, 2, 84092, '140826000000', '绛县', '山西,运城,绛县', '111.568236', '35.491190', 1); +INSERT INTO `yx_system_city` VALUES (697, 86238, 2, 84092, '140827000000', '垣曲县', '山西,运城,垣曲', '111.669917', '35.297620', 1); +INSERT INTO `yx_system_city` VALUES (698, 86448, 2, 84092, '140828000000', '夏县', '山西,运城,夏县', '111.220456', '35.141363', 1); +INSERT INTO `yx_system_city` VALUES (699, 86706, 2, 84092, '140829000000', '平陆县', '山西,运城,平陆', '111.194133', '34.829260', 1); +INSERT INTO `yx_system_city` VALUES (700, 86949, 2, 84092, '140830000000', '芮城县', '山西,运城,芮城', '110.694369', '34.693580', 1); +INSERT INTO `yx_system_city` VALUES (701, 87129, 2, 84092, '140881000000', '永济市', '山西,运城,永济', '110.447549', '34.867050', 1); +INSERT INTO `yx_system_city` VALUES (702, 87434, 2, 84092, '140882000000', '河津市', '山西,运城,河津', '110.712063', '35.596383', 1); +INSERT INTO `yx_system_city` VALUES (703, 87614, 2, 87613, '140901000000', '市辖区', '山西,忻州', '112.734174', '38.416663', 1); +INSERT INTO `yx_system_city` VALUES (704, 87615, 2, 87613, '140902000000', '忻府区', '山西,忻州,忻府', '112.746046', '38.404243', 1); +INSERT INTO `yx_system_city` VALUES (705, 88061, 2, 87613, '140921000000', '定襄县', '山西,忻州,定襄', '112.957215', '38.473548', 1); +INSERT INTO `yx_system_city` VALUES (706, 88227, 2, 87613, '140922000000', '五台县', '山西,忻州,五台', '113.255309', '38.728315', 1); +INSERT INTO `yx_system_city` VALUES (707, 88754, 2, 87613, '140923000000', '代县', '山西,忻州,代县', '112.960282', '39.066917', 1); +INSERT INTO `yx_system_city` VALUES (708, 89144, 2, 87613, '140924000000', '繁峙县', '山西,忻州,繁峙', '113.265564', '39.188811', 1); +INSERT INTO `yx_system_city` VALUES (709, 89570, 2, 87613, '140925000000', '宁武县', '山西,忻州,宁武', '112.304722', '39.001524', 1); +INSERT INTO `yx_system_city` VALUES (710, 90066, 2, 87613, '140926000000', '静乐县', '山西,忻州,静乐', '111.939440', '38.359036', 1); +INSERT INTO `yx_system_city` VALUES (711, 90462, 2, 87613, '140927000000', '神池县', '山西,忻州,神池', '112.211297', '39.090553', 1); +INSERT INTO `yx_system_city` VALUES (712, 90715, 2, 87613, '140928000000', '五寨县', '山西,忻州,五寨', '111.846905', '38.910726', 1); +INSERT INTO `yx_system_city` VALUES (713, 90978, 2, 87613, '140929000000', '岢岚县', '山西,忻州,岢岚', '111.572850', '38.704180', 1); +INSERT INTO `yx_system_city` VALUES (714, 91193, 2, 87613, '140930000000', '河曲县', '山西,忻州,河曲', '111.138472', '39.384482', 1); +INSERT INTO `yx_system_city` VALUES (715, 91548, 2, 87613, '140931000000', '保德县', '山西,忻州,保德', '111.086564', '39.022488', 1); +INSERT INTO `yx_system_city` VALUES (716, 91912, 2, 87613, '140932000000', '偏关县', '山西,忻州,偏关', '111.508831', '39.436306', 1); +INSERT INTO `yx_system_city` VALUES (717, 92172, 2, 87613, '140981000000', '原平市', '山西,忻州,原平', '112.711059', '38.731402', 1); +INSERT INTO `yx_system_city` VALUES (718, 92739, 2, 92738, '141001000000', '市辖区', '山西,临汾', '111.518976', '36.088005', 1); +INSERT INTO `yx_system_city` VALUES (719, 92740, 2, 92738, '141002000000', '尧都区', '山西,临汾,尧都', '111.579554', '36.078841', 1); +INSERT INTO `yx_system_city` VALUES (720, 93208, 2, 92738, '141021000000', '曲沃县', '山西,临汾,曲沃', '111.475861', '35.641087', 1); +INSERT INTO `yx_system_city` VALUES (721, 93375, 2, 92738, '141022000000', '翼城县', '山西,临汾,翼城', '111.718951', '35.738576', 1); +INSERT INTO `yx_system_city` VALUES (722, 93604, 2, 92738, '141023000000', '襄汾县', '山西,临汾,襄汾', '111.441725', '35.876293', 1); +INSERT INTO `yx_system_city` VALUES (723, 93972, 2, 92738, '141024000000', '洪洞县', '山西,临汾,洪洞', '111.674966', '36.253748', 1); +INSERT INTO `yx_system_city` VALUES (724, 94457, 2, 92738, '141025000000', '古县', '山西,临汾,古县', '111.920466', '36.266914', 1); +INSERT INTO `yx_system_city` VALUES (725, 94580, 2, 92738, '141026000000', '安泽县', '山西,临汾,安泽', '112.250144', '36.147787', 1); +INSERT INTO `yx_system_city` VALUES (726, 94696, 2, 92738, '141027000000', '浮山县', '山西,临汾,浮山', '111.848883', '35.968124', 1); +INSERT INTO `yx_system_city` VALUES (727, 94893, 2, 92738, '141028000000', '吉县', '山西,临汾,吉县', '110.681763', '36.098188', 1); +INSERT INTO `yx_system_city` VALUES (728, 94981, 2, 92738, '141029000000', '乡宁县', '山西,临汾,乡宁', '110.847021', '35.970389', 1); +INSERT INTO `yx_system_city` VALUES (729, 95181, 2, 92738, '141030000000', '大宁县', '山西,临汾,大宁', '110.752903', '36.465133', 1); +INSERT INTO `yx_system_city` VALUES (730, 95272, 2, 92738, '141031000000', '隰县', '山西,临汾,隰县', '110.940638', '36.693331', 1); +INSERT INTO `yx_system_city` VALUES (731, 95381, 2, 92738, '141032000000', '永和县', '山西,临汾,永和', '110.632007', '36.759507', 1); +INSERT INTO `yx_system_city` VALUES (732, 95472, 2, 92738, '141033000000', '蒲县', '山西,临汾,蒲县', '111.096439', '36.411827', 1); +INSERT INTO `yx_system_city` VALUES (733, 95579, 2, 92738, '141034000000', '汾西县', '山西,临汾,汾西', '111.563951', '36.652854', 1); +INSERT INTO `yx_system_city` VALUES (734, 95715, 2, 92738, '141081000000', '侯马市', '山西,临汾,侯马', '111.372002', '35.619105', 1); +INSERT INTO `yx_system_city` VALUES (735, 95828, 2, 92738, '141082000000', '霍州市', '山西,临汾,霍州', '111.755398', '36.568931', 1); +INSERT INTO `yx_system_city` VALUES (736, 96065, 2, 96064, '141101000000', '市辖区', '山西,吕梁', '111.144319', '37.518314', 1); +INSERT INTO `yx_system_city` VALUES (737, 96066, 2, 96064, '141102000000', '离石区', '山西,吕梁,离石', '111.150733', '37.517641', 1); +INSERT INTO `yx_system_city` VALUES (738, 96332, 2, 96064, '141121000000', '文水县', '山西,吕梁,文水', '112.028866', '37.438102', 1); +INSERT INTO `yx_system_city` VALUES (739, 96548, 2, 96064, '141122000000', '交城县', '山西,吕梁,交城', '112.155841', '37.551970', 1); +INSERT INTO `yx_system_city` VALUES (740, 96711, 2, 96064, '141123000000', '兴县', '山西,吕梁,兴县', '111.127668', '38.462390', 1); +INSERT INTO `yx_system_city` VALUES (741, 97113, 2, 96064, '141124000000', '临县', '山西,吕梁,临县', '110.992094', '37.950758', 1); +INSERT INTO `yx_system_city` VALUES (742, 97779, 2, 96064, '141125000000', '柳林县', '山西,吕梁,柳林', '110.889071', '37.429832', 1); +INSERT INTO `yx_system_city` VALUES (743, 98056, 2, 96064, '141126000000', '石楼县', '山西,吕梁,石楼', '110.834561', '36.997412', 1); +INSERT INTO `yx_system_city` VALUES (744, 98201, 2, 96064, '141127000000', '岚县', '山西,吕梁,岚县', '111.671917', '38.279299', 1); +INSERT INTO `yx_system_city` VALUES (745, 98383, 2, 96064, '141128000000', '方山县', '山西,吕梁,方山', '111.244098', '37.894631', 1); +INSERT INTO `yx_system_city` VALUES (746, 98562, 2, 96064, '141129000000', '中阳县', '山西,吕梁,中阳', '111.179657', '37.357058', 1); +INSERT INTO `yx_system_city` VALUES (747, 98670, 2, 96064, '141130000000', '交口县', '山西,吕梁,交口', '111.181151', '36.982186', 1); +INSERT INTO `yx_system_city` VALUES (748, 98774, 2, 96064, '141181000000', '孝义市', '山西,吕梁,孝义', '111.778818', '37.146294', 1); +INSERT INTO `yx_system_city` VALUES (749, 99219, 2, 96064, '141182000000', '汾阳市', '山西,吕梁,汾阳', '111.769894', '37.261564', 1); +INSERT INTO `yx_system_city` VALUES (750, 99539, 2, 99538, '150101000000', '市辖区', '内蒙古,呼和浩特', '111.749180', '40.842585', 1); +INSERT INTO `yx_system_city` VALUES (751, 99540, 2, 99538, '150102000000', '新城区', '内蒙古,呼和浩特,新城', '111.665544', '40.858289', 1); +INSERT INTO `yx_system_city` VALUES (752, 99624, 2, 99538, '150103000000', '回民区', '内蒙古,呼和浩特,回民', '111.623692', '40.808608', 1); +INSERT INTO `yx_system_city` VALUES (753, 99696, 2, 99538, '150104000000', '玉泉区', '内蒙古,呼和浩特,玉泉', '111.673881', '40.753655', 1); +INSERT INTO `yx_system_city` VALUES (754, 99807, 2, 99538, '150105000000', '赛罕区', '内蒙古,呼和浩特,赛罕', '111.701857', '40.792097', 1); +INSERT INTO `yx_system_city` VALUES (755, 100011, 2, 99538, '150121000000', '土默特左旗', '内蒙古,呼和浩特,土默特左旗', '111.163902', '40.729573', 1); +INSERT INTO `yx_system_city` VALUES (756, 100358, 2, 99538, '150122000000', '托克托县', '内蒙古,呼和浩特,托克托', '111.194313', '40.277431', 1); +INSERT INTO `yx_system_city` VALUES (757, 100502, 2, 99538, '150123000000', '和林格尔县', '内蒙古,呼和浩特,和林格尔', '111.821843', '40.378787', 1); +INSERT INTO `yx_system_city` VALUES (758, 100672, 2, 99538, '150124000000', '清水河县', '内蒙古,呼和浩特,清水河', '111.647609', '39.921095', 1); +INSERT INTO `yx_system_city` VALUES (759, 100790, 2, 99538, '150125000000', '武川县', '内蒙古,呼和浩特,武川', '111.451303', '41.096471', 1); +INSERT INTO `yx_system_city` VALUES (760, 100905, 2, 100904, '150201000000', '市辖区', '内蒙古,包头', '109.840347', '40.657449', 1); +INSERT INTO `yx_system_city` VALUES (761, 100906, 2, 100904, '150202000000', '东河区', '内蒙古,包头,东河', '110.044142', '40.575948', 1); +INSERT INTO `yx_system_city` VALUES (762, 101033, 2, 100904, '150203000000', '昆都仑区', '内蒙古,包头,昆都仑', '109.838178', '40.642236', 1); +INSERT INTO `yx_system_city` VALUES (763, 101148, 2, 100904, '150204000000', '青山区', '内蒙古,包头,青山', '109.901572', '40.643246', 1); +INSERT INTO `yx_system_city` VALUES (764, 101235, 2, 100904, '150205000000', '石拐区', '内蒙古,包头,石拐', '110.060686', '40.676645', 1); +INSERT INTO `yx_system_city` VALUES (765, 101268, 2, 100904, '150206000000', '白云鄂博矿区', '内蒙古,包头,白云鄂博', '109.840347', '40.657449', 1); +INSERT INTO `yx_system_city` VALUES (766, 101275, 2, 100904, '150207000000', '九原区', '内蒙古,包头,九原', '109.968122', '40.600581', 1); +INSERT INTO `yx_system_city` VALUES (767, 101359, 2, 100904, '150221000000', '土默特右旗', '内蒙古,包头,土默特右旗', '110.524263', '40.569426', 1); +INSERT INTO `yx_system_city` VALUES (768, 101583, 2, 100904, '150222000000', '固阳县', '内蒙古,包头,固阳', '110.060514', '41.034106', 1); +INSERT INTO `yx_system_city` VALUES (769, 101673, 2, 100904, '150223000000', '达尔罕茂明安联合旗', '内蒙古,包头,达尔罕茂明安联合旗', '110.432626', '41.698992', 1); +INSERT INTO `yx_system_city` VALUES (770, 101773, 2, 101772, '150301000000', '市辖区', '内蒙古,乌海', '106.794249', '39.655388', 1); +INSERT INTO `yx_system_city` VALUES (771, 101774, 2, 101772, '150302000000', '海勃湾区', '内蒙古,乌海,海勃湾', '106.822779', '39.691156', 1); +INSERT INTO `yx_system_city` VALUES (772, 101824, 2, 101772, '150303000000', '海南区', '内蒙古,乌海,海南', '106.891424', '39.441364', 1); +INSERT INTO `yx_system_city` VALUES (773, 101850, 2, 101772, '150304000000', '乌达区', '内蒙古,乌海,乌达', '106.726099', '39.505925', 1); +INSERT INTO `yx_system_city` VALUES (774, 101885, 2, 101884, '150401000000', '市辖区', '内蒙古,赤峰', '118.886856', '42.257817', 1); +INSERT INTO `yx_system_city` VALUES (775, 101886, 2, 101884, '150402000000', '红山区', '内蒙古,赤峰,红山', '118.955528', '42.295818', 1); +INSERT INTO `yx_system_city` VALUES (776, 101986, 2, 101884, '150403000000', '元宝山区', '内蒙古,赤峰,元宝山', '119.288611', '42.038902', 1); +INSERT INTO `yx_system_city` VALUES (777, 102110, 2, 101884, '150404000000', '松山区', '内蒙古,赤峰,松山', '118.931962', '42.286873', 1); +INSERT INTO `yx_system_city` VALUES (778, 102434, 2, 101884, '150421000000', '阿鲁科尔沁旗', '内蒙古,赤峰,阿鲁科尔沁旗', '120.065700', '43.872299', 1); +INSERT INTO `yx_system_city` VALUES (779, 102714, 2, 101884, '150422000000', '巴林左旗', '内蒙古,赤峰,巴林左旗', '119.379490', '43.971126', 1); +INSERT INTO `yx_system_city` VALUES (780, 102913, 2, 101884, '150423000000', '巴林右旗', '内蒙古,赤峰,巴林右旗', '118.665180', '43.534414', 1); +INSERT INTO `yx_system_city` VALUES (781, 103097, 2, 101884, '150424000000', '林西县', '内蒙古,赤峰,林西', '118.055450', '43.618120', 1); +INSERT INTO `yx_system_city` VALUES (782, 103225, 2, 101884, '150425000000', '克什克腾旗', '内蒙古,赤峰,克什克腾旗', '117.545798', '43.264989', 1); +INSERT INTO `yx_system_city` VALUES (783, 103385, 2, 101884, '150426000000', '翁牛特旗', '内蒙古,赤峰,翁牛特旗', '119.006580', '42.936188', 1); +INSERT INTO `yx_system_city` VALUES (784, 103647, 2, 101884, '150428000000', '喀喇沁旗', '内蒙古,赤峰,喀喇沁旗', '118.701938', '41.927364', 1); +INSERT INTO `yx_system_city` VALUES (785, 103835, 2, 101884, '150429000000', '宁城县', '内蒙古,赤峰,宁城', '119.318876', '41.601375', 1); +INSERT INTO `yx_system_city` VALUES (786, 104189, 2, 101884, '150430000000', '敖汉旗', '内蒙古,赤峰,敖汉旗', '119.921604', '42.290782', 1); +INSERT INTO `yx_system_city` VALUES (787, 104458, 2, 104457, '150501000000', '市辖区', '内蒙古,通辽', '122.243444', '43.652890', 1); +INSERT INTO `yx_system_city` VALUES (788, 104459, 2, 104457, '150502000000', '科尔沁区', '内蒙古,通辽,科尔沁', '122.255675', '43.623077', 1); +INSERT INTO `yx_system_city` VALUES (789, 104954, 2, 104457, '150521000000', '科尔沁左翼中旗', '内蒙古,通辽,科尔沁左翼中旗', '123.312265', '44.126626', 1); +INSERT INTO `yx_system_city` VALUES (790, 105531, 2, 104457, '150522000000', '科尔沁左翼后旗', '内蒙古,通辽,科尔沁左翼后旗', '122.356749', '42.935159', 1); +INSERT INTO `yx_system_city` VALUES (791, 105865, 2, 104457, '150523000000', '开鲁县', '内蒙古,通辽,开鲁', '121.319309', '43.601244', 1); +INSERT INTO `yx_system_city` VALUES (792, 106150, 2, 104457, '150524000000', '库伦旗', '内蒙古,通辽,库伦旗', '121.810701', '42.735657', 1); +INSERT INTO `yx_system_city` VALUES (793, 106356, 2, 104457, '150525000000', '奈曼旗', '内蒙古,通辽,奈曼旗', '120.658283', '42.867226', 1); +INSERT INTO `yx_system_city` VALUES (794, 106746, 2, 104457, '150526000000', '扎鲁特旗', '内蒙古,通辽,扎鲁特旗', '120.911676', '44.556389', 1); +INSERT INTO `yx_system_city` VALUES (795, 107028, 2, 104457, '150581000000', '霍林郭勒市', '内蒙古,通辽,霍林郭勒', '119.663534', '45.531726', 1); +INSERT INTO `yx_system_city` VALUES (796, 107066, 2, 107065, '150601000000', '市辖区', '内蒙古,鄂尔多斯', '109.781327', '39.608266', 1); +INSERT INTO `yx_system_city` VALUES (797, 107067, 2, 107065, '150602000000', '东胜区', '内蒙古,鄂尔多斯,东胜', '109.963339', '39.822507', 1); +INSERT INTO `yx_system_city` VALUES (798, 107193, 2, 107065, '150603000000', '康巴什区', '内蒙古,鄂尔多斯,康巴什', '109.999325', '39.809941', 1); +INSERT INTO `yx_system_city` VALUES (799, 107213, 2, 107065, '150621000000', '达拉特旗', '内蒙古,鄂尔多斯,达拉特旗', '110.033833', '40.412438', 1); +INSERT INTO `yx_system_city` VALUES (800, 107388, 2, 107065, '150622000000', '准格尔旗', '内蒙古,鄂尔多斯,准格尔旗', '111.240171', '39.864362', 1); +INSERT INTO `yx_system_city` VALUES (801, 107593, 2, 107065, '150623000000', '鄂托克前旗', '内蒙古,鄂尔多斯,鄂托克前旗', '107.477515', '38.182362', 1); +INSERT INTO `yx_system_city` VALUES (802, 107684, 2, 107065, '150624000000', '鄂托克旗', '内蒙古,鄂尔多斯,鄂托克旗', '107.976161', '39.089650', 1); +INSERT INTO `yx_system_city` VALUES (803, 107792, 2, 107065, '150625000000', '杭锦旗', '内蒙古,鄂尔多斯,杭锦旗', '108.736208', '39.833309', 1); +INSERT INTO `yx_system_city` VALUES (804, 107892, 2, 107065, '150626000000', '乌审旗', '内蒙古,鄂尔多斯,乌审旗', '108.817607', '38.604136', 1); +INSERT INTO `yx_system_city` VALUES (805, 107982, 2, 107065, '150627000000', '伊金霍洛旗', '内蒙古,鄂尔多斯,伊金霍洛旗', '109.747740', '39.564660', 1); +INSERT INTO `yx_system_city` VALUES (806, 108167, 2, 108166, '150701000000', '市辖区', '内蒙古,呼伦贝尔', '119.765744', '49.211574', 1); +INSERT INTO `yx_system_city` VALUES (807, 108168, 2, 108166, '150702000000', '海拉尔区', '内蒙古,呼伦贝尔,海拉尔', '119.736279', '49.212189', 1); +INSERT INTO `yx_system_city` VALUES (808, 108232, 2, 108166, '150703000000', '扎赉诺尔区', '内蒙古,呼伦贝尔,扎赉诺尔', '117.670248', '49.510375', 1); +INSERT INTO `yx_system_city` VALUES (809, 108260, 2, 108166, '150721000000', '阿荣旗', '内蒙古,呼伦贝尔,阿荣旗', '123.459050', '48.126585', 1); +INSERT INTO `yx_system_city` VALUES (810, 108483, 2, 108166, '150722000000', '莫力达瓦达斡尔族自治旗', '内蒙古,呼伦贝尔,莫力达瓦', '123.810423', '48.852112', 1); +INSERT INTO `yx_system_city` VALUES (811, 108785, 2, 108166, '150723000000', '鄂伦春自治旗', '内蒙古,呼伦贝尔,鄂伦春自治旗', '123.726201', '50.591842', 1); +INSERT INTO `yx_system_city` VALUES (812, 109030, 2, 108166, '150724000000', '鄂温克族自治旗', '内蒙古,呼伦贝尔,鄂温克族自治旗', '119.755213', '49.146588', 1); +INSERT INTO `yx_system_city` VALUES (813, 109113, 2, 108166, '150725000000', '陈巴尔虎旗', '内蒙古,呼伦贝尔,陈巴尔虎旗', '119.424026', '49.328916', 1); +INSERT INTO `yx_system_city` VALUES (814, 109205, 2, 108166, '150726000000', '新巴尔虎左旗', '内蒙古,呼伦贝尔,新巴尔虎左旗', '118.269820', '48.218241', 1); +INSERT INTO `yx_system_city` VALUES (815, 109281, 2, 108166, '150727000000', '新巴尔虎右旗', '内蒙古,呼伦贝尔,新巴尔虎右旗', '116.823690', '48.672101', 1); +INSERT INTO `yx_system_city` VALUES (816, 109355, 2, 108166, '150781000000', '满洲里市', '内蒙古,呼伦贝尔,满洲里', '117.378530', '49.597841', 1); +INSERT INTO `yx_system_city` VALUES (817, 109393, 2, 108166, '150782000000', '牙克石市', '内蒙古,呼伦贝尔,牙克石', '120.711770', '49.285568', 1); +INSERT INTO `yx_system_city` VALUES (818, 109490, 2, 108166, '150783000000', '扎兰屯市', '内蒙古,呼伦贝尔,扎兰屯', '122.737467', '48.013733', 1); +INSERT INTO `yx_system_city` VALUES (819, 109738, 2, 108166, '150784000000', '额尔古纳市', '内蒙古,呼伦贝尔,额尔古纳', '120.180506', '50.243102', 1); +INSERT INTO `yx_system_city` VALUES (820, 109813, 2, 108166, '150785000000', '根河市', '内蒙古,呼伦贝尔,根河', '121.520388', '50.780345', 1); +INSERT INTO `yx_system_city` VALUES (821, 109848, 2, 109847, '150801000000', '市辖区', '内蒙古,巴彦淖尔', '107.387657', '40.743213', 1); +INSERT INTO `yx_system_city` VALUES (822, 109849, 2, 109847, '150802000000', '临河区', '内蒙古,巴彦淖尔,临河', '107.363919', '40.751187', 1); +INSERT INTO `yx_system_city` VALUES (823, 110095, 2, 109847, '150821000000', '五原县', '内蒙古,巴彦淖尔,五原', '108.267562', '41.088422', 1); +INSERT INTO `yx_system_city` VALUES (824, 110255, 2, 109847, '150822000000', '磴口县', '内蒙古,巴彦淖尔,磴口', '107.008248', '40.330524', 1); +INSERT INTO `yx_system_city` VALUES (825, 110372, 2, 109847, '150823000000', '乌拉特前旗', '内蒙古,巴彦淖尔,乌拉特前旗', '108.652119', '40.737030', 1); +INSERT INTO `yx_system_city` VALUES (826, 110557, 2, 109847, '150824000000', '乌拉特中旗', '内蒙古,巴彦淖尔,乌拉特中旗', '108.513645', '41.587732', 1); +INSERT INTO `yx_system_city` VALUES (827, 110676, 2, 109847, '150825000000', '乌拉特后旗', '内蒙古,巴彦淖尔,乌拉特后旗', '107.074621', '41.084283', 1); +INSERT INTO `yx_system_city` VALUES (828, 110743, 2, 109847, '150826000000', '杭锦后旗', '内蒙古,巴彦淖尔,杭锦后旗', '107.150909', '40.885896', 1); +INSERT INTO `yx_system_city` VALUES (829, 110890, 2, 110889, '150901000000', '市辖区', '内蒙古,乌兰察布', '113.132585', '40.994785', 1); +INSERT INTO `yx_system_city` VALUES (830, 110891, 2, 110889, '150902000000', '集宁区', '内蒙古,乌兰察布,集宁', '113.123779', '40.990689', 1); +INSERT INTO `yx_system_city` VALUES (831, 110998, 2, 110889, '150921000000', '卓资县', '内蒙古,乌兰察布,卓资', '112.577528', '40.894692', 1); +INSERT INTO `yx_system_city` VALUES (832, 111127, 2, 110889, '150922000000', '化德县', '内蒙古,乌兰察布,化德', '114.010438', '41.904560', 1); +INSERT INTO `yx_system_city` VALUES (833, 111237, 2, 110889, '150923000000', '商都县', '内蒙古,乌兰察布,商都', '113.577816', '41.562113', 1); +INSERT INTO `yx_system_city` VALUES (834, 111481, 2, 110889, '150924000000', '兴和县', '内蒙古,乌兰察布,兴和', '113.834173', '40.872301', 1); +INSERT INTO `yx_system_city` VALUES (835, 111666, 2, 110889, '150925000000', '凉城县', '内蒙古,乌兰察布,凉城', '112.503971', '40.531555', 1); +INSERT INTO `yx_system_city` VALUES (836, 111824, 2, 110889, '150926000000', '察哈尔右翼前旗', '内蒙古,乌兰察布,察哈尔右翼前旗', '113.214733', '40.785631', 1); +INSERT INTO `yx_system_city` VALUES (837, 111969, 2, 110889, '150927000000', '察哈尔右翼中旗', '内蒙古,乌兰察布,察哈尔右翼中旗', '112.635577', '41.277462', 1); +INSERT INTO `yx_system_city` VALUES (838, 112164, 2, 110889, '150928000000', '察哈尔右翼后旗', '内蒙古,乌兰察布,察哈尔右翼后旗', '113.191035', '41.436069', 1); +INSERT INTO `yx_system_city` VALUES (839, 112277, 2, 110889, '150929000000', '四子王旗', '内蒙古,乌兰察布,四子王旗', '111.706618', '41.533462', 1); +INSERT INTO `yx_system_city` VALUES (840, 112427, 2, 110889, '150981000000', '丰镇市', '内蒙古,乌兰察布,丰镇', '113.109892', '40.436983', 1); +INSERT INTO `yx_system_city` VALUES (841, 112553, 2, 112552, '152201000000', '乌兰浩特市', '内蒙古,兴安,乌兰浩特', '122.093123', '46.072732', 1); +INSERT INTO `yx_system_city` VALUES (842, 112694, 2, 112552, '152202000000', '阿尔山市', '内蒙古,兴安,阿尔山', '119.943575', '47.177440', 1); +INSERT INTO `yx_system_city` VALUES (843, 112734, 2, 112552, '152221000000', '科尔沁右翼前旗', '内蒙古,兴安,科尔沁右翼前旗', '121.952550', '46.079810', 1); +INSERT INTO `yx_system_city` VALUES (844, 113051, 2, 112552, '152222000000', '科尔沁右翼中旗', '内蒙古,兴安,科尔沁右翼中旗', '121.476530', '45.060837', 1); +INSERT INTO `yx_system_city` VALUES (845, 113294, 2, 112552, '152223000000', '扎赉特旗', '内蒙古,兴安,扎赉特旗', '122.899656', '46.723237', 1); +INSERT INTO `yx_system_city` VALUES (846, 113554, 2, 112552, '152224000000', '突泉县', '内蒙古,兴安,突泉', '121.593799', '45.381930', 1); +INSERT INTO `yx_system_city` VALUES (847, 113778, 2, 113777, '152501000000', '二连浩特市', '内蒙古,锡林郭勒,二连浩特', '111.977943', '43.653170', 1); +INSERT INTO `yx_system_city` VALUES (848, 113796, 2, 113777, '152502000000', '锡林浩特市', '内蒙古,锡林郭勒,锡林浩特', '116.086032', '43.933411', 1); +INSERT INTO `yx_system_city` VALUES (849, 113912, 2, 113777, '152522000000', '阿巴嘎旗', '内蒙古,锡林郭勒,阿巴嘎旗', '114.950248', '44.022995', 1); +INSERT INTO `yx_system_city` VALUES (850, 113999, 2, 113777, '152523000000', '苏尼特左旗', '内蒙古,锡林郭勒,苏尼特左旗', '113.667248', '43.859880', 1); +INSERT INTO `yx_system_city` VALUES (851, 114065, 2, 113777, '152524000000', '苏尼特右旗', '内蒙古,锡林郭勒,苏尼特右旗', '112.641783', '42.742892', 1); +INSERT INTO `yx_system_city` VALUES (852, 114152, 2, 113777, '152525000000', '东乌珠穆沁旗', '内蒙古,锡林郭勒,东乌珠穆沁旗', '116.974494', '45.498221', 1); +INSERT INTO `yx_system_city` VALUES (853, 114239, 2, 113777, '152526000000', '西乌珠穆沁旗', '内蒙古,锡林郭勒,西乌珠穆沁旗', '117.608911', '44.587882', 1); +INSERT INTO `yx_system_city` VALUES (854, 114358, 2, 113777, '152527000000', '太仆寺旗', '内蒙古,锡林郭勒,太仆寺旗', '115.282986', '41.877136', 1); +INSERT INTO `yx_system_city` VALUES (855, 114557, 2, 113777, '152528000000', '镶黄旗', '内蒙古,锡林郭勒,镶黄旗', '113.847287', '42.232371', 1); +INSERT INTO `yx_system_city` VALUES (856, 114628, 2, 113777, '152529000000', '正镶白旗', '内蒙古,锡林郭勒,正镶白旗', '115.029849', '42.287471', 1); +INSERT INTO `yx_system_city` VALUES (857, 114722, 2, 113777, '152530000000', '正蓝旗', '内蒙古,锡林郭勒,正蓝旗', '115.992470', '42.241638', 1); +INSERT INTO `yx_system_city` VALUES (858, 114859, 2, 113777, '152531000000', '多伦县', '内蒙古,锡林郭勒,多伦', '116.485556', '42.203591', 1); +INSERT INTO `yx_system_city` VALUES (859, 114941, 2, 114940, '152921000000', '阿拉善左旗', '内蒙古,阿拉善,阿拉善左旗', '105.666293', '38.833411', 1); +INSERT INTO `yx_system_city` VALUES (860, 115132, 2, 114940, '152922000000', '阿拉善右旗', '内蒙古,阿拉善,阿拉善右旗', '101.666917', '39.216186', 1); +INSERT INTO `yx_system_city` VALUES (861, 115189, 2, 114940, '152923000000', '额济纳旗', '内蒙古,阿拉善,额济纳旗', '101.055590', '41.954347', 1); +INSERT INTO `yx_system_city` VALUES (862, 115226, 2, 115225, '210101000000', '市辖区', '辽宁,沈阳', '123.431474', '41.805698', 1); +INSERT INTO `yx_system_city` VALUES (863, 115227, 2, 115225, '210102000000', '和平区', '辽宁,沈阳,和平', '123.420382', '41.789809', 1); +INSERT INTO `yx_system_city` VALUES (864, 115347, 2, 115225, '210103000000', '沈河区', '辽宁,沈阳,沈河', '123.458897', '41.795655', 1); +INSERT INTO `yx_system_city` VALUES (865, 115474, 2, 115225, '210104000000', '大东区', '辽宁,沈阳,大东', '123.469949', '41.805137', 1); +INSERT INTO `yx_system_city` VALUES (866, 115612, 2, 115225, '210105000000', '皇姑区', '辽宁,沈阳,皇姑', '123.441970', '41.824796', 1); +INSERT INTO `yx_system_city` VALUES (867, 115752, 2, 115225, '210106000000', '铁西区', '辽宁,沈阳,铁西', '123.376301', '41.802914', 1); +INSERT INTO `yx_system_city` VALUES (868, 115964, 2, 115225, '210111000000', '苏家屯区', '辽宁,沈阳,苏家屯', '123.344031', '41.664757', 1); +INSERT INTO `yx_system_city` VALUES (869, 116159, 2, 115225, '210112000000', '浑南区', '辽宁,沈阳,浑南', '123.449715', '41.714914', 1); +INSERT INTO `yx_system_city` VALUES (870, 116399, 2, 115225, '210113000000', '沈北新区', '辽宁,沈阳,沈北', '123.431474', '41.805698', 1); +INSERT INTO `yx_system_city` VALUES (871, 116614, 2, 115225, '210114000000', '于洪区', '辽宁,沈阳,于洪', '123.308136', '41.793743', 1); +INSERT INTO `yx_system_city` VALUES (872, 116820, 2, 115225, '210115000000', '辽中区', '辽宁,沈阳,辽中', '122.765409', '41.516827', 1); +INSERT INTO `yx_system_city` VALUES (873, 117075, 2, 115225, '210123000000', '康平县', '辽宁,沈阳,康平', '123.355701', '42.741005', 1); +INSERT INTO `yx_system_city` VALUES (874, 117268, 2, 115225, '210124000000', '法库县', '辽宁,沈阳,法库', '123.440495', '42.500730', 1); +INSERT INTO `yx_system_city` VALUES (875, 117530, 2, 115225, '210181000000', '新民市', '辽宁,沈阳,新民', '122.836726', '41.985193', 1); +INSERT INTO `yx_system_city` VALUES (876, 117933, 2, 117932, '210201000000', '市辖区', '辽宁,大连', '121.614682', '38.914003', 1); +INSERT INTO `yx_system_city` VALUES (877, 117934, 2, 117932, '210202000000', '中山区', '辽宁,大连,中山', '121.644927', '38.918574', 1); +INSERT INTO `yx_system_city` VALUES (878, 117997, 2, 117932, '210203000000', '西岗区', '辽宁,大连,西岗', '121.612325', '38.914687', 1); +INSERT INTO `yx_system_city` VALUES (879, 118050, 2, 117932, '210204000000', '沙河口区', '辽宁,大连,沙河口', '121.594200', '38.904808', 1); +INSERT INTO `yx_system_city` VALUES (880, 118150, 2, 117932, '210211000000', '甘井子区', '辽宁,大连,甘井子', '121.525461', '38.953351', 1); +INSERT INTO `yx_system_city` VALUES (881, 118405, 2, 117932, '210212000000', '旅顺口区', '辽宁,大连,旅顺口', '121.261953', '38.851705', 1); +INSERT INTO `yx_system_city` VALUES (882, 118523, 2, 117932, '210213000000', '金州区', '辽宁,大连,金州', '121.782769', '39.050460', 1); +INSERT INTO `yx_system_city` VALUES (883, 118884, 2, 117932, '210214000000', '普兰店区', '辽宁,大连,普兰店', '121.970512', '39.401551', 1); +INSERT INTO `yx_system_city` VALUES (884, 119090, 2, 117932, '210224000000', '长海县', '辽宁,大连,长海', '122.588494', '39.272728', 1); +INSERT INTO `yx_system_city` VALUES (885, 119126, 2, 117932, '210281000000', '瓦房店市', '辽宁,大连,瓦房店', '121.979603', '39.627114', 1); +INSERT INTO `yx_system_city` VALUES (886, 119483, 2, 117932, '210283000000', '庄河市', '辽宁,大连,庄河', '122.967328', '39.680811', 1); +INSERT INTO `yx_system_city` VALUES (887, 119790, 2, 119789, '210301000000', '市辖区', '辽宁,鞍山', '122.994329', '41.108647', 1); +INSERT INTO `yx_system_city` VALUES (888, 119791, 2, 119789, '210302000000', '铁东区', '辽宁,鞍山,铁东', '122.991052', '41.089933', 1); +INSERT INTO `yx_system_city` VALUES (889, 119915, 2, 119789, '210303000000', '铁西区', '辽宁,鞍山,铁西', '122.969630', '41.119885', 1); +INSERT INTO `yx_system_city` VALUES (890, 120021, 2, 119789, '210304000000', '立山区', '辽宁,鞍山,立山', '123.029091', '41.150401', 1); +INSERT INTO `yx_system_city` VALUES (891, 120150, 2, 119789, '210311000000', '千山区', '辽宁,鞍山,千山', '122.949298', '41.068909', 1); +INSERT INTO `yx_system_city` VALUES (892, 120221, 2, 119789, '210321000000', '台安县', '辽宁,鞍山,台安', '122.436196', '41.412768', 1); +INSERT INTO `yx_system_city` VALUES (893, 120401, 2, 119789, '210323000000', '岫岩满族自治县', '辽宁,鞍山,岫岩', '123.280935', '40.290880', 1); +INSERT INTO `yx_system_city` VALUES (894, 120634, 2, 119789, '210381000000', '海城市', '辽宁,鞍山,海城', '122.685217', '40.882377', 1); +INSERT INTO `yx_system_city` VALUES (895, 121082, 2, 121081, '210401000000', '市辖区', '辽宁,抚顺', '123.957208', '41.880872', 1); +INSERT INTO `yx_system_city` VALUES (896, 121083, 2, 121081, '210402000000', '新抚区', '辽宁,抚顺,新抚', '123.912861', '41.862080', 1); +INSERT INTO `yx_system_city` VALUES (897, 121181, 2, 121081, '210403000000', '东洲区', '辽宁,抚顺,东洲', '124.038685', '41.853192', 1); +INSERT INTO `yx_system_city` VALUES (898, 121326, 2, 121081, '210404000000', '望花区', '辽宁,抚顺,望花', '123.784206', '41.853646', 1); +INSERT INTO `yx_system_city` VALUES (899, 121484, 2, 121081, '210411000000', '顺城区', '辽宁,抚顺,顺城', '123.945040', '41.883375', 1); +INSERT INTO `yx_system_city` VALUES (900, 121604, 2, 121081, '210421000000', '抚顺县', '辽宁,抚顺,抚顺', '124.097979', '41.922644', 1); +INSERT INTO `yx_system_city` VALUES (901, 121710, 2, 121081, '210422000000', '新宾满族自治县', '辽宁,抚顺,新宾', '125.039978', '41.734256', 1); +INSERT INTO `yx_system_city` VALUES (902, 121920, 2, 121081, '210423000000', '清原满族自治县', '辽宁,抚顺,清原', '124.924083', '42.100539', 1); +INSERT INTO `yx_system_city` VALUES (903, 122143, 2, 122142, '210501000000', '市辖区', '辽宁,本溪', '123.766485', '41.294175', 1); +INSERT INTO `yx_system_city` VALUES (904, 122144, 2, 122142, '210502000000', '平山区', '辽宁,本溪,平山', '123.768926', '41.299702', 1); +INSERT INTO `yx_system_city` VALUES (905, 122216, 2, 122142, '210503000000', '溪湖区', '辽宁,本溪,溪湖', '123.767647', '41.329219', 1); +INSERT INTO `yx_system_city` VALUES (906, 122310, 2, 122142, '210504000000', '明山区', '辽宁,本溪,明山', '123.817212', '41.308710', 1); +INSERT INTO `yx_system_city` VALUES (907, 122400, 2, 122142, '210505000000', '南芬区', '辽宁,本溪,南芬', '123.744802', '41.100445', 1); +INSERT INTO `yx_system_city` VALUES (908, 122444, 2, 122142, '210521000000', '本溪满族自治县', '辽宁,本溪,本溪', '124.120436', '41.301892', 1); +INSERT INTO `yx_system_city` VALUES (909, 122591, 2, 122142, '210522000000', '桓仁满族自治县', '辽宁,本溪,桓仁', '125.361007', '41.267128', 1); +INSERT INTO `yx_system_city` VALUES (910, 122731, 2, 122730, '210601000000', '市辖区', '辽宁,丹东', '124.354706', '40.000499', 1); +INSERT INTO `yx_system_city` VALUES (911, 122732, 2, 122730, '210602000000', '元宝区', '辽宁,丹东,元宝', '124.395757', '40.136520', 1); +INSERT INTO `yx_system_city` VALUES (912, 122785, 2, 122730, '210603000000', '振兴区', '辽宁,丹东,振兴', '124.360264', '40.105194', 1); +INSERT INTO `yx_system_city` VALUES (913, 122886, 2, 122730, '210604000000', '振安区', '辽宁,丹东,振安', '124.428162', '40.158267', 1); +INSERT INTO `yx_system_city` VALUES (914, 122958, 2, 122730, '210624000000', '宽甸满族自治县', '辽宁,丹东,宽甸', '124.783660', '40.731317', 1); +INSERT INTO `yx_system_city` VALUES (915, 123177, 2, 122730, '210681000000', '东港市', '辽宁,丹东,东港', '124.152705', '39.863008', 1); +INSERT INTO `yx_system_city` VALUES (916, 123438, 2, 122730, '210682000000', '凤城市', '辽宁,丹东,凤城', '124.066919', '40.452298', 1); +INSERT INTO `yx_system_city` VALUES (917, 123699, 2, 123698, '210701000000', '市辖区', '辽宁,锦州', '121.127003', '41.095119', 1); +INSERT INTO `yx_system_city` VALUES (918, 123700, 2, 123698, '210702000000', '古塔区', '辽宁,锦州,古塔', '121.128279', '41.117245', 1); +INSERT INTO `yx_system_city` VALUES (919, 123778, 2, 123698, '210703000000', '凌河区', '辽宁,锦州,凌河', '121.150877', '41.114990', 1); +INSERT INTO `yx_system_city` VALUES (920, 123869, 2, 123698, '210711000000', '太和区', '辽宁,锦州,太和', '121.103892', '41.109147', 1); +INSERT INTO `yx_system_city` VALUES (921, 124044, 2, 123698, '210726000000', '黑山县', '辽宁,锦州,黑山', '122.123443', '41.666028', 1); +INSERT INTO `yx_system_city` VALUES (922, 124398, 2, 123698, '210727000000', '义县', '辽宁,锦州,义县', '121.239080', '41.533087', 1); +INSERT INTO `yx_system_city` VALUES (923, 124670, 2, 123698, '210781000000', '凌海市', '辽宁,锦州,凌海', '121.357730', '41.173400', 1); +INSERT INTO `yx_system_city` VALUES (924, 124980, 2, 123698, '210782000000', '北镇市', '辽宁,锦州,北镇', '121.795962', '41.598764', 1); +INSERT INTO `yx_system_city` VALUES (925, 125250, 2, 125249, '210801000000', '市辖区', '辽宁,营口', '122.235417', '40.667012', 1); +INSERT INTO `yx_system_city` VALUES (926, 125251, 2, 125249, '210802000000', '站前区', '辽宁,营口,站前', '122.258961', '40.672670', 1); +INSERT INTO `yx_system_city` VALUES (927, 125305, 2, 125249, '210803000000', '西市区', '辽宁,营口,西市', '122.206414', '40.666408', 1); +INSERT INTO `yx_system_city` VALUES (928, 125353, 2, 125249, '210804000000', '鲅鱼圈区', '辽宁,营口,鲅鱼圈', '122.107814', '40.230636', 1); +INSERT INTO `yx_system_city` VALUES (929, 125454, 2, 125249, '210811000000', '老边区', '辽宁,营口,老边', '122.379967', '40.680303', 1); +INSERT INTO `yx_system_city` VALUES (930, 125520, 2, 125249, '210881000000', '盖州市', '辽宁,营口,盖州', '122.348936', '40.400611', 1); +INSERT INTO `yx_system_city` VALUES (931, 125849, 2, 125249, '210882000000', '大石桥市', '辽宁,营口,大石桥', '122.509131', '40.644622', 1); +INSERT INTO `yx_system_city` VALUES (932, 126157, 2, 126156, '210901000000', '市辖区', '辽宁,阜新', '121.670323', '42.021619', 1); +INSERT INTO `yx_system_city` VALUES (933, 126158, 2, 126156, '210902000000', '海州区', '辽宁,阜新,海州', '121.656255', '42.013242', 1); +INSERT INTO `yx_system_city` VALUES (934, 126236, 2, 126156, '210903000000', '新邱区', '辽宁,阜新,新邱', '121.792535', '42.087632', 1); +INSERT INTO `yx_system_city` VALUES (935, 126264, 2, 126156, '210904000000', '太平区', '辽宁,阜新,太平', '121.678512', '42.010600', 1); +INSERT INTO `yx_system_city` VALUES (936, 126314, 2, 126156, '210905000000', '清河门区', '辽宁,阜新,清河门', '121.416105', '41.783100', 1); +INSERT INTO `yx_system_city` VALUES (937, 126349, 2, 126156, '210911000000', '细河区', '辽宁,阜新,细河', '121.680540', '42.025495', 1); +INSERT INTO `yx_system_city` VALUES (938, 126417, 2, 126156, '210921000000', '阜新蒙古族自治县', '辽宁,阜新,阜新', '121.757901', '42.065175', 1); +INSERT INTO `yx_system_city` VALUES (939, 126845, 2, 126156, '210922000000', '彰武县', '辽宁,阜新,彰武', '122.538793', '42.386544', 1); +INSERT INTO `yx_system_city` VALUES (940, 127071, 2, 127070, '211001000000', '市辖区', '辽宁,辽阳', '123.236944', '41.267244', 1); +INSERT INTO `yx_system_city` VALUES (941, 127072, 2, 127070, '211002000000', '白塔区', '辽宁,辽阳,白塔', '123.174325', '41.270347', 1); +INSERT INTO `yx_system_city` VALUES (942, 127152, 2, 127070, '211003000000', '文圣区', '辽宁,辽阳,文圣', '123.185386', '41.262608', 1); +INSERT INTO `yx_system_city` VALUES (943, 127218, 2, 127070, '211004000000', '宏伟区', '辽宁,辽阳,宏伟', '123.196672', '41.217649', 1); +INSERT INTO `yx_system_city` VALUES (944, 127266, 2, 127070, '211005000000', '弓长岭区', '辽宁,辽阳,弓长岭', '123.419804', '41.151847', 1); +INSERT INTO `yx_system_city` VALUES (945, 127305, 2, 127070, '211011000000', '太子河区', '辽宁,辽阳,太子河', '123.181782', '41.253277', 1); +INSERT INTO `yx_system_city` VALUES (946, 127386, 2, 127070, '211021000000', '辽阳县', '辽宁,辽阳,辽阳', '123.105695', '41.205329', 1); +INSERT INTO `yx_system_city` VALUES (947, 127612, 2, 127070, '211081000000', '灯塔市', '辽宁,辽阳,灯塔', '123.339312', '41.426372', 1); +INSERT INTO `yx_system_city` VALUES (948, 127835, 2, 127834, '211101000000', '市辖区', '辽宁,盘锦', '122.070714', '41.119997', 1); +INSERT INTO `yx_system_city` VALUES (949, 127836, 2, 127834, '211102000000', '双台子区', '辽宁,盘锦,双台子', '122.060112', '41.190606', 1); +INSERT INTO `yx_system_city` VALUES (950, 127896, 2, 127834, '211103000000', '兴隆台区', '辽宁,盘锦,兴隆台', '122.069897', '41.158678', 1); +INSERT INTO `yx_system_city` VALUES (951, 128037, 2, 127834, '211104000000', '大洼区', '辽宁,盘锦,大洼', '122.082575', '41.002279', 1); +INSERT INTO `yx_system_city` VALUES (952, 128231, 2, 127834, '211122000000', '盘山县', '辽宁,盘锦,盘山', '121.996499', '41.242873', 1); +INSERT INTO `yx_system_city` VALUES (953, 128422, 2, 128421, '211201000000', '市辖区', '辽宁,铁岭', '123.726166', '42.223769', 1); +INSERT INTO `yx_system_city` VALUES (954, 128423, 2, 128421, '211202000000', '银州区', '辽宁,铁岭,银州', '123.842305', '42.286130', 1); +INSERT INTO `yx_system_city` VALUES (955, 128530, 2, 128421, '211204000000', '清河区', '辽宁,铁岭,清河', '123.726166', '42.223769', 1); +INSERT INTO `yx_system_city` VALUES (956, 128591, 2, 128421, '211221000000', '铁岭县', '辽宁,铁岭,铁岭', '123.729004', '42.223383', 1); +INSERT INTO `yx_system_city` VALUES (957, 128839, 2, 128421, '211223000000', '西丰县', '辽宁,铁岭,西丰', '124.727393', '42.738030', 1); +INSERT INTO `yx_system_city` VALUES (958, 129043, 2, 128421, '211224000000', '昌图县', '辽宁,铁岭,昌图', '124.111100', '42.785791', 1); +INSERT INTO `yx_system_city` VALUES (959, 129592, 2, 128421, '211281000000', '调兵山市', '辽宁,铁岭,调兵山', '123.567117', '42.467521', 1); +INSERT INTO `yx_system_city` VALUES (960, 129661, 2, 128421, '211282000000', '开原市', '辽宁,铁岭,开原', '124.038268', '42.546307', 1); +INSERT INTO `yx_system_city` VALUES (961, 129978, 2, 129977, '211301000000', '市辖区', '辽宁,朝阳', '120.389862', '41.497767', 1); +INSERT INTO `yx_system_city` VALUES (962, 129979, 2, 129977, '211302000000', '双塔区', '辽宁,朝阳,双塔', '120.453744', '41.565628', 1); +INSERT INTO `yx_system_city` VALUES (963, 130102, 2, 129977, '211303000000', '龙城区', '辽宁,朝阳,龙城', '120.413376', '41.576749', 1); +INSERT INTO `yx_system_city` VALUES (964, 130205, 2, 129977, '211321000000', '朝阳县', '辽宁,朝阳,朝阳', '120.389862', '41.497767', 1); +INSERT INTO `yx_system_city` VALUES (965, 130534, 2, 129977, '211322000000', '建平县', '辽宁,朝阳,建平', '119.643280', '41.403128', 1); +INSERT INTO `yx_system_city` VALUES (966, 130860, 2, 129977, '211324000000', '喀喇沁左翼蒙古族自治县', '辽宁,朝阳,喀喇沁左翼', '120.389862', '41.497767', 1); +INSERT INTO `yx_system_city` VALUES (967, 131089, 2, 129977, '211381000000', '北票市', '辽宁,朝阳,北票', '120.770730', '41.800684', 1); +INSERT INTO `yx_system_city` VALUES (968, 131425, 2, 129977, '211382000000', '凌源市', '辽宁,朝阳,凌源', '119.401574', '41.245445', 1); +INSERT INTO `yx_system_city` VALUES (969, 131739, 2, 131738, '211401000000', '市辖区', '辽宁,葫芦岛', '120.836932', '40.711052', 1); +INSERT INTO `yx_system_city` VALUES (970, 131740, 2, 131738, '211402000000', '连山区', '辽宁,葫芦岛,连山', '120.869231', '40.774461', 1); +INSERT INTO `yx_system_city` VALUES (971, 131976, 2, 131738, '211403000000', '龙港区', '辽宁,葫芦岛,龙港', '120.893786', '40.735519', 1); +INSERT INTO `yx_system_city` VALUES (972, 132073, 2, 131738, '211404000000', '南票区', '辽宁,葫芦岛,南票', '120.749728', '41.107108', 1); +INSERT INTO `yx_system_city` VALUES (973, 132258, 2, 131738, '211421000000', '绥中县', '辽宁,葫芦岛,绥中', '120.344229', '40.325659', 1); +INSERT INTO `yx_system_city` VALUES (974, 132590, 2, 131738, '211422000000', '建昌县', '辽宁,葫芦岛,建昌', '119.837124', '40.824368', 1); +INSERT INTO `yx_system_city` VALUES (975, 132912, 2, 131738, '211481000000', '兴城市', '辽宁,葫芦岛,兴城', '120.728310', '40.614762', 1); +INSERT INTO `yx_system_city` VALUES (976, 133210, 2, 133209, '220101000000', '市辖区', '吉林,长春', '125.323544', '43.817071', 1); +INSERT INTO `yx_system_city` VALUES (977, 133211, 2, 133209, '220102000000', '南关区', '吉林,长春,南关', '125.350173', '43.863989', 1); +INSERT INTO `yx_system_city` VALUES (978, 133289, 2, 133209, '220103000000', '宽城区', '吉林,长春,宽城', '125.326578', '43.943614', 1); +INSERT INTO `yx_system_city` VALUES (979, 133453, 2, 133209, '220104000000', '朝阳区', '吉林,长春,朝阳', '125.288319', '43.833513', 1); +INSERT INTO `yx_system_city` VALUES (980, 133543, 2, 133209, '220105000000', '二道区', '吉林,长春,二道', '125.374217', '43.865596', 1); +INSERT INTO `yx_system_city` VALUES (981, 133631, 2, 133209, '220106000000', '绿园区', '吉林,长春,绿园', '125.256136', '43.880975', 1); +INSERT INTO `yx_system_city` VALUES (982, 133719, 2, 133209, '220112000000', '双阳区', '吉林,长春,双阳', '125.664662', '43.525311', 1); +INSERT INTO `yx_system_city` VALUES (983, 133881, 2, 133209, '220113000000', '九台区', '吉林,长春,九台', '125.839574', '44.151742', 1); +INSERT INTO `yx_system_city` VALUES (984, 134236, 2, 133209, '220122000000', '农安县', '吉林,长春,农安', '125.184742', '44.432889', 1); +INSERT INTO `yx_system_city` VALUES (985, 134628, 2, 133209, '220182000000', '榆树市', '吉林,长春,榆树', '126.533146', '44.840288', 1); +INSERT INTO `yx_system_city` VALUES (986, 135061, 2, 133209, '220183000000', '德惠市', '吉林,长春,德惠', '125.728620', '44.521785', 1); +INSERT INTO `yx_system_city` VALUES (987, 135393, 2, 135392, '220201000000', '市辖区', '吉林,吉林', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (988, 135394, 2, 135392, '220202000000', '昌邑区', '吉林,吉林,昌邑', '126.574710', '43.881818', 1); +INSERT INTO `yx_system_city` VALUES (989, 135568, 2, 135392, '220203000000', '龙潭区', '吉林,吉林,龙潭', '126.562197', '43.910803', 1); +INSERT INTO `yx_system_city` VALUES (990, 135755, 2, 135392, '220204000000', '船营区', '吉林,吉林,船营', '126.540966', '43.833445', 1); +INSERT INTO `yx_system_city` VALUES (991, 135885, 2, 135392, '220211000000', '丰满区', '吉林,吉林,丰满', '126.562274', '43.821601', 1); +INSERT INTO `yx_system_city` VALUES (992, 135986, 2, 135392, '220221000000', '永吉县', '吉林,吉林,永吉', '126.497741', '43.672582', 1); +INSERT INTO `yx_system_city` VALUES (993, 136136, 2, 135392, '220281000000', '蛟河市', '吉林,吉林,蛟河', '127.344501', '43.723713', 1); +INSERT INTO `yx_system_city` VALUES (994, 136439, 2, 135392, '220282000000', '桦甸市', '吉林,吉林,桦甸', '126.746310', '42.972097', 1); +INSERT INTO `yx_system_city` VALUES (995, 136629, 2, 135392, '220283000000', '舒兰市', '吉林,吉林,舒兰', '126.965607', '44.406106', 1); +INSERT INTO `yx_system_city` VALUES (996, 136889, 2, 135392, '220284000000', '磐石市', '吉林,吉林,磐石', '126.060427', '42.946285', 1); +INSERT INTO `yx_system_city` VALUES (997, 137207, 2, 137206, '220301000000', '市辖区', '吉林,四平', '124.350398', '43.166419', 1); +INSERT INTO `yx_system_city` VALUES (998, 137208, 2, 137206, '220302000000', '铁西区', '吉林,四平,铁西', '124.345722', '43.146155', 1); +INSERT INTO `yx_system_city` VALUES (999, 137275, 2, 137206, '220303000000', '铁东区', '吉林,四平,铁东', '124.409622', '43.162048', 1); +INSERT INTO `yx_system_city` VALUES (1000, 137386, 2, 137206, '220322000000', '梨树县', '吉林,四平,梨树', '124.335390', '43.307060', 1); +INSERT INTO `yx_system_city` VALUES (1001, 137756, 2, 137206, '220323000000', '伊通满族自治县', '吉林,四平,伊通', '125.305394', '43.345754', 1); +INSERT INTO `yx_system_city` VALUES (1002, 137973, 2, 137206, '220381000000', '公主岭市', '吉林,四平,公主岭', '124.822830', '43.504687', 1); +INSERT INTO `yx_system_city` VALUES (1003, 138477, 2, 137206, '220382000000', '双辽市', '吉林,四平,双辽', '123.502724', '43.518302', 1); +INSERT INTO `yx_system_city` VALUES (1004, 138722, 2, 138721, '220401000000', '市辖区', '吉林,辽源', '125.143532', '42.887918', 1); +INSERT INTO `yx_system_city` VALUES (1005, 138723, 2, 138721, '220402000000', '龙山区', '吉林,辽源,龙山', '125.136452', '42.901534', 1); +INSERT INTO `yx_system_city` VALUES (1006, 138780, 2, 138721, '220403000000', '西安区', '吉林,辽源,西安', '125.149283', '42.927265', 1); +INSERT INTO `yx_system_city` VALUES (1007, 138818, 2, 138721, '220421000000', '东丰县', '吉林,辽源,东丰', '125.530991', '42.676935', 1); +INSERT INTO `yx_system_city` VALUES (1008, 139072, 2, 138721, '220422000000', '东辽县', '吉林,辽源,东辽', '124.991521', '42.926331', 1); +INSERT INTO `yx_system_city` VALUES (1009, 139341, 2, 139340, '220501000000', '市辖区', '吉林,通化', '125.939697', '41.728401', 1); +INSERT INTO `yx_system_city` VALUES (1010, 139342, 2, 139340, '220502000000', '东昌区', '吉林,通化,东昌', '125.955102', '41.728498', 1); +INSERT INTO `yx_system_city` VALUES (1011, 139405, 2, 139340, '220503000000', '二道江区', '吉林,通化,二道江', '126.042535', '41.774053', 1); +INSERT INTO `yx_system_city` VALUES (1012, 139453, 2, 139340, '220521000000', '通化县', '吉林,通化,通化', '125.759259', '41.679808', 1); +INSERT INTO `yx_system_city` VALUES (1013, 139654, 2, 139340, '220523000000', '辉南县', '吉林,通化,辉南', '126.046912', '42.684993', 1); +INSERT INTO `yx_system_city` VALUES (1014, 139824, 2, 139340, '220524000000', '柳河县', '吉林,通化,柳河', '125.744735', '42.284606', 1); +INSERT INTO `yx_system_city` VALUES (1015, 140077, 2, 139340, '220581000000', '梅河口市', '吉林,通化,梅河口', '125.683832', '42.530341', 1); +INSERT INTO `yx_system_city` VALUES (1016, 140432, 2, 139340, '220582000000', '集安市', '吉林,通化,集安', '126.194031', '41.125307', 1); +INSERT INTO `yx_system_city` VALUES (1017, 140602, 2, 140601, '220601000000', '市辖区', '吉林,白山', '126.423587', '41.939994', 1); +INSERT INTO `yx_system_city` VALUES (1018, 140603, 2, 140601, '220602000000', '浑江区', '吉林,白山,浑江', '126.416094', '41.945409', 1); +INSERT INTO `yx_system_city` VALUES (1019, 140714, 2, 140601, '220605000000', '江源区', '吉林,白山,江源', '126.591144', '42.056773', 1); +INSERT INTO `yx_system_city` VALUES (1020, 140816, 2, 140601, '220621000000', '抚松县', '吉林,白山,抚松', '127.449764', '42.221208', 1); +INSERT INTO `yx_system_city` VALUES (1021, 141003, 2, 140601, '220622000000', '靖宇县', '吉林,白山,靖宇', '126.813625', '42.388760', 1); +INSERT INTO `yx_system_city` VALUES (1022, 141140, 2, 140601, '220623000000', '长白朝鲜族自治县', '吉林,白山,长白', '128.200789', '41.420018', 1); +INSERT INTO `yx_system_city` VALUES (1023, 141237, 2, 140601, '220681000000', '临江市', '吉林,白山,临江', '126.918087', '41.811979', 1); +INSERT INTO `yx_system_city` VALUES (1024, 141362, 2, 141361, '220701000000', '市辖区', '吉林,松原', '124.825117', '45.141789', 1); +INSERT INTO `yx_system_city` VALUES (1025, 141363, 2, 141361, '220702000000', '宁江区', '吉林,松原,宁江', '124.817054', '45.171792', 1); +INSERT INTO `yx_system_city` VALUES (1026, 141560, 2, 141361, '220721000000', '前郭尔罗斯蒙古族自治县', '吉林,松原,前郭尔罗斯', '124.823242', '45.118030', 1); +INSERT INTO `yx_system_city` VALUES (1027, 141870, 2, 141361, '220722000000', '长岭县', '吉林,松原,长岭', '123.967484', '44.275895', 1); +INSERT INTO `yx_system_city` VALUES (1028, 142157, 2, 141361, '220723000000', '乾安县', '吉林,松原,乾安', '124.041139', '45.003774', 1); +INSERT INTO `yx_system_city` VALUES (1029, 142353, 2, 141361, '220781000000', '扶余市', '吉林,松原,扶余', '126.049774', '44.988449', 1); +INSERT INTO `yx_system_city` VALUES (1030, 142787, 2, 142786, '220801000000', '市辖区', '吉林,白城', '122.839024', '45.619641', 1); +INSERT INTO `yx_system_city` VALUES (1031, 142788, 2, 142786, '220802000000', '洮北区', '吉林,白城,洮北', '122.851029', '45.621716', 1); +INSERT INTO `yx_system_city` VALUES (1032, 143021, 2, 142786, '220821000000', '镇赉县', '吉林,白城,镇赉', '123.199890', '45.847435', 1); +INSERT INTO `yx_system_city` VALUES (1033, 143209, 2, 142786, '220822000000', '通榆县', '吉林,白城,通榆', '123.088239', '44.812911', 1); +INSERT INTO `yx_system_city` VALUES (1034, 143428, 2, 142786, '220881000000', '洮南市', '吉林,白城,洮南', '122.783779', '45.339113', 1); +INSERT INTO `yx_system_city` VALUES (1035, 143702, 2, 142786, '220882000000', '大安市', '吉林,白城,大安', '124.292626', '45.506996', 1); +INSERT INTO `yx_system_city` VALUES (1036, 143991, 2, 143990, '222401000000', '延吉市', '吉林,延边,延吉', '129.508946', '42.891255', 1); +INSERT INTO `yx_system_city` VALUES (1037, 144147, 2, 143990, '222402000000', '图们市', '吉林,延边,图们', '129.843710', '42.968044', 1); +INSERT INTO `yx_system_city` VALUES (1038, 144226, 2, 143990, '222403000000', '敦化市', '吉林,延边,敦化', '128.232013', '43.372413', 1); +INSERT INTO `yx_system_city` VALUES (1039, 144665, 2, 143990, '222404000000', '珲春市', '吉林,延边,珲春', '130.366036', '42.862821', 1); +INSERT INTO `yx_system_city` VALUES (1040, 144844, 2, 143990, '222405000000', '龙井市', '吉林,延边,龙井', '129.427066', '42.766311', 1); +INSERT INTO `yx_system_city` VALUES (1041, 144953, 2, 143990, '222406000000', '和龙市', '吉林,延边,和龙', '129.010106', '42.546675', 1); +INSERT INTO `yx_system_city` VALUES (1042, 145096, 2, 143990, '222424000000', '汪清县', '吉林,延边,汪清', '129.771607', '43.312522', 1); +INSERT INTO `yx_system_city` VALUES (1043, 145421, 2, 143990, '222426000000', '安图县', '吉林,延边,安图', '128.899807', '43.111964', 1); +INSERT INTO `yx_system_city` VALUES (1044, 145667, 2, 145666, '230101000000', '市辖区', '黑龙江,哈尔滨', '126.534967', '45.803775', 1); +INSERT INTO `yx_system_city` VALUES (1045, 145668, 2, 145666, '230102000000', '道里区', '黑龙江,哈尔滨,道里', '126.616957', '45.755777', 1); +INSERT INTO `yx_system_city` VALUES (1046, 145864, 2, 145666, '230103000000', '南岗区', '黑龙江,哈尔滨,南岗', '126.668788', '45.759970', 1); +INSERT INTO `yx_system_city` VALUES (1047, 146071, 2, 145666, '230104000000', '道外区', '黑龙江,哈尔滨,道外', '126.649451', '45.792113', 1); +INSERT INTO `yx_system_city` VALUES (1048, 146266, 2, 145666, '230108000000', '平房区', '黑龙江,哈尔滨,平房', '126.534967', '45.803775', 1); +INSERT INTO `yx_system_city` VALUES (1049, 146313, 2, 145666, '230109000000', '松北区', '黑龙江,哈尔滨,松北', '126.510275', '45.802756', 1); +INSERT INTO `yx_system_city` VALUES (1050, 146399, 2, 145666, '230110000000', '香坊区', '黑龙江,哈尔滨,香坊', '126.662593', '45.707716', 1); +INSERT INTO `yx_system_city` VALUES (1051, 146587, 2, 145666, '230111000000', '呼兰区', '黑龙江,哈尔滨,呼兰', '126.587709', '45.889427', 1); +INSERT INTO `yx_system_city` VALUES (1052, 146825, 2, 145666, '230112000000', '阿城区', '黑龙江,哈尔滨,阿城', '126.958098', '45.548670', 1); +INSERT INTO `yx_system_city` VALUES (1053, 147032, 2, 145666, '230113000000', '双城区', '黑龙江,哈尔滨,双城', '126.312745', '45.383263', 1); +INSERT INTO `yx_system_city` VALUES (1054, 147391, 2, 145666, '230123000000', '依兰县', '黑龙江,哈尔滨,依兰', '129.567985', '46.324534', 1); +INSERT INTO `yx_system_city` VALUES (1055, 147571, 2, 145666, '230124000000', '方正县', '黑龙江,哈尔滨,方正', '128.829536', '45.851695', 1); +INSERT INTO `yx_system_city` VALUES (1056, 147676, 2, 145666, '230125000000', '宾县', '黑龙江,哈尔滨,宾县', '127.466634', '45.745918', 1); +INSERT INTO `yx_system_city` VALUES (1057, 147884, 2, 145666, '230126000000', '巴彦县', '黑龙江,哈尔滨,巴彦', '127.403182', '46.085379', 1); +INSERT INTO `yx_system_city` VALUES (1058, 148060, 2, 145666, '230127000000', '木兰县', '黑龙江,哈尔滨,木兰', '128.043466', '45.950582', 1); +INSERT INTO `yx_system_city` VALUES (1059, 148178, 2, 145666, '230128000000', '通河县', '黑龙江,哈尔滨,通河', '128.749352', '45.972425', 1); +INSERT INTO `yx_system_city` VALUES (1060, 148351, 2, 145666, '230129000000', '延寿县', '黑龙江,哈尔滨,延寿', '128.331644', '45.451897', 1); +INSERT INTO `yx_system_city` VALUES (1061, 148502, 2, 145666, '230183000000', '尚志市', '黑龙江,哈尔滨,尚志', '128.009895', '45.209586', 1); +INSERT INTO `yx_system_city` VALUES (1062, 148755, 2, 145666, '230184000000', '五常市', '黑龙江,哈尔滨,五常', '127.167619', '44.931992', 1); +INSERT INTO `yx_system_city` VALUES (1063, 149080, 2, 149079, '230201000000', '市辖区', '黑龙江,齐齐哈尔', '123.918186', '47.354348', 1); +INSERT INTO `yx_system_city` VALUES (1064, 149081, 2, 149079, '230202000000', '龙沙区', '黑龙江,齐齐哈尔,龙沙', '123.957531', '47.317309', 1); +INSERT INTO `yx_system_city` VALUES (1065, 149129, 2, 149079, '230203000000', '建华区', '黑龙江,齐齐哈尔,建华', '123.955464', '47.354364', 1); +INSERT INTO `yx_system_city` VALUES (1066, 149173, 2, 149079, '230204000000', '铁锋区', '黑龙江,齐齐哈尔,铁锋', '123.978293', '47.340518', 1); +INSERT INTO `yx_system_city` VALUES (1067, 149231, 2, 149079, '230205000000', '昂昂溪区', '黑龙江,齐齐哈尔,昂昂溪', '123.822401', '47.155160', 1); +INSERT INTO `yx_system_city` VALUES (1068, 149266, 2, 149079, '230206000000', '富拉尔基区', '黑龙江,齐齐哈尔,富拉尔基', '123.629190', '47.208843', 1); +INSERT INTO `yx_system_city` VALUES (1069, 149317, 2, 149079, '230207000000', '碾子山区', '黑龙江,齐齐哈尔,碾子山', '122.887775', '47.516872', 1); +INSERT INTO `yx_system_city` VALUES (1070, 149338, 2, 149079, '230208000000', '梅里斯达斡尔族区', '黑龙江,齐齐哈尔,梅里斯', '123.752910', '47.309537', 1); +INSERT INTO `yx_system_city` VALUES (1071, 149404, 2, 149079, '230221000000', '龙江县', '黑龙江,齐齐哈尔,龙江', '123.205323', '47.338665', 1); +INSERT INTO `yx_system_city` VALUES (1072, 149588, 2, 149079, '230223000000', '依安县', '黑龙江,齐齐哈尔,依安', '125.306279', '47.893548', 1); +INSERT INTO `yx_system_city` VALUES (1073, 149767, 2, 149079, '230224000000', '泰来县', '黑龙江,齐齐哈尔,泰来', '123.416631', '46.393694', 1); +INSERT INTO `yx_system_city` VALUES (1074, 149896, 2, 149079, '230225000000', '甘南县', '黑龙江,齐齐哈尔,甘南', '123.507429', '47.922406', 1); +INSERT INTO `yx_system_city` VALUES (1075, 150046, 2, 149079, '230227000000', '富裕县', '黑龙江,齐齐哈尔,富裕', '124.473793', '47.774347', 1); +INSERT INTO `yx_system_city` VALUES (1076, 150168, 2, 149079, '230229000000', '克山县', '黑龙江,齐齐哈尔,克山', '125.875705', '48.037031', 1); +INSERT INTO `yx_system_city` VALUES (1077, 150337, 2, 149079, '230230000000', '克东县', '黑龙江,齐齐哈尔,克东', '126.248721', '48.042060', 1); +INSERT INTO `yx_system_city` VALUES (1078, 150471, 2, 149079, '230231000000', '拜泉县', '黑龙江,齐齐哈尔,拜泉', '126.100213', '47.595851', 1); +INSERT INTO `yx_system_city` VALUES (1079, 150680, 2, 149079, '230281000000', '讷河市', '黑龙江,齐齐哈尔,讷河', '124.884244', '48.484099', 1); +INSERT INTO `yx_system_city` VALUES (1080, 150916, 2, 150915, '230301000000', '市辖区', '黑龙江,鸡西', '130.969333', '45.295075', 1); +INSERT INTO `yx_system_city` VALUES (1081, 150917, 2, 150915, '230302000000', '鸡冠区', '黑龙江,鸡西,鸡冠', '130.980894', '45.304073', 1); +INSERT INTO `yx_system_city` VALUES (1082, 150984, 2, 150915, '230303000000', '恒山区', '黑龙江,鸡西,恒山', '130.904963', '45.210668', 1); +INSERT INTO `yx_system_city` VALUES (1083, 151039, 2, 150915, '230304000000', '滴道区', '黑龙江,鸡西,滴道', '130.843613', '45.348764', 1); +INSERT INTO `yx_system_city` VALUES (1084, 151084, 2, 150915, '230305000000', '梨树区', '黑龙江,鸡西,梨树', '130.696990', '45.092046', 1); +INSERT INTO `yx_system_city` VALUES (1085, 151113, 2, 150915, '230306000000', '城子河区', '黑龙江,鸡西,城子河', '131.011304', '45.336970', 1); +INSERT INTO `yx_system_city` VALUES (1086, 151154, 2, 150915, '230307000000', '麻山区', '黑龙江,鸡西,麻山', '130.478187', '45.212088', 1); +INSERT INTO `yx_system_city` VALUES (1087, 151177, 2, 150915, '230321000000', '鸡东县', '黑龙江,鸡西,鸡东', '131.124080', '45.260412', 1); +INSERT INTO `yx_system_city` VALUES (1088, 151347, 2, 150915, '230381000000', '虎林市', '黑龙江,鸡西,虎林', '132.937210', '45.762686', 1); +INSERT INTO `yx_system_city` VALUES (1089, 151577, 2, 150915, '230382000000', '密山市', '黑龙江,鸡西,密山', '131.846636', '45.529775', 1); +INSERT INTO `yx_system_city` VALUES (1090, 151831, 2, 151830, '230401000000', '市辖区', '黑龙江,鹤岗', '130.297964', '47.349916', 1); +INSERT INTO `yx_system_city` VALUES (1091, 151832, 2, 151830, '230402000000', '向阳区', '黑龙江,鹤岗,向阳', '130.294309', '47.342478', 1); +INSERT INTO `yx_system_city` VALUES (1092, 151855, 2, 151830, '230403000000', '工农区', '黑龙江,鹤岗,工农', '130.274684', '47.318781', 1); +INSERT INTO `yx_system_city` VALUES (1093, 151880, 2, 151830, '230404000000', '南山区', '黑龙江,鹤岗,南山', '130.287057', '47.315127', 1); +INSERT INTO `yx_system_city` VALUES (1094, 151912, 2, 151830, '230405000000', '兴安区', '黑龙江,鹤岗,兴安', '130.239245', '47.252850', 1); +INSERT INTO `yx_system_city` VALUES (1095, 151947, 2, 151830, '230406000000', '东山区', '黑龙江,鹤岗,东山', '130.317062', '47.338535', 1); +INSERT INTO `yx_system_city` VALUES (1096, 152026, 2, 151830, '230407000000', '兴山区', '黑龙江,鹤岗,兴山', '130.303574', '47.357666', 1); +INSERT INTO `yx_system_city` VALUES (1097, 152047, 2, 151830, '230421000000', '萝北县', '黑龙江,鹤岗,萝北', '130.828626', '47.577495', 1); +INSERT INTO `yx_system_city` VALUES (1098, 152237, 2, 151830, '230422000000', '绥滨县', '黑龙江,鹤岗,绥滨', '131.852759', '47.289116', 1); +INSERT INTO `yx_system_city` VALUES (1099, 152414, 2, 152413, '230501000000', '市辖区', '黑龙江,双鸭山', '131.159133', '46.646508', 1); +INSERT INTO `yx_system_city` VALUES (1100, 152415, 2, 152413, '230502000000', '尖山区', '黑龙江,双鸭山,尖山', '131.158416', '46.646350', 1); +INSERT INTO `yx_system_city` VALUES (1101, 152469, 2, 152413, '230503000000', '岭东区', '黑龙江,双鸭山,岭东', '131.164724', '46.592721', 1); +INSERT INTO `yx_system_city` VALUES (1102, 152508, 2, 152413, '230505000000', '四方台区', '黑龙江,双鸭山,四方台', '131.334503', '46.594316', 1); +INSERT INTO `yx_system_city` VALUES (1103, 152544, 2, 152413, '230506000000', '宝山区', '黑龙江,双鸭山,宝山', '131.401589', '46.577167', 1); +INSERT INTO `yx_system_city` VALUES (1104, 152590, 2, 152413, '230521000000', '集贤县', '黑龙江,双鸭山,集贤', '131.140483', '46.728377', 1); +INSERT INTO `yx_system_city` VALUES (1105, 152810, 2, 152413, '230522000000', '友谊县', '黑龙江,双鸭山,友谊', '131.808064', '46.767299', 1); +INSERT INTO `yx_system_city` VALUES (1106, 152910, 2, 152413, '230523000000', '宝清县', '黑龙江,双鸭山,宝清', '132.197243', '46.326925', 1); +INSERT INTO `yx_system_city` VALUES (1107, 153142, 2, 152413, '230524000000', '饶河县', '黑龙江,双鸭山,饶河', '134.013872', '46.798164', 1); +INSERT INTO `yx_system_city` VALUES (1108, 153314, 2, 153313, '230601000000', '市辖区', '黑龙江,大庆', '125.103784', '46.589309', 1); +INSERT INTO `yx_system_city` VALUES (1109, 153315, 2, 153313, '230602000000', '萨尔图区', '黑龙江,大庆,萨尔图', '125.114643', '46.596356', 1); +INSERT INTO `yx_system_city` VALUES (1110, 153371, 2, 153313, '230603000000', '龙凤区', '黑龙江,大庆,龙凤', '125.135326', '46.562247', 1); +INSERT INTO `yx_system_city` VALUES (1111, 153423, 2, 153313, '230604000000', '让胡路区', '黑龙江,大庆,让胡路', '124.870597', '46.652358', 1); +INSERT INTO `yx_system_city` VALUES (1112, 153513, 2, 153313, '230605000000', '红岗区', '黑龙江,大庆,红岗', '124.891039', '46.398418', 1); +INSERT INTO `yx_system_city` VALUES (1113, 153561, 2, 153313, '230606000000', '大同区', '黑龙江,大庆,大同', '124.812364', '46.039828', 1); +INSERT INTO `yx_system_city` VALUES (1114, 153659, 2, 153313, '230621000000', '肇州县', '黑龙江,大庆,肇州', '125.268643', '45.699066', 1); +INSERT INTO `yx_system_city` VALUES (1115, 153791, 2, 153313, '230622000000', '肇源县', '黑龙江,大庆,肇源', '125.078223', '45.519320', 1); +INSERT INTO `yx_system_city` VALUES (1116, 153974, 2, 153313, '230623000000', '林甸县', '黑龙江,大庆,林甸', '124.863603', '47.171717', 1); +INSERT INTO `yx_system_city` VALUES (1117, 154082, 2, 153313, '230624000000', '杜尔伯特蒙古族自治县', '黑龙江,大庆,杜尔伯特', '124.446705', '46.866580', 1); +INSERT INTO `yx_system_city` VALUES (1118, 154202, 2, 154201, '230701000000', '市辖区', '黑龙江,伊春', '128.841147', '47.727536', 1); +INSERT INTO `yx_system_city` VALUES (1119, 154203, 2, 154201, '230702000000', '伊春区', '黑龙江,伊春,伊春', '128.907303', '47.728171', 1); +INSERT INTO `yx_system_city` VALUES (1120, 154252, 2, 154201, '230703000000', '南岔区', '黑龙江,伊春,南岔', '129.283467', '47.138035', 1); +INSERT INTO `yx_system_city` VALUES (1121, 154342, 2, 154201, '230704000000', '友好区', '黑龙江,伊春,友好', '128.840750', '47.853778', 1); +INSERT INTO `yx_system_city` VALUES (1122, 154389, 2, 154201, '230705000000', '西林区', '黑龙江,伊春,西林', '129.312851', '47.480735', 1); +INSERT INTO `yx_system_city` VALUES (1123, 154404, 2, 154201, '230706000000', '翠峦区', '黑龙江,伊春,翠峦', '128.669859', '47.726728', 1); +INSERT INTO `yx_system_city` VALUES (1124, 154434, 2, 154201, '230707000000', '新青区', '黑龙江,伊春,新青', '129.533600', '48.290455', 1); +INSERT INTO `yx_system_city` VALUES (1125, 154473, 2, 154201, '230708000000', '美溪区', '黑龙江,伊春,美溪', '129.129314', '47.635090', 1); +INSERT INTO `yx_system_city` VALUES (1126, 154511, 2, 154201, '230709000000', '金山屯区', '黑龙江,伊春,金山屯', '129.429117', '47.413074', 1); +INSERT INTO `yx_system_city` VALUES (1127, 154547, 2, 154201, '230710000000', '五营区', '黑龙江,伊春,五营', '129.245344', '48.107910', 1); +INSERT INTO `yx_system_city` VALUES (1128, 154579, 2, 154201, '230711000000', '乌马河区', '黑龙江,伊春,乌马河', '128.799478', '47.727687', 1); +INSERT INTO `yx_system_city` VALUES (1129, 154616, 2, 154201, '230712000000', '汤旺河区', '黑龙江,伊春,汤旺河', '129.571108', '48.454651', 1); +INSERT INTO `yx_system_city` VALUES (1130, 154659, 2, 154201, '230713000000', '带岭区', '黑龙江,伊春,带岭', '129.020793', '47.028397', 1); +INSERT INTO `yx_system_city` VALUES (1131, 154695, 2, 154201, '230714000000', '乌伊岭区', '黑龙江,伊春,乌伊岭', '129.437920', '48.590323', 1); +INSERT INTO `yx_system_city` VALUES (1132, 154729, 2, 154201, '230715000000', '红星区', '黑龙江,伊春,红星', '129.390983', '48.239432', 1); +INSERT INTO `yx_system_city` VALUES (1133, 154759, 2, 154201, '230716000000', '上甘岭区', '黑龙江,伊春,上甘岭', '129.024260', '47.974708', 1); +INSERT INTO `yx_system_city` VALUES (1134, 154793, 2, 154201, '230722000000', '嘉荫县', '黑龙江,伊春,嘉荫', '130.403564', '48.889109', 1); +INSERT INTO `yx_system_city` VALUES (1135, 154899, 2, 154201, '230781000000', '铁力市', '黑龙江,伊春,铁力', '128.032422', '46.986640', 1); +INSERT INTO `yx_system_city` VALUES (1136, 155077, 2, 155076, '230801000000', '市辖区', '黑龙江,佳木斯', '130.318917', '46.799922', 1); +INSERT INTO `yx_system_city` VALUES (1137, 155078, 2, 155076, '230803000000', '向阳区', '黑龙江,佳木斯,向阳', '130.365346', '46.807790', 1); +INSERT INTO `yx_system_city` VALUES (1138, 155166, 2, 155076, '230804000000', '前进区', '黑龙江,佳木斯,前进', '130.375063', '46.814103', 1); +INSERT INTO `yx_system_city` VALUES (1139, 155191, 2, 155076, '230805000000', '东风区', '黑龙江,佳木斯,东风', '130.403664', '46.822572', 1); +INSERT INTO `yx_system_city` VALUES (1140, 155254, 2, 155076, '230811000000', '郊区', '黑龙江,佳木斯,郊区', '130.327195', '46.810086', 1); +INSERT INTO `yx_system_city` VALUES (1141, 155435, 2, 155076, '230822000000', '桦南县', '黑龙江,佳木斯,桦南', '130.553343', '46.239185', 1); +INSERT INTO `yx_system_city` VALUES (1142, 155702, 2, 155076, '230826000000', '桦川县', '黑龙江,佳木斯,桦川', '130.719081', '47.023001', 1); +INSERT INTO `yx_system_city` VALUES (1143, 155838, 2, 155076, '230828000000', '汤原县', '黑龙江,佳木斯,汤原', '129.905072', '46.730706', 1); +INSERT INTO `yx_system_city` VALUES (1144, 156034, 2, 155076, '230881000000', '同江市', '黑龙江,佳木斯,同江', '132.510919', '47.642707', 1); +INSERT INTO `yx_system_city` VALUES (1145, 156209, 2, 155076, '230882000000', '富锦市', '黑龙江,佳木斯,富锦', '132.037686', '47.250108', 1); +INSERT INTO `yx_system_city` VALUES (1146, 156599, 2, 155076, '230883000000', '抚远市', '黑龙江,佳木斯,抚远', '134.307884', '48.364687', 1); +INSERT INTO `yx_system_city` VALUES (1147, 156714, 2, 156713, '230901000000', '市辖区', '黑龙江,七台河', '131.003138', '45.771726', 1); +INSERT INTO `yx_system_city` VALUES (1148, 156715, 2, 156713, '230902000000', '新兴区', '黑龙江,七台河,新兴', '130.932143', '45.815930', 1); +INSERT INTO `yx_system_city` VALUES (1149, 156815, 2, 156713, '230903000000', '桃山区', '黑龙江,七台河,桃山', '131.020275', '45.765594', 1); +INSERT INTO `yx_system_city` VALUES (1150, 156865, 2, 156713, '230904000000', '茄子河区', '黑龙江,七台河,茄子河', '131.068075', '45.785215', 1); +INSERT INTO `yx_system_city` VALUES (1151, 156956, 2, 156713, '230921000000', '勃利县', '黑龙江,七台河,勃利', '130.592093', '45.755507', 1); +INSERT INTO `yx_system_city` VALUES (1152, 157131, 2, 157130, '231001000000', '市辖区', '黑龙江,牡丹江', '129.633168', '44.551653', 1); +INSERT INTO `yx_system_city` VALUES (1153, 157132, 2, 157130, '231002000000', '东安区', '黑龙江,牡丹江,东安', '129.626642', '44.581360', 1); +INSERT INTO `yx_system_city` VALUES (1154, 157170, 2, 157130, '231003000000', '阳明区', '黑龙江,牡丹江,阳明', '129.635615', '44.596104', 1); +INSERT INTO `yx_system_city` VALUES (1155, 157273, 2, 157130, '231004000000', '爱民区', '黑龙江,牡丹江,爱民', '129.591657', '44.596053', 1); +INSERT INTO `yx_system_city` VALUES (1156, 157321, 2, 157130, '231005000000', '西安区', '黑龙江,牡丹江,西安', '129.616121', '44.577625', 1); +INSERT INTO `yx_system_city` VALUES (1157, 157406, 2, 157130, '231025000000', '林口县', '黑龙江,牡丹江,林口', '130.284033', '45.278046', 1); +INSERT INTO `yx_system_city` VALUES (1158, 157646, 2, 157130, '231081000000', '绥芬河市', '黑龙江,牡丹江,绥芬河', '131.152546', '44.412309', 1); +INSERT INTO `yx_system_city` VALUES (1159, 157678, 2, 157130, '231083000000', '海林市', '黑龙江,牡丹江,海林', '129.380482', '44.594213', 1); +INSERT INTO `yx_system_city` VALUES (1160, 157911, 2, 157130, '231084000000', '宁安市', '黑龙江,牡丹江,宁安', '129.482851', '44.340720', 1); +INSERT INTO `yx_system_city` VALUES (1161, 158233, 2, 157130, '231085000000', '穆棱市', '黑龙江,牡丹江,穆棱', '130.524437', '44.918813', 1); +INSERT INTO `yx_system_city` VALUES (1162, 158470, 2, 157130, '231086000000', '东宁市', '黑龙江,牡丹江,东宁', '131.122915', '44.087585', 1); +INSERT INTO `yx_system_city` VALUES (1163, 158624, 2, 158623, '231101000000', '市辖区', '黑龙江,黑河', '127.528560', '50.245329', 1); +INSERT INTO `yx_system_city` VALUES (1164, 158625, 2, 158623, '231102000000', '爱辉区', '黑龙江,黑河,爱辉', '127.500451', '50.252106', 1); +INSERT INTO `yx_system_city` VALUES (1165, 158797, 2, 158623, '231121000000', '嫩江县', '黑龙江,黑河,嫩江', '125.221192', '49.185766', 1); +INSERT INTO `yx_system_city` VALUES (1166, 159105, 2, 158623, '231123000000', '逊克县', '黑龙江,黑河,逊克', '128.478750', '49.564252', 1); +INSERT INTO `yx_system_city` VALUES (1167, 159220, 2, 158623, '231124000000', '孙吴县', '黑龙江,黑河,孙吴', '127.336304', '49.425652', 1); +INSERT INTO `yx_system_city` VALUES (1168, 159359, 2, 158623, '231181000000', '北安市', '黑龙江,黑河,北安', '126.491199', '48.241374', 1); +INSERT INTO `yx_system_city` VALUES (1169, 159526, 2, 158623, '231182000000', '五大连池市', '黑龙江,黑河,五大连池', '126.205516', '48.517257', 1); +INSERT INTO `yx_system_city` VALUES (1170, 159770, 2, 159769, '231201000000', '市辖区', '黑龙江,绥化', '126.968887', '46.653845', 1); +INSERT INTO `yx_system_city` VALUES (1171, 159771, 2, 159769, '231202000000', '北林区', '黑龙江,绥化,北林', '126.985593', '46.637344', 1); +INSERT INTO `yx_system_city` VALUES (1172, 159985, 2, 159769, '231221000000', '望奎县', '黑龙江,绥化,望奎', '126.486076', '46.832719', 1); +INSERT INTO `yx_system_city` VALUES (1173, 160128, 2, 159769, '231222000000', '兰西县', '黑龙江,绥化,兰西', '126.288113', '46.252447', 1); +INSERT INTO `yx_system_city` VALUES (1174, 160271, 2, 159769, '231223000000', '青冈县', '黑龙江,绥化,青冈', '126.113860', '46.689671', 1); +INSERT INTO `yx_system_city` VALUES (1175, 160478, 2, 159769, '231224000000', '庆安县', '黑龙江,绥化,庆安', '127.507825', '46.880102', 1); +INSERT INTO `yx_system_city` VALUES (1176, 160610, 2, 159769, '231225000000', '明水县', '黑龙江,绥化,明水', '125.906301', '47.173426', 1); +INSERT INTO `yx_system_city` VALUES (1177, 160744, 2, 159769, '231226000000', '绥棱县', '黑龙江,绥化,绥棱', '127.114832', '47.236015', 1); +INSERT INTO `yx_system_city` VALUES (1178, 160910, 2, 159769, '231281000000', '安达市', '黑龙江,绥化,安达', '125.352188', '46.423508', 1); +INSERT INTO `yx_system_city` VALUES (1179, 161079, 2, 159769, '231282000000', '肇东市', '黑龙江,绥化,肇东', '125.961814', '46.051126', 1); +INSERT INTO `yx_system_city` VALUES (1180, 161331, 2, 159769, '231283000000', '海伦市', '黑龙江,绥化,海伦', '126.973143', '47.461971', 1); +INSERT INTO `yx_system_city` VALUES (1181, 161652, 2, 161651, '232721000000', '呼玛县', '黑龙江,大兴安岭,呼玛', '126.665319', '51.725637', 1); +INSERT INTO `yx_system_city` VALUES (1182, 161720, 2, 161651, '232722000000', '塔河县', '黑龙江,大兴安岭,塔河', '124.709996', '52.334457', 1); +INSERT INTO `yx_system_city` VALUES (1183, 161754, 2, 161651, '232723000000', '漠河县', '黑龙江,大兴安岭,漠河', '122.538592', '52.972272', 1); +INSERT INTO `yx_system_city` VALUES (1184, 161794, 2, 161793, '310101000000', '黄浦区', '上海,黄浦', '121.484443', '31.231763', 1); +INSERT INTO `yx_system_city` VALUES (1185, 161988, 2, 161793, '310104000000', '徐汇区', '上海,徐汇', '121.436525', '31.188523', 1); +INSERT INTO `yx_system_city` VALUES (1186, 162309, 2, 161793, '310105000000', '长宁区', '上海,长宁', '121.424624', '31.220367', 1); +INSERT INTO `yx_system_city` VALUES (1187, 162505, 2, 161793, '310106000000', '静安区', '上海,静安', '121.459384', '31.247105', 1); +INSERT INTO `yx_system_city` VALUES (1188, 162794, 2, 161793, '310107000000', '普陀区', '上海,普陀', '121.395555', '31.249840', 1); +INSERT INTO `yx_system_city` VALUES (1189, 163069, 2, 161793, '310109000000', '虹口区', '上海,虹口', '121.505133', '31.264600', 1); +INSERT INTO `yx_system_city` VALUES (1190, 163290, 2, 161793, '310110000000', '杨浦区', '上海,杨浦', '121.526077', '31.259541', 1); +INSERT INTO `yx_system_city` VALUES (1191, 163621, 2, 161793, '310112000000', '闵行区', '上海,闵行', '121.381709', '31.112813', 1); +INSERT INTO `yx_system_city` VALUES (1192, 164194, 2, 161793, '310113000000', '宝山区', '上海,宝山', '121.489612', '31.405457', 1); +INSERT INTO `yx_system_city` VALUES (1193, 164682, 2, 161793, '310114000000', '嘉定区', '上海,嘉定', '121.265300', '31.375602', 1); +INSERT INTO `yx_system_city` VALUES (1194, 165026, 2, 161793, '310115000000', '浦东新区', '上海,浦东', '121.544379', '31.221517', 1); +INSERT INTO `yx_system_city` VALUES (1195, 166350, 2, 161793, '310116000000', '金山区', '上海,金山', '121.341970', '30.741991', 1); +INSERT INTO `yx_system_city` VALUES (1196, 166585, 2, 161793, '310117000000', '松江区', '上海,松江', '121.227747', '31.032243', 1); +INSERT INTO `yx_system_city` VALUES (1197, 166927, 2, 161793, '310118000000', '青浦区', '上海,青浦', '121.124178', '31.150681', 1); +INSERT INTO `yx_system_city` VALUES (1198, 167228, 2, 161793, '310120000000', '奉贤区', '上海,奉贤', '121.474042', '30.917795', 1); +INSERT INTO `yx_system_city` VALUES (1199, 167533, 2, 161793, '310151000000', '崇明区', '上海,崇明', '121.473701', '31.230416', 1); +INSERT INTO `yx_system_city` VALUES (1200, 167906, 2, 167905, '320101000000', '市辖区', '江苏,南京', '118.796877', '32.060255', 1); +INSERT INTO `yx_system_city` VALUES (1201, 167907, 2, 167905, '320102000000', '玄武区', '江苏,南京,玄武', '118.797861', '32.048687', 1); +INSERT INTO `yx_system_city` VALUES (1202, 167974, 2, 167905, '320104000000', '秦淮区', '江苏,南京,秦淮', '118.794744', '32.039133', 1); +INSERT INTO `yx_system_city` VALUES (1203, 168104, 2, 167905, '320105000000', '建邺区', '江苏,南京,建邺', '118.731694', '32.003552', 1); +INSERT INTO `yx_system_city` VALUES (1204, 168174, 2, 167905, '320106000000', '鼓楼区', '江苏,南京,鼓楼', '118.769790', '32.066336', 1); +INSERT INTO `yx_system_city` VALUES (1205, 168310, 2, 167905, '320111000000', '浦口区', '江苏,南京,浦口', '118.627895', '32.059093', 1); +INSERT INTO `yx_system_city` VALUES (1206, 168451, 2, 167905, '320113000000', '栖霞区', '江苏,南京,栖霞', '118.909246', '32.096228', 1); +INSERT INTO `yx_system_city` VALUES (1207, 168604, 2, 167905, '320114000000', '雨花台区', '江苏,南京,雨花台', '118.779073', '31.991347', 1); +INSERT INTO `yx_system_city` VALUES (1208, 168704, 2, 167905, '320115000000', '江宁区', '江苏,南京,江宁', '118.839685', '31.953702', 1); +INSERT INTO `yx_system_city` VALUES (1209, 168925, 2, 167905, '320116000000', '六合区', '江苏,南京,六合', '118.821401', '32.322247', 1); +INSERT INTO `yx_system_city` VALUES (1210, 169096, 2, 167905, '320117000000', '溧水区', '江苏,南京,溧水', '119.028296', '31.651125', 1); +INSERT INTO `yx_system_city` VALUES (1211, 169214, 2, 167905, '320118000000', '高淳区', '江苏,南京,高淳', '118.892085', '31.328471', 1); +INSERT INTO `yx_system_city` VALUES (1212, 169376, 2, 169375, '320201000000', '市辖区', '江苏,无锡', '120.311910', '31.491169', 1); +INSERT INTO `yx_system_city` VALUES (1213, 169377, 2, 169375, '320205000000', '锡山区', '江苏,无锡,锡山', '120.357858', '31.589715', 1); +INSERT INTO `yx_system_city` VALUES (1214, 169507, 2, 169375, '320206000000', '惠山区', '江苏,无锡,惠山', '120.298500', '31.681012', 1); +INSERT INTO `yx_system_city` VALUES (1215, 169628, 2, 169375, '320211000000', '滨湖区', '江苏,无锡,滨湖', '120.282692', '31.527954', 1); +INSERT INTO `yx_system_city` VALUES (1216, 169751, 2, 169375, '320213000000', '梁溪区', '江苏,无锡,梁溪', '120.296591', '31.575719', 1); +INSERT INTO `yx_system_city` VALUES (1217, 169924, 2, 169375, '320214000000', '新吴区', '江苏,无锡,新吴', '120.352778', '31.550957', 1); +INSERT INTO `yx_system_city` VALUES (1218, 170064, 2, 169375, '320281000000', '江阴市', '江苏,无锡,江阴', '120.284939', '31.920658', 1); +INSERT INTO `yx_system_city` VALUES (1219, 170390, 2, 169375, '320282000000', '宜兴市', '江苏,无锡,宜兴', '119.823308', '31.340637', 1); +INSERT INTO `yx_system_city` VALUES (1220, 170725, 2, 170724, '320301000000', '市辖区', '江苏,徐州', '117.284124', '34.205768', 1); +INSERT INTO `yx_system_city` VALUES (1221, 170726, 2, 170724, '320302000000', '鼓楼区', '江苏,徐州,鼓楼', '117.185591', '34.288511', 1); +INSERT INTO `yx_system_city` VALUES (1222, 170800, 2, 170724, '320303000000', '云龙区', '江苏,徐州,云龙', '117.251560', '34.253167', 1); +INSERT INTO `yx_system_city` VALUES (1223, 170886, 2, 170724, '320305000000', '贾汪区', '江苏,徐州,贾汪', '117.466687', '34.435506', 1); +INSERT INTO `yx_system_city` VALUES (1224, 171049, 2, 170724, '320311000000', '泉山区', '江苏,徐州,泉山', '117.193805', '34.244258', 1); +INSERT INTO `yx_system_city` VALUES (1225, 171182, 2, 170724, '320312000000', '铜山区', '江苏,徐州,铜山', '117.169421', '34.180700', 1); +INSERT INTO `yx_system_city` VALUES (1226, 171537, 2, 170724, '320321000000', '丰县', '江苏,徐州,丰县', '116.595391', '34.693906', 1); +INSERT INTO `yx_system_city` VALUES (1227, 171966, 2, 170724, '320322000000', '沛县', '江苏,徐州,沛县', '116.937532', '34.721656', 1); +INSERT INTO `yx_system_city` VALUES (1228, 172381, 2, 170724, '320324000000', '睢宁县', '江苏,徐州,睢宁', '117.941563', '33.912598', 1); +INSERT INTO `yx_system_city` VALUES (1229, 172804, 2, 170724, '320381000000', '新沂市', '江苏,徐州,新沂', '118.354537', '34.369580', 1); +INSERT INTO `yx_system_city` VALUES (1230, 173105, 2, 170724, '320382000000', '邳州市', '江苏,徐州,邳州', '118.012531', '34.338888', 1); +INSERT INTO `yx_system_city` VALUES (1231, 173636, 2, 173635, '320401000000', '市辖区', '江苏,常州', '119.973987', '31.810689', 1); +INSERT INTO `yx_system_city` VALUES (1232, 173637, 2, 173635, '320402000000', '天宁区', '江苏,常州,天宁', '119.974991', '31.779619', 1); +INSERT INTO `yx_system_city` VALUES (1233, 173773, 2, 173635, '320404000000', '钟楼区', '江苏,常州,钟楼', '119.902112', '31.802192', 1); +INSERT INTO `yx_system_city` VALUES (1234, 173891, 2, 173635, '320411000000', '新北区', '江苏,常州,新北', '119.972182', '31.830641', 1); +INSERT INTO `yx_system_city` VALUES (1235, 174038, 2, 173635, '320412000000', '武进区', '江苏,常州,武进', '119.942437', '31.701188', 1); +INSERT INTO `yx_system_city` VALUES (1236, 174347, 2, 173635, '320413000000', '金坛区', '江苏,常州,金坛', '119.597897', '31.723247', 1); +INSERT INTO `yx_system_city` VALUES (1237, 174508, 2, 173635, '320481000000', '溧阳市', '江苏,常州,溧阳', '119.484211', '31.416911', 1); +INSERT INTO `yx_system_city` VALUES (1238, 174765, 2, 174764, '320501000000', '市辖区', '江苏,苏州', '120.585315', '31.298886', 1); +INSERT INTO `yx_system_city` VALUES (1239, 174766, 2, 174764, '320505000000', '虎丘区', '江苏,苏州,虎丘', '120.566833', '31.294845', 1); +INSERT INTO `yx_system_city` VALUES (1240, 174872, 2, 174764, '320506000000', '吴中区', '江苏,苏州,吴中', '120.631898', '31.264212', 1); +INSERT INTO `yx_system_city` VALUES (1241, 175088, 2, 174764, '320507000000', '相城区', '江苏,苏州,相城', '120.642663', '31.369088', 1); +INSERT INTO `yx_system_city` VALUES (1242, 175247, 2, 174764, '320508000000', '姑苏区', '江苏,苏州,姑苏', '120.617296', '31.336392', 1); +INSERT INTO `yx_system_city` VALUES (1243, 175444, 2, 174764, '320509000000', '吴江区', '江苏,苏州,吴江', '120.645158', '31.138677', 1); +INSERT INTO `yx_system_city` VALUES (1244, 175765, 2, 174764, '320581000000', '常熟市', '江苏,苏州,常熟', '120.752481', '31.654376', 1); +INSERT INTO `yx_system_city` VALUES (1245, 176120, 2, 174764, '320582000000', '张家港市', '江苏,苏州,张家港', '120.553200', '31.870405', 1); +INSERT INTO `yx_system_city` VALUES (1246, 176424, 2, 174764, '320583000000', '昆山市', '江苏,苏州,昆山', '120.980737', '31.385598', 1); +INSERT INTO `yx_system_city` VALUES (1247, 176763, 2, 174764, '320585000000', '太仓市', '江苏,苏州,太仓', '121.130550', '31.457735', 1); +INSERT INTO `yx_system_city` VALUES (1248, 176921, 2, 176920, '320601000000', '市辖区', '江苏,南通', '120.894291', '31.980171', 1); +INSERT INTO `yx_system_city` VALUES (1249, 176922, 2, 176920, '320602000000', '崇川区', '江苏,南通,崇川', '120.857434', '32.009875', 1); +INSERT INTO `yx_system_city` VALUES (1250, 177040, 2, 176920, '320611000000', '港闸区', '江苏,南通,港闸', '120.818527', '32.032442', 1); +INSERT INTO `yx_system_city` VALUES (1251, 177119, 2, 176920, '320612000000', '通州区', '江苏,南通,通州', '121.075087', '32.064161', 1); +INSERT INTO `yx_system_city` VALUES (1252, 177415, 2, 176920, '320621000000', '海安县', '江苏,南通,海安', '120.467370', '32.533549', 1); +INSERT INTO `yx_system_city` VALUES (1253, 177665, 2, 176920, '320623000000', '如东县', '江苏,南通,如东', '121.185201', '32.331766', 1); +INSERT INTO `yx_system_city` VALUES (1254, 177946, 2, 176920, '320681000000', '启东市', '江苏,南通,启东', '121.657441', '31.808026', 1); +INSERT INTO `yx_system_city` VALUES (1255, 178291, 2, 176920, '320682000000', '如皋市', '江苏,南通,如皋', '120.574946', '32.370557', 1); +INSERT INTO `yx_system_city` VALUES (1256, 178669, 2, 176920, '320684000000', '海门市', '江苏,南通,海门', '121.181615', '31.871173', 1); +INSERT INTO `yx_system_city` VALUES (1257, 179000, 2, 178999, '320701000000', '市辖区', '江苏,连云港', '119.221611', '34.596653', 1); +INSERT INTO `yx_system_city` VALUES (1258, 179001, 2, 178999, '320703000000', '连云区', '江苏,连云港,连云', '119.338788', '34.760249', 1); +INSERT INTO `yx_system_city` VALUES (1259, 179081, 2, 178999, '320706000000', '海州区', '江苏,连云港,海州', '119.193710', '34.606756', 1); +INSERT INTO `yx_system_city` VALUES (1260, 179296, 2, 178999, '320707000000', '赣榆区', '江苏,连云港,赣榆', '119.173331', '34.841349', 1); +INSERT INTO `yx_system_city` VALUES (1261, 179786, 2, 178999, '320722000000', '东海县', '江苏,连云港,东海', '118.752842', '34.542309', 1); +INSERT INTO `yx_system_city` VALUES (1262, 180136, 2, 178999, '320723000000', '灌云县', '江苏,连云港,灌云', '119.239381', '34.284381', 1); +INSERT INTO `yx_system_city` VALUES (1263, 180493, 2, 178999, '320724000000', '灌南县', '江苏,连云港,灌南', '119.315651', '34.087135', 1); +INSERT INTO `yx_system_city` VALUES (1264, 180744, 2, 180743, '320801000000', '市辖区', '江苏,淮安', '119.015285', '33.610353', 1); +INSERT INTO `yx_system_city` VALUES (1265, 180745, 2, 180743, '320803000000', '淮安区', '江苏,淮安,淮安', '119.141099', '33.502869', 1); +INSERT INTO `yx_system_city` VALUES (1266, 181117, 2, 180743, '320804000000', '淮阴区', '江苏,淮安,淮阴', '119.034725', '33.631893', 1); +INSERT INTO `yx_system_city` VALUES (1267, 181401, 2, 180743, '320812000000', '清江浦区', '江苏,淮安,清江浦', '119.028099', '33.624341', 1); +INSERT INTO `yx_system_city` VALUES (1268, 181547, 2, 180743, '320813000000', '洪泽区', '江苏,淮安,洪泽', '119.015285', '33.610353', 1); +INSERT INTO `yx_system_city` VALUES (1269, 181681, 2, 180743, '320826000000', '涟水县', '江苏,淮安,涟水', '119.260335', '33.780960', 1); +INSERT INTO `yx_system_city` VALUES (1270, 182092, 2, 180743, '320830000000', '盱眙县', '江苏,淮安,盱眙', '118.544360', '33.011971', 1); +INSERT INTO `yx_system_city` VALUES (1271, 182372, 2, 180743, '320831000000', '金湖县', '江苏,淮安,金湖', '119.020585', '33.025433', 1); +INSERT INTO `yx_system_city` VALUES (1272, 182539, 2, 182538, '320901000000', '市辖区', '江苏,盐城', '120.163561', '33.347382', 1); +INSERT INTO `yx_system_city` VALUES (1273, 182540, 2, 182538, '320902000000', '亭湖区', '江苏,盐城,亭湖', '120.197358', '33.390536', 1); +INSERT INTO `yx_system_city` VALUES (1274, 182762, 2, 182538, '320903000000', '盐都区', '江苏,盐城,盐都', '120.153898', '33.338094', 1); +INSERT INTO `yx_system_city` VALUES (1275, 183048, 2, 182538, '320904000000', '大丰区', '江苏,盐城,大丰', '120.500858', '33.200331', 1); +INSERT INTO `yx_system_city` VALUES (1276, 183334, 2, 182538, '320921000000', '响水县', '江苏,盐城,响水', '119.578364', '34.199479', 1); +INSERT INTO `yx_system_city` VALUES (1277, 183510, 2, 182538, '320922000000', '滨海县', '江苏,盐城,滨海', '119.820831', '33.990334', 1); +INSERT INTO `yx_system_city` VALUES (1278, 183829, 2, 182538, '320923000000', '阜宁县', '江苏,盐城,阜宁', '119.802527', '33.759325', 1); +INSERT INTO `yx_system_city` VALUES (1279, 184188, 2, 182538, '320924000000', '射阳县', '江苏,盐城,射阳', '120.258053', '33.774806', 1); +INSERT INTO `yx_system_city` VALUES (1280, 184485, 2, 182538, '320925000000', '建湖县', '江苏,盐城,建湖', '119.798581', '33.464204', 1); +INSERT INTO `yx_system_city` VALUES (1281, 184748, 2, 182538, '320981000000', '东台市', '江苏,盐城,东台', '120.320331', '32.868440', 1); +INSERT INTO `yx_system_city` VALUES (1282, 185202, 2, 185201, '321001000000', '市辖区', '江苏,扬州', '119.412966', '32.394210', 1); +INSERT INTO `yx_system_city` VALUES (1283, 185203, 2, 185201, '321002000000', '广陵区', '江苏,扬州,广陵', '119.431849', '32.394720', 1); +INSERT INTO `yx_system_city` VALUES (1284, 185360, 2, 185201, '321003000000', '邗江区', '江苏,扬州,邗江', '119.398015', '32.377528', 1); +INSERT INTO `yx_system_city` VALUES (1285, 185555, 2, 185201, '321012000000', '江都区', '江苏,扬州,江都', '119.569989', '32.434672', 1); +INSERT INTO `yx_system_city` VALUES (1286, 185905, 2, 185201, '321023000000', '宝应县', '江苏,扬州,宝应', '119.360729', '33.240392', 1); +INSERT INTO `yx_system_city` VALUES (1287, 186203, 2, 185201, '321081000000', '仪征市', '江苏,扬州,仪征', '119.184766', '32.272258', 1); +INSERT INTO `yx_system_city` VALUES (1288, 186414, 2, 185201, '321084000000', '高邮市', '江苏,扬州,高邮', '119.459161', '32.781659', 1); +INSERT INTO `yx_system_city` VALUES (1289, 186658, 2, 186657, '321101000000', '市辖区', '江苏,镇江', '119.425836', '32.187849', 1); +INSERT INTO `yx_system_city` VALUES (1290, 186659, 2, 186657, '321102000000', '京口区', '江苏,镇江,京口', '119.470160', '32.198280', 1); +INSERT INTO `yx_system_city` VALUES (1291, 186734, 2, 186657, '321111000000', '润州区', '江苏,镇江,润州', '119.411945', '32.195333', 1); +INSERT INTO `yx_system_city` VALUES (1292, 186817, 2, 186657, '321112000000', '丹徒区', '江苏,镇江,丹徒', '119.433854', '32.131962', 1); +INSERT INTO `yx_system_city` VALUES (1293, 186919, 2, 186657, '321181000000', '丹阳市', '江苏,镇江,丹阳', '119.606536', '32.010117', 1); +INSERT INTO `yx_system_city` VALUES (1294, 187149, 2, 186657, '321182000000', '扬中市', '江苏,镇江,扬中', '119.797635', '32.234831', 1); +INSERT INTO `yx_system_city` VALUES (1295, 187235, 2, 186657, '321183000000', '句容市', '江苏,镇江,句容', '119.168695', '31.944999', 1); +INSERT INTO `yx_system_city` VALUES (1296, 187442, 2, 187441, '321201000000', '市辖区', '江苏,泰州', '119.923116', '32.455778', 1); +INSERT INTO `yx_system_city` VALUES (1297, 187443, 2, 187441, '321202000000', '海陵区', '江苏,泰州,海陵', '119.919425', '32.491016', 1); +INSERT INTO `yx_system_city` VALUES (1298, 187593, 2, 187441, '321203000000', '高港区', '江苏,泰州,高港', '119.881717', '32.318822', 1); +INSERT INTO `yx_system_city` VALUES (1299, 187693, 2, 187441, '321204000000', '姜堰区', '江苏,泰州,姜堰', '120.127934', '32.509155', 1); +INSERT INTO `yx_system_city` VALUES (1300, 188035, 2, 187441, '321281000000', '兴化市', '江苏,泰州,兴化', '119.852541', '32.910459', 1); +INSERT INTO `yx_system_city` VALUES (1301, 188752, 2, 187441, '321282000000', '靖江市', '江苏,泰州,靖江', '120.277138', '31.982751', 1); +INSERT INTO `yx_system_city` VALUES (1302, 189026, 2, 187441, '321283000000', '泰兴市', '江苏,泰州,泰兴', '120.051744', '32.171854', 1); +INSERT INTO `yx_system_city` VALUES (1303, 189403, 2, 189402, '321301000000', '市辖区', '江苏,宿迁', '118.275198', '33.963232', 1); +INSERT INTO `yx_system_city` VALUES (1304, 189404, 2, 189402, '321302000000', '宿城区', '江苏,宿迁,宿城', '118.242534', '33.963029', 1); +INSERT INTO `yx_system_city` VALUES (1305, 189637, 2, 189402, '321311000000', '宿豫区', '江苏,宿迁,宿豫', '118.330782', '33.946822', 1); +INSERT INTO `yx_system_city` VALUES (1306, 189850, 2, 189402, '321322000000', '沭阳县', '江苏,宿迁,沭阳', '118.804784', '34.111022', 1); +INSERT INTO `yx_system_city` VALUES (1307, 190377, 2, 189402, '321323000000', '泗阳县', '江苏,宿迁,泗阳', '118.703038', '33.723140', 1); +INSERT INTO `yx_system_city` VALUES (1308, 190642, 2, 189402, '321324000000', '泗洪县', '江苏,宿迁,泗洪', '118.223591', '33.476051', 1); +INSERT INTO `yx_system_city` VALUES (1309, 191021, 2, 191020, '330101000000', '市辖区', '浙江,杭州', '120.155070', '30.274084', 1); +INSERT INTO `yx_system_city` VALUES (1310, 191022, 2, 191020, '330102000000', '上城区', '浙江,杭州,上城', '120.169329', '30.242312', 1); +INSERT INTO `yx_system_city` VALUES (1311, 191083, 2, 191020, '330103000000', '下城区', '浙江,杭州,下城', '120.180895', '30.281714', 1); +INSERT INTO `yx_system_city` VALUES (1312, 191166, 2, 191020, '330104000000', '江干区', '浙江,杭州,江干', '120.205001', '30.257012', 1); +INSERT INTO `yx_system_city` VALUES (1313, 191360, 2, 191020, '330105000000', '拱墅区', '浙江,杭州,拱墅', '120.141406', '30.319037', 1); +INSERT INTO `yx_system_city` VALUES (1314, 191479, 2, 191020, '330106000000', '西湖区', '浙江,杭州,西湖', '120.130203', '30.259324', 1); +INSERT INTO `yx_system_city` VALUES (1315, 191693, 2, 191020, '330108000000', '滨江区', '浙江,杭州,滨江', '120.211816', '30.208560', 1); +INSERT INTO `yx_system_city` VALUES (1316, 191756, 2, 191020, '330109000000', '萧山区', '浙江,杭州,萧山', '120.264253', '30.183806', 1); +INSERT INTO `yx_system_city` VALUES (1317, 192388, 2, 191020, '330110000000', '余杭区', '浙江,杭州,余杭', '120.299402', '30.419045', 1); +INSERT INTO `yx_system_city` VALUES (1318, 192753, 2, 191020, '330111000000', '富阳区', '浙江,杭州,富阳', '119.960076', '30.048692', 1); +INSERT INTO `yx_system_city` VALUES (1319, 193085, 2, 191020, '330122000000', '桐庐县', '浙江,杭州,桐庐', '119.691434', '29.793535', 1); +INSERT INTO `yx_system_city` VALUES (1320, 193304, 2, 191020, '330127000000', '淳安县', '浙江,杭州,淳安', '119.041864', '29.608772', 1); +INSERT INTO `yx_system_city` VALUES (1321, 193766, 2, 191020, '330182000000', '建德市', '浙江,杭州,建德', '119.281164', '29.474871', 1); +INSERT INTO `yx_system_city` VALUES (1322, 194060, 2, 191020, '330185000000', '临安市', '浙江,杭州,临安', '119.724733', '30.233873', 1); +INSERT INTO `yx_system_city` VALUES (1323, 194396, 2, 194395, '330201000000', '市辖区', '浙江,宁波', '121.550357', '29.874556', 1); +INSERT INTO `yx_system_city` VALUES (1324, 194397, 2, 194395, '330203000000', '海曙区', '浙江,宁波,海曙', '121.551066', '29.859772', 1); +INSERT INTO `yx_system_city` VALUES (1325, 194484, 2, 194395, '330204000000', '江东区', '浙江,宁波,江东', '121.570383', '29.866819', 1); +INSERT INTO `yx_system_city` VALUES (1326, 194568, 2, 194395, '330205000000', '江北区', '浙江,宁波,江北', '121.555227', '29.886757', 1); +INSERT INTO `yx_system_city` VALUES (1327, 194747, 2, 194395, '330206000000', '北仑区', '浙江,宁波,北仑', '121.844618', '29.899044', 1); +INSERT INTO `yx_system_city` VALUES (1328, 195023, 2, 194395, '330211000000', '镇海区', '浙江,宁波,镇海', '121.716540', '29.948998', 1); +INSERT INTO `yx_system_city` VALUES (1329, 195132, 2, 194395, '330212000000', '鄞州区', '浙江,宁波,鄞州', '121.546603', '29.816511', 1); +INSERT INTO `yx_system_city` VALUES (1330, 195703, 2, 194395, '330225000000', '象山县', '浙江,宁波,象山', '121.869339', '29.476705', 1); +INSERT INTO `yx_system_city` VALUES (1331, 196257, 2, 194395, '330226000000', '宁海县', '浙江,宁波,宁海', '121.429477', '29.287939', 1); +INSERT INTO `yx_system_city` VALUES (1332, 196686, 2, 194395, '330281000000', '余姚市', '浙江,宁波,余姚', '121.154634', '30.037192', 1); +INSERT INTO `yx_system_city` VALUES (1333, 197031, 2, 194395, '330282000000', '慈溪市', '浙江,宁波,慈溪', '121.266579', '30.169665', 1); +INSERT INTO `yx_system_city` VALUES (1334, 197440, 2, 194395, '330283000000', '奉化市', '浙江,宁波,奉化', '121.406995', '29.655143', 1); +INSERT INTO `yx_system_city` VALUES (1335, 197851, 2, 197850, '330301000000', '市辖区', '浙江,温州', '120.699366', '27.994267', 1); +INSERT INTO `yx_system_city` VALUES (1336, 197852, 2, 197850, '330302000000', '鹿城区', '浙江,温州,鹿城', '120.655135', '28.015455', 1); +INSERT INTO `yx_system_city` VALUES (1337, 198091, 2, 197850, '330303000000', '龙湾区', '浙江,温州,龙湾', '120.811213', '27.932747', 1); +INSERT INTO `yx_system_city` VALUES (1338, 198210, 2, 197850, '330304000000', '瓯海区', '浙江,温州,瓯海', '120.614910', '27.966844', 1); +INSERT INTO `yx_system_city` VALUES (1339, 198508, 2, 197850, '330305000000', '洞头区', '浙江,温州,洞头', '121.157249', '27.836154', 1); +INSERT INTO `yx_system_city` VALUES (1340, 198619, 2, 197850, '330324000000', '永嘉县', '浙江,温州,永嘉', '120.682144', '28.150591', 1); +INSERT INTO `yx_system_city` VALUES (1341, 199581, 2, 197850, '330326000000', '平阳县', '浙江,温州,平阳', '120.565793', '27.661918', 1); +INSERT INTO `yx_system_city` VALUES (1342, 200239, 2, 197850, '330327000000', '苍南县', '浙江,温州,苍南', '120.425766', '27.518280', 1); +INSERT INTO `yx_system_city` VALUES (1343, 201140, 2, 197850, '330328000000', '文成县', '浙江,温州,文成', '120.091498', '27.786996', 1); +INSERT INTO `yx_system_city` VALUES (1344, 201556, 2, 197850, '330329000000', '泰顺县', '浙江,温州,泰顺', '119.717649', '27.556884', 1); +INSERT INTO `yx_system_city` VALUES (1345, 201882, 2, 197850, '330381000000', '瑞安市', '浙江,温州,瑞安', '120.655148', '27.778657', 1); +INSERT INTO `yx_system_city` VALUES (1346, 202864, 2, 197850, '330382000000', '乐清市', '浙江,温州,乐清', '120.967147', '28.116083', 1); +INSERT INTO `yx_system_city` VALUES (1347, 203853, 2, 203852, '330401000000', '市辖区', '浙江,嘉兴', '120.755486', '30.746129', 1); +INSERT INTO `yx_system_city` VALUES (1348, 203854, 2, 203852, '330402000000', '南湖区', '浙江,嘉兴,南湖', '120.783025', '30.747842', 1); +INSERT INTO `yx_system_city` VALUES (1349, 204008, 2, 203852, '330411000000', '秀洲区', '浙江,嘉兴,秀洲', '120.709018', '30.765168', 1); +INSERT INTO `yx_system_city` VALUES (1350, 204177, 2, 203852, '330421000000', '嘉善县', '浙江,嘉兴,嘉善', '120.925850', '30.830898', 1); +INSERT INTO `yx_system_city` VALUES (1351, 204341, 2, 203852, '330424000000', '海盐县', '浙江,嘉兴,海盐', '120.946263', '30.526436', 1); +INSERT INTO `yx_system_city` VALUES (1352, 204486, 2, 203852, '330481000000', '海宁市', '浙江,嘉兴,海宁', '120.680757', '30.510659', 1); +INSERT INTO `yx_system_city` VALUES (1353, 204723, 2, 203852, '330482000000', '平湖市', '浙江,嘉兴,平湖', '121.015142', '30.677233', 1); +INSERT INTO `yx_system_city` VALUES (1354, 204877, 2, 203852, '330483000000', '桐乡市', '浙江,嘉兴,桐乡', '120.565099', '30.630173', 1); +INSERT INTO `yx_system_city` VALUES (1355, 205102, 2, 205101, '330501000000', '市辖区', '浙江,湖州', '120.086823', '30.894348', 1); +INSERT INTO `yx_system_city` VALUES (1356, 205103, 2, 205101, '330502000000', '吴兴区', '浙江,湖州,吴兴', '120.185838', '30.857151', 1); +INSERT INTO `yx_system_city` VALUES (1357, 205449, 2, 205101, '330503000000', '南浔区', '浙江,湖州,南浔', '120.418512', '30.849690', 1); +INSERT INTO `yx_system_city` VALUES (1358, 205717, 2, 205101, '330521000000', '德清县', '浙江,湖州,德清', '119.977401', '30.542510', 1); +INSERT INTO `yx_system_city` VALUES (1359, 205910, 2, 205101, '330522000000', '长兴县', '浙江,湖州,长兴', '119.910952', '31.026666', 1); +INSERT INTO `yx_system_city` VALUES (1360, 206213, 2, 205101, '330523000000', '安吉县', '浙江,湖州,安吉', '119.680353', '30.638675', 1); +INSERT INTO `yx_system_city` VALUES (1361, 206439, 2, 206438, '330601000000', '市辖区', '浙江,绍兴', '120.580232', '30.029752', 1); +INSERT INTO `yx_system_city` VALUES (1362, 206440, 2, 206438, '330602000000', '越城区', '浙江,绍兴,越城', '120.582633', '29.988245', 1); +INSERT INTO `yx_system_city` VALUES (1363, 206875, 2, 206438, '330603000000', '柯桥区', '浙江,绍兴,柯桥', '120.495065', '30.081942', 1); +INSERT INTO `yx_system_city` VALUES (1364, 207247, 2, 206438, '330604000000', '上虞区', '浙江,绍兴,上虞', '120.868122', '30.033121', 1); +INSERT INTO `yx_system_city` VALUES (1365, 207715, 2, 206438, '330624000000', '新昌县', '浙江,绍兴,新昌', '120.903866', '29.499832', 1); +INSERT INTO `yx_system_city` VALUES (1366, 208171, 2, 206438, '330681000000', '诸暨市', '浙江,绍兴,诸暨', '120.246863', '29.708692', 1); +INSERT INTO `yx_system_city` VALUES (1367, 208733, 2, 206438, '330683000000', '嵊州市', '浙江,绍兴,嵊州', '120.831025', '29.561410', 1); +INSERT INTO `yx_system_city` VALUES (1368, 209251, 2, 209250, '330701000000', '市辖区', '浙江,金华', '119.647444', '29.079059', 1); +INSERT INTO `yx_system_city` VALUES (1369, 209252, 2, 209250, '330702000000', '婺城区', '浙江,金华,婺城', '119.571633', '29.086221', 1); +INSERT INTO `yx_system_city` VALUES (1370, 209949, 2, 209250, '330703000000', '金东区', '浙江,金华,金东', '119.692862', '29.099122', 1); +INSERT INTO `yx_system_city` VALUES (1371, 210474, 2, 209250, '330723000000', '武义县', '浙江,金华,武义', '119.816318', '28.892721', 1); +INSERT INTO `yx_system_city` VALUES (1372, 211047, 2, 209250, '330726000000', '浦江县', '浙江,金华,浦江', '119.892222', '29.452477', 1); +INSERT INTO `yx_system_city` VALUES (1373, 211492, 2, 209250, '330727000000', '磐安县', '浙江,金华,磐安', '120.450178', '29.054048', 1); +INSERT INTO `yx_system_city` VALUES (1374, 211883, 2, 209250, '330781000000', '兰溪市', '浙江,金华,兰溪', '119.460526', '29.208919', 1); +INSERT INTO `yx_system_city` VALUES (1375, 212256, 2, 209250, '330782000000', '义乌市', '浙江,金华,义乌', '120.075058', '29.306841', 1); +INSERT INTO `yx_system_city` VALUES (1376, 213076, 2, 209250, '330783000000', '东阳市', '浙江,金华,东阳', '120.241566', '29.289648', 1); +INSERT INTO `yx_system_city` VALUES (1377, 213485, 2, 209250, '330784000000', '永康市', '浙江,金华,永康', '120.047651', '28.888555', 1); +INSERT INTO `yx_system_city` VALUES (1378, 214261, 2, 214260, '330801000000', '市辖区', '浙江,衢州', '118.859457', '28.970079', 1); +INSERT INTO `yx_system_city` VALUES (1379, 214262, 2, 214260, '330802000000', '柯城区', '浙江,衢州,柯城', '118.871333', '28.968504', 1); +INSERT INTO `yx_system_city` VALUES (1380, 214536, 2, 214260, '330803000000', '衢江区', '浙江,衢州,衢江', '118.959460', '28.979780', 1); +INSERT INTO `yx_system_city` VALUES (1381, 214843, 2, 214260, '330822000000', '常山县', '浙江,衢州,常山', '118.511287', '28.901343', 1); +INSERT INTO `yx_system_city` VALUES (1382, 215051, 2, 214260, '330824000000', '开化县', '浙江,衢州,开化', '118.415495', '29.137337', 1); +INSERT INTO `yx_system_city` VALUES (1383, 215332, 2, 214260, '330825000000', '龙游县', '浙江,衢州,龙游', '119.172304', '29.028319', 1); +INSERT INTO `yx_system_city` VALUES (1384, 215624, 2, 214260, '330881000000', '江山市', '浙江,衢州,江山', '118.626974', '28.737223', 1); +INSERT INTO `yx_system_city` VALUES (1385, 215956, 2, 215955, '330901000000', '市辖区', '浙江,舟山', '122.207215', '29.985295', 1); +INSERT INTO `yx_system_city` VALUES (1386, 215957, 2, 215955, '330902000000', '定海区', '浙江,舟山,定海', '122.106773', '30.019858', 1); +INSERT INTO `yx_system_city` VALUES (1387, 216139, 2, 215955, '330903000000', '普陀区', '浙江,舟山,普陀', '122.323867', '29.971760', 1); +INSERT INTO `yx_system_city` VALUES (1388, 216290, 2, 215955, '330921000000', '岱山县', '浙江,舟山,岱山', '122.226237', '30.264139', 1); +INSERT INTO `yx_system_city` VALUES (1389, 216394, 2, 215955, '330922000000', '嵊泗县', '浙江,舟山,嵊泗', '122.451382', '30.725686', 1); +INSERT INTO `yx_system_city` VALUES (1390, 216450, 2, 216449, '331001000000', '市辖区', '浙江,台州', '121.420757', '28.656386', 1); +INSERT INTO `yx_system_city` VALUES (1391, 216451, 2, 216449, '331002000000', '椒江区', '浙江,台州,椒江', '121.442676', '28.673726', 1); +INSERT INTO `yx_system_city` VALUES (1392, 216788, 2, 216449, '331003000000', '黄岩区', '浙江,台州,黄岩', '121.261893', '28.650117', 1); +INSERT INTO `yx_system_city` VALUES (1393, 217324, 2, 216449, '331004000000', '路桥区', '浙江,台州,路桥', '121.365123', '28.582655', 1); +INSERT INTO `yx_system_city` VALUES (1394, 217666, 2, 216449, '331021000000', '玉环县', '浙江,台州,玉环', '121.231805', '28.135930', 1); +INSERT INTO `yx_system_city` VALUES (1395, 217998, 2, 216449, '331022000000', '三门县', '浙江,台州,三门', '121.395777', '29.104873', 1); +INSERT INTO `yx_system_city` VALUES (1396, 218534, 2, 216449, '331023000000', '天台县', '浙江,台州,天台', '121.006725', '29.144079', 1); +INSERT INTO `yx_system_city` VALUES (1397, 219162, 2, 216449, '331024000000', '仙居县', '浙江,台州,仙居', '120.735081', '28.849213', 1); +INSERT INTO `yx_system_city` VALUES (1398, 219609, 2, 216449, '331081000000', '温岭市', '浙江,台州,温岭', '121.385604', '28.372506', 1); +INSERT INTO `yx_system_city` VALUES (1399, 220555, 2, 216449, '331082000000', '临海市', '浙江,台州,临海', '121.145047', '28.858457', 1); +INSERT INTO `yx_system_city` VALUES (1400, 221611, 2, 221610, '331101000000', '市辖区', '浙江,丽水', '119.922796', '28.467630', 1); +INSERT INTO `yx_system_city` VALUES (1401, 221612, 2, 221610, '331102000000', '莲都区', '浙江,丽水,莲都', '119.912612', '28.445836', 1); +INSERT INTO `yx_system_city` VALUES (1402, 221903, 2, 221610, '331121000000', '青田县', '浙江,丽水,青田', '120.289597', '28.139059', 1); +INSERT INTO `yx_system_city` VALUES (1403, 222380, 2, 221610, '331122000000', '缙云县', '浙江,丽水,缙云', '120.091573', '28.659279', 1); +INSERT INTO `yx_system_city` VALUES (1404, 222658, 2, 221610, '331123000000', '遂昌县', '浙江,丽水,遂昌', '119.276104', '28.592119', 1); +INSERT INTO `yx_system_city` VALUES (1405, 222890, 2, 221610, '331124000000', '松阳县', '浙江,丽水,松阳', '119.482015', '28.449171', 1); +INSERT INTO `yx_system_city` VALUES (1406, 223324, 2, 221610, '331125000000', '云和县', '浙江,丽水,云和', '119.573397', '28.115790', 1); +INSERT INTO `yx_system_city` VALUES (1407, 223512, 2, 221610, '331126000000', '庆元县', '浙江,丽水,庆元', '119.062590', '27.619220', 1); +INSERT INTO `yx_system_city` VALUES (1408, 223885, 2, 221610, '331127000000', '景宁畲族自治县', '浙江,丽水,景宁', '119.635697', '27.973312', 1); +INSERT INTO `yx_system_city` VALUES (1409, 224172, 2, 221610, '331181000000', '龙泉市', '浙江,丽水,龙泉', '119.141461', '28.074623', 1); +INSERT INTO `yx_system_city` VALUES (1410, 224651, 2, 224650, '340101000000', '市辖区', '安徽,合肥', '117.227239', '31.820586', 1); +INSERT INTO `yx_system_city` VALUES (1411, 224652, 2, 224650, '340102000000', '瑶海区', '安徽,合肥,瑶海', '117.309229', '31.858048', 1); +INSERT INTO `yx_system_city` VALUES (1412, 224755, 2, 224650, '340103000000', '庐阳区', '安徽,合肥,庐阳', '117.264595', '31.878641', 1); +INSERT INTO `yx_system_city` VALUES (1413, 224838, 2, 224650, '340104000000', '蜀山区', '安徽,合肥,蜀山', '117.260536', '31.851158', 1); +INSERT INTO `yx_system_city` VALUES (1414, 224946, 2, 224650, '340111000000', '包河区', '安徽,合肥,包河', '117.309658', '31.793093', 1); +INSERT INTO `yx_system_city` VALUES (1415, 225062, 2, 224650, '340121000000', '长丰县', '安徽,合肥,长丰', '117.167564', '32.478018', 1); +INSERT INTO `yx_system_city` VALUES (1416, 225352, 2, 224650, '340122000000', '肥东县', '安徽,合肥,肥东', '117.469383', '31.887940', 1); +INSERT INTO `yx_system_city` VALUES (1417, 225705, 2, 224650, '340123000000', '肥西县', '安徽,合肥,肥西', '117.157981', '31.706810', 1); +INSERT INTO `yx_system_city` VALUES (1418, 225998, 2, 224650, '340124000000', '庐江县', '安徽,合肥,庐江', '117.287800', '31.255550', 1); +INSERT INTO `yx_system_city` VALUES (1419, 226249, 2, 224650, '340181000000', '巢湖市', '安徽,合肥,巢湖', '117.861800', '31.598628', 1); +INSERT INTO `yx_system_city` VALUES (1420, 226470, 2, 226469, '340201000000', '市辖区', '安徽,芜湖', '118.432941', '31.352859', 1); +INSERT INTO `yx_system_city` VALUES (1421, 226471, 2, 226469, '340202000000', '镜湖区', '安徽,芜湖,镜湖', '118.385146', '31.340404', 1); +INSERT INTO `yx_system_city` VALUES (1422, 226550, 2, 226469, '340203000000', '弋江区', '安徽,芜湖,弋江', '118.372655', '31.311757', 1); +INSERT INTO `yx_system_city` VALUES (1423, 226612, 2, 226469, '340207000000', '鸠江区', '安徽,芜湖,鸠江', '118.391734', '31.369373', 1); +INSERT INTO `yx_system_city` VALUES (1424, 226735, 2, 226469, '340208000000', '三山区', '安徽,芜湖,三山', '118.268101', '31.219568', 1); +INSERT INTO `yx_system_city` VALUES (1425, 226786, 2, 226469, '340221000000', '芜湖县', '安徽,芜湖,芜湖', '118.576124', '31.134809', 1); +INSERT INTO `yx_system_city` VALUES (1426, 226891, 2, 226469, '340222000000', '繁昌县', '安徽,芜湖,繁昌', '118.201349', '31.080896', 1); +INSERT INTO `yx_system_city` VALUES (1427, 226995, 2, 226469, '340223000000', '南陵县', '安徽,芜湖,南陵', '118.334360', '30.914923', 1); +INSERT INTO `yx_system_city` VALUES (1428, 227183, 2, 226469, '340225000000', '无为县', '安徽,芜湖,无为', '117.902366', '31.303168', 1); +INSERT INTO `yx_system_city` VALUES (1429, 227483, 2, 227482, '340301000000', '市辖区', '安徽,蚌埠', '117.389719', '32.916287', 1); +INSERT INTO `yx_system_city` VALUES (1430, 227484, 2, 227482, '340302000000', '龙子湖区', '安徽,蚌埠,龙子湖', '117.393790', '32.943014', 1); +INSERT INTO `yx_system_city` VALUES (1431, 227551, 2, 227482, '340303000000', '蚌山区', '安徽,蚌埠,蚌山', '117.367614', '32.944198', 1); +INSERT INTO `yx_system_city` VALUES (1432, 227598, 2, 227482, '340304000000', '禹会区', '安徽,蚌埠,禹会', '117.342451', '32.929711', 1); +INSERT INTO `yx_system_city` VALUES (1433, 227677, 2, 227482, '340311000000', '淮上区', '安徽,蚌埠,淮上', '117.359331', '32.965435', 1); +INSERT INTO `yx_system_city` VALUES (1434, 227769, 2, 227482, '340321000000', '怀远县', '安徽,蚌埠,怀远', '117.205234', '32.970031', 1); +INSERT INTO `yx_system_city` VALUES (1435, 228155, 2, 227482, '340322000000', '五河县', '安徽,蚌埠,五河', '117.879486', '33.127823', 1); +INSERT INTO `yx_system_city` VALUES (1436, 228388, 2, 227482, '340323000000', '固镇县', '安徽,蚌埠,固镇', '117.316955', '33.316899', 1); +INSERT INTO `yx_system_city` VALUES (1437, 228631, 2, 228630, '340401000000', '市辖区', '安徽,淮南', '116.999932', '32.625478', 1); +INSERT INTO `yx_system_city` VALUES (1438, 228632, 2, 228630, '340402000000', '大通区', '安徽,淮南,大通', '117.053273', '32.631533', 1); +INSERT INTO `yx_system_city` VALUES (1439, 228710, 2, 228630, '340403000000', '田家庵区', '安徽,淮南,田家庵', '117.017409', '32.647155', 1); +INSERT INTO `yx_system_city` VALUES (1440, 228853, 2, 228630, '340404000000', '谢家集区', '安徽,淮南,谢家集', '116.859048', '32.599901', 1); +INSERT INTO `yx_system_city` VALUES (1441, 228960, 2, 228630, '340405000000', '八公山区', '安徽,淮南,八公山', '116.833490', '32.631379', 1); +INSERT INTO `yx_system_city` VALUES (1442, 229029, 2, 228630, '340406000000', '潘集区', '安徽,淮南,潘集', '116.834716', '32.772080', 1); +INSERT INTO `yx_system_city` VALUES (1443, 229221, 2, 228630, '340421000000', '凤台县', '安徽,淮南,凤台', '116.711051', '32.709445', 1); +INSERT INTO `yx_system_city` VALUES (1444, 229527, 2, 228630, '340422000000', '寿县', '安徽,淮南,寿县', '116.787141', '32.573306', 1); +INSERT INTO `yx_system_city` VALUES (1445, 229845, 2, 229844, '340501000000', '市辖区', '安徽,马鞍山', '118.506759', '31.670452', 1); +INSERT INTO `yx_system_city` VALUES (1446, 229846, 2, 229844, '340503000000', '花山区', '安徽,马鞍山,花山', '118.492562', '31.719710', 1); +INSERT INTO `yx_system_city` VALUES (1447, 229922, 2, 229844, '340504000000', '雨山区', '安徽,马鞍山,雨山', '118.498560', '31.682208', 1); +INSERT INTO `yx_system_city` VALUES (1448, 229992, 2, 229844, '340506000000', '博望区', '安徽,马鞍山,博望', '118.844538', '31.558471', 1); +INSERT INTO `yx_system_city` VALUES (1449, 230041, 2, 229844, '340521000000', '当涂县', '安徽,马鞍山,当涂', '118.497972', '31.571213', 1); +INSERT INTO `yx_system_city` VALUES (1450, 230213, 2, 229844, '340522000000', '含山县', '安徽,马鞍山,含山', '118.101421', '31.735599', 1); +INSERT INTO `yx_system_city` VALUES (1451, 230345, 2, 229844, '340523000000', '和县', '安徽,马鞍山,和县', '118.351405', '31.741794', 1); +INSERT INTO `yx_system_city` VALUES (1452, 230477, 2, 230476, '340601000000', '市辖区', '安徽,淮北', '116.798265', '33.955844', 1); +INSERT INTO `yx_system_city` VALUES (1453, 230478, 2, 230476, '340602000000', '杜集区', '安徽,淮北,杜集', '116.828134', '33.991451', 1); +INSERT INTO `yx_system_city` VALUES (1454, 230539, 2, 230476, '340603000000', '相山区', '安徽,淮北,相山', '116.794345', '33.959893', 1); +INSERT INTO `yx_system_city` VALUES (1455, 230648, 2, 230476, '340604000000', '烈山区', '安徽,淮北,烈山', '116.813042', '33.895139', 1); +INSERT INTO `yx_system_city` VALUES (1456, 230720, 2, 230476, '340621000000', '濉溪县', '安徽,淮北,濉溪', '116.766299', '33.915477', 1); +INSERT INTO `yx_system_city` VALUES (1457, 230982, 2, 230981, '340701000000', '市辖区', '安徽,铜陵', '117.812079', '30.945429', 1); +INSERT INTO `yx_system_city` VALUES (1458, 230983, 2, 230981, '340705000000', '铜官区', '安徽,铜陵,铜官', '117.816174', '30.927608', 1); +INSERT INTO `yx_system_city` VALUES (1459, 231043, 2, 230981, '340706000000', '义安区', '安徽,铜陵,义安', '117.791544', '30.952823', 1); +INSERT INTO `yx_system_city` VALUES (1460, 231171, 2, 230981, '340711000000', '郊区', '安徽,铜陵,郊区', '117.807070', '30.908927', 1); +INSERT INTO `yx_system_city` VALUES (1461, 231216, 2, 230981, '340722000000', '枞阳县', '安徽,铜陵,枞阳', '117.220200', '30.700733', 1); +INSERT INTO `yx_system_city` VALUES (1462, 231500, 2, 231499, '340801000000', '市辖区', '安徽,安庆', '117.063754', '30.543494', 1); +INSERT INTO `yx_system_city` VALUES (1463, 231501, 2, 231499, '340802000000', '迎江区', '安徽,安庆,迎江', '117.091150', '30.511548', 1); +INSERT INTO `yx_system_city` VALUES (1464, 231558, 2, 231499, '340803000000', '大观区', '安徽,安庆,大观', '117.021670', '30.553957', 1); +INSERT INTO `yx_system_city` VALUES (1465, 231646, 2, 231499, '340811000000', '宜秀区', '安徽,安庆,宜秀', '117.070003', '30.541323', 1); +INSERT INTO `yx_system_city` VALUES (1466, 231710, 2, 231499, '340822000000', '怀宁县', '安徽,安庆,怀宁', '116.829475', '30.733825', 1); +INSERT INTO `yx_system_city` VALUES (1467, 231974, 2, 231499, '340824000000', '潜山县', '安徽,安庆,潜山', '116.581270', '30.631129', 1); +INSERT INTO `yx_system_city` VALUES (1468, 232180, 2, 231499, '340825000000', '太湖县', '安徽,安庆,太湖', '116.308795', '30.454220', 1); +INSERT INTO `yx_system_city` VALUES (1469, 232386, 2, 231499, '340826000000', '宿松县', '安徽,安庆,宿松', '116.129105', '30.153746', 1); +INSERT INTO `yx_system_city` VALUES (1470, 232631, 2, 231499, '340827000000', '望江县', '安徽,安庆,望江', '116.694183', '30.124428', 1); +INSERT INTO `yx_system_city` VALUES (1471, 232781, 2, 231499, '340828000000', '岳西县', '安徽,安庆,岳西', '116.359921', '30.849442', 1); +INSERT INTO `yx_system_city` VALUES (1472, 232996, 2, 231499, '340881000000', '桐城市', '安徽,安庆,桐城', '116.974120', '31.035800', 1); +INSERT INTO `yx_system_city` VALUES (1473, 233237, 2, 233236, '341001000000', '市辖区', '安徽,黄山', '118.337481', '29.714655', 1); +INSERT INTO `yx_system_city` VALUES (1474, 233238, 2, 233236, '341002000000', '屯溪区', '安徽,黄山,屯溪', '118.315329', '29.696109', 1); +INSERT INTO `yx_system_city` VALUES (1475, 233321, 2, 233236, '341003000000', '黄山区', '安徽,黄山,黄山', '118.141568', '30.272942', 1); +INSERT INTO `yx_system_city` VALUES (1476, 233423, 2, 233236, '341004000000', '徽州区', '安徽,黄山,徽州', '118.336751', '29.827279', 1); +INSERT INTO `yx_system_city` VALUES (1477, 233487, 2, 233236, '341021000000', '歙县', '安徽,黄山,歙县', '118.415356', '29.861308', 1); +INSERT INTO `yx_system_city` VALUES (1478, 233714, 2, 233236, '341022000000', '休宁县', '安徽,黄山,休宁', '118.199179', '29.789095', 1); +INSERT INTO `yx_system_city` VALUES (1479, 233894, 2, 233236, '341023000000', '黟县', '安徽,黄山,黟县', '117.938373', '29.924805', 1); +INSERT INTO `yx_system_city` VALUES (1480, 233973, 2, 233236, '341024000000', '祁门县', '安徽,黄山,祁门', '117.717396', '29.854055', 1); +INSERT INTO `yx_system_city` VALUES (1481, 234110, 2, 234109, '341101000000', '市辖区', '安徽,滁州', '118.317106', '32.301556', 1); +INSERT INTO `yx_system_city` VALUES (1482, 234111, 2, 234109, '341102000000', '琅琊区', '安徽,滁州,琅琊', '118.305843', '32.294530', 1); +INSERT INTO `yx_system_city` VALUES (1483, 234174, 2, 234109, '341103000000', '南谯区', '安徽,滁州,南谯', '118.296955', '32.329842', 1); +INSERT INTO `yx_system_city` VALUES (1484, 234274, 2, 234109, '341122000000', '来安县', '安徽,滁州,来安', '118.435792', '32.452172', 1); +INSERT INTO `yx_system_city` VALUES (1485, 234434, 2, 234109, '341124000000', '全椒县', '安徽,滁州,全椒', '118.273090', '32.085407', 1); +INSERT INTO `yx_system_city` VALUES (1486, 234560, 2, 234109, '341125000000', '定远县', '安徽,滁州,定远', '117.698563', '32.530982', 1); +INSERT INTO `yx_system_city` VALUES (1487, 234847, 2, 234109, '341126000000', '凤阳县', '安徽,滁州,凤阳', '117.531623', '32.874735', 1); +INSERT INTO `yx_system_city` VALUES (1488, 235112, 2, 234109, '341181000000', '天长市', '安徽,滁州,天长', '119.004817', '32.667571', 1); +INSERT INTO `yx_system_city` VALUES (1489, 235305, 2, 234109, '341182000000', '明光市', '安徽,滁州,明光', '118.018276', '32.781995', 1); +INSERT INTO `yx_system_city` VALUES (1490, 235484, 2, 235483, '341201000000', '市辖区', '安徽,阜阳', '115.814204', '32.890124', 1); +INSERT INTO `yx_system_city` VALUES (1491, 235485, 2, 235483, '341202000000', '颍州区', '安徽,阜阳,颍州', '115.806942', '32.883468', 1); +INSERT INTO `yx_system_city` VALUES (1492, 235646, 2, 235483, '341203000000', '颍东区', '安徽,阜阳,颍东', '115.856687', '32.912478', 1); +INSERT INTO `yx_system_city` VALUES (1493, 235778, 2, 235483, '341204000000', '颍泉区', '安徽,阜阳,颍泉', '115.808327', '32.924918', 1); +INSERT INTO `yx_system_city` VALUES (1494, 235909, 2, 235483, '341221000000', '临泉县', '安徽,阜阳,临泉', '115.261473', '33.040261', 1); +INSERT INTO `yx_system_city` VALUES (1495, 236338, 2, 235483, '341222000000', '太和县', '安徽,阜阳,太和', '115.621934', '33.160326', 1); +INSERT INTO `yx_system_city` VALUES (1496, 236685, 2, 235483, '341225000000', '阜南县', '安徽,阜阳,阜南', '115.595644', '32.658297', 1); +INSERT INTO `yx_system_city` VALUES (1497, 237046, 2, 235483, '341226000000', '颍上县', '安徽,阜阳,颍上', '116.256789', '32.653255', 1); +INSERT INTO `yx_system_city` VALUES (1498, 237428, 2, 235483, '341282000000', '界首市', '安徽,阜阳,界首', '115.374564', '33.257013', 1); +INSERT INTO `yx_system_city` VALUES (1499, 237608, 2, 237607, '341301000000', '市辖区', '安徽,宿州', '116.964356', '33.646373', 1); +INSERT INTO `yx_system_city` VALUES (1500, 237609, 2, 237607, '341302000000', '埇桥区', '安徽,宿州,埇桥', '116.977463', '33.640061', 1); +INSERT INTO `yx_system_city` VALUES (1501, 238022, 2, 237607, '341321000000', '砀山县', '安徽,宿州,砀山', '116.367095', '34.442561', 1); +INSERT INTO `yx_system_city` VALUES (1502, 238207, 2, 237607, '341322000000', '萧县', '安徽,宿州,萧县', '116.947290', '34.188728', 1); +INSERT INTO `yx_system_city` VALUES (1503, 238533, 2, 237607, '341323000000', '灵璧县', '安徽,宿州,灵璧', '117.552462', '33.552998', 1); +INSERT INTO `yx_system_city` VALUES (1504, 238872, 2, 237607, '341324000000', '泗县', '安徽,宿州,泗县', '117.910629', '33.482982', 1); +INSERT INTO `yx_system_city` VALUES (1505, 239085, 2, 239084, '341501000000', '市辖区', '安徽,六安', '116.521854', '31.733699', 1); +INSERT INTO `yx_system_city` VALUES (1506, 239086, 2, 239084, '341502000000', '金安区', '安徽,六安,金安', '116.539679', '31.749265', 1); +INSERT INTO `yx_system_city` VALUES (1507, 239450, 2, 239084, '341503000000', '裕安区', '安徽,六安,裕安', '116.479920', '31.737813', 1); +INSERT INTO `yx_system_city` VALUES (1508, 239780, 2, 239084, '341504000000', '叶集区', '安徽,六安,叶集', '116.521854', '31.733699', 1); +INSERT INTO `yx_system_city` VALUES (1509, 239834, 2, 239084, '341522000000', '霍邱县', '安徽,六安,霍邱', '116.277912', '32.353038', 1); +INSERT INTO `yx_system_city` VALUES (1510, 240310, 2, 239084, '341523000000', '舒城县', '安徽,六安,舒城', '116.948623', '31.462027', 1); +INSERT INTO `yx_system_city` VALUES (1511, 240759, 2, 239084, '341524000000', '金寨县', '安徽,六安,金寨', '115.934366', '31.727170', 1); +INSERT INTO `yx_system_city` VALUES (1512, 241016, 2, 239084, '341525000000', '霍山县', '安徽,六安,霍山', '116.332951', '31.392786', 1); +INSERT INTO `yx_system_city` VALUES (1513, 241181, 2, 241180, '341601000000', '市辖区', '安徽,亳州', '115.778676', '33.844582', 1); +INSERT INTO `yx_system_city` VALUES (1514, 241182, 2, 241180, '341602000000', '谯城区', '安徽,亳州,谯城', '115.779025', '33.876235', 1); +INSERT INTO `yx_system_city` VALUES (1515, 241517, 2, 241180, '341621000000', '涡阳县', '安徽,亳州,涡阳', '116.215665', '33.492921', 1); +INSERT INTO `yx_system_city` VALUES (1516, 241927, 2, 241180, '341622000000', '蒙城县', '安徽,亳州,蒙城', '116.564248', '33.265831', 1); +INSERT INTO `yx_system_city` VALUES (1517, 242245, 2, 241180, '341623000000', '利辛县', '安徽,亳州,利辛', '116.208635', '33.144724', 1); +INSERT INTO `yx_system_city` VALUES (1518, 242635, 2, 242634, '341701000000', '市辖区', '安徽,池州', '117.491568', '30.664800', 1); +INSERT INTO `yx_system_city` VALUES (1519, 242636, 2, 242634, '341702000000', '贵池区', '安徽,池州,贵池', '117.567379', '30.687181', 1); +INSERT INTO `yx_system_city` VALUES (1520, 242888, 2, 242634, '341721000000', '东至县', '安徽,池州,东至', '117.027533', '30.111182', 1); +INSERT INTO `yx_system_city` VALUES (1521, 243159, 2, 242634, '341722000000', '石台县', '安徽,池州,石台', '117.486306', '30.210313', 1); +INSERT INTO `yx_system_city` VALUES (1522, 243254, 2, 242634, '341723000000', '青阳县', '安徽,池州,青阳', '117.847362', '30.639230', 1); +INSERT INTO `yx_system_city` VALUES (1523, 243400, 2, 243399, '341801000000', '市辖区', '安徽,宣城', '118.758816', '30.940718', 1); +INSERT INTO `yx_system_city` VALUES (1524, 243401, 2, 243399, '341802000000', '宣州区', '安徽,宣城,宣州', '118.756328', '30.946319', 1); +INSERT INTO `yx_system_city` VALUES (1525, 243636, 2, 243399, '341821000000', '郎溪县', '安徽,宣城,郎溪', '119.179657', '31.126412', 1); +INSERT INTO `yx_system_city` VALUES (1526, 243753, 2, 243399, '341822000000', '广德县', '安徽,宣城,广德', '119.420935', '30.877555', 1); +INSERT INTO `yx_system_city` VALUES (1527, 243902, 2, 243399, '341823000000', '泾县', '安徽,宣城,泾县', '118.419864', '30.688578', 1); +INSERT INTO `yx_system_city` VALUES (1528, 244058, 2, 243399, '341824000000', '绩溪县', '安徽,宣城,绩溪', '118.578519', '30.067533', 1); +INSERT INTO `yx_system_city` VALUES (1529, 244153, 2, 243399, '341825000000', '旌德县', '安徽,宣城,旌德', '118.540487', '30.286350', 1); +INSERT INTO `yx_system_city` VALUES (1530, 244232, 2, 243399, '341881000000', '宁国市', '安徽,宣城,宁国', '118.982915', '30.633571', 1); +INSERT INTO `yx_system_city` VALUES (1531, 244379, 2, 244378, '350101000000', '市辖区', '福建,福州', '119.296494', '26.074507', 1); +INSERT INTO `yx_system_city` VALUES (1532, 244380, 2, 244378, '350102000000', '鼓楼区', '福建,福州,鼓楼', '119.303822', '26.082294', 1); +INSERT INTO `yx_system_city` VALUES (1533, 244460, 2, 244378, '350103000000', '台江区', '福建,福州,台江', '119.314054', '26.052842', 1); +INSERT INTO `yx_system_city` VALUES (1534, 244523, 2, 244378, '350104000000', '仓山区', '福建,福州,仓山', '119.273546', '26.046744', 1); +INSERT INTO `yx_system_city` VALUES (1535, 244713, 2, 244378, '350105000000', '马尾区', '福建,福州,马尾', '119.455589', '25.989500', 1); +INSERT INTO `yx_system_city` VALUES (1536, 244793, 2, 244378, '350111000000', '晋安区', '福建,福州,晋安', '119.328515', '26.082105', 1); +INSERT INTO `yx_system_city` VALUES (1537, 244987, 2, 244378, '350121000000', '闽侯县', '福建,福州,闽侯', '119.131725', '26.150047', 1); +INSERT INTO `yx_system_city` VALUES (1538, 245329, 2, 244378, '350122000000', '连江县', '福建,福州,连江', '119.539704', '26.197364', 1); +INSERT INTO `yx_system_city` VALUES (1539, 245633, 2, 244378, '350123000000', '罗源县', '福建,福州,罗源', '119.549776', '26.489559', 1); +INSERT INTO `yx_system_city` VALUES (1540, 245845, 2, 244378, '350124000000', '闽清县', '福建,福州,闽清', '118.863361', '26.221198', 1); +INSERT INTO `yx_system_city` VALUES (1541, 246154, 2, 244378, '350125000000', '永泰县', '福建,福州,永泰', '118.932592', '25.866695', 1); +INSERT INTO `yx_system_city` VALUES (1542, 246443, 2, 244378, '350128000000', '平潭县', '福建,福州,平潭', '119.790168', '25.498720', 1); +INSERT INTO `yx_system_city` VALUES (1543, 246667, 2, 244378, '350181000000', '福清市', '福建,福州,福清', '119.384334', '25.721143', 1); +INSERT INTO `yx_system_city` VALUES (1544, 247200, 2, 244378, '350182000000', '长乐市', '福建,福州,长乐', '119.523266', '25.962888', 1); +INSERT INTO `yx_system_city` VALUES (1545, 247479, 2, 247478, '350201000000', '市辖区', '福建,厦门', '118.089425', '24.479833', 1); +INSERT INTO `yx_system_city` VALUES (1546, 247480, 2, 247478, '350203000000', '思明区', '福建,厦门,思明', '118.082658', '24.445567', 1); +INSERT INTO `yx_system_city` VALUES (1547, 247590, 2, 247478, '350205000000', '海沧区', '福建,厦门,海沧', '118.032818', '24.484503', 1); +INSERT INTO `yx_system_city` VALUES (1548, 247641, 2, 247478, '350206000000', '湖里区', '福建,厦门,湖里', '118.146769', '24.512905', 1); +INSERT INTO `yx_system_city` VALUES (1549, 247704, 2, 247478, '350211000000', '集美区', '福建,厦门,集美', '118.097337', '24.575970', 1); +INSERT INTO `yx_system_city` VALUES (1550, 247782, 2, 247478, '350212000000', '同安区', '福建,厦门,同安', '118.152149', '24.722747', 1); +INSERT INTO `yx_system_city` VALUES (1551, 247933, 2, 247478, '350213000000', '翔安区', '福建,厦门,翔安', '118.248034', '24.618544', 1); +INSERT INTO `yx_system_city` VALUES (1552, 248060, 2, 248059, '350301000000', '市辖区', '福建,莆田', '119.007777', '25.454084', 1); +INSERT INTO `yx_system_city` VALUES (1553, 248061, 2, 248059, '350302000000', '城厢区', '福建,莆田,城厢', '118.993885', '25.419319', 1); +INSERT INTO `yx_system_city` VALUES (1554, 248189, 2, 248059, '350303000000', '涵江区', '福建,莆田,涵江', '119.116290', '25.458720', 1); +INSERT INTO `yx_system_city` VALUES (1555, 248403, 2, 248059, '350304000000', '荔城区', '福建,莆田,荔城', '119.015123', '25.431979', 1); +INSERT INTO `yx_system_city` VALUES (1556, 248540, 2, 248059, '350305000000', '秀屿区', '福建,莆田,秀屿', '119.105528', '25.318672', 1); +INSERT INTO `yx_system_city` VALUES (1557, 248753, 2, 248059, '350322000000', '仙游县', '福建,莆田,仙游', '118.691601', '25.362094', 1); +INSERT INTO `yx_system_city` VALUES (1558, 249099, 2, 249098, '350401000000', '市辖区', '福建,三明', '117.638678', '26.263406', 1); +INSERT INTO `yx_system_city` VALUES (1559, 249100, 2, 249098, '350402000000', '梅列区', '福建,三明,梅列', '117.645856', '26.271711', 1); +INSERT INTO `yx_system_city` VALUES (1560, 249157, 2, 249098, '350403000000', '三元区', '福建,三明,三元', '117.608045', '26.234020', 1); +INSERT INTO `yx_system_city` VALUES (1561, 249245, 2, 249098, '350421000000', '明溪县', '福建,三明,明溪', '117.201847', '26.357379', 1); +INSERT INTO `yx_system_city` VALUES (1562, 249351, 2, 249098, '350423000000', '清流县', '福建,三明,清流', '116.816909', '26.177797', 1); +INSERT INTO `yx_system_city` VALUES (1563, 249484, 2, 249098, '350424000000', '宁化县', '福建,三明,宁化', '116.654365', '26.261754', 1); +INSERT INTO `yx_system_city` VALUES (1564, 249728, 2, 249098, '350425000000', '大田县', '福建,三明,大田', '117.847115', '25.692699', 1); +INSERT INTO `yx_system_city` VALUES (1565, 250026, 2, 249098, '350426000000', '尤溪县', '福建,三明,尤溪', '118.190467', '26.170171', 1); +INSERT INTO `yx_system_city` VALUES (1566, 250307, 2, 249098, '350427000000', '沙县', '福建,三明,沙县', '117.792450', '26.397300', 1); +INSERT INTO `yx_system_city` VALUES (1567, 250512, 2, 249098, '350428000000', '将乐县', '福建,三明,将乐', '117.471373', '26.728953', 1); +INSERT INTO `yx_system_city` VALUES (1568, 250680, 2, 249098, '350429000000', '泰宁县', '福建,三明,泰宁', '117.175740', '26.900259', 1); +INSERT INTO `yx_system_city` VALUES (1569, 250809, 2, 249098, '350430000000', '建宁县', '福建,三明,建宁', '116.846084', '26.830902', 1); +INSERT INTO `yx_system_city` VALUES (1570, 250920, 2, 249098, '350481000000', '永安市', '福建,三明,永安', '117.365053', '25.941937', 1); +INSERT INTO `yx_system_city` VALUES (1571, 251198, 2, 251197, '350501000000', '市辖区', '福建,泉州', '118.675675', '24.874132', 1); +INSERT INTO `yx_system_city` VALUES (1572, 251199, 2, 251197, '350502000000', '鲤城区', '福建,泉州,鲤城', '118.586884', '24.907581', 1); +INSERT INTO `yx_system_city` VALUES (1573, 251289, 2, 251197, '350503000000', '丰泽区', '福建,泉州,丰泽', '118.613173', '24.891173', 1); +INSERT INTO `yx_system_city` VALUES (1574, 251376, 2, 251197, '350504000000', '洛江区', '福建,泉州,洛江', '118.671193', '24.939796', 1); +INSERT INTO `yx_system_city` VALUES (1575, 251470, 2, 251197, '350505000000', '泉港区', '福建,泉州,泉港', '118.916309', '25.119815', 1); +INSERT INTO `yx_system_city` VALUES (1576, 251580, 2, 251197, '350521000000', '惠安县', '福建,泉州,惠安', '118.796605', '25.030781', 1); +INSERT INTO `yx_system_city` VALUES (1577, 251897, 2, 251197, '350524000000', '安溪县', '福建,泉州,安溪', '118.186289', '25.055955', 1); +INSERT INTO `yx_system_city` VALUES (1578, 252406, 2, 251197, '350525000000', '永春县', '福建,泉州,永春', '118.294048', '25.321565', 1); +INSERT INTO `yx_system_city` VALUES (1579, 252665, 2, 251197, '350526000000', '德化县', '福建,泉州,德化', '118.241094', '25.491494', 1); +INSERT INTO `yx_system_city` VALUES (1580, 252894, 2, 251197, '350527000000', '金门县', '福建,泉州,金门', '118.317089', '24.432706', 1); +INSERT INTO `yx_system_city` VALUES (1581, 252895, 2, 251197, '350581000000', '石狮市', '福建,泉州,石狮', '118.648066', '24.732204', 1); +INSERT INTO `yx_system_city` VALUES (1582, 253032, 2, 251197, '350582000000', '晋江市', '福建,泉州,晋江', '118.552365', '24.781681', 1); +INSERT INTO `yx_system_city` VALUES (1583, 253454, 2, 251197, '350583000000', '南安市', '福建,泉州,南安', '118.386279', '24.960385', 1); +INSERT INTO `yx_system_city` VALUES (1584, 253906, 2, 253905, '350601000000', '市辖区', '福建,漳州', '117.647481', '24.512948', 1); +INSERT INTO `yx_system_city` VALUES (1585, 253907, 2, 253905, '350602000000', '芗城区', '福建,漳州,芗城', '117.653975', '24.510900', 1); +INSERT INTO `yx_system_city` VALUES (1586, 254093, 2, 253905, '350603000000', '龙文区', '福建,漳州,龙文', '117.709755', '24.503113', 1); +INSERT INTO `yx_system_city` VALUES (1587, 254170, 2, 253905, '350622000000', '云霄县', '福建,漳州,云霄', '117.339573', '23.957936', 1); +INSERT INTO `yx_system_city` VALUES (1588, 254394, 2, 253905, '350623000000', '漳浦县', '福建,漳州,漳浦', '117.613808', '24.117102', 1); +INSERT INTO `yx_system_city` VALUES (1589, 254747, 2, 253905, '350624000000', '诏安县', '福建,漳州,诏安', '117.175185', '23.711579', 1); +INSERT INTO `yx_system_city` VALUES (1590, 255011, 2, 253905, '350625000000', '长泰县', '福建,漳州,长泰', '117.759153', '24.625449', 1); +INSERT INTO `yx_system_city` VALUES (1591, 255105, 2, 253905, '350626000000', '东山县', '福建,漳州,东山', '117.430061', '23.701262', 1); +INSERT INTO `yx_system_city` VALUES (1592, 255190, 2, 253905, '350627000000', '南靖县', '福建,漳州,南靖', '117.357321', '24.514654', 1); +INSERT INTO `yx_system_city` VALUES (1593, 255405, 2, 253905, '350628000000', '平和县', '福建,漳州,平和', '117.314891', '24.363437', 1); +INSERT INTO `yx_system_city` VALUES (1594, 255680, 2, 253905, '350629000000', '华安县', '福建,漳州,华安', '117.534103', '25.004425', 1); +INSERT INTO `yx_system_city` VALUES (1595, 255789, 2, 253905, '350681000000', '龙海市', '福建,漳州,龙海', '117.818197', '24.446706', 1); +INSERT INTO `yx_system_city` VALUES (1596, 256113, 2, 256112, '350701000000', '市辖区', '福建,南平', '118.177708', '26.641768', 1); +INSERT INTO `yx_system_city` VALUES (1597, 256114, 2, 256112, '350702000000', '延平区', '福建,南平,延平', '118.181894', '26.637457', 1); +INSERT INTO `yx_system_city` VALUES (1598, 256452, 2, 256112, '350703000000', '建阳区', '福建,南平,建阳', '118.120464', '27.331876', 1); +INSERT INTO `yx_system_city` VALUES (1599, 256687, 2, 256112, '350721000000', '顺昌县', '福建,南平,顺昌', '117.810357', '26.793288', 1); +INSERT INTO `yx_system_city` VALUES (1600, 256849, 2, 256112, '350722000000', '浦城县', '福建,南平,浦城', '118.541256', '27.917263', 1); +INSERT INTO `yx_system_city` VALUES (1601, 257172, 2, 256112, '350723000000', '光泽县', '福建,南平,光泽', '117.334106', '27.540988', 1); +INSERT INTO `yx_system_city` VALUES (1602, 257276, 2, 256112, '350724000000', '松溪县', '福建,南平,松溪', '118.785468', '27.526232', 1); +INSERT INTO `yx_system_city` VALUES (1603, 257395, 2, 256112, '350725000000', '政和县', '福建,南平,政和', '118.857642', '27.366104', 1); +INSERT INTO `yx_system_city` VALUES (1604, 257539, 2, 256112, '350781000000', '邵武市', '福建,南平,邵武', '117.492534', '27.340327', 1); +INSERT INTO `yx_system_city` VALUES (1605, 257733, 2, 256112, '350782000000', '武夷山市', '福建,南平,武夷山', '118.035310', '27.756648', 1); +INSERT INTO `yx_system_city` VALUES (1606, 257886, 2, 256112, '350783000000', '建瓯市', '福建,南平,建瓯', '118.304988', '27.022727', 1); +INSERT INTO `yx_system_city` VALUES (1607, 258161, 2, 258160, '350801000000', '市辖区', '福建,龙岩', '117.017536', '25.075123', 1); +INSERT INTO `yx_system_city` VALUES (1608, 258162, 2, 258160, '350802000000', '新罗区', '福建,龙岩,新罗', '117.037264', '25.098292', 1); +INSERT INTO `yx_system_city` VALUES (1609, 258520, 2, 258160, '350803000000', '永定区', '福建,龙岩,永定', '116.732092', '24.723962', 1); +INSERT INTO `yx_system_city` VALUES (1610, 258825, 2, 258160, '350821000000', '长汀县', '福建,龙岩,长汀', '116.357581', '25.833531', 1); +INSERT INTO `yx_system_city` VALUES (1611, 259144, 2, 258160, '350823000000', '上杭县', '福建,龙岩,上杭', '116.420099', '25.049518', 1); +INSERT INTO `yx_system_city` VALUES (1612, 259512, 2, 258160, '350824000000', '武平县', '福建,龙岩,武平', '116.100342', '25.095277', 1); +INSERT INTO `yx_system_city` VALUES (1613, 259749, 2, 258160, '350825000000', '连城县', '福建,龙岩,连城', '116.754473', '25.710539', 1); +INSERT INTO `yx_system_city` VALUES (1614, 260014, 2, 258160, '350881000000', '漳平市', '福建,龙岩,漳平', '117.419998', '25.290185', 1); +INSERT INTO `yx_system_city` VALUES (1615, 260231, 2, 260230, '350901000000', '市辖区', '福建,宁德', '119.547932', '26.665617', 1); +INSERT INTO `yx_system_city` VALUES (1616, 260232, 2, 260230, '350902000000', '蕉城区', '福建,宁德,蕉城', '119.526299', '26.660611', 1); +INSERT INTO `yx_system_city` VALUES (1617, 260575, 2, 260230, '350921000000', '霞浦县', '福建,宁德,霞浦', '120.005643', '26.885204', 1); +INSERT INTO `yx_system_city` VALUES (1618, 260905, 2, 260230, '350922000000', '古田县', '福建,宁德,古田', '118.746284', '26.577837', 1); +INSERT INTO `yx_system_city` VALUES (1619, 261211, 2, 260230, '350923000000', '屏南县', '福建,宁德,屏南', '118.985895', '26.908276', 1); +INSERT INTO `yx_system_city` VALUES (1620, 261382, 2, 260230, '350924000000', '寿宁县', '福建,宁德,寿宁', '119.514987', '27.454479', 1); +INSERT INTO `yx_system_city` VALUES (1621, 261602, 2, 260230, '350925000000', '周宁县', '福建,宁德,周宁', '119.339025', '27.104591', 1); +INSERT INTO `yx_system_city` VALUES (1622, 261759, 2, 260230, '350926000000', '柘荣县', '福建,宁德,柘荣', '119.900609', '27.233933', 1); +INSERT INTO `yx_system_city` VALUES (1623, 261885, 2, 260230, '350981000000', '福安市', '福建,宁德,福安', '119.647770', '27.088049', 1); +INSERT INTO `yx_system_city` VALUES (1624, 262395, 2, 260230, '350982000000', '福鼎市', '福建,宁德,福鼎', '120.216978', '27.324479', 1); +INSERT INTO `yx_system_city` VALUES (1625, 262700, 2, 262699, '360101000000', '市辖区', '江西,南昌', '115.858197', '28.682892', 1); +INSERT INTO `yx_system_city` VALUES (1626, 262701, 2, 262699, '360102000000', '东湖区', '江西,南昌,东湖', '115.899262', '28.685085', 1); +INSERT INTO `yx_system_city` VALUES (1627, 262889, 2, 262699, '360103000000', '西湖区', '江西,南昌,西湖', '115.877233', '28.657595', 1); +INSERT INTO `yx_system_city` VALUES (1628, 263058, 2, 262699, '360104000000', '青云谱区', '江西,南昌,青云谱', '115.925749', '28.621169', 1); +INSERT INTO `yx_system_city` VALUES (1629, 263152, 2, 262699, '360105000000', '湾里区', '江西,南昌,湾里', '115.730847', '28.714796', 1); +INSERT INTO `yx_system_city` VALUES (1630, 263217, 2, 262699, '360111000000', '青山湖区', '江西,南昌,青山湖', '115.962144', '28.682985', 1); +INSERT INTO `yx_system_city` VALUES (1631, 263496, 2, 262699, '360112000000', '新建区', '江西,南昌,新建', '115.815278', '28.692864', 1); +INSERT INTO `yx_system_city` VALUES (1632, 263948, 2, 262699, '360121000000', '南昌县', '江西,南昌,南昌', '115.944304', '28.545602', 1); +INSERT INTO `yx_system_city` VALUES (1633, 264375, 2, 262699, '360123000000', '安义县', '江西,南昌,安义', '115.549247', '28.844507', 1); +INSERT INTO `yx_system_city` VALUES (1634, 264517, 2, 262699, '360124000000', '进贤县', '江西,南昌,进贤', '116.240924', '28.376918', 1); +INSERT INTO `yx_system_city` VALUES (1635, 264863, 2, 264862, '360201000000', '市辖区', '江西,景德镇', '117.178419', '29.268835', 1); +INSERT INTO `yx_system_city` VALUES (1636, 264864, 2, 264862, '360202000000', '昌江区', '江西,景德镇,昌江', '117.183748', '29.273435', 1); +INSERT INTO `yx_system_city` VALUES (1637, 264962, 2, 264862, '360203000000', '珠山区', '江西,景德镇,珠山', '117.202893', '29.299923', 1); +INSERT INTO `yx_system_city` VALUES (1638, 265083, 2, 264862, '360222000000', '浮梁县', '江西,景德镇,浮梁', '117.215086', '29.351681', 1); +INSERT INTO `yx_system_city` VALUES (1639, 265297, 2, 264862, '360281000000', '乐平市', '江西,景德镇,乐平', '117.151796', '28.978440', 1); +INSERT INTO `yx_system_city` VALUES (1640, 265678, 2, 265677, '360301000000', '市辖区', '江西,萍乡', '113.854556', '27.622768', 1); +INSERT INTO `yx_system_city` VALUES (1641, 265679, 2, 265677, '360302000000', '安源区', '江西,萍乡,安源', '113.870730', '27.615202', 1); +INSERT INTO `yx_system_city` VALUES (1642, 265826, 2, 265677, '360313000000', '湘东区', '江西,萍乡,湘东', '113.733047', '27.640075', 1); +INSERT INTO `yx_system_city` VALUES (1643, 265994, 2, 265677, '360321000000', '莲花县', '江西,萍乡,莲花', '113.961465', '27.127669', 1); +INSERT INTO `yx_system_city` VALUES (1644, 266171, 2, 265677, '360322000000', '上栗县', '江西,萍乡,上栗', '113.795311', '27.880302', 1); +INSERT INTO `yx_system_city` VALUES (1645, 266356, 2, 265677, '360323000000', '芦溪县', '江西,萍乡,芦溪', '114.029828', '27.630806', 1); +INSERT INTO `yx_system_city` VALUES (1646, 266522, 2, 266521, '360401000000', '市辖区', '江西,九江', '116.001930', '29.705077', 1); +INSERT INTO `yx_system_city` VALUES (1647, 266523, 2, 266521, '360402000000', '濂溪区', '江西,九江,濂溪', '116.011380', '29.678540', 1); +INSERT INTO `yx_system_city` VALUES (1648, 266665, 2, 266521, '360403000000', '浔阳区', '江西,九江,浔阳', '115.990301', '29.727593', 1); +INSERT INTO `yx_system_city` VALUES (1649, 266781, 2, 266521, '360421000000', '九江县', '江西,九江,九江', '115.911323', '29.608431', 1); +INSERT INTO `yx_system_city` VALUES (1650, 266946, 2, 266521, '360423000000', '武宁县', '江西,九江,武宁', '115.100578', '29.256323', 1); +INSERT INTO `yx_system_city` VALUES (1651, 267168, 2, 266521, '360424000000', '修水县', '江西,九江,修水', '114.546702', '29.026022', 1); +INSERT INTO `yx_system_city` VALUES (1652, 267613, 2, 266521, '360425000000', '永修县', '江西,九江,永修', '115.832453', '29.012297', 1); +INSERT INTO `yx_system_city` VALUES (1653, 267868, 2, 266521, '360426000000', '德安县', '江西,九江,德安', '115.767484', '29.298738', 1); +INSERT INTO `yx_system_city` VALUES (1654, 267982, 2, 266521, '360428000000', '都昌县', '江西,九江,都昌', '116.204099', '29.273194', 1); +INSERT INTO `yx_system_city` VALUES (1655, 268318, 2, 266521, '360429000000', '湖口县', '江西,九江,湖口', '116.251947', '29.731101', 1); +INSERT INTO `yx_system_city` VALUES (1656, 268480, 2, 266521, '360430000000', '彭泽县', '江西,九江,彭泽', '116.549359', '29.896061', 1); +INSERT INTO `yx_system_city` VALUES (1657, 268689, 2, 266521, '360481000000', '瑞昌市', '江西,九江,瑞昌', '115.681337', '29.675874', 1); +INSERT INTO `yx_system_city` VALUES (1658, 268926, 2, 266521, '360482000000', '共青城市', '江西,九江,共青城', '115.808844', '29.248317', 1); +INSERT INTO `yx_system_city` VALUES (1659, 268995, 2, 266521, '360483000000', '庐山市', '江西,九江,庐山', '116.045060', '29.448128', 1); +INSERT INTO `yx_system_city` VALUES (1660, 269108, 2, 269107, '360501000000', '市辖区', '江西,新余', '114.917346', '27.817808', 1); +INSERT INTO `yx_system_city` VALUES (1661, 269109, 2, 269107, '360502000000', '渝水区', '江西,新余,渝水', '114.944646', '27.800387', 1); +INSERT INTO `yx_system_city` VALUES (1662, 269465, 2, 269107, '360521000000', '分宜县', '江西,新余,分宜', '114.692050', '27.814758', 1); +INSERT INTO `yx_system_city` VALUES (1663, 269655, 2, 269654, '360601000000', '市辖区', '江西,鹰潭', '117.069202', '28.260189', 1); +INSERT INTO `yx_system_city` VALUES (1664, 269656, 2, 269654, '360602000000', '月湖区', '江西,鹰潭,月湖', '117.037137', '28.239153', 1); +INSERT INTO `yx_system_city` VALUES (1665, 269746, 2, 269654, '360622000000', '余江县', '江西,鹰潭,余江', '116.822763', '28.206177', 1); +INSERT INTO `yx_system_city` VALUES (1666, 269942, 2, 269654, '360681000000', '贵溪市', '江西,鹰潭,贵溪', '117.245497', '28.292519', 1); +INSERT INTO `yx_system_city` VALUES (1667, 270223, 2, 270222, '360701000000', '市辖区', '江西,赣州', '114.935029', '25.831829', 1); +INSERT INTO `yx_system_city` VALUES (1668, 270224, 2, 270222, '360702000000', '章贡区', '江西,赣州,章贡', '114.921171', '25.817816', 1); +INSERT INTO `yx_system_city` VALUES (1669, 270442, 2, 270222, '360703000000', '南康区', '江西,赣州,南康', '114.765403', '25.661471', 1); +INSERT INTO `yx_system_city` VALUES (1670, 270780, 2, 270222, '360721000000', '赣县', '江西,赣州,赣县', '115.011561', '25.860691', 1); +INSERT INTO `yx_system_city` VALUES (1671, 271095, 2, 270222, '360722000000', '信丰县', '江西,赣州,信丰', '114.922830', '25.386704', 1); +INSERT INTO `yx_system_city` VALUES (1672, 271410, 2, 270222, '360723000000', '大余县', '江西,赣州,大余', '114.362112', '25.401314', 1); +INSERT INTO `yx_system_city` VALUES (1673, 271541, 2, 270222, '360724000000', '上犹县', '江西,赣州,上犹', '114.551138', '25.785172', 1); +INSERT INTO `yx_system_city` VALUES (1674, 271699, 2, 270222, '360725000000', '崇义县', '江西,赣州,崇义', '114.308267', '25.681784', 1); +INSERT INTO `yx_system_city` VALUES (1675, 271848, 2, 270222, '360726000000', '安远县', '江西,赣州,安远', '115.393922', '25.136927', 1); +INSERT INTO `yx_system_city` VALUES (1676, 272033, 2, 270222, '360727000000', '龙南县', '江西,赣州,龙南', '114.789873', '24.911069', 1); +INSERT INTO `yx_system_city` VALUES (1677, 272156, 2, 270222, '360728000000', '定南县', '江西,赣州,定南', '115.027845', '24.784410', 1); +INSERT INTO `yx_system_city` VALUES (1678, 272302, 2, 270222, '360729000000', '全南县', '江西,赣州,全南', '114.530125', '24.742403', 1); +INSERT INTO `yx_system_city` VALUES (1679, 272408, 2, 270222, '360730000000', '宁都县', '江西,赣州,宁都', '116.009472', '26.470116', 1); +INSERT INTO `yx_system_city` VALUES (1680, 272767, 2, 270222, '360731000000', '于都县', '江西,赣州,于都', '115.415508', '25.952069', 1); +INSERT INTO `yx_system_city` VALUES (1681, 273183, 2, 270222, '360732000000', '兴国县', '江西,赣州,兴国', '115.363190', '26.337937', 1); +INSERT INTO `yx_system_city` VALUES (1682, 273525, 2, 270222, '360733000000', '会昌县', '江西,赣州,会昌', '115.786057', '25.600272', 1); +INSERT INTO `yx_system_city` VALUES (1683, 273820, 2, 270222, '360734000000', '寻乌县', '江西,赣州,寻乌', '115.646636', '24.963371', 1); +INSERT INTO `yx_system_city` VALUES (1684, 274020, 2, 270222, '360735000000', '石城县', '江西,赣州,石城', '116.346995', '26.314775', 1); +INSERT INTO `yx_system_city` VALUES (1685, 274184, 2, 270222, '360781000000', '瑞金市', '江西,赣州,瑞金', '116.027135', '25.885555', 1); +INSERT INTO `yx_system_city` VALUES (1686, 274445, 2, 274444, '360801000000', '市辖区', '江西,吉安', '114.992509', '27.113443', 1); +INSERT INTO `yx_system_city` VALUES (1687, 274446, 2, 274444, '360802000000', '吉州区', '江西,吉安,吉州', '114.994764', '27.143801', 1); +INSERT INTO `yx_system_city` VALUES (1688, 274592, 2, 274444, '360803000000', '青原区', '江西,吉安,青原', '115.014812', '27.081977', 1); +INSERT INTO `yx_system_city` VALUES (1689, 274736, 2, 274444, '360821000000', '吉安县', '江西,吉安,吉安', '114.907733', '27.039890', 1); +INSERT INTO `yx_system_city` VALUES (1690, 275105, 2, 274444, '360822000000', '吉水县', '江西,吉安,吉水', '115.135507', '27.229632', 1); +INSERT INTO `yx_system_city` VALUES (1691, 275406, 2, 274444, '360823000000', '峡江县', '江西,吉安,峡江', '115.316566', '27.582901', 1); +INSERT INTO `yx_system_city` VALUES (1692, 275511, 2, 274444, '360824000000', '新干县', '江西,吉安,新干', '115.387052', '27.740192', 1); +INSERT INTO `yx_system_city` VALUES (1693, 275694, 2, 274444, '360825000000', '永丰县', '江西,吉安,永丰', '115.444320', '27.318852', 1); +INSERT INTO `yx_system_city` VALUES (1694, 275956, 2, 274444, '360826000000', '泰和县', '江西,吉安,泰和', '114.908869', '26.789960', 1); +INSERT INTO `yx_system_city` VALUES (1695, 276331, 2, 274444, '360827000000', '遂川县', '江西,吉安,遂川', '114.520537', '26.313737', 1); +INSERT INTO `yx_system_city` VALUES (1696, 276700, 2, 274444, '360828000000', '万安县', '江西,吉安,万安', '114.786182', '26.458254', 1); +INSERT INTO `yx_system_city` VALUES (1697, 276874, 2, 274444, '360829000000', '安福县', '江西,吉安,安福', '114.619893', '27.392874', 1); +INSERT INTO `yx_system_city` VALUES (1698, 277170, 2, 274444, '360830000000', '永新县', '江西,吉安,永新', '114.243096', '26.945002', 1); +INSERT INTO `yx_system_city` VALUES (1699, 277459, 2, 274444, '360881000000', '井冈山市', '江西,吉安,井冈山', '114.289228', '26.748081', 1); +INSERT INTO `yx_system_city` VALUES (1700, 277616, 2, 277615, '360901000000', '市辖区', '江西,宜春', '114.416778', '27.815619', 1); +INSERT INTO `yx_system_city` VALUES (1701, 277617, 2, 277615, '360902000000', '袁州区', '江西,宜春,袁州', '114.424657', '27.798846', 1); +INSERT INTO `yx_system_city` VALUES (1702, 278033, 2, 277615, '360921000000', '奉新县', '江西,宜春,奉新', '115.400491', '28.688423', 1); +INSERT INTO `yx_system_city` VALUES (1703, 278249, 2, 277615, '360922000000', '万载县', '江西,宜春,万载', '114.445523', '28.106004', 1); +INSERT INTO `yx_system_city` VALUES (1704, 278471, 2, 277615, '360923000000', '上高县', '江西,宜春,上高', '114.947594', '28.238509', 1); +INSERT INTO `yx_system_city` VALUES (1705, 278710, 2, 277615, '360924000000', '宜丰县', '江西,宜春,宜丰', '114.803515', '28.393666', 1); +INSERT INTO `yx_system_city` VALUES (1706, 278975, 2, 277615, '360925000000', '靖安县', '江西,宜春,靖安', '115.362629', '28.861479', 1); +INSERT INTO `yx_system_city` VALUES (1707, 279095, 2, 277615, '360926000000', '铜鼓县', '江西,宜春,铜鼓', '114.371172', '28.520770', 1); +INSERT INTO `yx_system_city` VALUES (1708, 279220, 2, 277615, '360981000000', '丰城市', '江西,宜春,丰城', '115.771094', '28.159142', 1); +INSERT INTO `yx_system_city` VALUES (1709, 279845, 2, 277615, '360982000000', '樟树市', '江西,宜春,樟树', '115.546385', '28.054814', 1); +INSERT INTO `yx_system_city` VALUES (1710, 280166, 2, 277615, '360983000000', '高安市', '江西,宜春,高安', '115.375616', '28.417255', 1); +INSERT INTO `yx_system_city` VALUES (1711, 280563, 2, 280562, '361001000000', '市辖区', '江西,抚州', '116.358181', '27.949217', 1); +INSERT INTO `yx_system_city` VALUES (1712, 280564, 2, 280562, '361002000000', '临川区', '江西,抚州,临川', '116.312167', '27.934573', 1); +INSERT INTO `yx_system_city` VALUES (1713, 281098, 2, 280562, '361021000000', '南城县', '江西,抚州,南城', '116.637040', '27.569678', 1); +INSERT INTO `yx_system_city` VALUES (1714, 281285, 2, 280562, '361022000000', '黎川县', '江西,抚州,黎川', '116.907681', '27.282333', 1); +INSERT INTO `yx_system_city` VALUES (1715, 281443, 2, 280562, '361023000000', '南丰县', '江西,抚州,南丰', '116.525725', '27.218445', 1); +INSERT INTO `yx_system_city` VALUES (1716, 281641, 2, 280562, '361024000000', '崇仁县', '江西,抚州,崇仁', '116.061101', '27.764394', 1); +INSERT INTO `yx_system_city` VALUES (1717, 281827, 2, 280562, '361025000000', '乐安县', '江西,抚州,乐安', '115.830481', '27.428765', 1); +INSERT INTO `yx_system_city` VALUES (1718, 282036, 2, 280562, '361026000000', '宜黄县', '江西,抚州,宜黄', '116.222128', '27.546146', 1); +INSERT INTO `yx_system_city` VALUES (1719, 282206, 2, 280562, '361027000000', '金溪县', '江西,抚州,金溪', '116.755058', '27.918959', 1); +INSERT INTO `yx_system_city` VALUES (1720, 282391, 2, 280562, '361028000000', '资溪县', '江西,抚州,资溪', '117.060264', '27.706102', 1); +INSERT INTO `yx_system_city` VALUES (1721, 282482, 2, 280562, '361029000000', '东乡县', '江西,抚州,东乡县', '116.603560', '28.247697', 1); +INSERT INTO `yx_system_city` VALUES (1722, 282684, 2, 280562, '361030000000', '广昌县', '江西,抚州,广昌', '116.325757', '26.837267', 1); +INSERT INTO `yx_system_city` VALUES (1723, 282842, 2, 282841, '361101000000', '市辖区', '江西,上饶', '117.943433', '28.454862', 1); +INSERT INTO `yx_system_city` VALUES (1724, 282843, 2, 282841, '361102000000', '信州区', '江西,上饶,信州', '117.966460', '28.431002', 1); +INSERT INTO `yx_system_city` VALUES (1725, 282978, 2, 282841, '361103000000', '广丰区', '江西,上饶,广丰', '118.191240', '28.436286', 1); +INSERT INTO `yx_system_city` VALUES (1726, 283240, 2, 282841, '361121000000', '上饶县', '江西,上饶,上饶', '117.907850', '28.448983', 1); +INSERT INTO `yx_system_city` VALUES (1727, 283511, 2, 282841, '361123000000', '玉山县', '江西,上饶,玉山', '118.245124', '28.682055', 1); +INSERT INTO `yx_system_city` VALUES (1728, 283769, 2, 282841, '361124000000', '铅山县', '江西,上饶,铅山', '117.709451', '28.315217', 1); +INSERT INTO `yx_system_city` VALUES (1729, 283970, 2, 282841, '361125000000', '横峰县', '江西,上饶,横峰', '117.596452', '28.407118', 1); +INSERT INTO `yx_system_city` VALUES (1730, 284066, 2, 282841, '361126000000', '弋阳县', '江西,上饶,弋阳', '117.449588', '28.378044', 1); +INSERT INTO `yx_system_city` VALUES (1731, 284239, 2, 282841, '361127000000', '余干县', '江西,上饶,余干', '116.695647', '28.702302', 1); +INSERT INTO `yx_system_city` VALUES (1732, 284706, 2, 282841, '361128000000', '鄱阳县', '江西,上饶,鄱阳', '116.699746', '29.011699', 1); +INSERT INTO `yx_system_city` VALUES (1733, 285319, 2, 282841, '361129000000', '万年县', '江西,上饶,万年', '117.058445', '28.694582', 1); +INSERT INTO `yx_system_city` VALUES (1734, 285488, 2, 282841, '361130000000', '婺源县', '江西,上饶,婺源', '117.861798', '29.248086', 1); +INSERT INTO `yx_system_city` VALUES (1735, 285711, 2, 282841, '361181000000', '德兴市', '江西,上饶,德兴', '117.578713', '28.946464', 1); +INSERT INTO `yx_system_city` VALUES (1736, 285862, 2, 285861, '370101000000', '市辖区', '山东,济南', '117.119999', '36.651216', 1); +INSERT INTO `yx_system_city` VALUES (1737, 285863, 2, 285861, '370102000000', '历下区', '山东,济南,历下', '117.076455', '36.666412', 1); +INSERT INTO `yx_system_city` VALUES (1738, 285991, 2, 285861, '370103000000', '市中区', '山东,济南,市中', '116.997777', '36.651474', 1); +INSERT INTO `yx_system_city` VALUES (1739, 286215, 2, 285861, '370104000000', '槐荫区', '山东,济南,槐荫', '116.901224', '36.651441', 1); +INSERT INTO `yx_system_city` VALUES (1740, 286404, 2, 285861, '370105000000', '天桥区', '山东,济南,天桥', '116.987492', '36.678016', 1); +INSERT INTO `yx_system_city` VALUES (1741, 286683, 2, 285861, '370112000000', '历城区', '山东,济南,历城', '117.065237', '36.680017', 1); +INSERT INTO `yx_system_city` VALUES (1742, 287424, 2, 285861, '370113000000', '长清区', '山东,济南,长清', '116.751937', '36.553571', 1); +INSERT INTO `yx_system_city` VALUES (1743, 288084, 2, 285861, '370124000000', '平阴县', '山东,济南,平阴', '116.456187', '36.289265', 1); +INSERT INTO `yx_system_city` VALUES (1744, 288448, 2, 285861, '370125000000', '济阳县', '山东,济南,济阳', '117.173525', '36.978537', 1); +INSERT INTO `yx_system_city` VALUES (1745, 289313, 2, 285861, '370126000000', '商河县', '山东,济南,商河', '117.157183', '37.309045', 1); +INSERT INTO `yx_system_city` VALUES (1746, 290291, 2, 285861, '370181000000', '章丘市', '山东,济南,章丘', '117.526228', '36.681259', 1); +INSERT INTO `yx_system_city` VALUES (1747, 291236, 2, 291235, '370201000000', '市辖区', '山东,青岛', '120.382639', '36.067082', 1); +INSERT INTO `yx_system_city` VALUES (1748, 291237, 2, 291235, '370202000000', '市南区', '山东,青岛,市南', '120.412392', '36.075651', 1); +INSERT INTO `yx_system_city` VALUES (1749, 291313, 2, 291235, '370203000000', '市北区', '山东,青岛,市北', '120.374731', '36.087609', 1); +INSERT INTO `yx_system_city` VALUES (1750, 291468, 2, 291235, '370211000000', '黄岛区', '山东,青岛,黄岛', '120.046190', '35.872664', 1); +INSERT INTO `yx_system_city` VALUES (1751, 292713, 2, 291235, '370212000000', '崂山区', '山东,青岛,崂山', '120.468956', '36.107538', 1); +INSERT INTO `yx_system_city` VALUES (1752, 292879, 2, 291235, '370213000000', '李沧区', '山东,青岛,李沧', '120.432697', '36.145463', 1); +INSERT INTO `yx_system_city` VALUES (1753, 293008, 2, 291235, '370214000000', '城阳区', '山东,青岛,城阳', '120.396310', '36.307064', 1); +INSERT INTO `yx_system_city` VALUES (1754, 293241, 2, 291235, '370281000000', '胶州市', '山东,青岛,胶州', '120.033382', '36.264680', 1); +INSERT INTO `yx_system_city` VALUES (1755, 294138, 2, 291235, '370282000000', '即墨市', '山东,青岛,即墨', '120.447128', '36.389639', 1); +INSERT INTO `yx_system_city` VALUES (1756, 295251, 2, 291235, '370283000000', '平度市', '山东,青岛,平度', '119.988420', '36.776358', 1); +INSERT INTO `yx_system_city` VALUES (1757, 297121, 2, 291235, '370285000000', '莱西市', '山东,青岛,莱西', '120.517690', '36.889084', 1); +INSERT INTO `yx_system_city` VALUES (1758, 298026, 2, 298025, '370301000000', '市辖区', '山东,淄博', '118.054927', '36.813487', 1); +INSERT INTO `yx_system_city` VALUES (1759, 298027, 2, 298025, '370302000000', '淄川区', '山东,淄博,淄川', '117.966723', '36.643452', 1); +INSERT INTO `yx_system_city` VALUES (1760, 298507, 2, 298025, '370303000000', '张店区', '山东,淄博,张店', '118.017913', '36.806674', 1); +INSERT INTO `yx_system_city` VALUES (1761, 298821, 2, 298025, '370304000000', '博山区', '山东,淄博,博山', '117.861677', '36.494721', 1); +INSERT INTO `yx_system_city` VALUES (1762, 299159, 2, 298025, '370305000000', '临淄区', '山东,淄博,临淄', '118.309118', '36.826981', 1); +INSERT INTO `yx_system_city` VALUES (1763, 299652, 2, 298025, '370306000000', '周村区', '山东,淄博,周村', '117.869886', '36.803072', 1); +INSERT INTO `yx_system_city` VALUES (1764, 299919, 2, 298025, '370321000000', '桓台县', '山东,淄博,桓台', '118.097923', '36.959804', 1); +INSERT INTO `yx_system_city` VALUES (1765, 300276, 2, 298025, '370322000000', '高青县', '山东,淄博,高青', '117.826916', '37.171063', 1); +INSERT INTO `yx_system_city` VALUES (1766, 301056, 2, 298025, '370323000000', '沂源县', '山东,淄博,沂源', '118.170856', '36.185038', 1); +INSERT INTO `yx_system_city` VALUES (1767, 301712, 2, 301711, '370401000000', '市辖区', '山东,枣庄', '117.323725', '34.810487', 1); +INSERT INTO `yx_system_city` VALUES (1768, 301713, 2, 301711, '370402000000', '市中区', '山东,枣庄,市中', '117.556123', '34.864114', 1); +INSERT INTO `yx_system_city` VALUES (1769, 301888, 2, 301711, '370403000000', '薛城区', '山东,枣庄,薛城', '117.263164', '34.795063', 1); +INSERT INTO `yx_system_city` VALUES (1770, 302179, 2, 301711, '370404000000', '峄城区', '山东,枣庄,峄城', '117.590816', '34.773263', 1); +INSERT INTO `yx_system_city` VALUES (1771, 302532, 2, 301711, '370405000000', '台儿庄区', '山东,枣庄,台儿庄', '117.733832', '34.562528', 1); +INSERT INTO `yx_system_city` VALUES (1772, 302750, 2, 301711, '370406000000', '山亭区', '山东,枣庄,山亭', '117.461517', '35.099528', 1); +INSERT INTO `yx_system_city` VALUES (1773, 303037, 2, 301711, '370481000000', '滕州市', '山东,枣庄,滕州', '117.165824', '35.114156', 1); +INSERT INTO `yx_system_city` VALUES (1774, 304310, 2, 304309, '370501000000', '市辖区', '山东,东营', '118.674767', '37.434751', 1); +INSERT INTO `yx_system_city` VALUES (1775, 304311, 2, 304309, '370502000000', '东营区', '山东,东营,东营', '118.582184', '37.448963', 1); +INSERT INTO `yx_system_city` VALUES (1776, 304647, 2, 304309, '370503000000', '河口区', '山东,东营,河口', '118.525543', '37.886162', 1); +INSERT INTO `yx_system_city` VALUES (1777, 304845, 2, 304309, '370505000000', '垦利区', '山东,东营,垦利', '118.674767', '37.434751', 1); +INSERT INTO `yx_system_city` VALUES (1778, 305208, 2, 304309, '370522000000', '利津县', '山东,东营,利津', '118.255273', '37.490260', 1); +INSERT INTO `yx_system_city` VALUES (1779, 305747, 2, 304309, '370523000000', '广饶县', '山东,东营,广饶', '118.407107', '37.053555', 1); +INSERT INTO `yx_system_city` VALUES (1780, 306340, 2, 306339, '370601000000', '市辖区', '山东,烟台', '121.447935', '37.463822', 1); +INSERT INTO `yx_system_city` VALUES (1781, 306341, 2, 306339, '370602000000', '芝罘区', '山东,烟台,芝罘', '121.400031', '37.540687', 1); +INSERT INTO `yx_system_city` VALUES (1782, 306496, 2, 306339, '370611000000', '福山区', '山东,烟台,福山', '121.267741', '37.498246', 1); +INSERT INTO `yx_system_city` VALUES (1783, 306743, 2, 306339, '370612000000', '牟平区', '山东,烟台,牟平', '121.600512', '37.386901', 1); +INSERT INTO `yx_system_city` VALUES (1784, 307348, 2, 306339, '370613000000', '莱山区', '山东,烟台,莱山', '121.445151', '37.511361', 1); +INSERT INTO `yx_system_city` VALUES (1785, 307481, 2, 306339, '370634000000', '长岛县', '山东,烟台,长岛', '120.736580', '37.921368', 1); +INSERT INTO `yx_system_city` VALUES (1786, 307530, 2, 306339, '370681000000', '龙口市', '山东,烟台,龙口', '120.477813', '37.646108', 1); +INSERT INTO `yx_system_city` VALUES (1787, 308140, 2, 306339, '370682000000', '莱阳市', '山东,烟台,莱阳', '120.711673', '36.978941', 1); +INSERT INTO `yx_system_city` VALUES (1788, 308953, 2, 306339, '370683000000', '莱州市', '山东,烟台,莱州', '119.942327', '37.177017', 1); +INSERT INTO `yx_system_city` VALUES (1789, 309985, 2, 306339, '370684000000', '蓬莱市', '山东,烟台,蓬莱', '120.758848', '37.810661', 1); +INSERT INTO `yx_system_city` VALUES (1790, 310581, 2, 306339, '370685000000', '招远市', '山东,烟台,招远', '120.434072', '37.355469', 1); +INSERT INTO `yx_system_city` VALUES (1791, 311342, 2, 306339, '370686000000', '栖霞市', '山东,烟台,栖霞', '120.849675', '37.335123', 1); +INSERT INTO `yx_system_city` VALUES (1792, 312312, 2, 306339, '370687000000', '海阳市', '山东,烟台,海阳', '121.158434', '36.776378', 1); +INSERT INTO `yx_system_city` VALUES (1793, 313064, 2, 313063, '370701000000', '市辖区', '山东,潍坊', '119.161755', '36.706774', 1); +INSERT INTO `yx_system_city` VALUES (1794, 313065, 2, 313063, '370702000000', '潍城区', '山东,潍坊,潍城', '119.024836', '36.728100', 1); +INSERT INTO `yx_system_city` VALUES (1795, 313327, 2, 313063, '370703000000', '寒亭区', '山东,潍坊,寒亭', '119.219734', '36.775491', 1); +INSERT INTO `yx_system_city` VALUES (1796, 313701, 2, 313063, '370704000000', '坊子区', '山东,潍坊,坊子', '119.166485', '36.654448', 1); +INSERT INTO `yx_system_city` VALUES (1797, 314288, 2, 313063, '370705000000', '奎文区', '山东,潍坊,奎文', '119.132486', '36.707676', 1); +INSERT INTO `yx_system_city` VALUES (1798, 314533, 2, 313063, '370724000000', '临朐县', '山东,潍坊,临朐', '118.542982', '36.512506', 1); +INSERT INTO `yx_system_city` VALUES (1799, 314894, 2, 313063, '370725000000', '昌乐县', '山东,潍坊,昌乐', '118.829914', '36.706945', 1); +INSERT INTO `yx_system_city` VALUES (1800, 315273, 2, 313063, '370781000000', '青州市', '山东,潍坊,青州', '118.479636', '36.684600', 1); +INSERT INTO `yx_system_city` VALUES (1801, 316361, 2, 313063, '370782000000', '诸城市', '山东,潍坊,诸城', '119.410103', '35.995654', 1); +INSERT INTO `yx_system_city` VALUES (1802, 316642, 2, 313063, '370783000000', '寿光市', '山东,潍坊,寿光', '118.790652', '36.855480', 1); +INSERT INTO `yx_system_city` VALUES (1803, 317633, 2, 313063, '370784000000', '安丘市', '山东,潍坊,安丘', '119.218978', '36.478494', 1); +INSERT INTO `yx_system_city` VALUES (1804, 318512, 2, 313063, '370785000000', '高密市', '山东,潍坊,高密', '119.755597', '36.382595', 1); +INSERT INTO `yx_system_city` VALUES (1805, 319478, 2, 313063, '370786000000', '昌邑市', '山东,潍坊,昌邑', '119.398525', '36.858820', 1); +INSERT INTO `yx_system_city` VALUES (1806, 320180, 2, 320179, '370801000000', '市辖区', '山东,济宁', '116.587098', '35.414921', 1); +INSERT INTO `yx_system_city` VALUES (1807, 320181, 2, 320179, '370811000000', '任城区', '山东,济宁,任城', '116.595050', '35.406596', 1); +INSERT INTO `yx_system_city` VALUES (1808, 320795, 2, 320179, '370812000000', '兖州区', '山东,济宁,兖州', '116.783834', '35.553144', 1); +INSERT INTO `yx_system_city` VALUES (1809, 321246, 2, 320179, '370826000000', '微山县', '山东,济宁,微山', '117.128828', '34.806554', 1); +INSERT INTO `yx_system_city` VALUES (1810, 321804, 2, 320179, '370827000000', '鱼台县', '山东,济宁,鱼台', '116.650608', '35.012749', 1); +INSERT INTO `yx_system_city` VALUES (1811, 322209, 2, 320179, '370828000000', '金乡县', '山东,济宁,金乡', '116.311532', '35.066620', 1); +INSERT INTO `yx_system_city` VALUES (1812, 322882, 2, 320179, '370829000000', '嘉祥县', '山东,济宁,嘉祥', '116.342442', '35.407829', 1); +INSERT INTO `yx_system_city` VALUES (1813, 323607, 2, 320179, '370830000000', '汶上县', '山东,济宁,汶上', '116.489043', '35.732799', 1); +INSERT INTO `yx_system_city` VALUES (1814, 324118, 2, 320179, '370831000000', '泗水县', '山东,济宁,泗水', '117.251195', '35.664323', 1); +INSERT INTO `yx_system_city` VALUES (1815, 324729, 2, 320179, '370832000000', '梁山县', '山东,济宁,梁山', '116.096044', '35.802306', 1); +INSERT INTO `yx_system_city` VALUES (1816, 325372, 2, 320179, '370881000000', '曲阜市', '山东,济宁,曲阜', '116.986503', '35.580996', 1); +INSERT INTO `yx_system_city` VALUES (1817, 325791, 2, 320179, '370883000000', '邹城市', '山东,济宁,邹城', '117.003743', '35.405185', 1); +INSERT INTO `yx_system_city` VALUES (1818, 326707, 2, 326706, '370901000000', '市辖区', '山东,泰安', '117.087614', '36.200252', 1); +INSERT INTO `yx_system_city` VALUES (1819, 326708, 2, 326706, '370902000000', '泰山区', '山东,泰安,泰山', '117.135354', '36.192084', 1); +INSERT INTO `yx_system_city` VALUES (1820, 326926, 2, 326706, '370911000000', '岱岳区', '山东,泰安,岱岳', '117.041582', '36.187990', 1); +INSERT INTO `yx_system_city` VALUES (1821, 327655, 2, 326706, '370921000000', '宁阳县', '山东,泰安,宁阳', '116.805797', '35.758787', 1); +INSERT INTO `yx_system_city` VALUES (1822, 328231, 2, 326706, '370923000000', '东平县', '山东,泰安,东平', '116.470304', '35.937102', 1); +INSERT INTO `yx_system_city` VALUES (1823, 328962, 2, 326706, '370982000000', '新泰市', '山东,泰安,新泰', '117.767953', '35.909032', 1); +INSERT INTO `yx_system_city` VALUES (1824, 329897, 2, 326706, '370983000000', '肥城市', '山东,泰安,肥城', '116.768358', '36.182572', 1); +INSERT INTO `yx_system_city` VALUES (1825, 330548, 2, 330547, '371001000000', '市辖区', '山东,威海', '122.120419', '37.513068', 1); +INSERT INTO `yx_system_city` VALUES (1826, 330549, 2, 330547, '371002000000', '环翠区', '山东,威海,环翠', '122.123444', '37.501991', 1); +INSERT INTO `yx_system_city` VALUES (1827, 330748, 2, 330547, '371003000000', '文登区', '山东,威海,文登', '122.057941', '37.193886', 1); +INSERT INTO `yx_system_city` VALUES (1828, 331529, 2, 330547, '371082000000', '荣成市', '山东,威海,荣成', '122.486658', '37.165160', 1); +INSERT INTO `yx_system_city` VALUES (1829, 332496, 2, 330547, '371083000000', '乳山市', '山东,威海,乳山', '121.539765', '36.919816', 1); +INSERT INTO `yx_system_city` VALUES (1830, 333141, 2, 333140, '371101000000', '市辖区', '山东,日照', '119.526888', '35.416377', 1); +INSERT INTO `yx_system_city` VALUES (1831, 333142, 2, 333140, '371102000000', '东港区', '山东,日照,东港', '119.462228', '35.425475', 1); +INSERT INTO `yx_system_city` VALUES (1832, 333755, 2, 333140, '371103000000', '岚山区', '山东,日照,岚山', '119.318929', '35.121884', 1); +INSERT INTO `yx_system_city` VALUES (1833, 334188, 2, 333140, '371121000000', '五莲县', '山东,日照,五莲', '119.206763', '35.751927', 1); +INSERT INTO `yx_system_city` VALUES (1834, 334833, 2, 333140, '371122000000', '莒县', '山东,日照,莒县', '118.837064', '35.579868', 1); +INSERT INTO `yx_system_city` VALUES (1835, 336051, 2, 336050, '371201000000', '市辖区', '山东,莱芜', '117.676723', '36.213813', 1); +INSERT INTO `yx_system_city` VALUES (1836, 336052, 2, 336050, '371202000000', '莱城区', '山东,莱芜,莱城', '117.659884', '36.203180', 1); +INSERT INTO `yx_system_city` VALUES (1837, 336908, 2, 336050, '371203000000', '钢城区', '山东,莱芜,钢城', '117.811355', '36.058572', 1); +INSERT INTO `yx_system_city` VALUES (1838, 337145, 2, 337144, '371301000000', '市辖区', '山东,临沂', '118.356448', '35.104672', 1); +INSERT INTO `yx_system_city` VALUES (1839, 337146, 2, 337144, '371302000000', '兰山区', '山东,临沂,兰山', '118.347731', '35.051734', 1); +INSERT INTO `yx_system_city` VALUES (1840, 337621, 2, 337144, '371311000000', '罗庄区', '山东,临沂,罗庄', '118.284786', '34.996741', 1); +INSERT INTO `yx_system_city` VALUES (1841, 337844, 2, 337144, '371312000000', '河东区', '山东,临沂,河东', '118.402893', '35.089917', 1); +INSERT INTO `yx_system_city` VALUES (1842, 338188, 2, 337144, '371321000000', '沂南县', '山东,临沂,沂南', '118.465213', '35.549976', 1); +INSERT INTO `yx_system_city` VALUES (1843, 338778, 2, 337144, '371322000000', '郯城县', '山东,临沂,郯城', '118.367263', '34.613557', 1); +INSERT INTO `yx_system_city` VALUES (1844, 339408, 2, 337144, '371323000000', '沂水县', '山东,临沂,沂水', '118.627918', '35.790450', 1); +INSERT INTO `yx_system_city` VALUES (1845, 340490, 2, 337144, '371324000000', '兰陵县', '山东,临沂,兰陵', '118.070650', '34.857149', 1); +INSERT INTO `yx_system_city` VALUES (1846, 341532, 2, 337144, '371325000000', '费县', '山东,临沂,费县', '117.977325', '35.265961', 1); +INSERT INTO `yx_system_city` VALUES (1847, 342020, 2, 337144, '371326000000', '平邑县', '山东,临沂,平邑', '117.640352', '35.505943', 1); +INSERT INTO `yx_system_city` VALUES (1848, 342766, 2, 337144, '371327000000', '莒南县', '山东,临沂,莒南', '118.835163', '35.174846', 1); +INSERT INTO `yx_system_city` VALUES (1849, 343361, 2, 337144, '371328000000', '蒙阴县', '山东,临沂,蒙阴', '117.945085', '35.710032', 1); +INSERT INTO `yx_system_city` VALUES (1850, 343836, 2, 337144, '371329000000', '临沭县', '山东,临沂,临沭', '118.650782', '34.919852', 1); +INSERT INTO `yx_system_city` VALUES (1851, 344134, 2, 344133, '371401000000', '市辖区', '山东,德州', '116.357464', '37.434092', 1); +INSERT INTO `yx_system_city` VALUES (1852, 344135, 2, 344133, '371402000000', '德城区', '山东,德州,德城', '116.299471', '37.450805', 1); +INSERT INTO `yx_system_city` VALUES (1853, 344244, 2, 344133, '371403000000', '陵城区', '山东,德州,陵城', '116.576092', '37.335794', 1); +INSERT INTO `yx_system_city` VALUES (1854, 345248, 2, 344133, '371422000000', '宁津县', '山东,德州,宁津', '116.800306', '37.652190', 1); +INSERT INTO `yx_system_city` VALUES (1855, 346117, 2, 344133, '371423000000', '庆云县', '山东,德州,庆云', '117.385257', '37.775350', 1); +INSERT INTO `yx_system_city` VALUES (1856, 346518, 2, 344133, '371424000000', '临邑县', '山东,德州,临邑', '116.866800', '37.189798', 1); +INSERT INTO `yx_system_city` VALUES (1857, 346715, 2, 344133, '371425000000', '齐河县', '山东,德州,齐河', '116.762810', '36.783415', 1); +INSERT INTO `yx_system_city` VALUES (1858, 347749, 2, 344133, '371426000000', '平原县', '山东,德州,平原', '116.434056', '37.165314', 1); +INSERT INTO `yx_system_city` VALUES (1859, 347943, 2, 344133, '371427000000', '夏津县', '山东,德州,夏津', '116.001726', '36.948371', 1); +INSERT INTO `yx_system_city` VALUES (1860, 348268, 2, 344133, '371428000000', '武城县', '山东,德州,武城', '116.069302', '37.213311', 1); +INSERT INTO `yx_system_city` VALUES (1861, 348472, 2, 344133, '371481000000', '乐陵市', '山东,德州,乐陵', '117.231935', '37.729907', 1); +INSERT INTO `yx_system_city` VALUES (1862, 348980, 2, 344133, '371482000000', '禹城市', '山东,德州,禹城', '116.638327', '36.933812', 1); +INSERT INTO `yx_system_city` VALUES (1863, 349383, 2, 349382, '371501000000', '市辖区', '山东,聊城', '115.985371', '36.456703', 1); +INSERT INTO `yx_system_city` VALUES (1864, 349384, 2, 349382, '371502000000', '东昌府区', '山东,聊城,东昌府', '115.988491', '36.434645', 1); +INSERT INTO `yx_system_city` VALUES (1865, 350543, 2, 349382, '371521000000', '阳谷县', '山东,聊城,阳谷', '115.791820', '36.114392', 1); +INSERT INTO `yx_system_city` VALUES (1866, 351436, 2, 349382, '371522000000', '莘县', '山东,聊城,莘县', '115.671191', '36.233598', 1); +INSERT INTO `yx_system_city` VALUES (1867, 352587, 2, 349382, '371523000000', '茌平县', '山东,聊城,茌平', '115.985371', '36.456703', 1); +INSERT INTO `yx_system_city` VALUES (1868, 353334, 2, 349382, '371524000000', '东阿县', '山东,聊城,东阿', '116.247580', '36.334917', 1); +INSERT INTO `yx_system_city` VALUES (1869, 353863, 2, 349382, '371525000000', '冠县', '山东,聊城,冠县', '115.442740', '36.484009', 1); +INSERT INTO `yx_system_city` VALUES (1870, 354643, 2, 349382, '371526000000', '高唐县', '山东,聊城,高唐', '116.230158', '36.846755', 1); +INSERT INTO `yx_system_city` VALUES (1871, 355301, 2, 349382, '371581000000', '临清市', '山东,聊城,临清', '115.704881', '36.838277', 1); +INSERT INTO `yx_system_city` VALUES (1872, 355973, 2, 355972, '371601000000', '市辖区', '山东,滨州', '117.970703', '37.381990', 1); +INSERT INTO `yx_system_city` VALUES (1873, 355974, 2, 355972, '371602000000', '滨城区', '山东,滨州,滨城', '118.019326', '37.430724', 1); +INSERT INTO `yx_system_city` VALUES (1874, 356960, 2, 355972, '371603000000', '沾化区', '山东,滨州,沾化', '118.098902', '37.699260', 1); +INSERT INTO `yx_system_city` VALUES (1875, 357420, 2, 355972, '371621000000', '惠民县', '山东,滨州,惠民', '117.509921', '37.489877', 1); +INSERT INTO `yx_system_city` VALUES (1876, 358556, 2, 355972, '371622000000', '阳信县', '山东,滨州,阳信', '117.578262', '37.641106', 1); +INSERT INTO `yx_system_city` VALUES (1877, 359424, 2, 355972, '371623000000', '无棣县', '山东,滨州,无棣', '117.625696', '37.770260', 1); +INSERT INTO `yx_system_city` VALUES (1878, 360038, 2, 355972, '371625000000', '博兴县', '山东,滨州,博兴', '118.131815', '37.150226', 1); +INSERT INTO `yx_system_city` VALUES (1879, 360507, 2, 355972, '371626000000', '邹平县', '山东,滨州,邹平', '117.743109', '36.862989', 1); +INSERT INTO `yx_system_city` VALUES (1880, 361376, 2, 361375, '371701000000', '市辖区', '山东,菏泽', '115.480656', '35.233750', 1); +INSERT INTO `yx_system_city` VALUES (1881, 361377, 2, 361375, '371702000000', '牡丹区', '山东,菏泽,牡丹', '115.417827', '35.252512', 1); +INSERT INTO `yx_system_city` VALUES (1882, 361988, 2, 361375, '371703000000', '定陶区', '山东,菏泽,定陶', '115.569619', '35.072701', 1); +INSERT INTO `yx_system_city` VALUES (1883, 362368, 2, 361375, '371721000000', '曹县', '山东,菏泽,曹县', '115.542328', '34.825508', 1); +INSERT INTO `yx_system_city` VALUES (1884, 363576, 2, 361375, '371722000000', '单县', '山东,菏泽,单县', '116.107428', '34.778808', 1); +INSERT INTO `yx_system_city` VALUES (1885, 364107, 2, 361375, '371723000000', '成武县', '山东,菏泽,成武', '115.889765', '34.952459', 1); +INSERT INTO `yx_system_city` VALUES (1886, 364606, 2, 361375, '371724000000', '巨野县', '山东,菏泽,巨野', '116.065396', '35.387374', 1); +INSERT INTO `yx_system_city` VALUES (1887, 365498, 2, 361375, '371725000000', '郓城县', '山东,菏泽,郓城', '115.943613', '35.599758', 1); +INSERT INTO `yx_system_city` VALUES (1888, 366562, 2, 361375, '371726000000', '鄄城县', '山东,菏泽,鄄城', '115.510193', '35.563408', 1); +INSERT INTO `yx_system_city` VALUES (1889, 366971, 2, 361375, '371728000000', '东明县', '山东,菏泽,东明', '115.089905', '35.289368', 1); +INSERT INTO `yx_system_city` VALUES (1890, 367397, 2, 367396, '410101000000', '市辖区', '河南,郑州', '113.625368', '34.746599', 1); +INSERT INTO `yx_system_city` VALUES (1891, 367398, 2, 367396, '410102000000', '中原区', '河南,郑州,中原', '113.612850', '34.748257', 1); +INSERT INTO `yx_system_city` VALUES (1892, 367563, 2, 367396, '410103000000', '二七区', '河南,郑州,二七', '113.640179', '34.723930', 1); +INSERT INTO `yx_system_city` VALUES (1893, 367741, 2, 367396, '410104000000', '管城回族区', '河南,郑州,管城', '113.625368', '34.746599', 1); +INSERT INTO `yx_system_city` VALUES (1894, 367877, 2, 367396, '410105000000', '金水区', '河南,郑州,金水', '113.660555', '34.800156', 1); +INSERT INTO `yx_system_city` VALUES (1895, 368151, 2, 367396, '410106000000', '上街区', '河南,郑州,上街', '113.308961', '34.802780', 1); +INSERT INTO `yx_system_city` VALUES (1896, 368217, 2, 367396, '410108000000', '惠济区', '河南,郑州,惠济', '113.616901', '34.867458', 1); +INSERT INTO `yx_system_city` VALUES (1897, 368291, 2, 367396, '410122000000', '中牟县', '河南,郑州,中牟', '113.976254', '34.718937', 1); +INSERT INTO `yx_system_city` VALUES (1898, 368635, 2, 367396, '410181000000', '巩义市', '河南,郑州,巩义', '113.022497', '34.747834', 1); +INSERT INTO `yx_system_city` VALUES (1899, 368975, 2, 367396, '410182000000', '荥阳市', '河南,郑州,荥阳', '113.383221', '34.787375', 1); +INSERT INTO `yx_system_city` VALUES (1900, 369293, 2, 367396, '410183000000', '新密市', '河南,郑州,新密', '113.390891', '34.539443', 1); +INSERT INTO `yx_system_city` VALUES (1901, 369663, 2, 367396, '410184000000', '新郑市', '河南,郑州,新郑', '113.740529', '34.395562', 1); +INSERT INTO `yx_system_city` VALUES (1902, 369963, 2, 367396, '410185000000', '登封市', '河南,郑州,登封', '113.050492', '34.453667', 1); +INSERT INTO `yx_system_city` VALUES (1903, 370305, 2, 370304, '410201000000', '市辖区', '河南,开封', '114.307581', '34.797239', 1); +INSERT INTO `yx_system_city` VALUES (1904, 370306, 2, 370304, '410202000000', '龙亭区', '河南,开封,龙亭', '114.354730', '34.815784', 1); +INSERT INTO `yx_system_city` VALUES (1905, 370373, 2, 370304, '410203000000', '顺河回族区', '河南,开封,顺河', '114.369716', '34.811344', 1); +INSERT INTO `yx_system_city` VALUES (1906, 370450, 2, 370304, '410204000000', '鼓楼区', '河南,开封,鼓楼', '114.348307', '34.788561', 1); +INSERT INTO `yx_system_city` VALUES (1907, 370501, 2, 370304, '410205000000', '禹王台区', '河南,开封,禹王台', '114.348170', '34.777104', 1); +INSERT INTO `yx_system_city` VALUES (1908, 370557, 2, 370304, '410211000000', '金明区', '河南,开封,金明', '114.307581', '34.797239', 1); +INSERT INTO `yx_system_city` VALUES (1909, 370634, 2, 370304, '410212000000', '祥符区', '河南,开封,祥符', '114.441327', '34.756921', 1); +INSERT INTO `yx_system_city` VALUES (1910, 370995, 2, 370304, '410221000000', '杞县', '河南,开封,杞县', '114.783041', '34.549166', 1); +INSERT INTO `yx_system_city` VALUES (1911, 371618, 2, 370304, '410222000000', '通许县', '河南,开封,通许', '114.467467', '34.480433', 1); +INSERT INTO `yx_system_city` VALUES (1912, 371942, 2, 370304, '410223000000', '尉氏县', '河南,开封,尉氏', '114.193081', '34.411494', 1); +INSERT INTO `yx_system_city` VALUES (1913, 372481, 2, 370304, '410225000000', '兰考县', '河南,开封,兰考', '114.821348', '34.822211', 1); +INSERT INTO `yx_system_city` VALUES (1914, 372972, 2, 372971, '410301000000', '市辖区', '河南,洛阳', '112.454040', '34.619682', 1); +INSERT INTO `yx_system_city` VALUES (1915, 372973, 2, 372971, '410302000000', '老城区', '河南,洛阳,老城', '112.469024', '34.683646', 1); +INSERT INTO `yx_system_city` VALUES (1916, 373030, 2, 372971, '410303000000', '西工区', '河南,洛阳,西工', '112.428413', '34.659900', 1); +INSERT INTO `yx_system_city` VALUES (1917, 373105, 2, 372971, '410304000000', '瀍河回族区', '河南,洛阳,瀍河', '112.479653', '34.714976', 1); +INSERT INTO `yx_system_city` VALUES (1918, 373143, 2, 372971, '410305000000', '涧西区', '河南,洛阳,涧西', '112.395756', '34.658034', 1); +INSERT INTO `yx_system_city` VALUES (1919, 373227, 2, 372971, '410306000000', '吉利区', '河南,洛阳,吉利', '112.589052', '34.900889', 1); +INSERT INTO `yx_system_city` VALUES (1920, 373268, 2, 372971, '410311000000', '洛龙区', '河南,洛阳,洛龙', '112.464173', '34.619404', 1); +INSERT INTO `yx_system_city` VALUES (1921, 373554, 2, 372971, '410322000000', '孟津县', '河南,洛阳,孟津', '112.445252', '34.825307', 1); +INSERT INTO `yx_system_city` VALUES (1922, 373799, 2, 372971, '410323000000', '新安县', '河南,洛阳,新安', '112.132488', '34.728584', 1); +INSERT INTO `yx_system_city` VALUES (1923, 374121, 2, 372971, '410324000000', '栾川县', '河南,洛阳,栾川', '111.615769', '33.785698', 1); +INSERT INTO `yx_system_city` VALUES (1924, 374349, 2, 372971, '410325000000', '嵩县', '河南,洛阳,嵩县', '112.085634', '34.134517', 1); +INSERT INTO `yx_system_city` VALUES (1925, 374694, 2, 372971, '410326000000', '汝阳县', '河南,洛阳,汝阳', '112.473139', '34.153940', 1); +INSERT INTO `yx_system_city` VALUES (1926, 374929, 2, 372971, '410327000000', '宜阳县', '河南,洛阳,宜阳', '112.179238', '34.514645', 1); +INSERT INTO `yx_system_city` VALUES (1927, 375308, 2, 372971, '410328000000', '洛宁县', '河南,洛阳,洛宁', '111.653039', '34.389414', 1); +INSERT INTO `yx_system_city` VALUES (1928, 375717, 2, 372971, '410329000000', '伊川县', '河南,洛阳,伊川', '112.425651', '34.421460', 1); +INSERT INTO `yx_system_city` VALUES (1929, 376105, 2, 372971, '410381000000', '偃师市', '河南,洛阳,偃师', '112.789535', '34.727220', 1); +INSERT INTO `yx_system_city` VALUES (1930, 376366, 2, 376365, '410401000000', '市辖区', '河南,平顶山', '113.192661', '33.766169', 1); +INSERT INTO `yx_system_city` VALUES (1931, 376367, 2, 376365, '410402000000', '新华区', '河南,平顶山,新华', '113.293999', '33.737365', 1); +INSERT INTO `yx_system_city` VALUES (1932, 376442, 2, 376365, '410403000000', '卫东区', '河南,平顶山,卫东', '113.335193', '33.734707', 1); +INSERT INTO `yx_system_city` VALUES (1933, 376513, 2, 376365, '410404000000', '石龙区', '河南,平顶山,石龙', '112.898818', '33.898713', 1); +INSERT INTO `yx_system_city` VALUES (1934, 376532, 2, 376365, '410411000000', '湛河区', '河南,平顶山,湛河', '113.320873', '33.725681', 1); +INSERT INTO `yx_system_city` VALUES (1935, 376643, 2, 376365, '410421000000', '宝丰县', '河南,平顶山,宝丰', '113.054754', '33.868441', 1); +INSERT INTO `yx_system_city` VALUES (1936, 376984, 2, 376365, '410422000000', '叶县', '河南,平顶山,叶县', '113.357239', '33.626731', 1); +INSERT INTO `yx_system_city` VALUES (1937, 377555, 2, 376365, '410423000000', '鲁山县', '河南,平顶山,鲁山', '112.908023', '33.738518', 1); +INSERT INTO `yx_system_city` VALUES (1938, 378139, 2, 376365, '410425000000', '郏县', '河南,平顶山,郏县', '113.212609', '33.971787', 1); +INSERT INTO `yx_system_city` VALUES (1939, 378532, 2, 376365, '410481000000', '舞钢市', '河南,平顶山,舞钢', '113.524794', '33.307776', 1); +INSERT INTO `yx_system_city` VALUES (1940, 378764, 2, 376365, '410482000000', '汝州市', '河南,平顶山,汝州', '112.844517', '34.167030', 1); +INSERT INTO `yx_system_city` VALUES (1941, 379246, 2, 379245, '410501000000', '市辖区', '河南,安阳', '114.392392', '36.097577', 1); +INSERT INTO `yx_system_city` VALUES (1942, 379247, 2, 379245, '410502000000', '文峰区', '河南,安阳,文峰', '114.357082', '36.090468', 1); +INSERT INTO `yx_system_city` VALUES (1943, 379400, 2, 379245, '410503000000', '北关区', '河南,安阳,北关', '114.355822', '36.107255', 1); +INSERT INTO `yx_system_city` VALUES (1944, 379488, 2, 379245, '410505000000', '殷都区', '河南,安阳,殷都', '114.303410', '36.109890', 1); +INSERT INTO `yx_system_city` VALUES (1945, 379584, 2, 379245, '410506000000', '龙安区', '河南,安阳,龙安', '114.323522', '36.095568', 1); +INSERT INTO `yx_system_city` VALUES (1946, 379742, 2, 379245, '410522000000', '安阳县', '河南,安阳,安阳', '114.130207', '36.130585', 1); +INSERT INTO `yx_system_city` VALUES (1947, 380371, 2, 379245, '410523000000', '汤阴县', '河南,安阳,汤阴', '114.357763', '35.924515', 1); +INSERT INTO `yx_system_city` VALUES (1948, 380688, 2, 379245, '410526000000', '滑县', '河南,安阳,滑县', '114.518997', '35.575002', 1); +INSERT INTO `yx_system_city` VALUES (1949, 381731, 2, 379245, '410527000000', '内黄县', '河南,安阳,内黄', '114.901492', '35.971653', 1); +INSERT INTO `yx_system_city` VALUES (1950, 382281, 2, 379245, '410581000000', '林州市', '河南,安阳,林州', '113.820130', '36.083047', 1); +INSERT INTO `yx_system_city` VALUES (1951, 382879, 2, 382878, '410601000000', '市辖区', '河南,鹤壁', '114.297272', '35.747225', 1); +INSERT INTO `yx_system_city` VALUES (1952, 382880, 2, 382878, '410602000000', '鹤山区', '河南,鹤壁,鹤山', '114.163367', '35.954582', 1); +INSERT INTO `yx_system_city` VALUES (1953, 382969, 2, 382878, '410603000000', '山城区', '河南,鹤壁,山城', '114.184428', '35.897703', 1); +INSERT INTO `yx_system_city` VALUES (1954, 383079, 2, 382878, '410611000000', '淇滨区', '河南,鹤壁,淇滨', '114.298694', '35.741296', 1); +INSERT INTO `yx_system_city` VALUES (1955, 383228, 2, 382878, '410621000000', '浚县', '河南,鹤壁,浚县', '114.550813', '35.676240', 1); +INSERT INTO `yx_system_city` VALUES (1956, 383704, 2, 382878, '410622000000', '淇县', '河南,鹤壁,淇县', '114.197651', '35.607762', 1); +INSERT INTO `yx_system_city` VALUES (1957, 383891, 2, 383890, '410701000000', '市辖区', '河南,新乡', '113.926800', '35.303004', 1); +INSERT INTO `yx_system_city` VALUES (1958, 383892, 2, 383890, '410702000000', '红旗区', '河南,新乡,红旗', '113.875245', '35.303851', 1); +INSERT INTO `yx_system_city` VALUES (1959, 383978, 2, 383890, '410703000000', '卫滨区', '河南,新乡,卫滨', '113.865780', '35.302117', 1); +INSERT INTO `yx_system_city` VALUES (1960, 384041, 2, 383890, '410704000000', '凤泉区', '河南,新乡,凤泉', '113.915184', '35.383978', 1); +INSERT INTO `yx_system_city` VALUES (1961, 384093, 2, 383890, '410711000000', '牧野区', '河南,新乡,牧野', '113.908772', '35.315039', 1); +INSERT INTO `yx_system_city` VALUES (1962, 384193, 2, 383890, '410721000000', '新乡县', '河南,新乡,新乡', '113.805205', '35.190836', 1); +INSERT INTO `yx_system_city` VALUES (1963, 384380, 2, 383890, '410724000000', '获嘉县', '河南,新乡,获嘉', '113.657433', '35.259808', 1); +INSERT INTO `yx_system_city` VALUES (1964, 384622, 2, 383890, '410725000000', '原阳县', '河南,新乡,原阳', '113.940115', '35.065587', 1); +INSERT INTO `yx_system_city` VALUES (1965, 385122, 2, 383890, '410726000000', '延津县', '河南,新乡,延津', '114.205197', '35.141956', 1); +INSERT INTO `yx_system_city` VALUES (1966, 385485, 2, 383890, '410727000000', '封丘县', '河南,新乡,封丘', '114.418882', '35.041198', 1); +INSERT INTO `yx_system_city` VALUES (1967, 386113, 2, 383890, '410728000000', '长垣县', '河南,新乡,长垣', '114.668936', '35.201548', 1); +INSERT INTO `yx_system_city` VALUES (1968, 386744, 2, 383890, '410781000000', '卫辉市', '河南,新乡,卫辉', '114.064907', '35.398494', 1); +INSERT INTO `yx_system_city` VALUES (1969, 387125, 2, 383890, '410782000000', '辉县市', '河南,新乡,辉', '113.926800', '35.303004', 1); +INSERT INTO `yx_system_city` VALUES (1970, 387708, 2, 387707, '410801000000', '市辖区', '河南,焦作', '113.241823', '35.215892', 1); +INSERT INTO `yx_system_city` VALUES (1971, 387709, 2, 387707, '410802000000', '解放区', '河南,焦作,解放', '113.230817', '35.240282', 1); +INSERT INTO `yx_system_city` VALUES (1972, 387776, 2, 387707, '410803000000', '中站区', '河南,焦作,中站', '113.182946', '35.236820', 1); +INSERT INTO `yx_system_city` VALUES (1973, 387836, 2, 387707, '410804000000', '马村区', '河南,焦作,马村', '113.322332', '35.256108', 1); +INSERT INTO `yx_system_city` VALUES (1974, 387922, 2, 387707, '410811000000', '山阳区', '河南,焦作,山阳', '113.254881', '35.214507', 1); +INSERT INTO `yx_system_city` VALUES (1975, 387985, 2, 387707, '410821000000', '修武县', '河南,焦作,修武', '113.447755', '35.223514', 1); +INSERT INTO `yx_system_city` VALUES (1976, 388187, 2, 387707, '410822000000', '博爱县', '河南,焦作,博爱', '113.064379', '35.171045', 1); +INSERT INTO `yx_system_city` VALUES (1977, 388415, 2, 387707, '410823000000', '武陟县', '河南,焦作,武陟', '113.401679', '35.099378', 1); +INSERT INTO `yx_system_city` VALUES (1978, 388783, 2, 387707, '410825000000', '温县', '河南,焦作,温县', '113.080530', '34.940189', 1); +INSERT INTO `yx_system_city` VALUES (1979, 389064, 2, 387707, '410882000000', '沁阳市', '河南,焦作,沁阳', '112.950716', '35.087539', 1); +INSERT INTO `yx_system_city` VALUES (1980, 389418, 2, 387707, '410883000000', '孟州市', '河南,焦作,孟州', '112.789612', '34.907970', 1); +INSERT INTO `yx_system_city` VALUES (1981, 389720, 2, 389719, '410901000000', '市辖区', '河南,濮阳', '115.029215', '35.761829', 1); +INSERT INTO `yx_system_city` VALUES (1982, 389721, 2, 389719, '410902000000', '华龙区', '河南,濮阳,华龙', '115.074151', '35.777346', 1); +INSERT INTO `yx_system_city` VALUES (1983, 389884, 2, 389719, '410922000000', '清丰县', '河南,濮阳,清丰', '115.104389', '35.885180', 1); +INSERT INTO `yx_system_city` VALUES (1984, 390411, 2, 389719, '410923000000', '南乐县', '河南,濮阳,南乐', '115.204752', '36.069664', 1); +INSERT INTO `yx_system_city` VALUES (1985, 390751, 2, 389719, '410926000000', '范县', '河南,濮阳,范县', '115.504201', '35.851907', 1); +INSERT INTO `yx_system_city` VALUES (1986, 391345, 2, 389719, '410927000000', '台前县', '河南,濮阳,台前', '115.871906', '35.969390', 1); +INSERT INTO `yx_system_city` VALUES (1987, 391730, 2, 389719, '410928000000', '濮阳县', '河南,濮阳,濮阳', '115.029078', '35.712193', 1); +INSERT INTO `yx_system_city` VALUES (1988, 392738, 2, 392737, '411001000000', '市辖区', '河南,许昌', '113.852640', '34.035506', 1); +INSERT INTO `yx_system_city` VALUES (1989, 392739, 2, 392737, '411002000000', '魏都区', '河南,许昌,魏都', '113.822647', '34.025342', 1); +INSERT INTO `yx_system_city` VALUES (1990, 392850, 2, 392737, '411023000000', '许昌县', '河南,许昌,许昌', '113.822983', '34.124660', 1); +INSERT INTO `yx_system_city` VALUES (1991, 393306, 2, 392737, '411024000000', '鄢陵县', '河南,许昌,鄢陵', '114.177400', '34.102332', 1); +INSERT INTO `yx_system_city` VALUES (1992, 393705, 2, 392737, '411025000000', '襄城县', '河南,许昌,襄城', '113.482453', '33.846369', 1); +INSERT INTO `yx_system_city` VALUES (1993, 394170, 2, 392737, '411081000000', '禹州市', '河南,许昌,禹州', '113.488478', '34.140701', 1); +INSERT INTO `yx_system_city` VALUES (1994, 394863, 2, 392737, '411082000000', '长葛市', '河南,许昌,长葛', '113.819888', '34.194136', 1); +INSERT INTO `yx_system_city` VALUES (1995, 395255, 2, 395254, '411101000000', '市辖区', '河南,漯河', '114.016539', '33.581412', 1); +INSERT INTO `yx_system_city` VALUES (1996, 395256, 2, 395254, '411102000000', '源汇区', '河南,漯河,源汇', '114.017948', '33.565441', 1); +INSERT INTO `yx_system_city` VALUES (1997, 395392, 2, 395254, '411103000000', '郾城区', '河南,漯河,郾城', '114.006944', '33.587409', 1); +INSERT INTO `yx_system_city` VALUES (1998, 395601, 2, 395254, '411104000000', '召陵区', '河南,漯河,召陵', '114.093902', '33.586565', 1); +INSERT INTO `yx_system_city` VALUES (1999, 395816, 2, 395254, '411121000000', '舞阳县', '河南,漯河,舞阳', '113.609286', '33.437877', 1); +INSERT INTO `yx_system_city` VALUES (2000, 396228, 2, 395254, '411122000000', '临颍县', '河南,漯河,临颍', '113.931203', '33.827304', 1); +INSERT INTO `yx_system_city` VALUES (2001, 396612, 2, 396611, '411201000000', '市辖区', '河南,三门峡', '111.200135', '34.772493', 1); +INSERT INTO `yx_system_city` VALUES (2002, 396613, 2, 396611, '411202000000', '湖滨区', '河南,三门峡,湖滨', '111.188398', '34.770886', 1); +INSERT INTO `yx_system_city` VALUES (2003, 396710, 2, 396611, '411203000000', '陕州区', '河南,三门峡,陕州', '111.103563', '34.720548', 1); +INSERT INTO `yx_system_city` VALUES (2004, 396996, 2, 396611, '411221000000', '渑池县', '河南,三门峡,渑池', '111.761504', '34.767244', 1); +INSERT INTO `yx_system_city` VALUES (2005, 397257, 2, 396611, '411224000000', '卢氏县', '河南,三门峡,卢氏', '111.047858', '34.054324', 1); +INSERT INTO `yx_system_city` VALUES (2006, 397644, 2, 396611, '411281000000', '义马市', '河南,三门峡,义马', '111.874393', '34.747129', 1); +INSERT INTO `yx_system_city` VALUES (2007, 397687, 2, 396611, '411282000000', '灵宝市', '河南,三门峡,灵宝', '110.894220', '34.516828', 1); +INSERT INTO `yx_system_city` VALUES (2008, 398170, 2, 398169, '411301000000', '市辖区', '河南,南阳', '112.528321', '32.990833', 1); +INSERT INTO `yx_system_city` VALUES (2009, 398171, 2, 398169, '411302000000', '宛城区', '河南,南阳,宛城', '112.539559', '33.003784', 1); +INSERT INTO `yx_system_city` VALUES (2010, 398437, 2, 398169, '411303000000', '卧龙区', '河南,南阳,卧龙', '112.528789', '32.989877', 1); +INSERT INTO `yx_system_city` VALUES (2011, 398747, 2, 398169, '411321000000', '南召县', '河南,南阳,南召', '112.429133', '33.489877', 1); +INSERT INTO `yx_system_city` VALUES (2012, 399117, 2, 398169, '411322000000', '方城县', '河南,南阳,方城', '113.012494', '33.254391', 1); +INSERT INTO `yx_system_city` VALUES (2013, 399702, 2, 398169, '411323000000', '西峡县', '河南,南阳,西峡', '111.473530', '33.307294', 1); +INSERT INTO `yx_system_city` VALUES (2014, 400021, 2, 398169, '411324000000', '镇平县', '河南,南阳,镇平', '112.234698', '33.034111', 1); +INSERT INTO `yx_system_city` VALUES (2015, 400474, 2, 398169, '411325000000', '内乡县', '河南,南阳,内乡', '111.849392', '33.044865', 1); +INSERT INTO `yx_system_city` VALUES (2016, 400787, 2, 398169, '411326000000', '淅川县', '河南,南阳,淅川', '111.490964', '33.137820', 1); +INSERT INTO `yx_system_city` VALUES (2017, 401305, 2, 398169, '411327000000', '社旗县', '河南,南阳,社旗', '112.948245', '33.056109', 1); +INSERT INTO `yx_system_city` VALUES (2018, 401579, 2, 398169, '411328000000', '唐河县', '河南,南阳,唐河', '112.807637', '32.681335', 1); +INSERT INTO `yx_system_city` VALUES (2019, 402141, 2, 398169, '411329000000', '新野县', '河南,南阳,新野', '112.360026', '32.520805', 1); +INSERT INTO `yx_system_city` VALUES (2020, 402429, 2, 398169, '411330000000', '桐柏县', '河南,南阳,桐柏', '113.428287', '32.380073', 1); +INSERT INTO `yx_system_city` VALUES (2021, 402668, 2, 398169, '411381000000', '邓州市', '河南,南阳,邓州', '112.087278', '32.687938', 1); +INSERT INTO `yx_system_city` VALUES (2022, 403312, 2, 403311, '411401000000', '市辖区', '河南,商丘', '115.656370', '34.414172', 1); +INSERT INTO `yx_system_city` VALUES (2023, 403313, 2, 403311, '411402000000', '梁园区', '河南,商丘,梁园', '115.613965', '34.443893', 1); +INSERT INTO `yx_system_city` VALUES (2024, 403577, 2, 403311, '411403000000', '睢阳区', '河南,商丘,睢阳', '115.653302', '34.388390', 1); +INSERT INTO `yx_system_city` VALUES (2025, 403992, 2, 403311, '411421000000', '民权县', '河南,商丘,民权', '115.179594', '34.647758', 1); +INSERT INTO `yx_system_city` VALUES (2026, 404572, 2, 403311, '411422000000', '睢县', '河南,商丘,睢县', '115.071879', '34.445656', 1); +INSERT INTO `yx_system_city` VALUES (2027, 405150, 2, 403311, '411423000000', '宁陵县', '河南,商丘,宁陵', '115.313690', '34.460232', 1); +INSERT INTO `yx_system_city` VALUES (2028, 405530, 2, 403311, '411424000000', '柘城县', '河南,商丘,柘城', '115.305843', '34.091045', 1); +INSERT INTO `yx_system_city` VALUES (2029, 406070, 2, 403311, '411425000000', '虞城县', '河南,商丘,虞城', '115.840511', '34.402512', 1); +INSERT INTO `yx_system_city` VALUES (2030, 406717, 2, 403311, '411426000000', '夏邑县', '河南,商丘,夏邑', '116.131447', '34.237554', 1); +INSERT INTO `yx_system_city` VALUES (2031, 407487, 2, 403311, '411481000000', '永城市', '河南,商丘,永城', '116.449500', '33.929291', 1); +INSERT INTO `yx_system_city` VALUES (2032, 408288, 2, 408287, '411501000000', '市辖区', '河南,信阳', '114.091023', '32.146983', 1); +INSERT INTO `yx_system_city` VALUES (2033, 408289, 2, 408287, '411502000000', '浉河区', '河南,信阳,浉河', '114.058713', '32.116803', 1); +INSERT INTO `yx_system_city` VALUES (2034, 408566, 2, 408287, '411503000000', '平桥区', '河南,信阳,平桥', '114.125656', '32.101031', 1); +INSERT INTO `yx_system_city` VALUES (2035, 408914, 2, 408287, '411521000000', '罗山县', '河南,信阳,罗山', '114.513012', '32.203073', 1); +INSERT INTO `yx_system_city` VALUES (2036, 409241, 2, 408287, '411522000000', '光山县', '河南,信阳,光山', '114.919033', '32.011103', 1); +INSERT INTO `yx_system_city` VALUES (2037, 409621, 2, 408287, '411523000000', '新县', '河南,信阳,新县', '114.879239', '31.643918', 1); +INSERT INTO `yx_system_city` VALUES (2038, 409844, 2, 408287, '411524000000', '商城县', '河南,信阳,商城', '115.406862', '31.798378', 1); +INSERT INTO `yx_system_city` VALUES (2039, 410235, 2, 408287, '411525000000', '固始县', '河南,信阳,固始', '115.654482', '32.168137', 1); +INSERT INTO `yx_system_city` VALUES (2040, 410916, 2, 408287, '411526000000', '潢川县', '河南,信阳,潢川', '115.051808', '32.131383', 1); +INSERT INTO `yx_system_city` VALUES (2041, 411226, 2, 408287, '411527000000', '淮滨县', '河南,信阳,淮滨', '115.419538', '32.473258', 1); +INSERT INTO `yx_system_city` VALUES (2042, 411541, 2, 408287, '411528000000', '息县', '河南,信阳,息县', '114.740456', '32.342792', 1); +INSERT INTO `yx_system_city` VALUES (2043, 411926, 2, 411925, '411601000000', '市辖区', '河南,周口', '114.696951', '33.626149', 1); +INSERT INTO `yx_system_city` VALUES (2044, 411927, 2, 411925, '411602000000', '川汇区', '河南,周口,川汇', '114.650628', '33.647598', 1); +INSERT INTO `yx_system_city` VALUES (2045, 412097, 2, 411925, '411621000000', '扶沟县', '河南,周口,扶沟', '114.394915', '34.059862', 1); +INSERT INTO `yx_system_city` VALUES (2046, 412526, 2, 411925, '411622000000', '西华县', '河南,周口,西华', '114.529756', '33.767408', 1); +INSERT INTO `yx_system_city` VALUES (2047, 413030, 2, 411925, '411623000000', '商水县', '河南,周口,商水', '114.611596', '33.542480', 1); +INSERT INTO `yx_system_city` VALUES (2048, 413644, 2, 411925, '411624000000', '沈丘县', '河南,周口,沈丘', '115.098583', '33.409369', 1); +INSERT INTO `yx_system_city` VALUES (2049, 414239, 2, 411925, '411625000000', '郸城县', '河南,周口,郸城', '115.177189', '33.644743', 1); +INSERT INTO `yx_system_city` VALUES (2050, 414779, 2, 411925, '411626000000', '淮阳县', '河南,周口,淮阳', '114.886154', '33.731561', 1); +INSERT INTO `yx_system_city` VALUES (2051, 415271, 2, 411925, '411627000000', '太康县', '河南,周口,太康', '114.837887', '34.063798', 1); +INSERT INTO `yx_system_city` VALUES (2052, 416070, 2, 411925, '411628000000', '鹿邑县', '河南,周口,鹿邑', '115.484454', '33.860000', 1); +INSERT INTO `yx_system_city` VALUES (2053, 416651, 2, 411925, '411681000000', '项城市', '河南,周口,项城', '114.875333', '33.465838', 1); +INSERT INTO `yx_system_city` VALUES (2054, 417175, 2, 417174, '411701000000', '市辖区', '河南,驻马店', '114.022298', '33.011529', 1); +INSERT INTO `yx_system_city` VALUES (2055, 417176, 2, 417174, '411702000000', '驿城区', '河南,驻马店,驿城', '113.993914', '32.973054', 1); +INSERT INTO `yx_system_city` VALUES (2056, 417405, 2, 417174, '411721000000', '西平县', '河南,驻马店,西平', '114.021539', '33.387685', 1); +INSERT INTO `yx_system_city` VALUES (2057, 417712, 2, 417174, '411722000000', '上蔡县', '河南,驻马店,上蔡', '114.264381', '33.262439', 1); +INSERT INTO `yx_system_city` VALUES (2058, 418199, 2, 417174, '411723000000', '平舆县', '河南,驻马店,平舆', '114.619159', '32.962710', 1); +INSERT INTO `yx_system_city` VALUES (2059, 418443, 2, 417174, '411724000000', '正阳县', '河南,驻马店,正阳', '114.392774', '32.605697', 1); +INSERT INTO `yx_system_city` VALUES (2060, 418759, 2, 417174, '411725000000', '确山县', '河南,驻马店,确山', '114.026430', '32.802065', 1); +INSERT INTO `yx_system_city` VALUES (2061, 418973, 2, 417174, '411726000000', '泌阳县', '河南,驻马店,泌阳', '113.327144', '32.723975', 1); +INSERT INTO `yx_system_city` VALUES (2062, 419354, 2, 417174, '411727000000', '汝南县', '河南,驻马店,汝南', '114.362379', '33.006729', 1); +INSERT INTO `yx_system_city` VALUES (2063, 419654, 2, 417174, '411728000000', '遂平县', '河南,驻马店,遂平', '114.013182', '33.145649', 1); +INSERT INTO `yx_system_city` VALUES (2064, 419874, 2, 417174, '411729000000', '新蔡县', '河南,驻马店,新蔡', '114.965469', '32.744855', 1); +INSERT INTO `yx_system_city` VALUES (2065, 420259, 2, 420258, '419001000000', '济源市', '河南,济源', '112.602341', '35.069031', 1); +INSERT INTO `yx_system_city` VALUES (2066, 420826, 2, 420825, '420101000000', '市辖区', '湖北,武汉', '114.305392', '30.593098', 1); +INSERT INTO `yx_system_city` VALUES (2067, 420827, 2, 420825, '420102000000', '江岸区', '湖北,武汉,江岸', '114.309091', '30.600064', 1); +INSERT INTO `yx_system_city` VALUES (2068, 420996, 2, 420825, '420103000000', '江汉区', '湖北,武汉,江汉', '114.270871', '30.601430', 1); +INSERT INTO `yx_system_city` VALUES (2069, 421122, 2, 420825, '420104000000', '硚口区', '湖北,武汉,硚口', '114.214920', '30.582202', 1); +INSERT INTO `yx_system_city` VALUES (2070, 421270, 2, 420825, '420105000000', '汉阳区', '湖北,武汉,汉阳', '114.218724', '30.553905', 1); +INSERT INTO `yx_system_city` VALUES (2071, 421400, 2, 420825, '420106000000', '武昌区', '湖北,武汉,武昌', '114.316223', '30.554235', 1); +INSERT INTO `yx_system_city` VALUES (2072, 421559, 2, 420825, '420107000000', '青山区', '湖北,武汉,青山', '114.385539', '30.639630', 1); +INSERT INTO `yx_system_city` VALUES (2073, 421676, 2, 420825, '420111000000', '洪山区', '湖北,武汉,洪山', '114.343913', '30.500317', 1); +INSERT INTO `yx_system_city` VALUES (2074, 421983, 2, 420825, '420112000000', '东西湖区', '湖北,武汉,东西湖', '114.136886', '30.620020', 1); +INSERT INTO `yx_system_city` VALUES (2075, 422149, 2, 420825, '420113000000', '汉南区', '湖北,武汉,汉南', '114.084445', '30.308856', 1); +INSERT INTO `yx_system_city` VALUES (2076, 422220, 2, 420825, '420114000000', '蔡甸区', '湖北,武汉,蔡甸', '114.029328', '30.582271', 1); +INSERT INTO `yx_system_city` VALUES (2077, 422631, 2, 420825, '420115000000', '江夏区', '湖北,武汉,江夏', '114.321551', '30.375748', 1); +INSERT INTO `yx_system_city` VALUES (2078, 423075, 2, 420825, '420116000000', '黄陂区', '湖北,武汉,黄陂', '114.375743', '30.882557', 1); +INSERT INTO `yx_system_city` VALUES (2079, 423775, 2, 420825, '420117000000', '新洲区', '湖北,武汉,新洲', '114.801107', '30.841544', 1); +INSERT INTO `yx_system_city` VALUES (2080, 424450, 2, 424449, '420201000000', '市辖区', '湖北,黄石', '115.038520', '30.199652', 1); +INSERT INTO `yx_system_city` VALUES (2081, 424451, 2, 424449, '420202000000', '黄石港区', '湖北,黄石,黄石港', '115.065978', '30.223003', 1); +INSERT INTO `yx_system_city` VALUES (2082, 424489, 2, 424449, '420203000000', '西塞山区', '湖北,黄石,西塞山', '115.109955', '30.204924', 1); +INSERT INTO `yx_system_city` VALUES (2083, 424531, 2, 424449, '420204000000', '下陆区', '湖北,黄石,下陆', '114.961327', '30.173913', 1); +INSERT INTO `yx_system_city` VALUES (2084, 424574, 2, 424449, '420205000000', '铁山区', '湖北,黄石,铁山', '114.901412', '30.206592', 1); +INSERT INTO `yx_system_city` VALUES (2085, 424590, 2, 424449, '420222000000', '阳新县', '湖北,黄石,阳新', '115.215227', '29.830258', 1); +INSERT INTO `yx_system_city` VALUES (2086, 425070, 2, 424449, '420281000000', '大冶市', '湖北,黄石,大冶', '114.979875', '30.095643', 1); +INSERT INTO `yx_system_city` VALUES (2087, 425509, 2, 425508, '420301000000', '市辖区', '湖北,十堰', '110.797990', '32.629397', 1); +INSERT INTO `yx_system_city` VALUES (2088, 425510, 2, 425508, '420302000000', '茅箭区', '湖北,十堰,茅箭', '110.813621', '32.591929', 1); +INSERT INTO `yx_system_city` VALUES (2089, 425592, 2, 425508, '420303000000', '张湾区', '湖北,十堰,张湾', '110.769133', '32.652297', 1); +INSERT INTO `yx_system_city` VALUES (2090, 425709, 2, 425508, '420304000000', '郧阳区', '湖北,十堰,郧阳', '110.812050', '32.834776', 1); +INSERT INTO `yx_system_city` VALUES (2091, 426078, 2, 425508, '420322000000', '郧西县', '湖北,十堰,郧西', '110.425983', '32.993182', 1); +INSERT INTO `yx_system_city` VALUES (2092, 426440, 2, 425508, '420323000000', '竹山县', '湖北,十堰,竹山', '110.228694', '32.224875', 1); +INSERT INTO `yx_system_city` VALUES (2093, 426708, 2, 425508, '420324000000', '竹溪县', '湖北,十堰,竹溪', '109.715304', '32.318255', 1); +INSERT INTO `yx_system_city` VALUES (2094, 427085, 2, 425508, '420325000000', '房县', '湖北,十堰,房县', '110.726670', '32.040085', 1); +INSERT INTO `yx_system_city` VALUES (2095, 427420, 2, 425508, '420381000000', '丹江口市', '湖北,十堰,丹江口', '111.513127', '32.540157', 1); +INSERT INTO `yx_system_city` VALUES (2096, 427711, 2, 427710, '420501000000', '市辖区', '湖北,宜昌', '111.286471', '30.691967', 1); +INSERT INTO `yx_system_city` VALUES (2097, 427712, 2, 427710, '420502000000', '西陵区', '湖北,宜昌,西陵', '111.285646', '30.710782', 1); +INSERT INTO `yx_system_city` VALUES (2098, 427828, 2, 427710, '420503000000', '伍家岗区', '湖北,宜昌,伍家岗', '111.361037', '30.644334', 1); +INSERT INTO `yx_system_city` VALUES (2099, 427894, 2, 427710, '420504000000', '点军区', '湖北,宜昌,点军', '111.268120', '30.693247', 1); +INSERT INTO `yx_system_city` VALUES (2100, 427953, 2, 427710, '420505000000', '猇亭区', '湖北,宜昌,猇亭', '111.434620', '30.530903', 1); +INSERT INTO `yx_system_city` VALUES (2101, 427983, 2, 427710, '420506000000', '夷陵区', '湖北,宜昌,夷陵', '111.326380', '30.770006', 1); +INSERT INTO `yx_system_city` VALUES (2102, 428194, 2, 427710, '420525000000', '远安县', '湖北,宜昌,远安', '111.640508', '31.060869', 1); +INSERT INTO `yx_system_city` VALUES (2103, 428319, 2, 427710, '420526000000', '兴山县', '湖北,宜昌,兴山', '110.746805', '31.348196', 1); +INSERT INTO `yx_system_city` VALUES (2104, 428424, 2, 427710, '420527000000', '秭归县', '湖北,宜昌,秭归', '110.977711', '30.825897', 1); +INSERT INTO `yx_system_city` VALUES (2105, 428630, 2, 427710, '420528000000', '长阳土家族自治县', '湖北,宜昌,长阳', '111.207242', '30.472763', 1); +INSERT INTO `yx_system_city` VALUES (2106, 428807, 2, 427710, '420529000000', '五峰土家族自治县', '湖北,宜昌,五峰', '110.674706', '30.199688', 1); +INSERT INTO `yx_system_city` VALUES (2107, 428924, 2, 427710, '420581000000', '宜都市', '湖北,宜昌,宜都', '111.450006', '30.378327', 1); +INSERT INTO `yx_system_city` VALUES (2108, 429089, 2, 427710, '420582000000', '当阳市', '湖北,宜昌,当阳', '111.788312', '30.821266', 1); +INSERT INTO `yx_system_city` VALUES (2109, 429273, 2, 427710, '420583000000', '枝江市', '湖北,宜昌,枝江', '111.760530', '30.425940', 1); +INSERT INTO `yx_system_city` VALUES (2110, 429502, 2, 429501, '420601000000', '市辖区', '湖北,襄阳', '112.122414', '32.008986', 1); +INSERT INTO `yx_system_city` VALUES (2111, 429503, 2, 429501, '420602000000', '襄城区', '湖北,襄阳,襄城', '112.133974', '32.010351', 1); +INSERT INTO `yx_system_city` VALUES (2112, 429687, 2, 429501, '420606000000', '樊城区', '湖北,襄阳,樊城', '112.135684', '32.044833', 1); +INSERT INTO `yx_system_city` VALUES (2113, 429907, 2, 429501, '420607000000', '襄州区', '湖北,襄阳,襄州', '112.211899', '32.087298', 1); +INSERT INTO `yx_system_city` VALUES (2114, 430402, 2, 429501, '420624000000', '南漳县', '湖北,襄阳,南漳', '111.838905', '31.774636', 1); +INSERT INTO `yx_system_city` VALUES (2115, 430723, 2, 429501, '420625000000', '谷城县', '湖北,襄阳,谷城', '111.652982', '32.263849', 1); +INSERT INTO `yx_system_city` VALUES (2116, 431025, 2, 429501, '420626000000', '保康县', '湖北,襄阳,保康', '111.261309', '31.878310', 1); +INSERT INTO `yx_system_city` VALUES (2117, 431301, 2, 429501, '420682000000', '老河口市', '湖北,襄阳,老河口', '111.683861', '32.359068', 1); +INSERT INTO `yx_system_city` VALUES (2118, 431575, 2, 429501, '420683000000', '枣阳市', '湖北,襄阳,枣阳', '112.771959', '32.128818', 1); +INSERT INTO `yx_system_city` VALUES (2119, 432166, 2, 429501, '420684000000', '宜城市', '湖北,襄阳,宜城', '112.257788', '31.719806', 1); +INSERT INTO `yx_system_city` VALUES (2120, 432416, 2, 432415, '420701000000', '市辖区', '湖北,鄂州', '114.894843', '30.391940', 1); +INSERT INTO `yx_system_city` VALUES (2121, 432417, 2, 432415, '420702000000', '梁子湖区', '湖北,鄂州,梁子湖', '114.684731', '30.100141', 1); +INSERT INTO `yx_system_city` VALUES (2122, 432510, 2, 432415, '420703000000', '华容区', '湖北,鄂州,华容', '114.729878', '30.534310', 1); +INSERT INTO `yx_system_city` VALUES (2123, 432633, 2, 432415, '420704000000', '鄂城区', '湖北,鄂州,鄂城', '114.891615', '30.400572', 1); +INSERT INTO `yx_system_city` VALUES (2124, 432830, 2, 432829, '420801000000', '市辖区', '湖北,荆门', '112.199265', '31.035423', 1); +INSERT INTO `yx_system_city` VALUES (2125, 432831, 2, 432829, '420802000000', '东宝区', '湖北,荆门,东宝', '112.201493', '31.051852', 1); +INSERT INTO `yx_system_city` VALUES (2126, 433052, 2, 432829, '420804000000', '掇刀区', '湖北,荆门,掇刀', '112.207833', '30.973431', 1); +INSERT INTO `yx_system_city` VALUES (2127, 433182, 2, 432829, '420821000000', '京山县', '湖北,荆门,京山', '113.119566', '31.018457', 1); +INSERT INTO `yx_system_city` VALUES (2128, 433634, 2, 432829, '420822000000', '沙洋县', '湖北,荆门,沙洋', '112.588581', '30.709221', 1); +INSERT INTO `yx_system_city` VALUES (2129, 433944, 2, 432829, '420881000000', '钟祥市', '湖北,荆门,钟祥', '112.588121', '31.167820', 1); +INSERT INTO `yx_system_city` VALUES (2130, 434549, 2, 434548, '420901000000', '市辖区', '湖北,孝感', '113.916902', '30.924568', 1); +INSERT INTO `yx_system_city` VALUES (2131, 434550, 2, 434548, '420902000000', '孝南区', '湖北,孝感,孝南', '113.910958', '30.916874', 1); +INSERT INTO `yx_system_city` VALUES (2132, 435091, 2, 434548, '420921000000', '孝昌县', '湖北,孝感,孝昌', '113.998010', '31.258159', 1); +INSERT INTO `yx_system_city` VALUES (2133, 435563, 2, 434548, '420922000000', '大悟县', '湖北,孝感,大悟', '114.127022', '31.561165', 1); +INSERT INTO `yx_system_city` VALUES (2134, 435956, 2, 434548, '420923000000', '云梦县', '湖北,孝感,云梦', '113.753554', '31.020983', 1); +INSERT INTO `yx_system_city` VALUES (2135, 436267, 2, 434548, '420981000000', '应城市', '湖北,孝感,应城', '113.572707', '30.928370', 1); +INSERT INTO `yx_system_city` VALUES (2136, 436706, 2, 434548, '420982000000', '安陆市', '湖北,孝感,安陆', '113.688941', '31.255610', 1); +INSERT INTO `yx_system_city` VALUES (2137, 437119, 2, 434548, '420984000000', '汉川市', '湖北,孝感,汉川', '113.839149', '30.661244', 1); +INSERT INTO `yx_system_city` VALUES (2138, 437780, 2, 437779, '421001000000', '市辖区', '湖北,荆州', '112.239741', '30.335165', 1); +INSERT INTO `yx_system_city` VALUES (2139, 437781, 2, 437779, '421002000000', '沙市区', '湖北,荆州,沙市', '112.255583', '30.311056', 1); +INSERT INTO `yx_system_city` VALUES (2140, 437909, 2, 437779, '421003000000', '荆州区', '湖北,荆州,荆州', '112.190185', '30.352832', 1); +INSERT INTO `yx_system_city` VALUES (2141, 438103, 2, 437779, '421022000000', '公安县', '湖北,荆州,公安', '112.229648', '30.058336', 1); +INSERT INTO `yx_system_city` VALUES (2142, 438512, 2, 437779, '421023000000', '监利县', '湖北,荆州,监利', '112.897465', '29.811574', 1); +INSERT INTO `yx_system_city` VALUES (2143, 439263, 2, 437779, '421024000000', '江陵县', '湖北,荆州,江陵', '112.424664', '30.041822', 1); +INSERT INTO `yx_system_city` VALUES (2144, 439491, 2, 437779, '421081000000', '石首市', '湖北,荆州,石首', '112.425454', '29.720938', 1); +INSERT INTO `yx_system_city` VALUES (2145, 439836, 2, 437779, '421083000000', '洪湖市', '湖北,荆州,洪湖', '113.475980', '29.825458', 1); +INSERT INTO `yx_system_city` VALUES (2146, 440344, 2, 437779, '421087000000', '松滋市', '湖北,荆州,松滋', '111.756773', '30.174522', 1); +INSERT INTO `yx_system_city` VALUES (2147, 440640, 2, 440639, '421101000000', '市辖区', '湖北,黄冈', '114.872316', '30.453905', 1); +INSERT INTO `yx_system_city` VALUES (2148, 440641, 2, 440639, '421102000000', '黄州区', '湖北,黄冈,黄州', '114.879398', '30.434050', 1); +INSERT INTO `yx_system_city` VALUES (2149, 440797, 2, 440639, '421121000000', '团风县', '湖北,黄冈,团风', '114.872191', '30.643569', 1); +INSERT INTO `yx_system_city` VALUES (2150, 441110, 2, 440639, '421122000000', '红安县', '湖北,黄冈,红安', '114.618236', '31.288153', 1); +INSERT INTO `yx_system_city` VALUES (2151, 441550, 2, 440639, '421123000000', '罗田县', '湖北,黄冈,罗田', '115.399492', '30.783100', 1); +INSERT INTO `yx_system_city` VALUES (2152, 442017, 2, 440639, '421124000000', '英山县', '湖北,黄冈,英山', '115.681259', '30.734959', 1); +INSERT INTO `yx_system_city` VALUES (2153, 442351, 2, 440639, '421125000000', '浠水县', '湖北,黄冈,浠水', '115.265535', '30.451867', 1); +INSERT INTO `yx_system_city` VALUES (2154, 443040, 2, 440639, '421126000000', '蕲春县', '湖北,黄冈,蕲春', '115.437008', '30.225964', 1); +INSERT INTO `yx_system_city` VALUES (2155, 443641, 2, 440639, '421127000000', '黄梅县', '湖北,黄冈,黄梅', '115.944219', '30.070454', 1); +INSERT INTO `yx_system_city` VALUES (2156, 444186, 2, 440639, '421181000000', '麻城市', '湖北,黄冈,麻城', '115.008163', '31.172740', 1); +INSERT INTO `yx_system_city` VALUES (2157, 444684, 2, 440639, '421182000000', '武穴市', '湖北,黄冈,武穴', '115.561217', '29.844107', 1); +INSERT INTO `yx_system_city` VALUES (2158, 445041, 2, 445040, '421201000000', '市辖区', '湖北,咸宁', '114.322492', '29.841443', 1); +INSERT INTO `yx_system_city` VALUES (2159, 445042, 2, 445040, '421202000000', '咸安区', '湖北,咸宁,咸安', '114.298711', '29.852892', 1); +INSERT INTO `yx_system_city` VALUES (2160, 445249, 2, 445040, '421221000000', '嘉鱼县', '湖北,咸宁,嘉鱼', '113.939277', '29.970737', 1); +INSERT INTO `yx_system_city` VALUES (2161, 445363, 2, 445040, '421222000000', '通城县', '湖北,咸宁,通城', '113.816966', '29.245269', 1); +INSERT INTO `yx_system_city` VALUES (2162, 445569, 2, 445040, '421223000000', '崇阳县', '湖北,咸宁,崇阳', '114.039828', '29.555605', 1); +INSERT INTO `yx_system_city` VALUES (2163, 445786, 2, 445040, '421224000000', '通山县', '湖北,咸宁,通山', '114.482606', '29.605376', 1); +INSERT INTO `yx_system_city` VALUES (2164, 446007, 2, 445040, '421281000000', '赤壁市', '湖北,咸宁,赤壁', '113.900628', '29.724692', 1); +INSERT INTO `yx_system_city` VALUES (2165, 446213, 2, 446212, '421301000000', '市辖区', '湖北,随州', '113.382458', '31.690215', 1); +INSERT INTO `yx_system_city` VALUES (2166, 446214, 2, 446212, '421303000000', '曾都区', '湖北,随州,曾都', '113.371121', '31.716280', 1); +INSERT INTO `yx_system_city` VALUES (2167, 446433, 2, 446212, '421321000000', '随县', '湖北,随州,随县', '113.299528', '31.853833', 1); +INSERT INTO `yx_system_city` VALUES (2168, 446847, 2, 446212, '421381000000', '广水市', '湖北,随州,广水', '113.825890', '31.616854', 1); +INSERT INTO `yx_system_city` VALUES (2169, 447269, 2, 447268, '422801000000', '恩施市', '湖北,恩施,恩施', '109.479665', '30.294680', 1); +INSERT INTO `yx_system_city` VALUES (2170, 447495, 2, 447268, '422802000000', '利川市', '湖北,恩施,利川', '108.936376', '30.290996', 1); +INSERT INTO `yx_system_city` VALUES (2171, 448099, 2, 447268, '422822000000', '建始县', '湖北,恩施,建始', '109.726667', '30.601555', 1); +INSERT INTO `yx_system_city` VALUES (2172, 448521, 2, 447268, '422823000000', '巴东县', '湖北,恩施,巴东', '110.340756', '31.042324', 1); +INSERT INTO `yx_system_city` VALUES (2173, 448856, 2, 447268, '422825000000', '宣恩县', '湖北,恩施,宣恩', '109.491485', '29.986899', 1); +INSERT INTO `yx_system_city` VALUES (2174, 449150, 2, 447268, '422826000000', '咸丰县', '湖北,恩施,咸丰', '109.139726', '29.665203', 1); +INSERT INTO `yx_system_city` VALUES (2175, 449431, 2, 447268, '422827000000', '来凤县', '湖北,恩施,来凤', '109.407828', '29.493485', 1); +INSERT INTO `yx_system_city` VALUES (2176, 449636, 2, 447268, '422828000000', '鹤峰县', '湖北,恩施,鹤峰', '110.033662', '29.890171', 1); +INSERT INTO `yx_system_city` VALUES (2177, 449866, 2, 449865, '429004000000', '仙桃市', '湖北,仙桃', '113.442970', '30.328407', 1); +INSERT INTO `yx_system_city` VALUES (2178, 450653, 2, 449865, '429005000000', '潜江市', '湖北,潜江', '112.900284', '30.401947', 1); +INSERT INTO `yx_system_city` VALUES (2179, 451150, 2, 449865, '429006000000', '天门市', '湖北,天门', '113.166557', '30.663719', 1); +INSERT INTO `yx_system_city` VALUES (2180, 452034, 2, 449865, '429021000000', '神农架林区', '湖北,神农架林', '110.675758', '31.744898', 1); +INSERT INTO `yx_system_city` VALUES (2181, 452125, 2, 452124, '430101000000', '市辖区', '湖南,长沙', '112.938814', '28.228209', 1); +INSERT INTO `yx_system_city` VALUES (2182, 452126, 2, 452124, '430102000000', '芙蓉区', '湖南,长沙,芙蓉', '113.032539', '28.185386', 1); +INSERT INTO `yx_system_city` VALUES (2183, 452213, 2, 452124, '430103000000', '天心区', '湖南,长沙,天心', '112.989855', '28.112525', 1); +INSERT INTO `yx_system_city` VALUES (2184, 452314, 2, 452124, '430104000000', '岳麓区', '湖南,长沙,岳麓', '112.931383', '28.235243', 1); +INSERT INTO `yx_system_city` VALUES (2185, 452486, 2, 452124, '430105000000', '开福区', '湖南,长沙,开福', '112.985545', '28.257269', 1); +INSERT INTO `yx_system_city` VALUES (2186, 452610, 2, 452124, '430111000000', '雨花区', '湖南,长沙,雨花', '113.038017', '28.137710', 1); +INSERT INTO `yx_system_city` VALUES (2187, 452771, 2, 452124, '430112000000', '望城区', '湖南,长沙,望城', '112.819549', '28.347458', 1); +INSERT INTO `yx_system_city` VALUES (2188, 452924, 2, 452124, '430121000000', '长沙县', '湖南,长沙,长沙', '113.080810', '28.246150', 1); +INSERT INTO `yx_system_city` VALUES (2189, 453140, 2, 452124, '430124000000', '宁乡县', '湖南,长沙,宁乡', '112.551885', '28.277483', 1); +INSERT INTO `yx_system_city` VALUES (2190, 453444, 2, 452124, '430181000000', '浏阳市', '湖南,长沙,浏阳', '113.643076', '28.162833', 1); +INSERT INTO `yx_system_city` VALUES (2191, 453800, 2, 453799, '430201000000', '市辖区', '湖南,株洲', '113.134002', '27.827550', 1); +INSERT INTO `yx_system_city` VALUES (2192, 453801, 2, 453799, '430202000000', '荷塘区', '湖南,株洲,荷塘', '113.173487', '27.855929', 1); +INSERT INTO `yx_system_city` VALUES (2193, 453867, 2, 453799, '430203000000', '芦淞区', '湖南,株洲,芦淞', '113.152724', '27.785070', 1); +INSERT INTO `yx_system_city` VALUES (2194, 453957, 2, 453799, '430204000000', '石峰区', '湖南,株洲,石峰', '113.117732', '27.875445', 1); +INSERT INTO `yx_system_city` VALUES (2195, 454008, 2, 453799, '430211000000', '天元区', '湖南,株洲,天元', '113.082216', '27.826867', 1); +INSERT INTO `yx_system_city` VALUES (2196, 454113, 2, 453799, '430221000000', '株洲县', '湖南,株洲,株洲', '113.144006', '27.699346', 1); +INSERT INTO `yx_system_city` VALUES (2197, 454261, 2, 453799, '430223000000', '攸县', '湖南,株洲,攸县', '113.345309', '27.000227', 1); +INSERT INTO `yx_system_city` VALUES (2198, 454580, 2, 453799, '430224000000', '茶陵县', '湖南,株洲,茶陵', '113.539280', '26.777492', 1); +INSERT INTO `yx_system_city` VALUES (2199, 454845, 2, 453799, '430225000000', '炎陵县', '湖南,株洲,炎陵', '113.772655', '26.489902', 1); +INSERT INTO `yx_system_city` VALUES (2200, 454989, 2, 453799, '430281000000', '醴陵市', '湖南,株洲,醴陵', '113.496894', '27.646130', 1); +INSERT INTO `yx_system_city` VALUES (2201, 455284, 2, 455283, '430301000000', '市辖区', '湖南,湘潭', '112.944049', '27.829738', 1); +INSERT INTO `yx_system_city` VALUES (2202, 455285, 2, 455283, '430302000000', '雨湖区', '湖南,湘潭,雨湖', '112.907238', '27.856250', 1); +INSERT INTO `yx_system_city` VALUES (2203, 455426, 2, 455283, '430304000000', '岳塘区', '湖南,湘潭,岳塘', '112.969480', '27.872028', 1); +INSERT INTO `yx_system_city` VALUES (2204, 455515, 2, 455283, '430321000000', '湘潭县', '湖南,湘潭,湘潭', '112.950831', '27.778958', 1); +INSERT INTO `yx_system_city` VALUES (2205, 455889, 2, 455283, '430381000000', '湘乡市', '湖南,湘潭,湘乡', '112.535028', '27.734120', 1); +INSERT INTO `yx_system_city` VALUES (2206, 456260, 2, 455283, '430382000000', '韶山市', '湖南,湘潭,韶山', '112.526671', '27.915009', 1); +INSERT INTO `yx_system_city` VALUES (2207, 456304, 2, 456303, '430401000000', '市辖区', '湖南,衡阳', '112.571997', '26.893230', 1); +INSERT INTO `yx_system_city` VALUES (2208, 456305, 2, 456303, '430405000000', '珠晖区', '湖南,衡阳,珠晖', '112.620112', '26.894657', 1); +INSERT INTO `yx_system_city` VALUES (2209, 456391, 2, 456303, '430406000000', '雁峰区', '湖南,衡阳,雁峰', '112.616546', '26.888666', 1); +INSERT INTO `yx_system_city` VALUES (2210, 456449, 2, 456303, '430407000000', '石鼓区', '湖南,衡阳,石鼓', '112.598089', '26.943215', 1); +INSERT INTO `yx_system_city` VALUES (2211, 456502, 2, 456303, '430408000000', '蒸湘区', '湖南,衡阳,蒸湘', '112.567064', '26.911404', 1); +INSERT INTO `yx_system_city` VALUES (2212, 456558, 2, 456303, '430412000000', '南岳区', '湖南,衡阳,南岳', '112.738604', '27.232444', 1); +INSERT INTO `yx_system_city` VALUES (2213, 456587, 2, 456303, '430421000000', '衡阳县', '湖南,衡阳,衡阳', '112.370532', '26.969635', 1); +INSERT INTO `yx_system_city` VALUES (2214, 457104, 2, 456303, '430422000000', '衡南县', '湖南,衡阳,衡南', '112.677877', '26.738248', 1); +INSERT INTO `yx_system_city` VALUES (2215, 457576, 2, 456303, '430423000000', '衡山县', '湖南,衡阳,衡山', '112.868268', '27.230291', 1); +INSERT INTO `yx_system_city` VALUES (2216, 457742, 2, 456303, '430424000000', '衡东县', '湖南,衡阳,衡东', '112.953168', '27.081170', 1); +INSERT INTO `yx_system_city` VALUES (2217, 458018, 2, 456303, '430426000000', '祁东县', '湖南,衡阳,祁东', '112.090357', '26.799896', 1); +INSERT INTO `yx_system_city` VALUES (2218, 458411, 2, 456303, '430481000000', '耒阳市', '湖南,衡阳,耒阳', '112.859795', '26.422275', 1); +INSERT INTO `yx_system_city` VALUES (2219, 458820, 2, 456303, '430482000000', '常宁市', '湖南,衡阳,常宁', '112.399995', '26.420932', 1); +INSERT INTO `yx_system_city` VALUES (2220, 459252, 2, 459251, '430501000000', '市辖区', '湖南,邵阳', '111.467791', '27.238892', 1); +INSERT INTO `yx_system_city` VALUES (2221, 459253, 2, 459251, '430502000000', '双清区', '湖南,邵阳,双清', '111.496341', '27.232708', 1); +INSERT INTO `yx_system_city` VALUES (2222, 459357, 2, 459251, '430503000000', '大祥区', '湖南,邵阳,大祥', '111.439091', '27.221452', 1); +INSERT INTO `yx_system_city` VALUES (2223, 459470, 2, 459251, '430511000000', '北塔区', '湖南,邵阳,北塔', '111.452197', '27.246489', 1); +INSERT INTO `yx_system_city` VALUES (2224, 459517, 2, 459251, '430521000000', '邵东县', '湖南,邵阳,邵东', '111.744258', '27.258942', 1); +INSERT INTO `yx_system_city` VALUES (2225, 460126, 2, 459251, '430522000000', '新邵县', '湖南,邵阳,新邵', '111.458657', '27.320918', 1); +INSERT INTO `yx_system_city` VALUES (2226, 460558, 2, 459251, '430523000000', '邵阳县', '湖南,邵阳,邵阳', '111.273806', '26.990637', 1); +INSERT INTO `yx_system_city` VALUES (2227, 461014, 2, 459251, '430524000000', '隆回县', '湖南,邵阳,隆回', '111.032438', '27.113978', 1); +INSERT INTO `yx_system_city` VALUES (2228, 461613, 2, 459251, '430525000000', '洞口县', '湖南,邵阳,洞口', '110.575846', '27.060321', 1); +INSERT INTO `yx_system_city` VALUES (2229, 462000, 2, 459251, '430527000000', '绥宁县', '湖南,邵阳,绥宁', '110.155655', '26.581955', 1); +INSERT INTO `yx_system_city` VALUES (2230, 462257, 2, 459251, '430528000000', '新宁县', '湖南,邵阳,新宁', '110.856623', '26.433418', 1); +INSERT INTO `yx_system_city` VALUES (2231, 462600, 2, 459251, '430529000000', '城步苗族自治县', '湖南,邵阳,城步', '111.467791', '27.238892', 1); +INSERT INTO `yx_system_city` VALUES (2232, 462807, 2, 459251, '430581000000', '武冈市', '湖南,邵阳,武冈', '110.631884', '26.726599', 1); +INSERT INTO `yx_system_city` VALUES (2233, 463142, 2, 463141, '430601000000', '市辖区', '湖南,岳阳', '113.128958', '29.357104', 1); +INSERT INTO `yx_system_city` VALUES (2234, 463143, 2, 463141, '430602000000', '岳阳楼区', '湖南,岳阳,岳阳楼', '113.129702', '29.371903', 1); +INSERT INTO `yx_system_city` VALUES (2235, 463333, 2, 463141, '430603000000', '云溪区', '湖南,岳阳,云溪', '113.272313', '29.472746', 1); +INSERT INTO `yx_system_city` VALUES (2236, 463397, 2, 463141, '430611000000', '君山区', '湖南,岳阳,君山', '113.006435', '29.461106', 1); +INSERT INTO `yx_system_city` VALUES (2237, 463489, 2, 463141, '430621000000', '岳阳县', '湖南,岳阳,岳阳', '113.116418', '29.144067', 1); +INSERT INTO `yx_system_city` VALUES (2238, 463722, 2, 463141, '430623000000', '华容县', '湖南,岳阳,华容', '112.540463', '29.531057', 1); +INSERT INTO `yx_system_city` VALUES (2239, 463961, 2, 463141, '430624000000', '湘阴县', '湖南,岳阳,湘阴', '112.909426', '28.689105', 1); +INSERT INTO `yx_system_city` VALUES (2240, 464180, 2, 463141, '430626000000', '平江县', '湖南,岳阳,平江', '113.581234', '28.701868', 1); +INSERT INTO `yx_system_city` VALUES (2241, 464747, 2, 463141, '430681000000', '汨罗市', '湖南,岳阳,汨罗', '113.067259', '28.806890', 1); +INSERT INTO `yx_system_city` VALUES (2242, 464944, 2, 463141, '430682000000', '临湘市', '湖南,岳阳,临湘', '113.450423', '29.476849', 1); +INSERT INTO `yx_system_city` VALUES (2243, 465106, 2, 465105, '430701000000', '市辖区', '湖南,常德', '111.698497', '29.031673', 1); +INSERT INTO `yx_system_city` VALUES (2244, 465107, 2, 465105, '430702000000', '武陵区', '湖南,常德,武陵', '111.683153', '29.055163', 1); +INSERT INTO `yx_system_city` VALUES (2245, 465295, 2, 465105, '430703000000', '鼎城区', '湖南,常德,鼎城', '111.680783', '29.018593', 1); +INSERT INTO `yx_system_city` VALUES (2246, 465661, 2, 465105, '430721000000', '安乡县', '湖南,常德,安乡', '112.171131', '29.411309', 1); +INSERT INTO `yx_system_city` VALUES (2247, 465844, 2, 465105, '430722000000', '汉寿县', '湖南,常德,汉寿', '111.970514', '28.906107', 1); +INSERT INTO `yx_system_city` VALUES (2248, 466173, 2, 465105, '430723000000', '澧县', '湖南,常德,澧县', '111.758702', '29.633237', 1); +INSERT INTO `yx_system_city` VALUES (2249, 466483, 2, 465105, '430724000000', '临澧县', '湖南,常德,临澧', '111.647518', '29.440793', 1); +INSERT INTO `yx_system_city` VALUES (2250, 466654, 2, 465105, '430725000000', '桃源县', '湖南,常德,桃源', '111.488925', '28.902503', 1); +INSERT INTO `yx_system_city` VALUES (2251, 467112, 2, 465105, '430726000000', '石门县', '湖南,常德,石门', '111.380014', '29.584293', 1); +INSERT INTO `yx_system_city` VALUES (2252, 467471, 2, 465105, '430781000000', '津市市', '湖南,常德,津', '111.698497', '29.031673', 1); +INSERT INTO `yx_system_city` VALUES (2253, 467563, 2, 467562, '430801000000', '市辖区', '湖南,张家界', '110.479191', '29.117096', 1); +INSERT INTO `yx_system_city` VALUES (2254, 467564, 2, 467562, '430802000000', '永定区', '湖南,张家界,永定', '110.537138', '29.119856', 1); +INSERT INTO `yx_system_city` VALUES (2255, 467841, 2, 467562, '430811000000', '武陵源区', '湖南,张家界,武陵源', '110.550434', '29.345730', 1); +INSERT INTO `yx_system_city` VALUES (2256, 467881, 2, 467562, '430821000000', '慈利县', '湖南,张家界,慈利', '111.139711', '29.429972', 1); +INSERT INTO `yx_system_city` VALUES (2257, 468338, 2, 467562, '430822000000', '桑植县', '湖南,张家界,桑植', '110.204911', '29.414264', 1); +INSERT INTO `yx_system_city` VALUES (2258, 468661, 2, 468660, '430901000000', '市辖区', '湖南,益阳', '112.355180', '28.553860', 1); +INSERT INTO `yx_system_city` VALUES (2259, 468662, 2, 468660, '430902000000', '资阳区', '湖南,益阳,资阳', '112.324322', '28.590966', 1); +INSERT INTO `yx_system_city` VALUES (2260, 468790, 2, 468660, '430903000000', '赫山区', '湖南,益阳,赫山', '112.374024', '28.579343', 1); +INSERT INTO `yx_system_city` VALUES (2261, 469015, 2, 468660, '430921000000', '南县', '湖南,益阳,南县', '112.396241', '29.361338', 1); +INSERT INTO `yx_system_city` VALUES (2262, 469192, 2, 468660, '430922000000', '桃江县', '湖南,益阳,桃江', '112.155822', '28.518085', 1); +INSERT INTO `yx_system_city` VALUES (2263, 469452, 2, 468660, '430923000000', '安化县', '湖南,益阳,安化', '111.212846', '28.374107', 1); +INSERT INTO `yx_system_city` VALUES (2264, 469909, 2, 468660, '430981000000', '沅江市', '湖南,益阳,沅江', '112.355954', '28.847045', 1); +INSERT INTO `yx_system_city` VALUES (2265, 470124, 2, 470123, '431001000000', '市辖区', '湖南,郴州', '113.014717', '25.770509', 1); +INSERT INTO `yx_system_city` VALUES (2266, 470125, 2, 470123, '431002000000', '北湖区', '湖南,郴州,北湖', '113.011035', '25.784054', 1); +INSERT INTO `yx_system_city` VALUES (2267, 470300, 2, 470123, '431003000000', '苏仙区', '湖南,郴州,苏仙', '113.042441', '25.800370', 1); +INSERT INTO `yx_system_city` VALUES (2268, 470500, 2, 470123, '431021000000', '桂阳县', '湖南,郴州,桂阳', '112.734176', '25.754167', 1); +INSERT INTO `yx_system_city` VALUES (2269, 470894, 2, 470123, '431022000000', '宜章县', '湖南,郴州,宜章', '112.948772', '25.399792', 1); +INSERT INTO `yx_system_city` VALUES (2270, 471178, 2, 470123, '431023000000', '永兴县', '湖南,郴州,永兴', '113.116528', '26.127151', 1); +INSERT INTO `yx_system_city` VALUES (2271, 471473, 2, 470123, '431024000000', '嘉禾县', '湖南,郴州,嘉禾', '112.369021', '25.587520', 1); +INSERT INTO `yx_system_city` VALUES (2272, 471685, 2, 470123, '431025000000', '临武县', '湖南,郴州,临武', '112.563456', '25.275560', 1); +INSERT INTO `yx_system_city` VALUES (2273, 471908, 2, 470123, '431026000000', '汝城县', '湖南,郴州,汝城', '113.684727', '25.532816', 1); +INSERT INTO `yx_system_city` VALUES (2274, 472174, 2, 470123, '431027000000', '桂东县', '湖南,郴州,桂东', '113.944614', '26.077616', 1); +INSERT INTO `yx_system_city` VALUES (2275, 472301, 2, 470123, '431028000000', '安仁县', '湖南,郴州,安仁', '113.269441', '26.709056', 1); +INSERT INTO `yx_system_city` VALUES (2276, 472477, 2, 470123, '431081000000', '资兴市', '湖南,郴州,资兴', '113.236146', '25.976243', 1); +INSERT INTO `yx_system_city` VALUES (2277, 472710, 2, 472709, '431101000000', '市辖区', '湖南,永州', '111.613445', '26.420394', 1); +INSERT INTO `yx_system_city` VALUES (2278, 472711, 2, 472709, '431102000000', '零陵区', '湖南,永州,零陵', '111.631109', '26.221936', 1); +INSERT INTO `yx_system_city` VALUES (2279, 473062, 2, 472709, '431103000000', '冷水滩区', '湖南,永州,冷水滩', '111.592143', '26.461077', 1); +INSERT INTO `yx_system_city` VALUES (2280, 473284, 2, 472709, '431121000000', '祁阳县', '湖南,永州,祁阳', '111.840657', '26.580120', 1); +INSERT INTO `yx_system_city` VALUES (2281, 473871, 2, 472709, '431122000000', '东安县', '湖南,永州,东安', '111.314117', '26.394404', 1); +INSERT INTO `yx_system_city` VALUES (2282, 474233, 2, 472709, '431123000000', '双牌县', '湖南,永州,双牌', '111.659967', '25.961910', 1); +INSERT INTO `yx_system_city` VALUES (2283, 474367, 2, 472709, '431124000000', '道县', '湖南,永州,道县', '111.600796', '25.526438', 1); +INSERT INTO `yx_system_city` VALUES (2284, 474761, 2, 472709, '431125000000', '江永县', '湖南,永州,江永', '111.343911', '25.273539', 1); +INSERT INTO `yx_system_city` VALUES (2285, 474883, 2, 472709, '431126000000', '宁远县', '湖南,永州,宁远', '111.945805', '25.570976', 1); +INSERT INTO `yx_system_city` VALUES (2286, 475326, 2, 472709, '431127000000', '蓝山县', '湖南,永州,蓝山', '112.196731', '25.369898', 1); +INSERT INTO `yx_system_city` VALUES (2287, 475574, 2, 472709, '431128000000', '新田县', '湖南,永州,新田', '112.203287', '25.904305', 1); +INSERT INTO `yx_system_city` VALUES (2288, 475819, 2, 472709, '431129000000', '江华瑶族自治县', '湖南,永州,江华', '111.579305', '25.185590', 1); +INSERT INTO `yx_system_city` VALUES (2289, 476149, 2, 476148, '431201000000', '市辖区', '湖南,怀化', '109.998488', '27.554978', 1); +INSERT INTO `yx_system_city` VALUES (2290, 476150, 2, 476148, '431202000000', '鹤城区', '湖南,怀化,鹤城', '110.040315', '27.578926', 1); +INSERT INTO `yx_system_city` VALUES (2291, 476288, 2, 476148, '431221000000', '中方县', '湖南,怀化,中方', '109.944712', '27.440139', 1); +INSERT INTO `yx_system_city` VALUES (2292, 476449, 2, 476148, '431222000000', '沅陵县', '湖南,怀化,沅陵', '110.393844', '28.452686', 1); +INSERT INTO `yx_system_city` VALUES (2293, 476874, 2, 476148, '431223000000', '辰溪县', '湖南,怀化,辰溪', '110.183917', '28.006336', 1); +INSERT INTO `yx_system_city` VALUES (2294, 477191, 2, 476148, '431224000000', '溆浦县', '湖南,怀化,溆浦', '110.594921', '27.908281', 1); +INSERT INTO `yx_system_city` VALUES (2295, 477633, 2, 476148, '431225000000', '会同县', '湖南,怀化,会同', '109.735661', '26.887239', 1); +INSERT INTO `yx_system_city` VALUES (2296, 477895, 2, 476148, '431226000000', '麻阳苗族自治县', '湖南,怀化,麻阳', '109.802587', '27.865548', 1); +INSERT INTO `yx_system_city` VALUES (2297, 478135, 2, 476148, '431227000000', '新晃侗族自治县', '湖南,怀化,新晃', '109.174932', '27.352673', 1); +INSERT INTO `yx_system_city` VALUES (2298, 478299, 2, 476148, '431228000000', '芷江侗族自治县', '湖南,怀化,芷江', '109.684629', '27.443499', 1); +INSERT INTO `yx_system_city` VALUES (2299, 478536, 2, 476148, '431229000000', '靖州苗族侗族自治县', '湖南,怀化,靖州', '109.696311', '26.575052', 1); +INSERT INTO `yx_system_city` VALUES (2300, 478685, 2, 476148, '431230000000', '通道侗族自治县', '湖南,怀化,通道', '109.784412', '26.158054', 1); +INSERT INTO `yx_system_city` VALUES (2301, 478864, 2, 476148, '431281000000', '洪江市', '湖南,怀化,洪江', '109.836669', '27.208609', 1); +INSERT INTO `yx_system_city` VALUES (2302, 479104, 2, 479103, '431301000000', '市辖区', '湖南,娄底', '111.993497', '27.700062', 1); +INSERT INTO `yx_system_city` VALUES (2303, 479105, 2, 479103, '431302000000', '娄星区', '湖南,娄底,娄星', '112.001936', '27.729924', 1); +INSERT INTO `yx_system_city` VALUES (2304, 479285, 2, 479103, '431321000000', '双峰县', '湖南,娄底,双峰', '112.175246', '27.456658', 1); +INSERT INTO `yx_system_city` VALUES (2305, 479889, 2, 479103, '431322000000', '新化县', '湖南,娄底,新化', '111.327412', '27.726515', 1); +INSERT INTO `yx_system_city` VALUES (2306, 480606, 2, 479103, '431381000000', '冷水江市', '湖南,娄底,冷水江', '111.435623', '27.685850', 1); +INSERT INTO `yx_system_city` VALUES (2307, 480767, 2, 479103, '431382000000', '涟源市', '湖南,娄底,涟源', '111.664316', '27.692542', 1); +INSERT INTO `yx_system_city` VALUES (2308, 481320, 2, 481319, '433101000000', '吉首市', '湖南,湘西,吉首', '109.698055', '28.262507', 1); +INSERT INTO `yx_system_city` VALUES (2309, 481465, 2, 481319, '433122000000', '泸溪县', '湖南,湘西,泸溪', '110.219610', '28.216641', 1); +INSERT INTO `yx_system_city` VALUES (2310, 481626, 2, 481319, '433123000000', '凤凰县', '湖南,湘西,凤凰', '109.598719', '27.948116', 1); +INSERT INTO `yx_system_city` VALUES (2311, 481925, 2, 481319, '433124000000', '花垣县', '湖南,湘西,花垣', '109.482078', '28.572030', 1); +INSERT INTO `yx_system_city` VALUES (2312, 482179, 2, 481319, '433125000000', '保靖县', '湖南,湘西,保靖', '109.660577', '28.699774', 1); +INSERT INTO `yx_system_city` VALUES (2313, 482377, 2, 481319, '433126000000', '古丈县', '湖南,湘西,古丈', '109.950728', '28.616935', 1); +INSERT INTO `yx_system_city` VALUES (2314, 482506, 2, 481319, '433127000000', '永顺县', '湖南,湘西,永顺', '109.851254', '29.001440', 1); +INSERT INTO `yx_system_city` VALUES (2315, 482831, 2, 481319, '433130000000', '龙山县', '湖南,湘西,龙山', '109.443939', '29.457663', 1); +INSERT INTO `yx_system_city` VALUES (2316, 483252, 2, 483251, '440101000000', '市辖区', '广东,广州', '113.264434', '23.129162', 1); +INSERT INTO `yx_system_city` VALUES (2317, 483253, 2, 483251, '440103000000', '荔湾区', '广东,广州,荔湾', '113.244261', '23.125981', 1); +INSERT INTO `yx_system_city` VALUES (2318, 483462, 2, 483251, '440104000000', '越秀区', '广东,广州,越秀', '113.266841', '23.128524', 1); +INSERT INTO `yx_system_city` VALUES (2319, 483703, 2, 483251, '440105000000', '海珠区', '广东,广州,海珠', '113.317388', '23.083801', 1); +INSERT INTO `yx_system_city` VALUES (2320, 483979, 2, 483251, '440106000000', '天河区', '广东,广州,天河', '113.361200', '23.124680', 1); +INSERT INTO `yx_system_city` VALUES (2321, 484218, 2, 483251, '440111000000', '白云区', '广东,广州,白云', '113.273289', '23.157290', 1); +INSERT INTO `yx_system_city` VALUES (2322, 484627, 2, 483251, '440112000000', '黄埔区', '广东,广州,黄埔', '113.459749', '23.106402', 1); +INSERT INTO `yx_system_city` VALUES (2323, 484770, 2, 483251, '440113000000', '番禺区', '广东,广州,番禺', '113.384129', '22.937244', 1); +INSERT INTO `yx_system_city` VALUES (2324, 485059, 2, 483251, '440114000000', '花都区', '广东,广州,花都', '113.220218', '23.404165', 1); +INSERT INTO `yx_system_city` VALUES (2325, 485312, 2, 483251, '440115000000', '南沙区', '广东,广州,南沙', '113.525172', '22.801627', 1); +INSERT INTO `yx_system_city` VALUES (2326, 485489, 2, 483251, '440117000000', '从化区', '广东,广州,从化', '113.586605', '23.548852', 1); +INSERT INTO `yx_system_city` VALUES (2327, 485776, 2, 483251, '440118000000', '增城区', '广东,广州,增城', '113.810860', '23.261141', 1); +INSERT INTO `yx_system_city` VALUES (2328, 486130, 2, 486129, '440201000000', '市辖区', '广东,韶关', '113.597522', '24.810403', 1); +INSERT INTO `yx_system_city` VALUES (2329, 486131, 2, 486129, '440203000000', '武江区', '广东,韶关,武江', '113.587774', '24.792924', 1); +INSERT INTO `yx_system_city` VALUES (2330, 486223, 2, 486129, '440204000000', '浈江区', '广东,韶关,浈江', '113.611098', '24.804381', 1); +INSERT INTO `yx_system_city` VALUES (2331, 486345, 2, 486129, '440205000000', '曲江区', '广东,韶关,曲江', '113.604549', '24.682728', 1); +INSERT INTO `yx_system_city` VALUES (2332, 486469, 2, 486129, '440222000000', '始兴县', '广东,韶关,始兴', '114.061789', '24.952977', 1); +INSERT INTO `yx_system_city` VALUES (2333, 486609, 2, 486129, '440224000000', '仁化县', '广东,韶关,仁化', '113.749027', '25.085621', 1); +INSERT INTO `yx_system_city` VALUES (2334, 486746, 2, 486129, '440229000000', '翁源县', '广东,韶关,翁源', '114.130342', '24.350347', 1); +INSERT INTO `yx_system_city` VALUES (2335, 486929, 2, 486129, '440232000000', '乳源瑶族自治县', '广东,韶关,乳源', '113.275883', '24.776078', 1); +INSERT INTO `yx_system_city` VALUES (2336, 487058, 2, 486129, '440233000000', '新丰县', '广东,韶关,新丰', '114.206867', '24.059760', 1); +INSERT INTO `yx_system_city` VALUES (2337, 487223, 2, 486129, '440281000000', '乐昌市', '广东,韶关,乐昌', '113.347519', '25.130136', 1); +INSERT INTO `yx_system_city` VALUES (2338, 487468, 2, 486129, '440282000000', '南雄市', '广东,韶关,南雄', '114.311982', '25.117753', 1); +INSERT INTO `yx_system_city` VALUES (2339, 487722, 2, 487721, '440301000000', '市辖区', '广东,深圳', '114.057868', '22.543099', 1); +INSERT INTO `yx_system_city` VALUES (2340, 487723, 2, 487721, '440303000000', '罗湖区', '广东,深圳,罗湖', '114.131764', '22.548171', 1); +INSERT INTO `yx_system_city` VALUES (2341, 487849, 2, 487721, '440304000000', '福田区', '广东,深圳,福田', '114.055036', '22.521530', 1); +INSERT INTO `yx_system_city` VALUES (2342, 487977, 2, 487721, '440305000000', '南山区', '广东,深圳,南山', '113.930476', '22.533013', 1); +INSERT INTO `yx_system_city` VALUES (2343, 488090, 2, 487721, '440306000000', '宝安区', '广东,深圳,宝安', '113.884020', '22.555259', 1); +INSERT INTO `yx_system_city` VALUES (2344, 488375, 2, 487721, '440307000000', '龙岗区', '广东,深圳,龙岗', '114.246899', '22.720968', 1); +INSERT INTO `yx_system_city` VALUES (2345, 488558, 2, 487721, '440308000000', '盐田区', '广东,深圳,盐田', '114.236875', '22.556499', 1); +INSERT INTO `yx_system_city` VALUES (2346, 488590, 2, 488589, '440401000000', '市辖区', '广东,珠海', '113.576726', '22.270715', 1); +INSERT INTO `yx_system_city` VALUES (2347, 488591, 2, 488589, '440402000000', '香洲区', '广东,珠海,香洲', '113.543785', '22.265811', 1); +INSERT INTO `yx_system_city` VALUES (2348, 488768, 2, 488589, '440403000000', '斗门区', '广东,珠海,斗门', '113.296467', '22.209200', 1); +INSERT INTO `yx_system_city` VALUES (2349, 488905, 2, 488589, '440404000000', '金湾区', '广东,珠海,金湾', '113.363393', '22.146874', 1); +INSERT INTO `yx_system_city` VALUES (2350, 488955, 2, 488954, '440501000000', '市辖区', '广东,汕头', '116.681972', '23.354091', 1); +INSERT INTO `yx_system_city` VALUES (2351, 488956, 2, 488954, '440507000000', '龙湖区', '广东,汕头,龙湖', '116.716534', '23.371476', 1); +INSERT INTO `yx_system_city` VALUES (2352, 489082, 2, 488954, '440511000000', '金平区', '广东,汕头,金平', '116.703426', '23.365613', 1); +INSERT INTO `yx_system_city` VALUES (2353, 489270, 2, 488954, '440512000000', '濠江区', '广东,汕头,濠江', '116.726973', '23.286079', 1); +INSERT INTO `yx_system_city` VALUES (2354, 489338, 2, 488954, '440513000000', '潮阳区', '广东,汕头,潮阳', '116.601515', '23.264936', 1); +INSERT INTO `yx_system_city` VALUES (2355, 489624, 2, 488954, '440514000000', '潮南区', '广东,汕头,潮南', '116.433017', '23.250425', 1); +INSERT INTO `yx_system_city` VALUES (2356, 489868, 2, 488954, '440515000000', '澄海区', '广东,汕头,澄海', '116.756092', '23.465960', 1); +INSERT INTO `yx_system_city` VALUES (2357, 490064, 2, 488954, '440523000000', '南澳县', '广东,汕头,南澳', '117.023374', '23.421724', 1); +INSERT INTO `yx_system_city` VALUES (2358, 490107, 2, 490106, '440601000000', '市辖区', '广东,佛山', '113.121416', '23.021548', 1); +INSERT INTO `yx_system_city` VALUES (2359, 490108, 2, 490106, '440604000000', '禅城区', '广东,佛山,禅城', '113.122440', '23.009505', 1); +INSERT INTO `yx_system_city` VALUES (2360, 490257, 2, 490106, '440605000000', '南海区', '广东,佛山,南海', '113.143441', '23.028956', 1); +INSERT INTO `yx_system_city` VALUES (2361, 490531, 2, 490106, '440606000000', '顺德区', '广东,佛山,顺德', '113.293359', '22.805240', 1); +INSERT INTO `yx_system_city` VALUES (2362, 490746, 2, 490106, '440607000000', '三水区', '广东,佛山,三水', '112.896668', '23.156065', 1); +INSERT INTO `yx_system_city` VALUES (2363, 490834, 2, 490106, '440608000000', '高明区', '广东,佛山,高明', '112.892578', '22.900182', 1); +INSERT INTO `yx_system_city` VALUES (2364, 490920, 2, 490919, '440701000000', '市辖区', '广东,江门', '113.081901', '22.578738', 1); +INSERT INTO `yx_system_city` VALUES (2365, 490921, 2, 490919, '440703000000', '蓬江区', '广东,江门,蓬江', '113.078521', '22.595149', 1); +INSERT INTO `yx_system_city` VALUES (2366, 491070, 2, 490919, '440704000000', '江海区', '广东,江门,江海', '113.111612', '22.560474', 1); +INSERT INTO `yx_system_city` VALUES (2367, 491136, 2, 490919, '440705000000', '新会区', '广东,江门,新会', '113.034187', '22.458300', 1); +INSERT INTO `yx_system_city` VALUES (2368, 491380, 2, 490919, '440781000000', '台山市', '广东,江门,台山', '112.794065', '22.251924', 1); +INSERT INTO `yx_system_city` VALUES (2369, 491711, 2, 490919, '440783000000', '开平市', '广东,江门,开平', '112.698545', '22.376395', 1); +INSERT INTO `yx_system_city` VALUES (2370, 492000, 2, 490919, '440784000000', '鹤山市', '广东,江门,鹤山', '112.964446', '22.765392', 1); +INSERT INTO `yx_system_city` VALUES (2371, 492153, 2, 490919, '440785000000', '恩平市', '广东,江门,恩平', '112.305145', '22.183206', 1); +INSERT INTO `yx_system_city` VALUES (2372, 492342, 2, 492341, '440801000000', '市辖区', '广东,湛江', '110.359377', '21.270707', 1); +INSERT INTO `yx_system_city` VALUES (2373, 492343, 2, 492341, '440802000000', '赤坎区', '广东,湛江,赤坎', '110.365900', '21.266119', 1); +INSERT INTO `yx_system_city` VALUES (2374, 492393, 2, 492341, '440803000000', '霞山区', '广东,湛江,霞山', '110.398070', '21.191720', 1); +INSERT INTO `yx_system_city` VALUES (2375, 492484, 2, 492341, '440804000000', '坡头区', '广东,湛江,坡头', '110.455332', '21.244721', 1); +INSERT INTO `yx_system_city` VALUES (2376, 492563, 2, 492341, '440811000000', '麻章区', '广东,湛江,麻章', '110.334387', '21.263443', 1); +INSERT INTO `yx_system_city` VALUES (2377, 492716, 2, 492341, '440823000000', '遂溪县', '广东,湛江,遂溪', '110.250124', '21.377246', 1); +INSERT INTO `yx_system_city` VALUES (2378, 493015, 2, 492341, '440825000000', '徐闻县', '广东,湛江,徐闻', '110.176750', '20.325489', 1); +INSERT INTO `yx_system_city` VALUES (2379, 493241, 2, 492341, '440881000000', '廉江市', '广东,湛江,廉江', '110.286209', '21.609700', 1); +INSERT INTO `yx_system_city` VALUES (2380, 493663, 2, 492341, '440882000000', '雷州市', '广东,湛江,雷州', '110.096749', '20.914278', 1); +INSERT INTO `yx_system_city` VALUES (2381, 494182, 2, 492341, '440883000000', '吴川市', '广东,湛江,吴川', '110.778411', '21.441808', 1); +INSERT INTO `yx_system_city` VALUES (2382, 494395, 2, 494394, '440901000000', '市辖区', '广东,茂名', '110.925456', '21.662999', 1); +INSERT INTO `yx_system_city` VALUES (2383, 494396, 2, 494394, '440902000000', '茂南区', '广东,茂名,茂南', '110.918026', '21.641337', 1); +INSERT INTO `yx_system_city` VALUES (2384, 494629, 2, 494394, '440904000000', '电白区', '广东,茂名,电白', '111.013556', '21.514164', 1); +INSERT INTO `yx_system_city` VALUES (2385, 495088, 2, 494394, '440981000000', '高州市', '广东,茂名,高州', '110.853302', '21.917982', 1); +INSERT INTO `yx_system_city` VALUES (2386, 495611, 2, 494394, '440982000000', '化州市', '广东,茂名,化州', '110.639569', '21.664044', 1); +INSERT INTO `yx_system_city` VALUES (2387, 496016, 2, 494394, '440983000000', '信宜市', '广东,茂名,信宜', '110.947044', '22.354385', 1); +INSERT INTO `yx_system_city` VALUES (2388, 496439, 2, 496438, '441201000000', '市辖区', '广东,肇庆', '112.465091', '23.047191', 1); +INSERT INTO `yx_system_city` VALUES (2389, 496440, 2, 496438, '441202000000', '端州区', '广东,肇庆,端州', '112.484848', '23.052101', 1); +INSERT INTO `yx_system_city` VALUES (2390, 496505, 2, 496438, '441203000000', '鼎湖区', '广东,肇庆,鼎湖', '112.567588', '23.158447', 1); +INSERT INTO `yx_system_city` VALUES (2391, 496594, 2, 496438, '441204000000', '高要区', '广东,肇庆,高要', '112.457771', '23.025668', 1); +INSERT INTO `yx_system_city` VALUES (2392, 496964, 2, 496438, '441223000000', '广宁县', '广东,肇庆,广宁', '112.440690', '23.634676', 1); +INSERT INTO `yx_system_city` VALUES (2393, 497158, 2, 496438, '441224000000', '怀集县', '广东,肇庆,怀集', '112.184652', '23.911899', 1); +INSERT INTO `yx_system_city` VALUES (2394, 497503, 2, 496438, '441225000000', '封开县', '广东,肇庆,封开', '111.512343', '23.424033', 1); +INSERT INTO `yx_system_city` VALUES (2395, 497719, 2, 496438, '441226000000', '德庆县', '广东,肇庆,德庆', '111.785937', '23.143722', 1); +INSERT INTO `yx_system_city` VALUES (2396, 497926, 2, 496438, '441284000000', '四会市', '广东,肇庆,四会', '112.733773', '23.326504', 1); +INSERT INTO `yx_system_city` VALUES (2397, 498105, 2, 498104, '441301000000', '市辖区', '广东,惠州', '114.416196', '23.111847', 1); +INSERT INTO `yx_system_city` VALUES (2398, 498106, 2, 498104, '441302000000', '惠城区', '广东,惠州,惠城', '114.382541', '23.084122', 1); +INSERT INTO `yx_system_city` VALUES (2399, 498397, 2, 498104, '441303000000', '惠阳区', '广东,惠州,惠阳', '114.456696', '22.788734', 1); +INSERT INTO `yx_system_city` VALUES (2400, 498578, 2, 498104, '441322000000', '博罗县', '广东,惠州,博罗', '114.289496', '23.172899', 1); +INSERT INTO `yx_system_city` VALUES (2401, 498978, 2, 498104, '441323000000', '惠东县', '广东,惠州,惠东', '114.720079', '22.984975', 1); +INSERT INTO `yx_system_city` VALUES (2402, 499292, 2, 498104, '441324000000', '龙门县', '广东,惠州,龙门', '114.254863', '23.727737', 1); +INSERT INTO `yx_system_city` VALUES (2403, 499490, 2, 499489, '441401000000', '市辖区', '广东,梅州', '116.122238', '24.288615', 1); +INSERT INTO `yx_system_city` VALUES (2404, 499491, 2, 499489, '441402000000', '梅江区', '广东,梅州,梅江', '116.116616', '24.310384', 1); +INSERT INTO `yx_system_city` VALUES (2405, 499625, 2, 499489, '441403000000', '梅县区', '广东,梅州,梅县', '116.082183', '24.265312', 1); +INSERT INTO `yx_system_city` VALUES (2406, 500036, 2, 499489, '441422000000', '大埔县', '广东,梅州,大埔', '116.695195', '24.347783', 1); +INSERT INTO `yx_system_city` VALUES (2407, 500312, 2, 499489, '441423000000', '丰顺县', '广东,梅州,丰顺', '116.182299', '23.739526', 1); +INSERT INTO `yx_system_city` VALUES (2408, 500611, 2, 499489, '441424000000', '五华县', '广东,梅州,五华', '115.775788', '23.932409', 1); +INSERT INTO `yx_system_city` VALUES (2409, 501074, 2, 499489, '441426000000', '平远县', '广东,梅州,平远', '115.891638', '24.567262', 1); +INSERT INTO `yx_system_city` VALUES (2410, 501230, 2, 499489, '441427000000', '蕉岭县', '广东,梅州,蕉岭', '116.171356', '24.658700', 1); +INSERT INTO `yx_system_city` VALUES (2411, 501351, 2, 499489, '441481000000', '兴宁市', '广东,梅州,兴宁', '115.731110', '24.136630', 1); +INSERT INTO `yx_system_city` VALUES (2412, 501868, 2, 501867, '441501000000', '市辖区', '广东,汕尾', '115.375278', '22.786211', 1); +INSERT INTO `yx_system_city` VALUES (2413, 501869, 2, 501867, '441502000000', '城区', '广东,汕尾,城区', '115.365029', '22.778699', 1); +INSERT INTO `yx_system_city` VALUES (2414, 502002, 2, 501867, '441521000000', '海丰县', '广东,汕尾,海丰', '115.323436', '22.966586', 1); +INSERT INTO `yx_system_city` VALUES (2415, 502303, 2, 501867, '441523000000', '陆河县', '广东,汕尾,陆河', '115.660143', '23.301617', 1); +INSERT INTO `yx_system_city` VALUES (2416, 502439, 2, 501867, '441581000000', '陆丰市', '广东,汕尾,陆丰', '115.652260', '22.917576', 1); +INSERT INTO `yx_system_city` VALUES (2417, 502829, 2, 502828, '441601000000', '市辖区', '广东,河源', '114.700447', '23.743538', 1); +INSERT INTO `yx_system_city` VALUES (2418, 502830, 2, 502828, '441602000000', '源城区', '广东,河源,源城', '114.702517', '23.733969', 1); +INSERT INTO `yx_system_city` VALUES (2419, 502907, 2, 502828, '441621000000', '紫金县', '广东,河源,紫金', '115.184061', '23.635271', 1); +INSERT INTO `yx_system_city` VALUES (2420, 503226, 2, 502828, '441622000000', '龙川县', '广东,河源,龙川', '115.259872', '24.100066', 1); +INSERT INTO `yx_system_city` VALUES (2421, 503608, 2, 502828, '441623000000', '连平县', '广东,河源,连平', '114.488714', '24.369588', 1); +INSERT INTO `yx_system_city` VALUES (2422, 503797, 2, 502828, '441624000000', '和平县', '广东,河源,和平', '114.938684', '24.442180', 1); +INSERT INTO `yx_system_city` VALUES (2423, 504060, 2, 502828, '441625000000', '东源县', '广东,河源,东源', '114.746380', '23.788393', 1); +INSERT INTO `yx_system_city` VALUES (2424, 504367, 2, 504366, '441701000000', '市辖区', '广东,阳江', '111.982232', '21.857958', 1); +INSERT INTO `yx_system_city` VALUES (2425, 504368, 2, 504366, '441702000000', '江城区', '广东,阳江,江城', '111.955059', '21.861787', 1); +INSERT INTO `yx_system_city` VALUES (2426, 504549, 2, 504366, '441704000000', '阳东区', '广东,阳江,阳东', '112.006338', '21.868358', 1); +INSERT INTO `yx_system_city` VALUES (2427, 504749, 2, 504366, '441721000000', '阳西县', '广东,阳江,阳西', '111.617849', '21.752396', 1); +INSERT INTO `yx_system_city` VALUES (2428, 504911, 2, 504366, '441781000000', '阳春市', '广东,阳江,阳春', '111.791539', '22.170438', 1); +INSERT INTO `yx_system_city` VALUES (2429, 505299, 2, 505298, '441801000000', '市辖区', '广东,清远', '113.056031', '23.681763', 1); +INSERT INTO `yx_system_city` VALUES (2430, 505300, 2, 505298, '441802000000', '清城区', '广东,清远,清城', '113.062692', '23.697899', 1); +INSERT INTO `yx_system_city` VALUES (2431, 505466, 2, 505298, '441803000000', '清新区', '广东,清远,清新', '113.017749', '23.734673', 1); +INSERT INTO `yx_system_city` VALUES (2432, 505685, 2, 505298, '441821000000', '佛冈县', '广东,清远,佛冈', '113.531607', '23.879192', 1); +INSERT INTO `yx_system_city` VALUES (2433, 505782, 2, 505298, '441823000000', '阳山县', '广东,清远,阳山', '112.641363', '24.465359', 1); +INSERT INTO `yx_system_city` VALUES (2434, 505963, 2, 505298, '441825000000', '连山壮族瑶族自治县', '广东,清远,连山', '112.093617', '24.570491', 1); +INSERT INTO `yx_system_city` VALUES (2435, 506027, 2, 505298, '441826000000', '连南瑶族自治县', '广东,清远,连南', '112.287012', '24.726017', 1); +INSERT INTO `yx_system_city` VALUES (2436, 506106, 2, 505298, '441881000000', '英德市', '广东,清远,英德', '113.402376', '24.205024', 1); +INSERT INTO `yx_system_city` VALUES (2437, 506430, 2, 505298, '441882000000', '连州市', '广东,清远,连州', '112.377361', '24.780966', 1); +INSERT INTO `yx_system_city` VALUES (2438, 506617, 2, 506616, '441900003000', '东城街道办事处', '广东,东莞,东城', '113.754635', '23.002896', 1); +INSERT INTO `yx_system_city` VALUES (2439, 506643, 2, 506616, '441900004000', '南城街道办事处', '广东,东莞,南城', '113.753133', '22.987560', 1); +INSERT INTO `yx_system_city` VALUES (2440, 506662, 2, 506616, '441900005000', '万江街道办事处', '广东,东莞,万江', '113.740409', '23.052146', 1); +INSERT INTO `yx_system_city` VALUES (2441, 506691, 2, 506616, '441900006000', '莞城街道办事处', '广东,东莞,莞城', '113.751050', '23.053413', 1); +INSERT INTO `yx_system_city` VALUES (2442, 506700, 2, 506616, '441900101000', '石碣镇', '广东,东莞,石碣', '113.802109', '23.094111', 1); +INSERT INTO `yx_system_city` VALUES (2443, 506716, 2, 506616, '441900102000', '石龙镇', '广东,东莞,石龙', '113.751765', '23.020536', 1); +INSERT INTO `yx_system_city` VALUES (2444, 506727, 2, 506616, '441900103000', '茶山镇', '广东,东莞,茶山', '113.751765', '23.020536', 1); +INSERT INTO `yx_system_city` VALUES (2445, 506746, 2, 506616, '441900104000', '石排镇', '广东,东莞,石排', '113.751765', '23.020536', 1); +INSERT INTO `yx_system_city` VALUES (2446, 506766, 2, 506616, '441900105000', '企石镇', '广东,东莞,企石', '113.751765', '23.020536', 1); +INSERT INTO `yx_system_city` VALUES (2447, 506787, 2, 506616, '441900106000', '横沥镇', '广东,东莞,横沥', '113.751765', '23.020536', 1); +INSERT INTO `yx_system_city` VALUES (2448, 506805, 2, 506616, '441900107000', '桥头镇', '广东,东莞,桥头', '113.751765', '23.020536', 1); +INSERT INTO `yx_system_city` VALUES (2449, 506823, 2, 506616, '441900108000', '谢岗镇', '广东,东莞,谢岗', '114.141456', '22.972083', 1); +INSERT INTO `yx_system_city` VALUES (2450, 506836, 2, 506616, '441900109000', '东坑镇', '广东,东莞,东坑', '113.948089', '22.989033', 1); +INSERT INTO `yx_system_city` VALUES (2451, 506853, 2, 506616, '441900110000', '常平镇', '广东,东莞,常平', '113.992186', '22.975601', 1); +INSERT INTO `yx_system_city` VALUES (2452, 506887, 2, 506616, '441900111000', '寮步镇', '广东,东莞,寮步', '113.818996', '23.025373', 1); +INSERT INTO `yx_system_city` VALUES (2453, 506918, 2, 506616, '441900112000', '樟木头镇', '广东,东莞,樟木头镇', '114.083278', '22.914909', 1); +INSERT INTO `yx_system_city` VALUES (2454, 506930, 2, 506616, '441900113000', '大朗镇', '广东,东莞,大朗', '113.915820', '22.915996', 1); +INSERT INTO `yx_system_city` VALUES (2455, 506959, 2, 506616, '441900114000', '黄江镇', '广东,东莞,黄江', '113.996039', '22.877840', 1); +INSERT INTO `yx_system_city` VALUES (2456, 506967, 2, 506616, '441900115000', '清溪镇', '广东,东莞,清溪', '114.164330', '22.844557', 1); +INSERT INTO `yx_system_city` VALUES (2457, 506990, 2, 506616, '441900116000', '塘厦镇', '广东,东莞,塘厦', '113.774481', '22.791051', 1); +INSERT INTO `yx_system_city` VALUES (2458, 507015, 2, 506616, '441900117000', '凤岗镇', '广东,东莞,凤岗', '113.751765', '23.020536', 1); +INSERT INTO `yx_system_city` VALUES (2459, 507028, 2, 506616, '441900118000', '大岭山镇', '广东,东莞,大岭山镇', '113.842223', '22.899965', 1); +INSERT INTO `yx_system_city` VALUES (2460, 507052, 2, 506616, '441900119000', '长安镇', '广东,东莞,长安', '113.794060', '22.803590', 1); +INSERT INTO `yx_system_city` VALUES (2461, 507066, 2, 506616, '441900121000', '虎门镇', '广东,东莞,虎门', '113.672560', '22.814835', 1); +INSERT INTO `yx_system_city` VALUES (2462, 507099, 2, 506616, '441900122000', '厚街镇', '广东,东莞,厚街', '113.751765', '23.020536', 1); +INSERT INTO `yx_system_city` VALUES (2463, 507124, 2, 506616, '441900123000', '沙田镇', '广东,东莞,沙田', '113.751765', '23.020536', 1); +INSERT INTO `yx_system_city` VALUES (2464, 507143, 2, 506616, '441900124000', '道滘镇', '广东,东莞,道滘', '113.751765', '23.020536', 1); +INSERT INTO `yx_system_city` VALUES (2465, 507158, 2, 506616, '441900125000', '洪梅镇', '广东,东莞,洪梅', '113.608903', '22.994717', 1); +INSERT INTO `yx_system_city` VALUES (2466, 507169, 2, 506616, '441900126000', '麻涌镇', '广东,东莞,麻涌', '113.751765', '23.020536', 1); +INSERT INTO `yx_system_city` VALUES (2467, 507185, 2, 506616, '441900127000', '望牛墩镇', '广东,东莞,望牛墩镇', '113.656243', '23.055331', 1); +INSERT INTO `yx_system_city` VALUES (2468, 507208, 2, 506616, '441900128000', '中堂镇', '广东,东莞,中堂', '113.751765', '23.020536', 1); +INSERT INTO `yx_system_city` VALUES (2469, 507229, 2, 506616, '441900129000', '高埗镇', '广东,东莞,高埗', '113.722126', '23.078713', 1); +INSERT INTO `yx_system_city` VALUES (2470, 507249, 2, 506616, '441900401000', '松山湖管委会', '广东,东莞,松山湖', '113.909208', '22.960541', 1); +INSERT INTO `yx_system_city` VALUES (2471, 507251, 2, 506616, '441900402000', '虎门港管委会', '广东,东莞,虎门港', '113.583070', '22.864175', 1); +INSERT INTO `yx_system_city` VALUES (2472, 507253, 2, 506616, '441900403000', '东莞生态园', '广东,东莞,东莞生态园', '113.927452', '23.063210', 1); +INSERT INTO `yx_system_city` VALUES (2473, 507256, 2, 507255, '442000001000', '石岐区街道办事处', '广东,中山,石岐区', '113.384930', '22.532046', 1); +INSERT INTO `yx_system_city` VALUES (2474, 507276, 2, 507255, '442000002000', '东区街道办事处', '广东,中山,东区', '113.392782', '22.517645', 1); +INSERT INTO `yx_system_city` VALUES (2475, 507287, 2, 507255, '442000003000', '火炬开发区街道办事处', '广东,中山,火炬开发区', '113.480528', '22.566086', 1); +INSERT INTO `yx_system_city` VALUES (2476, 507295, 2, 507255, '442000004000', '西区街道办事处', '广东,中山,西区', '113.392782', '22.517645', 1); +INSERT INTO `yx_system_city` VALUES (2477, 507305, 2, 507255, '442000005000', '南区街道办事处', '广东,中山,南区', '113.358509', '22.472530', 1); +INSERT INTO `yx_system_city` VALUES (2478, 507310, 2, 507255, '442000006000', '五桂山街道办事处', '广东,中山,五桂山', '113.463397', '22.421549', 1); +INSERT INTO `yx_system_city` VALUES (2479, 507316, 2, 507255, '442000100000', '小榄镇', '广东,中山,小榄', '113.250897', '22.672099', 1); +INSERT INTO `yx_system_city` VALUES (2480, 507332, 2, 507255, '442000101000', '黄圃镇', '广东,中山,黄圃', '113.335242', '22.709897', 1); +INSERT INTO `yx_system_city` VALUES (2481, 507349, 2, 507255, '442000102000', '民众镇', '广东,中山,民众', '113.392782', '22.517645', 1); +INSERT INTO `yx_system_city` VALUES (2482, 507369, 2, 507255, '442000103000', '东凤镇', '广东,中山,东凤', '113.392782', '22.517645', 1); +INSERT INTO `yx_system_city` VALUES (2483, 507384, 2, 507255, '442000104000', '东升镇', '广东,中山,东升', '113.294393', '22.616908', 1); +INSERT INTO `yx_system_city` VALUES (2484, 507399, 2, 507255, '442000105000', '古镇镇', '广东,中山,古镇', '113.190869', '22.613406', 1); +INSERT INTO `yx_system_city` VALUES (2485, 507413, 2, 507255, '442000106000', '沙溪镇', '广东,中山,沙溪', '113.392782', '22.517645', 1); +INSERT INTO `yx_system_city` VALUES (2486, 507430, 2, 507255, '442000107000', '坦洲镇', '广东,中山,坦洲', '113.460373', '22.265182', 1); +INSERT INTO `yx_system_city` VALUES (2487, 507445, 2, 507255, '442000108000', '港口镇', '广东,中山,港口', '113.247148', '22.683616', 1); +INSERT INTO `yx_system_city` VALUES (2488, 507455, 2, 507255, '442000109000', '三角镇', '广东,中山,三角', '113.422371', '22.684688', 1); +INSERT INTO `yx_system_city` VALUES (2489, 507464, 2, 507255, '442000110000', '横栏镇', '广东,中山,横栏', '113.265845', '22.523201', 1); +INSERT INTO `yx_system_city` VALUES (2490, 507476, 2, 507255, '442000111000', '南头镇', '广东,中山,南头', '113.392782', '22.517645', 1); +INSERT INTO `yx_system_city` VALUES (2491, 507483, 2, 507255, '442000112000', '阜沙镇', '广东,中山,阜沙', '113.392782', '22.517645', 1); +INSERT INTO `yx_system_city` VALUES (2492, 507493, 2, 507255, '442000113000', '南朗镇', '广东,中山,南朗', '113.392782', '22.517645', 1); +INSERT INTO `yx_system_city` VALUES (2493, 507509, 2, 507255, '442000114000', '三乡镇', '广东,中山,三乡', '113.441614', '22.357754', 1); +INSERT INTO `yx_system_city` VALUES (2494, 507526, 2, 507255, '442000115000', '板芙镇', '广东,中山,板芙', '113.392782', '22.517645', 1); +INSERT INTO `yx_system_city` VALUES (2495, 507538, 2, 507255, '442000116000', '大涌镇', '广东,中山,大涌', '113.392782', '22.517645', 1); +INSERT INTO `yx_system_city` VALUES (2496, 507550, 2, 507255, '442000117000', '神湾镇', '广东,中山,神湾', '113.392782', '22.517645', 1); +INSERT INTO `yx_system_city` VALUES (2497, 507558, 2, 507557, '445101000000', '市辖区', '广东,潮州', '116.622603', '23.656950', 1); +INSERT INTO `yx_system_city` VALUES (2498, 507559, 2, 507557, '445102000000', '湘桥区', '广东,潮州,湘桥', '116.628632', '23.674536', 1); +INSERT INTO `yx_system_city` VALUES (2499, 507748, 2, 507557, '445103000000', '潮安区', '广东,潮州,潮安', '116.678204', '23.462613', 1); +INSERT INTO `yx_system_city` VALUES (2500, 508223, 2, 507557, '445122000000', '饶平县', '广东,潮州,饶平', '117.003900', '23.663824', 1); +INSERT INTO `yx_system_city` VALUES (2501, 508649, 2, 508648, '445201000000', '市辖区', '广东,揭阳', '116.372831', '23.549993', 1); +INSERT INTO `yx_system_city` VALUES (2502, 508650, 2, 508648, '445202000000', '榕城区', '广东,揭阳,榕城', '116.367026', '23.525153', 1); +INSERT INTO `yx_system_city` VALUES (2503, 508863, 2, 508648, '445203000000', '揭东区', '广东,揭阳,揭东', '116.412015', '23.566127', 1); +INSERT INTO `yx_system_city` VALUES (2504, 509101, 2, 508648, '445222000000', '揭西县', '广东,揭阳,揭西', '115.841838', '23.431294', 1); +INSERT INTO `yx_system_city` VALUES (2505, 509449, 2, 508648, '445224000000', '惠来县', '广东,揭阳,惠来', '116.295150', '23.033267', 1); +INSERT INTO `yx_system_city` VALUES (2506, 509796, 2, 508648, '445281000000', '普宁市', '广东,揭阳,普宁', '116.166004', '23.297642', 1); +INSERT INTO `yx_system_city` VALUES (2507, 510409, 2, 510408, '445301000000', '市辖区', '广东,云浮', '112.044491', '22.915094', 1); +INSERT INTO `yx_system_city` VALUES (2508, 510410, 2, 510408, '445302000000', '云城区', '广东,云浮,云城', '112.043857', '22.928115', 1); +INSERT INTO `yx_system_city` VALUES (2509, 510536, 2, 510408, '445303000000', '云安区', '广东,云浮,云安', '112.003209', '23.071020', 1); +INSERT INTO `yx_system_city` VALUES (2510, 510660, 2, 510408, '445321000000', '新兴县', '广东,云浮,新兴', '112.225335', '22.695690', 1); +INSERT INTO `yx_system_city` VALUES (2511, 510878, 2, 510408, '445322000000', '郁南县', '广东,云浮,郁南', '111.535249', '23.234627', 1); +INSERT INTO `yx_system_city` VALUES (2512, 511102, 2, 510408, '445381000000', '罗定市', '广东,云浮,罗定', '111.570010', '22.768595', 1); +INSERT INTO `yx_system_city` VALUES (2513, 511464, 2, 511463, '450101000000', '市辖区', '广西,南宁', '108.366543', '22.817002', 1); +INSERT INTO `yx_system_city` VALUES (2514, 511465, 2, 511463, '450102000000', '兴宁区', '广西,南宁,兴宁', '108.368871', '22.854021', 1); +INSERT INTO `yx_system_city` VALUES (2515, 511545, 2, 511463, '450103000000', '青秀区', '广西,南宁,青秀', '108.494024', '22.785879', 1); +INSERT INTO `yx_system_city` VALUES (2516, 511662, 2, 511463, '450105000000', '江南区', '广西,南宁,江南', '108.273158', '22.781632', 1); +INSERT INTO `yx_system_city` VALUES (2517, 511790, 2, 511463, '450107000000', '西乡塘区', '广西,南宁,西乡塘', '108.306886', '22.832770', 1); +INSERT INTO `yx_system_city` VALUES (2518, 511960, 2, 511463, '450108000000', '良庆区', '广西,南宁,良庆', '108.322102', '22.759090', 1); +INSERT INTO `yx_system_city` VALUES (2519, 512044, 2, 511463, '450109000000', '邕宁区', '广西,南宁,邕宁', '108.487369', '22.758390', 1); +INSERT INTO `yx_system_city` VALUES (2520, 512124, 2, 511463, '450110000000', '武鸣区', '广西,南宁,武鸣', '108.274712', '23.158693', 1); +INSERT INTO `yx_system_city` VALUES (2521, 512381, 2, 511463, '450123000000', '隆安县', '广西,南宁,隆安', '107.696153', '23.166028', 1); +INSERT INTO `yx_system_city` VALUES (2522, 512530, 2, 511463, '450124000000', '马山县', '广西,南宁,马山', '108.176979', '23.708192', 1); +INSERT INTO `yx_system_city` VALUES (2523, 512695, 2, 511463, '450125000000', '上林县', '广西,南宁,上林', '108.604921', '23.431936', 1); +INSERT INTO `yx_system_city` VALUES (2524, 512838, 2, 511463, '450126000000', '宾阳县', '广西,南宁,宾阳', '108.810326', '23.217787', 1); +INSERT INTO `yx_system_city` VALUES (2525, 513091, 2, 511463, '450127000000', '横县', '广西,南宁,横县', '109.261384', '22.679932', 1); +INSERT INTO `yx_system_city` VALUES (2526, 513435, 2, 513434, '450201000000', '市辖区', '广西,柳州', '109.415953', '24.325502', 1); +INSERT INTO `yx_system_city` VALUES (2527, 513436, 2, 513434, '450202000000', '城中区', '广西,柳州,城中', '109.410736', '24.315602', 1); +INSERT INTO `yx_system_city` VALUES (2528, 513477, 2, 513434, '450203000000', '鱼峰区', '广西,柳州,鱼峰', '109.452442', '24.318517', 1); +INSERT INTO `yx_system_city` VALUES (2529, 513569, 2, 513434, '450204000000', '柳南区', '广西,柳州,柳南', '109.385519', '24.336229', 1); +INSERT INTO `yx_system_city` VALUES (2530, 513661, 2, 513434, '450205000000', '柳北区', '广西,柳州,柳北', '109.402050', '24.362691', 1); +INSERT INTO `yx_system_city` VALUES (2531, 513772, 2, 513434, '450206000000', '柳江区', '广西,柳州,柳江', '109.326380', '24.254892', 1); +INSERT INTO `yx_system_city` VALUES (2532, 513938, 2, 513434, '450222000000', '柳城县', '广西,柳州,柳城', '109.244730', '24.651518', 1); +INSERT INTO `yx_system_city` VALUES (2533, 514091, 2, 513434, '450223000000', '鹿寨县', '广西,柳州,鹿寨', '109.750638', '24.472897', 1); +INSERT INTO `yx_system_city` VALUES (2534, 514219, 2, 513434, '450224000000', '融安县', '广西,柳州,融安', '109.397538', '25.224550', 1); +INSERT INTO `yx_system_city` VALUES (2535, 514380, 2, 513434, '450225000000', '融水苗族自治县', '广西,柳州,融水', '109.256334', '25.065934', 1); +INSERT INTO `yx_system_city` VALUES (2536, 514607, 2, 513434, '450226000000', '三江侗族自治县', '广西,柳州,三江', '109.607675', '25.783198', 1); +INSERT INTO `yx_system_city` VALUES (2537, 514791, 2, 514790, '450301000000', '市辖区', '广西,桂林', '110.290194', '25.273566', 1); +INSERT INTO `yx_system_city` VALUES (2538, 514792, 2, 514790, '450302000000', '秀峰区', '广西,桂林,秀峰', '110.264183', '25.273625', 1); +INSERT INTO `yx_system_city` VALUES (2539, 514824, 2, 514790, '450303000000', '叠彩区', '广西,桂林,叠彩', '110.301723', '25.314001', 1); +INSERT INTO `yx_system_city` VALUES (2540, 514864, 2, 514790, '450304000000', '象山区', '广西,桂林,象山', '110.281082', '25.261687', 1); +INSERT INTO `yx_system_city` VALUES (2541, 514911, 2, 514790, '450305000000', '七星区', '广西,桂林,七星', '110.317826', '25.252701', 1); +INSERT INTO `yx_system_city` VALUES (2542, 514964, 2, 514790, '450311000000', '雁山区', '广西,桂林,雁山', '110.286690', '25.101935', 1); +INSERT INTO `yx_system_city` VALUES (2543, 515012, 2, 514790, '450312000000', '临桂区', '广西,桂林,临桂', '110.212463', '25.238628', 1); +INSERT INTO `yx_system_city` VALUES (2544, 515195, 2, 514790, '450321000000', '阳朔县', '广西,桂林,阳朔', '110.496593', '24.778481', 1); +INSERT INTO `yx_system_city` VALUES (2545, 515319, 2, 514790, '450323000000', '灵川县', '广西,桂林,灵川', '110.325636', '25.409747', 1); +INSERT INTO `yx_system_city` VALUES (2546, 515481, 2, 514790, '450324000000', '全州县', '广西,桂林,全州', '111.072926', '25.928617', 1); +INSERT INTO `yx_system_city` VALUES (2547, 515784, 2, 514790, '450325000000', '兴安县', '广西,桂林,兴安', '110.671670', '25.611705', 1); +INSERT INTO `yx_system_city` VALUES (2548, 515920, 2, 514790, '450326000000', '永福县', '广西,桂林,永福', '109.983076', '24.979856', 1); +INSERT INTO `yx_system_city` VALUES (2549, 516029, 2, 514790, '450327000000', '灌阳县', '广西,桂林,灌阳', '111.160851', '25.489383', 1); +INSERT INTO `yx_system_city` VALUES (2550, 516180, 2, 514790, '450328000000', '龙胜各族自治县', '广西,桂林,龙胜各族', '110.011238', '25.797931', 1); +INSERT INTO `yx_system_city` VALUES (2551, 516317, 2, 514790, '450329000000', '资源县', '广西,桂林,资源', '110.652700', '26.042443', 1); +INSERT INTO `yx_system_city` VALUES (2552, 516399, 2, 514790, '450330000000', '平乐县', '广西,桂林,平乐', '110.643305', '24.633362', 1); +INSERT INTO `yx_system_city` VALUES (2553, 516563, 2, 514790, '450331000000', '荔浦县', '广西,桂林,荔浦', '110.395287', '24.487824', 1); +INSERT INTO `yx_system_city` VALUES (2554, 516721, 2, 514790, '450332000000', '恭城瑶族自治县', '广西,桂林,恭城', '110.830193', '24.822522', 1); +INSERT INTO `yx_system_city` VALUES (2555, 516859, 2, 516858, '450401000000', '市辖区', '广西,梧州', '111.279115', '23.476962', 1); +INSERT INTO `yx_system_city` VALUES (2556, 516860, 2, 516858, '450403000000', '万秀区', '广西,梧州,万秀', '111.320542', '23.472962', 1); +INSERT INTO `yx_system_city` VALUES (2557, 516945, 2, 516858, '450405000000', '长洲区', '广西,梧州,长洲', '111.274777', '23.485695', 1); +INSERT INTO `yx_system_city` VALUES (2558, 516991, 2, 516858, '450406000000', '龙圩区', '广西,梧州,龙圩', '111.246035', '23.409960', 1); +INSERT INTO `yx_system_city` VALUES (2559, 517075, 2, 516858, '450421000000', '苍梧县', '广西,梧州,苍梧', '111.544008', '23.845097', 1); +INSERT INTO `yx_system_city` VALUES (2560, 517230, 2, 516858, '450422000000', '藤县', '广西,梧州,藤县', '110.914849', '23.374984', 1); +INSERT INTO `yx_system_city` VALUES (2561, 517542, 2, 516858, '450423000000', '蒙山县', '广西,梧州,蒙山', '110.525003', '24.193570', 1); +INSERT INTO `yx_system_city` VALUES (2562, 517636, 2, 516858, '450481000000', '岑溪市', '广西,梧州,岑溪', '110.994913', '22.918350', 1); +INSERT INTO `yx_system_city` VALUES (2563, 517934, 2, 517933, '450501000000', '市辖区', '广西,北海', '109.119927', '21.481254', 1); +INSERT INTO `yx_system_city` VALUES (2564, 517935, 2, 517933, '450502000000', '海城区', '广西,北海,海城', '109.117210', '21.475005', 1); +INSERT INTO `yx_system_city` VALUES (2565, 518010, 2, 517933, '450503000000', '银海区', '广西,北海,银海', '109.139990', '21.449219', 1); +INSERT INTO `yx_system_city` VALUES (2566, 518067, 2, 517933, '450512000000', '铁山港区', '广西,北海,铁山港', '109.421581', '21.529128', 1); +INSERT INTO `yx_system_city` VALUES (2567, 518115, 2, 517933, '450521000000', '合浦县', '广西,北海,合浦', '109.207336', '21.660936', 1); +INSERT INTO `yx_system_city` VALUES (2568, 518408, 2, 518407, '450601000000', '市辖区', '广西,防城港', '108.353846', '21.686860', 1); +INSERT INTO `yx_system_city` VALUES (2569, 518409, 2, 518407, '450602000000', '港口区', '广西,防城港,港口', '108.380144', '21.643384', 1); +INSERT INTO `yx_system_city` VALUES (2570, 518455, 2, 518407, '450603000000', '防城区', '广西,防城港,防城', '108.353499', '21.769212', 1); +INSERT INTO `yx_system_city` VALUES (2571, 518641, 2, 518407, '450621000000', '上思县', '广西,防城港,上思', '107.983626', '22.153672', 1); +INSERT INTO `yx_system_city` VALUES (2572, 518762, 2, 518407, '450681000000', '东兴市', '广西,防城港,东兴', '107.971826', '21.547822', 1); +INSERT INTO `yx_system_city` VALUES (2573, 518809, 2, 518808, '450701000000', '市辖区', '广西,钦州', '108.654146', '21.979933', 1); +INSERT INTO `yx_system_city` VALUES (2574, 518810, 2, 518808, '450702000000', '钦南区', '广西,钦州,钦南', '108.657210', '21.938860', 1); +INSERT INTO `yx_system_city` VALUES (2575, 519003, 2, 518808, '450703000000', '钦北区', '广西,钦州,钦北', '108.449110', '22.132761', 1); +INSERT INTO `yx_system_city` VALUES (2576, 519201, 2, 518808, '450721000000', '灵山县', '广西,钦州,灵山', '109.291007', '22.416537', 1); +INSERT INTO `yx_system_city` VALUES (2577, 519637, 2, 518808, '450722000000', '浦北县', '广西,钦州,浦北', '109.556953', '22.271651', 1); +INSERT INTO `yx_system_city` VALUES (2578, 519930, 2, 519929, '450801000000', '市辖区', '广西,贵港', '109.598926', '23.111530', 1); +INSERT INTO `yx_system_city` VALUES (2579, 519931, 2, 519929, '450802000000', '港北区', '广西,贵港,港北', '109.572240', '23.111531', 1); +INSERT INTO `yx_system_city` VALUES (2580, 520063, 2, 519929, '450803000000', '港南区', '广西,贵港,港南', '109.599557', '23.075573', 1); +INSERT INTO `yx_system_city` VALUES (2581, 520240, 2, 519929, '450804000000', '覃塘区', '广西,贵港,覃塘', '109.452662', '23.127149', 1); +INSERT INTO `yx_system_city` VALUES (2582, 520397, 2, 519929, '450821000000', '平南县', '广西,贵港,平南', '110.392168', '23.539127', 1); +INSERT INTO `yx_system_city` VALUES (2583, 520707, 2, 519929, '450881000000', '桂平市', '广西,贵港,桂平', '110.079379', '23.394326', 1); +INSERT INTO `yx_system_city` VALUES (2584, 521167, 2, 521166, '450901000000', '市辖区', '广西,玉林', '110.164756', '22.636379', 1); +INSERT INTO `yx_system_city` VALUES (2585, 521168, 2, 521166, '450902000000', '玉州区', '广西,玉林,玉州', '110.151147', '22.628102', 1); +INSERT INTO `yx_system_city` VALUES (2586, 521286, 2, 521166, '450903000000', '福绵区', '广西,玉林,福绵', '110.059439', '22.585557', 1); +INSERT INTO `yx_system_city` VALUES (2587, 521409, 2, 521166, '450921000000', '容县', '广西,玉林,容县', '110.557874', '22.857823', 1); +INSERT INTO `yx_system_city` VALUES (2588, 521652, 2, 521166, '450922000000', '陆川县', '广西,玉林,陆川', '110.264052', '22.321048', 1); +INSERT INTO `yx_system_city` VALUES (2589, 521832, 2, 521166, '450923000000', '博白县', '广西,玉林,博白', '109.975985', '22.273048', 1); +INSERT INTO `yx_system_city` VALUES (2590, 522220, 2, 521166, '450924000000', '兴业县', '广西,玉林,兴业', '109.875304', '22.736421', 1); +INSERT INTO `yx_system_city` VALUES (2591, 522448, 2, 521166, '450981000000', '北流市', '广西,玉林,北流', '110.354215', '22.708311', 1); +INSERT INTO `yx_system_city` VALUES (2592, 522787, 2, 522786, '451001000000', '市辖区', '广西,百色', '106.618201', '23.902333', 1); +INSERT INTO `yx_system_city` VALUES (2593, 522788, 2, 522786, '451002000000', '右江区', '广西,百色,右江', '106.618645', '23.901383', 1); +INSERT INTO `yx_system_city` VALUES (2594, 522918, 2, 522786, '451021000000', '田阳县', '广西,百色,田阳', '106.915418', '23.735682', 1); +INSERT INTO `yx_system_city` VALUES (2595, 523086, 2, 522786, '451022000000', '田东县', '广西,百色,田东', '107.126081', '23.597194', 1); +INSERT INTO `yx_system_city` VALUES (2596, 523265, 2, 522786, '451023000000', '平果县', '广西,百色,平果', '107.589810', '23.329376', 1); +INSERT INTO `yx_system_city` VALUES (2597, 523461, 2, 522786, '451024000000', '德保县', '广西,百色,德保', '106.615374', '23.323450', 1); +INSERT INTO `yx_system_city` VALUES (2598, 523661, 2, 522786, '451026000000', '那坡县', '广西,百色,那坡', '105.832530', '23.387441', 1); +INSERT INTO `yx_system_city` VALUES (2599, 523801, 2, 522786, '451027000000', '凌云县', '广西,百色,凌云', '106.561310', '24.347557', 1); +INSERT INTO `yx_system_city` VALUES (2600, 523920, 2, 522786, '451028000000', '乐业县', '广西,百色,乐业', '106.556519', '24.776827', 1); +INSERT INTO `yx_system_city` VALUES (2601, 524017, 2, 522786, '451029000000', '田林县', '广西,百色,田林', '106.228538', '24.294488', 1); +INSERT INTO `yx_system_city` VALUES (2602, 524200, 2, 522786, '451030000000', '西林县', '广西,百色,西林', '105.093837', '24.489810', 1); +INSERT INTO `yx_system_city` VALUES (2603, 524306, 2, 522786, '451031000000', '隆林各族自治县', '广西,百色,隆林各族', '105.344040', '24.770896', 1); +INSERT INTO `yx_system_city` VALUES (2604, 524502, 2, 522786, '451081000000', '靖西市', '广西,百色,靖西', '106.417549', '23.134766', 1); +INSERT INTO `yx_system_city` VALUES (2605, 524815, 2, 524814, '451101000000', '市辖区', '广西,贺州', '111.566694', '24.403582', 1); +INSERT INTO `yx_system_city` VALUES (2606, 524816, 2, 524814, '451102000000', '八步区', '广西,贺州,八步', '111.552096', '24.411805', 1); +INSERT INTO `yx_system_city` VALUES (2607, 525035, 2, 524814, '451103000000', '平桂区', '广西,贺州,平桂', '111.566694', '24.403582', 1); +INSERT INTO `yx_system_city` VALUES (2608, 525169, 2, 524814, '451121000000', '昭平县', '广西,贺州,昭平', '110.811287', '24.169480', 1); +INSERT INTO `yx_system_city` VALUES (2609, 525341, 2, 524814, '451122000000', '钟山县', '广西,贺州,钟山', '111.303111', '24.526022', 1); +INSERT INTO `yx_system_city` VALUES (2610, 525470, 2, 524814, '451123000000', '富川瑶族自治县', '广西,贺州,富川', '111.277389', '24.814444', 1); +INSERT INTO `yx_system_city` VALUES (2611, 525639, 2, 525638, '451201000000', '市辖区', '广西,河池', '108.085261', '24.692931', 1); +INSERT INTO `yx_system_city` VALUES (2612, 525640, 2, 525638, '451202000000', '金城江区', '广西,河池,金城江', '108.037277', '24.689703', 1); +INSERT INTO `yx_system_city` VALUES (2613, 525798, 2, 525638, '451221000000', '南丹县', '广西,河池,南丹', '107.540722', '24.974486', 1); +INSERT INTO `yx_system_city` VALUES (2614, 525961, 2, 525638, '451222000000', '天峨县', '广西,河池,天峨', '107.173802', '24.999108', 1); +INSERT INTO `yx_system_city` VALUES (2615, 526066, 2, 525638, '451223000000', '凤山县', '广西,河池,凤山', '107.042191', '24.546876', 1); +INSERT INTO `yx_system_city` VALUES (2616, 526174, 2, 525638, '451224000000', '东兰县', '广西,河池,东兰', '107.374294', '24.510842', 1); +INSERT INTO `yx_system_city` VALUES (2617, 526338, 2, 525638, '451225000000', '罗城仫佬族自治县', '广西,河池,罗城', '108.904707', '24.777413', 1); +INSERT INTO `yx_system_city` VALUES (2618, 526493, 2, 525638, '451226000000', '环江毛南族自治县', '广西,河池,环江', '108.258028', '24.825664', 1); +INSERT INTO `yx_system_city` VALUES (2619, 526654, 2, 525638, '451227000000', '巴马瑶族自治县', '广西,河池,巴马', '107.258588', '24.142299', 1); +INSERT INTO `yx_system_city` VALUES (2620, 526772, 2, 525638, '451228000000', '都安瑶族自治县', '广西,河池,都安', '108.128403', '23.919338', 1); +INSERT INTO `yx_system_city` VALUES (2621, 527041, 2, 525638, '451229000000', '大化瑶族自治县', '广西,河池,大化', '108.085261', '24.692931', 1); +INSERT INTO `yx_system_city` VALUES (2622, 527216, 2, 525638, '451281000000', '宜州市', '广西,河池,宜州', '108.636415', '24.485214', 1); +INSERT INTO `yx_system_city` VALUES (2623, 527444, 2, 527443, '451301000000', '市辖区', '广西,来宾', '109.221465', '23.750306', 1); +INSERT INTO `yx_system_city` VALUES (2624, 527445, 2, 527443, '451302000000', '兴宾区', '广西,来宾,兴宾', '109.230541', '23.732926', 1); +INSERT INTO `yx_system_city` VALUES (2625, 527762, 2, 527443, '451321000000', '忻城县', '广西,来宾,忻城', '108.665666', '24.066235', 1); +INSERT INTO `yx_system_city` VALUES (2626, 527905, 2, 527443, '451322000000', '象州县', '广西,来宾,象州', '109.683985', '23.958528', 1); +INSERT INTO `yx_system_city` VALUES (2627, 528042, 2, 527443, '451323000000', '武宣县', '广西,来宾,武宣', '109.663207', '23.594110', 1); +INSERT INTO `yx_system_city` VALUES (2628, 528205, 2, 527443, '451324000000', '金秀瑶族自治县', '广西,来宾,金秀', '110.189462', '24.130374', 1); +INSERT INTO `yx_system_city` VALUES (2629, 528299, 2, 527443, '451381000000', '合山市', '广西,来宾,合山', '108.886082', '23.806536', 1); +INSERT INTO `yx_system_city` VALUES (2630, 528340, 2, 528339, '451401000000', '市辖区', '广西,崇左', '107.364711', '22.376532', 1); +INSERT INTO `yx_system_city` VALUES (2631, 528341, 2, 528339, '451402000000', '江州区', '广西,崇左,江州', '107.353437', '22.405325', 1); +INSERT INTO `yx_system_city` VALUES (2632, 528494, 2, 528339, '451421000000', '扶绥县', '广西,崇左,扶绥', '107.904187', '22.635013', 1); +INSERT INTO `yx_system_city` VALUES (2633, 528647, 2, 528339, '451422000000', '宁明县', '广西,崇左,宁明', '107.076457', '22.140192', 1); +INSERT INTO `yx_system_city` VALUES (2634, 528845, 2, 528339, '451423000000', '龙州县', '广西,崇左,龙州', '106.854451', '22.342797', 1); +INSERT INTO `yx_system_city` VALUES (2635, 528986, 2, 528339, '451424000000', '大新县', '广西,崇左,大新', '107.200654', '22.829288', 1); +INSERT INTO `yx_system_city` VALUES (2636, 529159, 2, 528339, '451425000000', '天等县', '广西,崇左,天等', '107.143433', '23.081394', 1); +INSERT INTO `yx_system_city` VALUES (2637, 529297, 2, 528339, '451481000000', '凭祥市', '广西,崇左,凭祥', '106.766293', '22.094485', 1); +INSERT INTO `yx_system_city` VALUES (2638, 529346, 2, 529345, '460101000000', '市辖区', '海南,海口', '110.198293', '20.044001', 1); +INSERT INTO `yx_system_city` VALUES (2639, 529347, 2, 529345, '460105000000', '秀英区', '海南,海口,秀英', '110.293561', '20.007969', 1); +INSERT INTO `yx_system_city` VALUES (2640, 529451, 2, 529345, '460106000000', '龙华区', '海南,海口,龙华', '110.328492', '20.031007', 1); +INSERT INTO `yx_system_city` VALUES (2641, 529589, 2, 529345, '460107000000', '琼山区', '海南,海口,琼山', '110.353972', '20.003170', 1); +INSERT INTO `yx_system_city` VALUES (2642, 529720, 2, 529345, '460108000000', '美兰区', '海南,海口,美兰', '110.366357', '20.029083', 1); +INSERT INTO `yx_system_city` VALUES (2643, 529879, 2, 529878, '460201000000', '市辖区', '海南,三亚', '109.511909', '18.252847', 1); +INSERT INTO `yx_system_city` VALUES (2644, 529910, 2, 529878, '460202000000', '海棠区', '海南,三亚,海棠', '109.760778', '18.407516', 1); +INSERT INTO `yx_system_city` VALUES (2645, 529934, 2, 529878, '460203000000', '吉阳区', '海南,三亚,吉阳', '109.578330', '18.281397', 1); +INSERT INTO `yx_system_city` VALUES (2646, 529973, 2, 529878, '460204000000', '天涯区', '海南,三亚,天涯', '109.506357', '18.247340', 1); +INSERT INTO `yx_system_city` VALUES (2647, 530027, 2, 529878, '460205000000', '崖州区', '海南,三亚,崖州', '109.174313', '18.352212', 1); +INSERT INTO `yx_system_city` VALUES (2648, 530061, 2, 530060, '460321000000', '西沙群岛', '海南,三沙,西沙群岛', '112.338695', '16.831839', 1); +INSERT INTO `yx_system_city` VALUES (2649, 530064, 2, 530060, '460322000000', '南沙群岛', '海南,三沙,南沙群岛', '112.338695', '16.831839', 1); +INSERT INTO `yx_system_city` VALUES (2650, 530067, 2, 530060, '460323000000', '中沙群岛的岛礁及其海域', '海南,三沙,中沙群岛的岛礁及其海域', '112.338695', '16.831839', 1); +INSERT INTO `yx_system_city` VALUES (2651, 530071, 2, 530070, '460400100000', '那大镇', '海南,儋州,那大', '110.349228', '20.017377', 1); +INSERT INTO `yx_system_city` VALUES (2652, 530112, 2, 530070, '460400101000', '和庆镇', '海南,儋州,和庆', '109.640856', '19.525399', 1); +INSERT INTO `yx_system_city` VALUES (2653, 530126, 2, 530070, '460400102000', '南丰镇', '海南,儋州,南丰', '110.349228', '20.017377', 1); +INSERT INTO `yx_system_city` VALUES (2654, 530139, 2, 530070, '460400103000', '大成镇', '海南,儋州,大成', '110.349228', '20.017377', 1); +INSERT INTO `yx_system_city` VALUES (2655, 530162, 2, 530070, '460400104000', '雅星镇', '海南,儋州,雅星', '110.349228', '20.017377', 1); +INSERT INTO `yx_system_city` VALUES (2656, 530188, 2, 530070, '460400105000', '兰洋镇', '海南,儋州,兰洋', '110.349228', '20.017377', 1); +INSERT INTO `yx_system_city` VALUES (2657, 530207, 2, 530070, '460400106000', '光村镇', '海南,儋州,光村', '110.349228', '20.017377', 1); +INSERT INTO `yx_system_city` VALUES (2658, 530220, 2, 530070, '460400107000', '木棠镇', '海南,儋州,木棠', '110.349228', '20.017377', 1); +INSERT INTO `yx_system_city` VALUES (2659, 530246, 2, 530070, '460400108000', '海头镇', '海南,儋州,海头', '110.349228', '20.017377', 1); +INSERT INTO `yx_system_city` VALUES (2660, 530261, 2, 530070, '460400109000', '峨蔓镇', '海南,儋州,峨蔓', '110.349228', '20.017377', 1); +INSERT INTO `yx_system_city` VALUES (2661, 530275, 2, 530070, '460400110000', '三都镇', '海南,儋州,三都', '110.349228', '20.017377', 1); +INSERT INTO `yx_system_city` VALUES (2662, 530285, 2, 530070, '460400111000', '王五镇', '海南,儋州,王五', '110.349228', '20.017377', 1); +INSERT INTO `yx_system_city` VALUES (2663, 530295, 2, 530070, '460400112000', '白马井镇', '海南,儋州,白马井镇', '109.218734', '19.696407', 1); +INSERT INTO `yx_system_city` VALUES (2664, 530318, 2, 530070, '460400113000', '中和镇', '海南,儋州,中和', '110.349228', '20.017377', 1); +INSERT INTO `yx_system_city` VALUES (2665, 530331, 2, 530070, '460400114000', '排浦镇', '海南,儋州,排浦', '110.349228', '20.017377', 1); +INSERT INTO `yx_system_city` VALUES (2666, 530340, 2, 530070, '460400115000', '东成镇', '海南,儋州,东成', '110.349228', '20.017377', 1); +INSERT INTO `yx_system_city` VALUES (2667, 530361, 2, 530070, '460400116000', '新州镇', '海南,儋州,新州', '110.349228', '20.017377', 1); +INSERT INTO `yx_system_city` VALUES (2668, 530394, 2, 530070, '460400400000', '国营西培农场', '海南,儋州,国营西培农场', '109.455554', '19.476422', 1); +INSERT INTO `yx_system_city` VALUES (2669, 530410, 2, 530070, '460400404000', '国营西联农场', '海南,儋州,国营西联农场', '109.539074', '19.673015', 1); +INSERT INTO `yx_system_city` VALUES (2670, 530431, 2, 530070, '460400405000', '国营蓝洋农场', '海南,儋州,国营蓝洋农场', '109.670723', '19.458984', 1); +INSERT INTO `yx_system_city` VALUES (2671, 530437, 2, 530070, '460400407000', '国营八一农场', '海南,儋州,国营八一农场', '109.364519', '19.413460', 1); +INSERT INTO `yx_system_city` VALUES (2672, 530447, 2, 530070, '460400499000', '洋浦经济开发区', '海南,儋州,洋浦经济开发', '109.202064', '19.736941', 1); +INSERT INTO `yx_system_city` VALUES (2673, 530466, 2, 530070, '460400500000', '华南热作学院', '海南,儋州,华南热作学院', '109.494073', '19.505382', 1); +INSERT INTO `yx_system_city` VALUES (2674, 530469, 2, 530468, '469001000000', '五指山市', '海南,五指山', '109.516922', '18.775146', 1); +INSERT INTO `yx_system_city` VALUES (2675, 530552, 2, 530468, '469002000000', '琼海市', '海南,琼海', '110.474579', '19.259140', 1); +INSERT INTO `yx_system_city` VALUES (2676, 530809, 2, 530468, '469005000000', '文昌市', '海南,文昌', '110.797714', '19.543423', 1); +INSERT INTO `yx_system_city` VALUES (2677, 531148, 2, 530468, '469006000000', '万宁市', '海南,万宁', '110.391075', '18.795143', 1); +INSERT INTO `yx_system_city` VALUES (2678, 531426, 2, 530468, '469007000000', '东方市', '海南,东方', '108.651817', '19.095350', 1); +INSERT INTO `yx_system_city` VALUES (2679, 531647, 2, 530468, '469021000000', '定安县', '海南,定安', '110.358891', '19.681434', 1); +INSERT INTO `yx_system_city` VALUES (2680, 531811, 2, 530468, '469022000000', '屯昌县', '海南,屯昌', '110.103415', '19.351766', 1); +INSERT INTO `yx_system_city` VALUES (2681, 531971, 2, 530468, '469023000000', '澄迈县', '海南,澄迈', '110.006755', '19.738521', 1); +INSERT INTO `yx_system_city` VALUES (2682, 532200, 2, 530468, '469024000000', '临高县', '海南,临高', '109.690508', '19.912026', 1); +INSERT INTO `yx_system_city` VALUES (2683, 532409, 2, 530468, '469025000000', '白沙黎族自治县', '海南,白沙', '109.451484', '19.224823', 1); +INSERT INTO `yx_system_city` VALUES (2684, 532558, 2, 530468, '469026000000', '昌江黎族自治县', '海南,昌江', '109.055724', '19.298062', 1); +INSERT INTO `yx_system_city` VALUES (2685, 532672, 2, 530468, '469027000000', '乐东黎族自治县', '海南,乐东', '109.173055', '18.750260', 1); +INSERT INTO `yx_system_city` VALUES (2686, 532906, 2, 530468, '469028000000', '陵水黎族自治县', '海南,陵水', '110.037504', '18.506048', 1); +INSERT INTO `yx_system_city` VALUES (2687, 533053, 2, 530468, '469029000000', '保亭黎族苗族自治县', '海南,保亭', '109.702590', '18.639130', 1); +INSERT INTO `yx_system_city` VALUES (2688, 533161, 2, 530468, '469030000000', '琼中黎族苗族自治县', '海南,琼中', '109.838389', '19.033369', 1); +INSERT INTO `yx_system_city` VALUES (2689, 533330, 2, 533329, '500101000000', '万州区', '重庆,万州', '108.408661', '30.807667', 1); +INSERT INTO `yx_system_city` VALUES (2690, 534019, 2, 533329, '500102000000', '涪陵区', '重庆,涪陵', '107.389298', '29.703113', 1); +INSERT INTO `yx_system_city` VALUES (2691, 534468, 2, 533329, '500103000000', '渝中区', '重庆,渝中', '106.568892', '29.552750', 1); +INSERT INTO `yx_system_city` VALUES (2692, 534558, 2, 533329, '500104000000', '大渡口区', '重庆,大渡口', '106.482347', '29.484527', 1); +INSERT INTO `yx_system_city` VALUES (2693, 534656, 2, 533329, '500105000000', '江北区', '重庆,江北', '106.574271', '29.606703', 1); +INSERT INTO `yx_system_city` VALUES (2694, 534799, 2, 533329, '500106000000', '沙坪坝区', '重庆,沙坪坝', '106.456878', '29.541145', 1); +INSERT INTO `yx_system_city` VALUES (2695, 535021, 2, 533329, '500107000000', '九龙坡区', '重庆,九龙坡', '106.510676', '29.502272', 1); +INSERT INTO `yx_system_city` VALUES (2696, 535262, 2, 533329, '500108000000', '南岸区', '重庆,南岸', '106.644428', '29.500297', 1); +INSERT INTO `yx_system_city` VALUES (2697, 535428, 2, 533329, '500109000000', '北碚区', '重庆,北碚', '106.395612', '29.805108', 1); +INSERT INTO `yx_system_city` VALUES (2698, 535629, 2, 533329, '500110000000', '綦江区', '重庆,綦江', '106.651362', '29.028067', 1); +INSERT INTO `yx_system_city` VALUES (2699, 536131, 2, 533329, '500111000000', '大足区', '重庆,大足', '105.721733', '29.707032', 1); +INSERT INTO `yx_system_city` VALUES (2700, 536468, 2, 533329, '500112000000', '渝北区', '重庆,渝北', '106.631187', '29.718143', 1); +INSERT INTO `yx_system_city` VALUES (2701, 536890, 2, 533329, '500113000000', '巴南区', '重庆,巴南', '106.540257', '29.402408', 1); +INSERT INTO `yx_system_city` VALUES (2702, 537212, 2, 533329, '500114000000', '黔江区', '重庆,黔江', '108.770678', '29.533610', 1); +INSERT INTO `yx_system_city` VALUES (2703, 537461, 2, 533329, '500115000000', '长寿区', '重庆,长寿', '107.081283', '29.857996', 1); +INSERT INTO `yx_system_city` VALUES (2704, 537745, 2, 533329, '500116000000', '江津区', '重庆,江津', '106.259281', '29.290069', 1); +INSERT INTO `yx_system_city` VALUES (2705, 538050, 2, 533329, '500117000000', '合川区', '重庆,合川', '106.276130', '29.972084', 1); +INSERT INTO `yx_system_city` VALUES (2706, 538493, 2, 533329, '500118000000', '永川区', '重庆,永川', '105.927376', '29.356117', 1); +INSERT INTO `yx_system_city` VALUES (2707, 538778, 2, 533329, '500119000000', '南川区', '重庆,南川', '107.099266', '29.157891', 1); +INSERT INTO `yx_system_city` VALUES (2708, 539057, 2, 533329, '500120000000', '璧山区', '重庆,璧山', '106.227305', '29.592024', 1); +INSERT INTO `yx_system_city` VALUES (2709, 539260, 2, 533329, '500151000000', '铜梁区', '重庆,铜梁', '106.056404', '29.844811', 1); +INSERT INTO `yx_system_city` VALUES (2710, 539615, 2, 533329, '500152000000', '潼南区', '重庆,潼南', '105.840556', '30.191013', 1); +INSERT INTO `yx_system_city` VALUES (2711, 539942, 2, 533329, '500153000000', '荣昌区', '重庆,荣昌', '105.594623', '29.405002', 1); +INSERT INTO `yx_system_city` VALUES (2712, 540131, 2, 533329, '500154000000', '开州区', '重庆,开州', '106.551556', '29.563009', 1); +INSERT INTO `yx_system_city` VALUES (2713, 540701, 2, 540700, '500228000000', '梁平县', '重庆,梁平', '107.769312', '30.654203', 1); +INSERT INTO `yx_system_city` VALUES (2714, 541080, 2, 540700, '500229000000', '城口县', '重庆,城口', '108.664214', '31.947633', 1); +INSERT INTO `yx_system_city` VALUES (2715, 541310, 2, 540700, '500230000000', '丰都县', '重庆,丰都', '107.730895', '29.863500', 1); +INSERT INTO `yx_system_city` VALUES (2716, 541671, 2, 540700, '500231000000', '垫江县', '重庆,垫江', '107.333390', '30.327717', 1); +INSERT INTO `yx_system_city` VALUES (2717, 541999, 2, 540700, '500232000000', '武隆县', '重庆,武隆', '107.760025', '29.325601', 1); +INSERT INTO `yx_system_city` VALUES (2718, 542236, 2, 540700, '500233000000', '忠县', '重庆,忠县', '108.039002', '30.299560', 1); +INSERT INTO `yx_system_city` VALUES (2719, 542631, 2, 540700, '500235000000', '云阳县', '重庆,云阳', '108.697324', '30.930613', 1); +INSERT INTO `yx_system_city` VALUES (2720, 543152, 2, 540700, '500236000000', '奉节县', '重庆,奉节', '109.463987', '31.018498', 1); +INSERT INTO `yx_system_city` VALUES (2721, 543575, 2, 540700, '500237000000', '巫山县', '重庆,巫山', '109.879153', '31.074834', 1); +INSERT INTO `yx_system_city` VALUES (2722, 543943, 2, 540700, '500238000000', '巫溪县', '重庆,巫溪', '109.570062', '31.398604', 1); +INSERT INTO `yx_system_city` VALUES (2723, 544307, 2, 540700, '500240000000', '石柱土家族自治县', '重庆,石柱', '108.114069', '29.999285', 1); +INSERT INTO `yx_system_city` VALUES (2724, 544583, 2, 540700, '500241000000', '秀山土家族苗族自治县', '重庆,秀山', '109.007094', '28.447997', 1); +INSERT INTO `yx_system_city` VALUES (2725, 544878, 2, 540700, '500242000000', '酉阳土家族苗族自治县', '重庆,酉阳', '108.767747', '28.841244', 1); +INSERT INTO `yx_system_city` VALUES (2726, 545196, 2, 540700, '500243000000', '彭水苗族土家族自治县', '重庆,彭水', '108.165538', '29.293902', 1); +INSERT INTO `yx_system_city` VALUES (2727, 545534, 2, 545533, '510101000000', '市辖区', '四川,成都', '104.066541', '30.572269', 1); +INSERT INTO `yx_system_city` VALUES (2728, 545535, 2, 545533, '510104000000', '锦江区', '四川,成都,锦江', '104.080989', '30.657689', 1); +INSERT INTO `yx_system_city` VALUES (2729, 545669, 2, 545533, '510105000000', '青羊区', '四川,成都,青羊', '104.062499', '30.674406', 1); +INSERT INTO `yx_system_city` VALUES (2730, 545763, 2, 545533, '510106000000', '金牛区', '四川,成都,金牛', '104.052236', '30.691359', 1); +INSERT INTO `yx_system_city` VALUES (2731, 545889, 2, 545533, '510107000000', '武侯区', '四川,成都,武侯', '104.043390', '30.641982', 1); +INSERT INTO `yx_system_city` VALUES (2732, 546035, 2, 545533, '510108000000', '成华区', '四川,成都,成华', '104.101255', '30.660122', 1); +INSERT INTO `yx_system_city` VALUES (2733, 546151, 2, 545533, '510112000000', '龙泉驿区', '四川,成都,龙泉驿', '104.274632', '30.556507', 1); +INSERT INTO `yx_system_city` VALUES (2734, 546306, 2, 545533, '510113000000', '青白江区', '四川,成都,青白江', '104.250877', '30.878681', 1); +INSERT INTO `yx_system_city` VALUES (2735, 546441, 2, 545533, '510114000000', '新都区', '四川,成都,新都', '104.158705', '30.823499', 1); +INSERT INTO `yx_system_city` VALUES (2736, 546710, 2, 545533, '510115000000', '温江区', '四川,成都,温江', '103.856646', '30.682203', 1); +INSERT INTO `yx_system_city` VALUES (2737, 546835, 2, 545533, '510116000000', '双流区', '四川,成都,双流', '103.923588', '30.574488', 1); +INSERT INTO `yx_system_city` VALUES (2738, 547144, 2, 545533, '510121000000', '金堂县', '四川,成都,金堂', '104.412005', '30.862017', 1); +INSERT INTO `yx_system_city` VALUES (2739, 547398, 2, 545533, '510124000000', '郫县', '四川,成都,郫县', '103.901092', '30.795854', 1); +INSERT INTO `yx_system_city` VALUES (2740, 547634, 2, 545533, '510129000000', '大邑县', '四川,成都,大邑', '103.511875', '30.572269', 1); +INSERT INTO `yx_system_city` VALUES (2741, 547873, 2, 545533, '510131000000', '蒲江县', '四川,成都,蒲江', '103.506498', '30.196789', 1); +INSERT INTO `yx_system_city` VALUES (2742, 548018, 2, 545533, '510132000000', '新津县', '四川,成都,新津', '103.811345', '30.410222', 1); +INSERT INTO `yx_system_city` VALUES (2743, 548137, 2, 545533, '510181000000', '都江堰市', '四川,成都,都江堰', '103.646912', '30.988435', 1); +INSERT INTO `yx_system_city` VALUES (2744, 548412, 2, 545533, '510182000000', '彭州市', '四川,成都,彭州', '103.958013', '30.990165', 1); +INSERT INTO `yx_system_city` VALUES (2745, 548788, 2, 545533, '510183000000', '邛崃市', '四川,成都,邛崃', '103.464156', '30.410275', 1); +INSERT INTO `yx_system_city` VALUES (2746, 549084, 2, 545533, '510184000000', '崇州市', '四川,成都,崇州', '103.673001', '30.630122', 1); +INSERT INTO `yx_system_city` VALUES (2747, 549363, 2, 545533, '510185000000', '简阳市', '四川,成都,简阳', '104.546774', '30.410755', 1); +INSERT INTO `yx_system_city` VALUES (2748, 550276, 2, 550275, '510301000000', '市辖区', '四川,自贡', '104.778442', '29.339030', 1); +INSERT INTO `yx_system_city` VALUES (2749, 550277, 2, 550275, '510302000000', '自流井区', '四川,自贡,自流井', '104.777191', '29.337430', 1); +INSERT INTO `yx_system_city` VALUES (2750, 550413, 2, 550275, '510303000000', '贡井区', '四川,自贡,贡井', '104.715117', '29.345546', 1); +INSERT INTO `yx_system_city` VALUES (2751, 550609, 2, 550275, '510304000000', '大安区', '四川,自贡,大安', '104.773968', '29.363634', 1); +INSERT INTO `yx_system_city` VALUES (2752, 550816, 2, 550275, '510311000000', '沿滩区', '四川,自贡,沿滩', '104.874073', '29.272581', 1); +INSERT INTO `yx_system_city` VALUES (2753, 551023, 2, 550275, '510321000000', '荣县', '四川,自贡,荣县', '104.417388', '29.445410', 1); +INSERT INTO `yx_system_city` VALUES (2754, 551398, 2, 550275, '510322000000', '富顺县', '四川,自贡,富顺', '104.975048', '29.181430', 1); +INSERT INTO `yx_system_city` VALUES (2755, 551810, 2, 551809, '510401000000', '市辖区', '四川,攀枝花', '101.718637', '26.582347', 1); +INSERT INTO `yx_system_city` VALUES (2756, 551811, 2, 551809, '510402000000', '东区', '四川,攀枝花,东区', '101.718637', '26.582347', 1); +INSERT INTO `yx_system_city` VALUES (2757, 551891, 2, 551809, '510403000000', '西区', '四川,攀枝花,西区', '101.718637', '26.582347', 1); +INSERT INTO `yx_system_city` VALUES (2758, 551941, 2, 551809, '510411000000', '仁和区', '四川,攀枝花,仁和', '101.738528', '26.497765', 1); +INSERT INTO `yx_system_city` VALUES (2759, 552057, 2, 551809, '510421000000', '米易县', '四川,攀枝花,米易', '102.110339', '26.890689', 1); +INSERT INTO `yx_system_city` VALUES (2760, 552169, 2, 551809, '510422000000', '盐边县', '四川,攀枝花,盐边', '101.855071', '26.683213', 1); +INSERT INTO `yx_system_city` VALUES (2761, 552359, 2, 552358, '510501000000', '市辖区', '四川,泸州', '105.442258', '28.871810', 1); +INSERT INTO `yx_system_city` VALUES (2762, 552360, 2, 552358, '510502000000', '江阳区', '四川,泸州,江阳', '105.435009', '28.878818', 1); +INSERT INTO `yx_system_city` VALUES (2763, 552536, 2, 552358, '510503000000', '纳溪区', '四川,泸州,纳溪', '105.371151', '28.773428', 1); +INSERT INTO `yx_system_city` VALUES (2764, 552755, 2, 552358, '510504000000', '龙马潭区', '四川,泸州,龙马潭', '105.437765', '28.913221', 1); +INSERT INTO `yx_system_city` VALUES (2765, 552858, 2, 552358, '510521000000', '泸县', '四川,泸州,泸县', '105.381893', '29.151534', 1); +INSERT INTO `yx_system_city` VALUES (2766, 553181, 2, 552358, '510522000000', '合江县', '四川,泸州,合江', '105.831067', '28.811203', 1); +INSERT INTO `yx_system_city` VALUES (2767, 553536, 2, 552358, '510524000000', '叙永县', '四川,泸州,叙永', '105.444765', '28.155801', 1); +INSERT INTO `yx_system_city` VALUES (2768, 553823, 2, 552358, '510525000000', '古蔺县', '四川,泸州,古蔺', '105.812602', '28.038802', 1); +INSERT INTO `yx_system_city` VALUES (2769, 554143, 2, 554142, '510601000000', '市辖区', '四川,德阳', '104.397894', '31.126855', 1); +INSERT INTO `yx_system_city` VALUES (2770, 554144, 2, 554142, '510603000000', '旌阳区', '四川,德阳,旌阳', '104.416943', '31.142498', 1); +INSERT INTO `yx_system_city` VALUES (2771, 554397, 2, 554142, '510623000000', '中江县', '四川,德阳,中江', '104.678749', '31.033051', 1); +INSERT INTO `yx_system_city` VALUES (2772, 555280, 2, 554142, '510626000000', '罗江县', '四川,德阳,罗江', '104.510249', '31.317045', 1); +INSERT INTO `yx_system_city` VALUES (2773, 555418, 2, 554142, '510681000000', '广汉市', '四川,德阳,广汉', '104.282331', '30.976165', 1); +INSERT INTO `yx_system_city` VALUES (2774, 555660, 2, 554142, '510682000000', '什邡市', '四川,德阳,什邡', '104.167501', '31.126780', 1); +INSERT INTO `yx_system_city` VALUES (2775, 555848, 2, 554142, '510683000000', '绵竹市', '四川,德阳,绵竹', '104.220750', '31.338077', 1); +INSERT INTO `yx_system_city` VALUES (2776, 556078, 2, 556077, '510701000000', '市辖区', '四川,绵阳', '104.679114', '31.467450', 1); +INSERT INTO `yx_system_city` VALUES (2777, 556079, 2, 556077, '510703000000', '涪城区', '四川,绵阳,涪城', '104.756944', '31.455101', 1); +INSERT INTO `yx_system_city` VALUES (2778, 556357, 2, 556077, '510704000000', '游仙区', '四川,绵阳,游仙', '104.766393', '31.473779', 1); +INSERT INTO `yx_system_city` VALUES (2779, 556705, 2, 556077, '510705000000', '安州区', '四川,绵阳,安州', '104.679114', '31.467450', 1); +INSERT INTO `yx_system_city` VALUES (2780, 556985, 2, 556077, '510722000000', '三台县', '四川,绵阳,三台', '105.094586', '31.095979', 1); +INSERT INTO `yx_system_city` VALUES (2781, 558091, 2, 556077, '510723000000', '盐亭县', '四川,绵阳,盐亭', '105.389453', '31.208363', 1); +INSERT INTO `yx_system_city` VALUES (2782, 558648, 2, 556077, '510725000000', '梓潼县', '四川,绵阳,梓潼', '105.170845', '31.642718', 1); +INSERT INTO `yx_system_city` VALUES (2783, 559030, 2, 556077, '510726000000', '北川羌族自治县', '四川,绵阳,北川', '104.467970', '31.617203', 1); +INSERT INTO `yx_system_city` VALUES (2784, 559397, 2, 556077, '510727000000', '平武县', '四川,绵阳,平武', '104.555583', '32.409675', 1); +INSERT INTO `yx_system_city` VALUES (2785, 559687, 2, 556077, '510781000000', '江油市', '四川,绵阳,江油', '104.745877', '31.778025', 1); +INSERT INTO `yx_system_city` VALUES (2786, 560192, 2, 560191, '510801000000', '市辖区', '四川,广元', '105.843357', '32.435435', 1); +INSERT INTO `yx_system_city` VALUES (2787, 560193, 2, 560191, '510802000000', '利州区', '四川,广元,利州', '105.845218', '32.433898', 1); +INSERT INTO `yx_system_city` VALUES (2788, 560469, 2, 560191, '510811000000', '昭化区', '四川,广元,昭化', '105.964121', '32.322788', 1); +INSERT INTO `yx_system_city` VALUES (2789, 560735, 2, 560191, '510812000000', '朝天区', '四川,广元,朝天', '105.890445', '32.643982', 1); +INSERT INTO `yx_system_city` VALUES (2790, 560982, 2, 560191, '510821000000', '旺苍县', '四川,广元,旺苍', '106.289905', '32.228917', 1); +INSERT INTO `yx_system_city` VALUES (2791, 561413, 2, 560191, '510822000000', '青川县', '四川,广元,青川', '105.238842', '32.575485', 1); +INSERT INTO `yx_system_city` VALUES (2792, 561756, 2, 560191, '510823000000', '剑阁县', '四川,广元,剑阁', '105.524766', '32.287723', 1); +INSERT INTO `yx_system_city` VALUES (2793, 562393, 2, 560191, '510824000000', '苍溪县', '四川,广元,苍溪', '105.934801', '31.732432', 1); +INSERT INTO `yx_system_city` VALUES (2794, 563243, 2, 563242, '510901000000', '市辖区', '四川,遂宁', '105.592898', '30.532847', 1); +INSERT INTO `yx_system_city` VALUES (2795, 563244, 2, 563242, '510903000000', '船山区', '四川,遂宁,船山', '105.568297', '30.525475', 1); +INSERT INTO `yx_system_city` VALUES (2796, 563569, 2, 563242, '510904000000', '安居区', '四川,遂宁,安居', '105.456342', '30.355379', 1); +INSERT INTO `yx_system_city` VALUES (2797, 564115, 2, 563242, '510921000000', '蓬溪县', '四川,遂宁,蓬溪', '105.707570', '30.757575', 1); +INSERT INTO `yx_system_city` VALUES (2798, 564699, 2, 563242, '510922000000', '射洪县', '四川,遂宁,射洪', '105.388405', '30.870986', 1); +INSERT INTO `yx_system_city` VALUES (2799, 565387, 2, 563242, '510923000000', '大英县', '四川,遂宁,大英', '105.236904', '30.594337', 1); +INSERT INTO `yx_system_city` VALUES (2800, 565736, 2, 565735, '511001000000', '市辖区', '四川,内江', '105.058433', '29.580228', 1); +INSERT INTO `yx_system_city` VALUES (2801, 565737, 2, 565735, '511002000000', '市中区', '四川,内江,市中', '105.067597', '29.587053', 1); +INSERT INTO `yx_system_city` VALUES (2802, 565956, 2, 565735, '511011000000', '东兴区', '四川,内江,东兴', '105.075490', '29.592756', 1); +INSERT INTO `yx_system_city` VALUES (2803, 566504, 2, 565735, '511024000000', '威远县', '四川,内江,威远', '104.668879', '29.527440', 1); +INSERT INTO `yx_system_city` VALUES (2804, 566895, 2, 565735, '511025000000', '资中县', '四川,内江,资中', '104.851944', '29.764059', 1); +INSERT INTO `yx_system_city` VALUES (2805, 567769, 2, 565735, '511028000000', '隆昌县', '四川,内江,隆昌', '105.287612', '29.339476', 1); +INSERT INTO `yx_system_city` VALUES (2806, 568203, 2, 568202, '511101000000', '市辖区', '四川,乐山', '103.765568', '29.552106', 1); +INSERT INTO `yx_system_city` VALUES (2807, 568204, 2, 568202, '511102000000', '市中区', '四川,乐山,市中', '103.761330', '29.555375', 1); +INSERT INTO `yx_system_city` VALUES (2808, 568549, 2, 568202, '511111000000', '沙湾区', '四川,乐山,沙湾', '103.549991', '29.413091', 1); +INSERT INTO `yx_system_city` VALUES (2809, 568712, 2, 568202, '511112000000', '五通桥区', '四川,乐山,五通桥', '103.818009', '29.406932', 1); +INSERT INTO `yx_system_city` VALUES (2810, 568897, 2, 568202, '511113000000', '金口河区', '四川,乐山,金口河', '103.078621', '29.244345', 1); +INSERT INTO `yx_system_city` VALUES (2811, 568949, 2, 568202, '511123000000', '犍为县', '四川,乐山,犍为', '103.949326', '29.208171', 1); +INSERT INTO `yx_system_city` VALUES (2812, 569368, 2, 568202, '511124000000', '井研县', '四川,乐山,井研', '104.069726', '29.651287', 1); +INSERT INTO `yx_system_city` VALUES (2813, 569627, 2, 568202, '511126000000', '夹江县', '四川,乐山,夹江', '103.571657', '29.737630', 1); +INSERT INTO `yx_system_city` VALUES (2814, 569905, 2, 568202, '511129000000', '沐川县', '四川,乐山,沐川', '103.902335', '28.956647', 1); +INSERT INTO `yx_system_city` VALUES (2815, 570138, 2, 568202, '511132000000', '峨边彝族自治县', '四川,乐山,峨边', '103.765568', '29.552106', 1); +INSERT INTO `yx_system_city` VALUES (2816, 570296, 2, 568202, '511133000000', '马边彝族自治县', '四川,乐山,马边', '103.546348', '28.835521', 1); +INSERT INTO `yx_system_city` VALUES (2817, 570440, 2, 568202, '511181000000', '峨眉山市', '四川,乐山,峨眉山', '103.484504', '29.601199', 1); +INSERT INTO `yx_system_city` VALUES (2818, 570734, 2, 570733, '511301000000', '市辖区', '四川,南充', '106.110698', '30.837793', 1); +INSERT INTO `yx_system_city` VALUES (2819, 570735, 2, 570733, '511302000000', '顺庆区', '四川,南充,顺庆', '106.092399', '30.796486', 1); +INSERT INTO `yx_system_city` VALUES (2820, 571078, 2, 570733, '511303000000', '高坪区', '四川,南充,高坪', '106.118808', '30.781623', 1); +INSERT INTO `yx_system_city` VALUES (2821, 571510, 2, 570733, '511304000000', '嘉陵区', '四川,南充,嘉陵', '106.071793', '30.758748', 1); +INSERT INTO `yx_system_city` VALUES (2822, 572146, 2, 570733, '511321000000', '南部县', '四川,南充,南部', '106.036584', '31.347467', 1); +INSERT INTO `yx_system_city` VALUES (2823, 573339, 2, 570733, '511322000000', '营山县', '四川,南充,营山', '106.565473', '31.076458', 1); +INSERT INTO `yx_system_city` VALUES (2824, 574080, 2, 570733, '511323000000', '蓬安县', '四川,南充,蓬安', '106.412151', '31.029097', 1); +INSERT INTO `yx_system_city` VALUES (2825, 574767, 2, 570733, '511324000000', '仪陇县', '四川,南充,仪陇', '106.303042', '31.271562', 1); +INSERT INTO `yx_system_city` VALUES (2826, 575761, 2, 570733, '511325000000', '西充县', '四川,南充,西充', '105.900878', '30.995669', 1); +INSERT INTO `yx_system_city` VALUES (2827, 576427, 2, 570733, '511381000000', '阆中市', '四川,南充,阆中', '106.005047', '31.558357', 1); +INSERT INTO `yx_system_city` VALUES (2828, 576993, 2, 576992, '511401000000', '市辖区', '四川,眉山', '103.848538', '30.075439', 1); +INSERT INTO `yx_system_city` VALUES (2829, 576994, 2, 576992, '511402000000', '东坡区', '四川,眉山,东坡', '103.831752', '30.042345', 1); +INSERT INTO `yx_system_city` VALUES (2830, 577323, 2, 576992, '511403000000', '彭山区', '四川,眉山,彭山', '103.872950', '30.193056', 1); +INSERT INTO `yx_system_city` VALUES (2831, 577445, 2, 576992, '511421000000', '仁寿县', '四川,眉山,仁寿', '104.134082', '29.995630', 1); +INSERT INTO `yx_system_city` VALUES (2832, 578124, 2, 576992, '511423000000', '洪雅县', '四川,眉山,洪雅', '103.372863', '29.904890', 1); +INSERT INTO `yx_system_city` VALUES (2833, 578299, 2, 576992, '511424000000', '丹棱县', '四川,眉山,丹棱', '103.512733', '30.014448', 1); +INSERT INTO `yx_system_city` VALUES (2834, 578385, 2, 576992, '511425000000', '青神县', '四川,眉山,青神', '103.846688', '29.831358', 1); +INSERT INTO `yx_system_city` VALUES (2835, 578486, 2, 578485, '511501000000', '市辖区', '四川,宜宾', '104.643215', '28.751768', 1); +INSERT INTO `yx_system_city` VALUES (2836, 578487, 2, 578485, '511502000000', '翠屏区', '四川,宜宾,翠屏', '104.620009', '28.765690', 1); +INSERT INTO `yx_system_city` VALUES (2837, 578857, 2, 578485, '511503000000', '南溪区', '四川,宜宾,南溪', '104.969882', '28.845626', 1); +INSERT INTO `yx_system_city` VALUES (2838, 579114, 2, 578485, '511521000000', '宜宾县', '四川,宜宾,宜宾', '104.533213', '28.690045', 1); +INSERT INTO `yx_system_city` VALUES (2839, 579727, 2, 578485, '511523000000', '江安县', '四川,宜宾,江安', '105.066943', '28.723999', 1); +INSERT INTO `yx_system_city` VALUES (2840, 580070, 2, 578485, '511524000000', '长宁县', '四川,宜宾,长宁', '104.921174', '28.582169', 1); +INSERT INTO `yx_system_city` VALUES (2841, 580388, 2, 578485, '511525000000', '高县', '四川,宜宾,高县', '104.517739', '28.436226', 1); +INSERT INTO `yx_system_city` VALUES (2842, 580725, 2, 578485, '511526000000', '珙县', '四川,宜宾,珙县', '104.709202', '28.438630', 1); +INSERT INTO `yx_system_city` VALUES (2843, 581025, 2, 578485, '511527000000', '筠连县', '四川,宜宾,筠连', '104.510988', '28.163860', 1); +INSERT INTO `yx_system_city` VALUES (2844, 581304, 2, 578485, '511528000000', '兴文县', '四川,宜宾,兴文', '105.236325', '28.303614', 1); +INSERT INTO `yx_system_city` VALUES (2845, 581579, 2, 578485, '511529000000', '屏山县', '四川,宜宾,屏山', '104.345974', '28.828482', 1); +INSERT INTO `yx_system_city` VALUES (2846, 581871, 2, 581870, '511601000000', '市辖区', '四川,广安', '106.633212', '30.455961', 1); +INSERT INTO `yx_system_city` VALUES (2847, 581872, 2, 581870, '511602000000', '广安区', '四川,广安,广安', '106.641608', '30.474003', 1); +INSERT INTO `yx_system_city` VALUES (2848, 582526, 2, 581870, '511603000000', '前锋区', '四川,广安,前锋', '106.893277', '30.496300', 1); +INSERT INTO `yx_system_city` VALUES (2849, 582827, 2, 581870, '511621000000', '岳池县', '四川,广安,岳池', '106.440114', '30.537863', 1); +INSERT INTO `yx_system_city` VALUES (2850, 583751, 2, 581870, '511622000000', '武胜县', '四川,广安,武胜', '106.295764', '30.348772', 1); +INSERT INTO `yx_system_city` VALUES (2851, 584332, 2, 581870, '511623000000', '邻水县', '四川,广安,邻水', '106.930380', '30.334769', 1); +INSERT INTO `yx_system_city` VALUES (2852, 584900, 2, 581870, '511681000000', '华蓥市', '四川,广安,华蓥', '106.783088', '30.390435', 1); +INSERT INTO `yx_system_city` VALUES (2853, 585050, 2, 585049, '511701000000', '市辖区', '四川,达州', '107.468023', '31.209571', 1); +INSERT INTO `yx_system_city` VALUES (2854, 585051, 2, 585049, '511702000000', '通川区', '四川,达州,通川', '107.504517', '31.214724', 1); +INSERT INTO `yx_system_city` VALUES (2855, 585347, 2, 585049, '511703000000', '达川区', '四川,达州,达川', '107.511845', '31.196118', 1); +INSERT INTO `yx_system_city` VALUES (2856, 586085, 2, 585049, '511722000000', '宣汉县', '四川,达州,宣汉', '107.727191', '31.353835', 1); +INSERT INTO `yx_system_city` VALUES (2857, 586709, 2, 585049, '511723000000', '开江县', '四川,达州,开江', '107.868736', '31.082987', 1); +INSERT INTO `yx_system_city` VALUES (2858, 586957, 2, 585049, '511724000000', '大竹县', '四川,达州,大竹', '107.204744', '30.736266', 1); +INSERT INTO `yx_system_city` VALUES (2859, 587452, 2, 585049, '511725000000', '渠县', '四川,达州,渠县', '106.972996', '30.836659', 1); +INSERT INTO `yx_system_city` VALUES (2860, 588071, 2, 585049, '511781000000', '万源市', '四川,达州,万源', '108.034657', '32.081631', 1); +INSERT INTO `yx_system_city` VALUES (2861, 588539, 2, 588538, '511801000000', '市辖区', '四川,雅安', '103.013261', '29.980537', 1); +INSERT INTO `yx_system_city` VALUES (2862, 588540, 2, 588538, '511802000000', '雨城区', '四川,雅安,雨城', '103.033083', '30.005447', 1); +INSERT INTO `yx_system_city` VALUES (2863, 588771, 2, 588538, '511803000000', '名山区', '四川,雅安,名山', '103.109185', '30.069954', 1); +INSERT INTO `yx_system_city` VALUES (2864, 589001, 2, 588538, '511822000000', '荥经县', '四川,雅安,荥经', '102.846738', '29.792931', 1); +INSERT INTO `yx_system_city` VALUES (2865, 589135, 2, 588538, '511823000000', '汉源县', '四川,雅安,汉源', '102.645453', '29.347187', 1); +INSERT INTO `yx_system_city` VALUES (2866, 589376, 2, 588538, '511824000000', '石棉县', '四川,雅安,石棉', '102.359462', '29.227874', 1); +INSERT INTO `yx_system_city` VALUES (2867, 589494, 2, 588538, '511825000000', '天全县', '四川,雅安,天全', '102.758317', '30.066713', 1); +INSERT INTO `yx_system_city` VALUES (2868, 589654, 2, 588538, '511826000000', '芦山县', '四川,雅安,芦山', '102.928260', '30.144084', 1); +INSERT INTO `yx_system_city` VALUES (2869, 589711, 2, 588538, '511827000000', '宝兴县', '四川,雅安,宝兴', '102.814531', '30.368126', 1); +INSERT INTO `yx_system_city` VALUES (2870, 589780, 2, 589779, '511901000000', '市辖区', '四川,巴中', '106.747477', '31.867903', 1); +INSERT INTO `yx_system_city` VALUES (2871, 589781, 2, 589779, '511902000000', '巴州区', '四川,巴中,巴州', '106.768878', '31.851478', 1); +INSERT INTO `yx_system_city` VALUES (2872, 590246, 2, 589779, '511903000000', '恩阳区', '四川,巴中,恩阳', '106.655347', '31.786691', 1); +INSERT INTO `yx_system_city` VALUES (2873, 590712, 2, 589779, '511921000000', '通江县', '四川,巴中,通江', '107.245033', '31.911705', 1); +INSERT INTO `yx_system_city` VALUES (2874, 591330, 2, 589779, '511922000000', '南江县', '四川,巴中,南江', '106.828697', '32.346589', 1); +INSERT INTO `yx_system_city` VALUES (2875, 592003, 2, 589779, '511923000000', '平昌县', '四川,巴中,平昌', '107.104008', '31.560874', 1); +INSERT INTO `yx_system_city` VALUES (2876, 592599, 2, 592598, '512001000000', '市辖区', '四川,资阳', '104.627636', '30.128901', 1); +INSERT INTO `yx_system_city` VALUES (2877, 592600, 2, 592598, '512002000000', '雁江区', '四川,资阳,雁江', '104.677096', '30.108210', 1); +INSERT INTO `yx_system_city` VALUES (2878, 593157, 2, 592598, '512021000000', '安岳县', '四川,资阳,安岳', '105.335613', '30.097246', 1); +INSERT INTO `yx_system_city` VALUES (2879, 594205, 2, 592598, '512022000000', '乐至县', '四川,资阳,乐至', '105.020204', '30.276120', 1); +INSERT INTO `yx_system_city` VALUES (2880, 594865, 2, 594864, '513201000000', '马尔康市', '四川,阿坝,马尔康', '102.206504', '31.905813', 1); +INSERT INTO `yx_system_city` VALUES (2881, 594988, 2, 594864, '513221000000', '汶川县', '四川,阿坝,汶川', '103.590387', '31.476822', 1); +INSERT INTO `yx_system_city` VALUES (2882, 595128, 2, 594864, '513222000000', '理县', '四川,阿坝,理县', '103.166853', '31.436473', 1); +INSERT INTO `yx_system_city` VALUES (2883, 595230, 2, 594864, '513223000000', '茂县', '四川,阿坝,茂县', '103.853522', '31.681154', 1); +INSERT INTO `yx_system_city` VALUES (2884, 595404, 2, 594864, '513224000000', '松潘县', '四川,阿坝,松潘', '103.604698', '32.655325', 1); +INSERT INTO `yx_system_city` VALUES (2885, 595579, 2, 594864, '513225000000', '九寨沟县', '四川,阿坝,九寨沟', '104.243841', '33.252056', 1); +INSERT INTO `yx_system_city` VALUES (2886, 595731, 2, 594864, '513226000000', '金川县', '四川,阿坝,金川', '102.063829', '31.476277', 1); +INSERT INTO `yx_system_city` VALUES (2887, 595864, 2, 594864, '513227000000', '小金县', '四川,阿坝,小金', '102.364373', '30.999031', 1); +INSERT INTO `yx_system_city` VALUES (2888, 596022, 2, 594864, '513228000000', '黑水县', '四川,阿坝,黑水', '102.990108', '32.061895', 1); +INSERT INTO `yx_system_city` VALUES (2889, 596167, 2, 594864, '513230000000', '壤塘县', '四川,阿坝,壤塘', '100.978526', '32.265796', 1); +INSERT INTO `yx_system_city` VALUES (2890, 596243, 2, 594864, '513231000000', '阿坝县', '四川,阿坝,阿坝', '101.706655', '32.902459', 1); +INSERT INTO `yx_system_city` VALUES (2891, 596354, 2, 594864, '513232000000', '若尔盖县', '四川,阿坝,若尔盖', '102.961798', '33.575892', 1); +INSERT INTO `yx_system_city` VALUES (2892, 596475, 2, 594864, '513233000000', '红原县', '四川,阿坝,红原', '102.544405', '32.790891', 1); +INSERT INTO `yx_system_city` VALUES (2893, 596526, 2, 596525, '513301000000', '康定市', '四川,甘孜,康定', '101.957146', '29.998436', 1); +INSERT INTO `yx_system_city` VALUES (2894, 596792, 2, 596525, '513322000000', '泸定县', '四川,甘孜,泸定', '102.234618', '29.914160', 1); +INSERT INTO `yx_system_city` VALUES (2895, 596957, 2, 596525, '513323000000', '丹巴县', '四川,甘孜,丹巴', '101.890358', '30.878577', 1); +INSERT INTO `yx_system_city` VALUES (2896, 597158, 2, 596525, '513324000000', '九龙县', '四川,甘孜,九龙', '101.507294', '29.000348', 1); +INSERT INTO `yx_system_city` VALUES (2897, 597242, 2, 596525, '513325000000', '雅江县', '四川,甘孜,雅江', '101.014425', '30.031533', 1); +INSERT INTO `yx_system_city` VALUES (2898, 597374, 2, 596525, '513326000000', '道孚县', '四川,甘孜,道孚', '101.125237', '30.979545', 1); +INSERT INTO `yx_system_city` VALUES (2899, 597557, 2, 596525, '513327000000', '炉霍县', '四川,甘孜,炉霍', '100.676372', '31.391790', 1); +INSERT INTO `yx_system_city` VALUES (2900, 597749, 2, 596525, '513328000000', '甘孜县', '四川,甘孜,甘孜', '99.992671', '31.622934', 1); +INSERT INTO `yx_system_city` VALUES (2901, 597992, 2, 596525, '513329000000', '新龙县', '四川,甘孜,新龙', '100.311369', '30.939169', 1); +INSERT INTO `yx_system_city` VALUES (2902, 598162, 2, 596525, '513330000000', '德格县', '四川,甘孜,德格', '98.580915', '31.806118', 1); +INSERT INTO `yx_system_city` VALUES (2903, 598363, 2, 596525, '513331000000', '白玉县', '四川,甘孜,白玉', '98.824182', '31.209913', 1); +INSERT INTO `yx_system_city` VALUES (2904, 598540, 2, 596525, '513332000000', '石渠县', '四川,甘孜,石渠', '98.102900', '32.978960', 1); +INSERT INTO `yx_system_city` VALUES (2905, 598733, 2, 596525, '513333000000', '色达县', '四川,甘孜,色达', '100.332743', '32.268129', 1); +INSERT INTO `yx_system_city` VALUES (2906, 598889, 2, 596525, '513334000000', '理塘县', '四川,甘孜,理塘', '100.269818', '29.996049', 1); +INSERT INTO `yx_system_city` VALUES (2907, 599129, 2, 596525, '513335000000', '巴塘县', '四川,甘孜,巴塘', '99.110712', '30.004677', 1); +INSERT INTO `yx_system_city` VALUES (2908, 599272, 2, 596525, '513336000000', '乡城县', '四川,甘孜,乡城', '99.798435', '28.931172', 1); +INSERT INTO `yx_system_city` VALUES (2909, 599377, 2, 596525, '513337000000', '稻城县', '四川,甘孜,稻城', '100.298403', '29.037007', 1); +INSERT INTO `yx_system_city` VALUES (2910, 599516, 2, 596525, '513338000000', '得荣县', '四川,甘孜,得荣', '99.286335', '28.713037', 1); +INSERT INTO `yx_system_city` VALUES (2911, 599660, 2, 599659, '513401000000', '西昌市', '四川,凉山,西昌', '102.264449', '27.894504', 1); +INSERT INTO `yx_system_city` VALUES (2912, 599974, 2, 599659, '513422000000', '木里藏族自治县', '四川,凉山,木里', '101.280206', '27.928835', 1); +INSERT INTO `yx_system_city` VALUES (2913, 600127, 2, 599659, '513423000000', '盐源县', '四川,凉山,盐源', '101.509188', '27.422645', 1); +INSERT INTO `yx_system_city` VALUES (2914, 600415, 2, 599659, '513424000000', '德昌县', '四川,凉山,德昌', '102.175670', '27.402839', 1); +INSERT INTO `yx_system_city` VALUES (2915, 600579, 2, 599659, '513425000000', '会理县', '四川,凉山,会理', '102.244683', '26.655026', 1); +INSERT INTO `yx_system_city` VALUES (2916, 600938, 2, 599659, '513426000000', '会东县', '四川,凉山,会东', '102.577961', '26.634669', 1); +INSERT INTO `yx_system_city` VALUES (2917, 601284, 2, 599659, '513427000000', '宁南县', '四川,凉山,宁南', '102.759634', '27.066384', 1); +INSERT INTO `yx_system_city` VALUES (2918, 601444, 2, 599659, '513428000000', '普格县', '四川,凉山,普格', '102.540901', '27.376413', 1); +INSERT INTO `yx_system_city` VALUES (2919, 601640, 2, 599659, '513429000000', '布拖县', '四川,凉山,布拖', '102.811631', '27.706192', 1); +INSERT INTO `yx_system_city` VALUES (2920, 601863, 2, 599659, '513430000000', '金阳县', '四川,凉山,金阳', '103.248772', '27.696861', 1); +INSERT INTO `yx_system_city` VALUES (2921, 602076, 2, 599659, '513431000000', '昭觉县', '四川,凉山,昭觉', '102.842611', '28.014088', 1); +INSERT INTO `yx_system_city` VALUES (2922, 602396, 2, 599659, '513432000000', '喜德县', '四川,凉山,喜德', '102.412518', '28.306726', 1); +INSERT INTO `yx_system_city` VALUES (2923, 602594, 2, 599659, '513433000000', '冕宁县', '四川,凉山,冕宁', '102.177010', '28.549657', 1); +INSERT INTO `yx_system_city` VALUES (2924, 602865, 2, 599659, '513434000000', '越西县', '四川,凉山,越西', '102.507680', '28.639801', 1); +INSERT INTO `yx_system_city` VALUES (2925, 603201, 2, 599659, '513435000000', '甘洛县', '四川,凉山,甘洛', '102.771749', '28.966069', 1); +INSERT INTO `yx_system_city` VALUES (2926, 603460, 2, 599659, '513436000000', '美姑县', '四川,凉山,美姑', '103.132180', '28.328640', 1); +INSERT INTO `yx_system_city` VALUES (2927, 603792, 2, 599659, '513437000000', '雷波县', '四川,凉山,雷波', '103.571696', '28.262683', 1); +INSERT INTO `yx_system_city` VALUES (2928, 604133, 2, 604132, '520101000000', '市辖区', '贵州,贵阳', '106.630153', '26.647661', 1); +INSERT INTO `yx_system_city` VALUES (2929, 604134, 2, 604132, '520102000000', '南明区', '贵州,贵阳,南明', '106.714371', '26.567944', 1); +INSERT INTO `yx_system_city` VALUES (2930, 604342, 2, 604132, '520103000000', '云岩区', '贵州,贵阳,云岩', '106.630153', '26.647661', 1); +INSERT INTO `yx_system_city` VALUES (2931, 604530, 2, 604132, '520111000000', '花溪区', '贵州,贵阳,花溪', '106.670258', '26.409817', 1); +INSERT INTO `yx_system_city` VALUES (2932, 604769, 2, 604132, '520112000000', '乌当区', '贵州,贵阳,乌当', '106.630153', '26.647661', 1); +INSERT INTO `yx_system_city` VALUES (2933, 604883, 2, 604132, '520113000000', '白云区', '贵州,贵阳,白云', '106.630153', '26.647661', 1); +INSERT INTO `yx_system_city` VALUES (2934, 604989, 2, 604132, '520115000000', '观山湖区', '贵州,贵阳,观山湖', '106.622452', '26.601450', 1); +INSERT INTO `yx_system_city` VALUES (2935, 605114, 2, 604132, '520121000000', '开阳县', '贵州,贵阳,开阳', '106.965088', '27.057764', 1); +INSERT INTO `yx_system_city` VALUES (2936, 605264, 2, 604132, '520122000000', '息烽县', '贵州,贵阳,息烽', '106.740410', '27.090479', 1); +INSERT INTO `yx_system_city` VALUES (2937, 605453, 2, 604132, '520123000000', '修文县', '贵州,贵阳,修文', '106.592110', '26.838926', 1); +INSERT INTO `yx_system_city` VALUES (2938, 605593, 2, 604132, '520181000000', '清镇市', '贵州,贵阳,清镇', '106.470711', '26.556080', 1); +INSERT INTO `yx_system_city` VALUES (2939, 605835, 2, 605834, '520201000000', '钟山区', '贵州,六盘水,钟山', '104.843555', '26.574979', 1); +INSERT INTO `yx_system_city` VALUES (2940, 605994, 2, 605834, '520203000000', '六枝特区', '贵州,六盘水,六枝特', '105.480029', '26.201228', 1); +INSERT INTO `yx_system_city` VALUES (2941, 606258, 2, 605834, '520221000000', '水城县', '贵州,六盘水,水城', '104.957831', '26.547904', 1); +INSERT INTO `yx_system_city` VALUES (2942, 606493, 2, 605834, '520222000000', '盘县', '贵州,六盘水,盘县', '104.471535', '25.710002', 1); +INSERT INTO `yx_system_city` VALUES (2943, 607030, 2, 607029, '520301000000', '市辖区', '贵州,遵义', '106.927389', '27.725654', 1); +INSERT INTO `yx_system_city` VALUES (2944, 607031, 2, 607029, '520302000000', '红花岗区', '贵州,遵义,红花岗', '106.893709', '27.644755', 1); +INSERT INTO `yx_system_city` VALUES (2945, 607235, 2, 607029, '520303000000', '汇川区', '贵州,遵义,汇川', '106.934270', '27.750125', 1); +INSERT INTO `yx_system_city` VALUES (2946, 607385, 2, 607029, '520304000000', '播州区', '贵州,遵义,播州', '106.927389', '27.725654', 1); +INSERT INTO `yx_system_city` VALUES (2947, 607584, 2, 607029, '520322000000', '桐梓县', '贵州,遵义,桐梓', '106.825644', '28.133583', 1); +INSERT INTO `yx_system_city` VALUES (2948, 607833, 2, 607029, '520323000000', '绥阳县', '贵州,遵义,绥阳', '107.191222', '27.946222', 1); +INSERT INTO `yx_system_city` VALUES (2949, 607966, 2, 607029, '520324000000', '正安县', '贵州,遵义,正安', '107.453945', '28.553285', 1); +INSERT INTO `yx_system_city` VALUES (2950, 608138, 2, 607029, '520325000000', '道真仡佬族苗族自治县', '贵州,遵义,道真', '106.927389', '27.725654', 1); +INSERT INTO `yx_system_city` VALUES (2951, 608236, 2, 607029, '520326000000', '务川仡佬族苗族自治县', '贵州,遵义,务川', '107.898957', '28.563086', 1); +INSERT INTO `yx_system_city` VALUES (2952, 608370, 2, 607029, '520327000000', '凤冈县', '贵州,遵义,凤冈', '107.716356', '27.954695', 1); +INSERT INTO `yx_system_city` VALUES (2953, 608471, 2, 607029, '520328000000', '湄潭县', '贵州,遵义,湄潭', '107.465407', '27.749055', 1); +INSERT INTO `yx_system_city` VALUES (2954, 608620, 2, 607029, '520329000000', '余庆县', '贵州,遵义,余庆', '107.905278', '27.215420', 1); +INSERT INTO `yx_system_city` VALUES (2955, 608701, 2, 607029, '520330000000', '习水县', '贵州,遵义,习水', '106.197138', '28.331270', 1); +INSERT INTO `yx_system_city` VALUES (2956, 608974, 2, 607029, '520381000000', '赤水市', '贵州,遵义,赤水', '105.697472', '28.590337', 1); +INSERT INTO `yx_system_city` VALUES (2957, 609114, 2, 607029, '520382000000', '仁怀市', '贵州,遵义,仁怀', '106.400342', '27.791650', 1); +INSERT INTO `yx_system_city` VALUES (2958, 609310, 2, 609309, '520401000000', '市辖区', '贵州,安顺', '105.947593', '26.253072', 1); +INSERT INTO `yx_system_city` VALUES (2959, 609311, 2, 609309, '520402000000', '西秀区', '贵州,安顺,西秀', '105.965535', '26.245433', 1); +INSERT INTO `yx_system_city` VALUES (2960, 609686, 2, 609309, '520403000000', '平坝区', '贵州,安顺,平坝', '106.255557', '26.405502', 1); +INSERT INTO `yx_system_city` VALUES (2961, 609845, 2, 609309, '520422000000', '普定县', '贵州,安顺,普定', '105.743196', '26.301446', 1); +INSERT INTO `yx_system_city` VALUES (2962, 610030, 2, 609309, '520423000000', '镇宁布依族苗族自治县', '贵州,安顺,镇宁', '105.770402', '26.057362', 1); +INSERT INTO `yx_system_city` VALUES (2963, 610256, 2, 609309, '520424000000', '关岭布依族苗族自治县', '贵州,安顺,关岭', '105.622053', '25.940378', 1); +INSERT INTO `yx_system_city` VALUES (2964, 610426, 2, 609309, '520425000000', '紫云苗族布依族自治县', '贵州,安顺,紫云', '106.087216', '25.755886', 1); +INSERT INTO `yx_system_city` VALUES (2965, 610608, 2, 610607, '520501000000', '市辖区', '贵州,毕节', '105.283992', '27.302589', 1); +INSERT INTO `yx_system_city` VALUES (2966, 610609, 2, 610607, '520502000000', '七星关区', '贵州,毕节,七星关', '105.305138', '27.298494', 1); +INSERT INTO `yx_system_city` VALUES (2967, 611207, 2, 610607, '520521000000', '大方县', '贵州,毕节,大方', '105.613174', '27.141682', 1); +INSERT INTO `yx_system_city` VALUES (2968, 611627, 2, 610607, '520522000000', '黔西县', '贵州,毕节,黔西', '106.033544', '27.007713', 1); +INSERT INTO `yx_system_city` VALUES (2969, 612043, 2, 610607, '520523000000', '金沙县', '贵州,毕节,金沙', '106.220228', '27.459214', 1); +INSERT INTO `yx_system_city` VALUES (2970, 612308, 2, 610607, '520524000000', '织金县', '贵州,毕节,织金', '105.770542', '26.663450', 1); +INSERT INTO `yx_system_city` VALUES (2971, 612915, 2, 610607, '520525000000', '纳雍县', '贵州,毕节,纳雍', '105.382715', '26.777645', 1); +INSERT INTO `yx_system_city` VALUES (2972, 613369, 2, 610607, '520526000000', '威宁彝族回族苗族自治县', '贵州,毕节,威宁', '104.278740', '26.856210', 1); +INSERT INTO `yx_system_city` VALUES (2973, 614035, 2, 610607, '520527000000', '赫章县', '贵州,毕节,赫章', '104.727418', '27.123079', 1); +INSERT INTO `yx_system_city` VALUES (2974, 614531, 2, 614530, '520601000000', '市辖区', '贵州,铜仁', '109.189598', '27.731514', 1); +INSERT INTO `yx_system_city` VALUES (2975, 614532, 2, 614530, '520602000000', '碧江区', '贵州,铜仁,碧江', '109.181122', '27.690653', 1); +INSERT INTO `yx_system_city` VALUES (2976, 614636, 2, 614530, '520603000000', '万山区', '贵州,铜仁,万山', '109.213644', '27.517896', 1); +INSERT INTO `yx_system_city` VALUES (2977, 614733, 2, 614530, '520621000000', '江口县', '贵州,铜仁,江口', '108.839557', '27.699650', 1); +INSERT INTO `yx_system_city` VALUES (2978, 614900, 2, 614530, '520622000000', '玉屏侗族自治县', '贵州,铜仁,玉屏', '108.914680', '27.243012', 1); +INSERT INTO `yx_system_city` VALUES (2979, 615001, 2, 614530, '520623000000', '石阡县', '贵州,铜仁,石阡', '108.223612', '27.513829', 1); +INSERT INTO `yx_system_city` VALUES (2980, 615331, 2, 614530, '520624000000', '思南县', '贵州,铜仁,思南', '108.253873', '27.937560', 1); +INSERT INTO `yx_system_city` VALUES (2981, 615886, 2, 614530, '520625000000', '印江土家族苗族自治县', '贵州,铜仁,印江', '108.409752', '27.994247', 1); +INSERT INTO `yx_system_city` VALUES (2982, 616278, 2, 614530, '520626000000', '德江县', '贵州,铜仁,德江', '108.119807', '28.263964', 1); +INSERT INTO `yx_system_city` VALUES (2983, 616644, 2, 614530, '520627000000', '沿河土家族自治县', '贵州,铜仁,沿河', '108.503870', '28.563928', 1); +INSERT INTO `yx_system_city` VALUES (2984, 617116, 2, 614530, '520628000000', '松桃苗族自治县', '贵州,铜仁,松桃', '109.202886', '28.154071', 1); +INSERT INTO `yx_system_city` VALUES (2985, 617671, 2, 617670, '522301000000', '兴义市', '贵州,黔西南,兴义', '104.895467', '25.092040', 1); +INSERT INTO `yx_system_city` VALUES (2986, 617923, 2, 617670, '522322000000', '兴仁县', '贵州,黔西南,兴仁', '105.186238', '25.435183', 1); +INSERT INTO `yx_system_city` VALUES (2987, 618102, 2, 617670, '522323000000', '普安县', '贵州,黔西南,普安', '104.953063', '25.784135', 1); +INSERT INTO `yx_system_city` VALUES (2988, 618205, 2, 617670, '522324000000', '晴隆县', '贵州,黔西南,晴隆', '105.218991', '25.834784', 1); +INSERT INTO `yx_system_city` VALUES (2989, 618316, 2, 617670, '522325000000', '贞丰县', '贵州,黔西南,贞丰', '105.649864', '25.385760', 1); +INSERT INTO `yx_system_city` VALUES (2990, 618489, 2, 617670, '522326000000', '望谟县', '贵州,黔西南,望谟', '106.099617', '25.178422', 1); +INSERT INTO `yx_system_city` VALUES (2991, 618671, 2, 617670, '522327000000', '册亨县', '贵州,黔西南,册亨', '105.811593', '24.983663', 1); +INSERT INTO `yx_system_city` VALUES (2992, 618816, 2, 617670, '522328000000', '安龙县', '贵州,黔西南,安龙', '105.442701', '25.099014', 1); +INSERT INTO `yx_system_city` VALUES (2993, 619018, 2, 619017, '522601000000', '凯里市', '贵州,黔东南,凯里', '107.981212', '26.566867', 1); +INSERT INTO `yx_system_city` VALUES (2994, 619308, 2, 619017, '522622000000', '黄平县', '贵州,黔东南,黄平', '107.916412', '26.905396', 1); +INSERT INTO `yx_system_city` VALUES (2995, 619574, 2, 619017, '522623000000', '施秉县', '贵州,黔东南,施秉', '108.124380', '27.032920', 1); +INSERT INTO `yx_system_city` VALUES (2996, 619657, 2, 619017, '522624000000', '三穗县', '贵州,黔东南,三穗', '108.675267', '26.952968', 1); +INSERT INTO `yx_system_city` VALUES (2997, 619831, 2, 619017, '522625000000', '镇远县', '贵州,黔东南,镇远', '108.429691', '27.049110', 1); +INSERT INTO `yx_system_city` VALUES (2998, 619970, 2, 619017, '522626000000', '岑巩县', '贵州,黔东南,岑巩', '108.816060', '27.173887', 1); +INSERT INTO `yx_system_city` VALUES (2999, 620122, 2, 619017, '522627000000', '天柱县', '贵州,黔东南,天柱', '109.207757', '26.909678', 1); +INSERT INTO `yx_system_city` VALUES (3000, 620465, 2, 619017, '522628000000', '锦屏县', '贵州,黔东南,锦屏', '109.200534', '26.676233', 1); +INSERT INTO `yx_system_city` VALUES (3001, 620673, 2, 619017, '522629000000', '剑河县', '贵州,黔东南,剑河', '108.441501', '26.728274', 1); +INSERT INTO `yx_system_city` VALUES (3002, 620996, 2, 619017, '522630000000', '台江县', '贵州,黔东南,台江', '108.321245', '26.667525', 1); +INSERT INTO `yx_system_city` VALUES (3003, 621166, 2, 619017, '522631000000', '黎平县', '贵州,黔东南,黎平', '109.136658', '26.230424', 1); +INSERT INTO `yx_system_city` VALUES (3004, 621616, 2, 619017, '522632000000', '榕江县', '贵州,黔东南,榕江', '108.521881', '25.931893', 1); +INSERT INTO `yx_system_city` VALUES (3005, 621906, 2, 619017, '522633000000', '从江县', '贵州,黔东南,从江', '108.905329', '25.753009', 1); +INSERT INTO `yx_system_city` VALUES (3006, 622312, 2, 619017, '522634000000', '雷山县', '贵州,黔东南,雷山', '108.077540', '26.378443', 1); +INSERT INTO `yx_system_city` VALUES (3007, 622484, 2, 619017, '522635000000', '麻江县', '贵州,黔东南,麻江', '107.589359', '26.491105', 1); +INSERT INTO `yx_system_city` VALUES (3008, 622561, 2, 619017, '522636000000', '丹寨县', '贵州,黔东南,丹寨', '107.788728', '26.198320', 1); +INSERT INTO `yx_system_city` VALUES (3009, 622735, 2, 622734, '522701000000', '都匀市', '贵州,黔南,都匀', '107.518847', '26.259427', 1); +INSERT INTO `yx_system_city` VALUES (3010, 622888, 2, 622734, '522702000000', '福泉市', '贵州,黔南,福泉', '107.520386', '26.686335', 1); +INSERT INTO `yx_system_city` VALUES (3011, 622973, 2, 622734, '522722000000', '荔波县', '贵州,黔南,荔波', '107.886450', '25.410654', 1); +INSERT INTO `yx_system_city` VALUES (3012, 623082, 2, 622734, '522723000000', '贵定县', '贵州,黔南,贵定', '107.232889', '26.557071', 1); +INSERT INTO `yx_system_city` VALUES (3013, 623205, 2, 622734, '522725000000', '瓮安县', '贵州,黔南,瓮安', '107.471555', '27.078472', 1); +INSERT INTO `yx_system_city` VALUES (3014, 623318, 2, 622734, '522726000000', '独山县', '贵州,黔南,独山', '107.545048', '25.822132', 1); +INSERT INTO `yx_system_city` VALUES (3015, 623391, 2, 622734, '522727000000', '平塘县', '贵州,黔南,平塘', '107.323077', '25.831955', 1); +INSERT INTO `yx_system_city` VALUES (3016, 623530, 2, 622734, '522728000000', '罗甸县', '贵州,黔南,罗甸', '106.751418', '25.424845', 1); +INSERT INTO `yx_system_city` VALUES (3017, 623723, 2, 622734, '522729000000', '长顺县', '贵州,黔南,长顺', '106.447376', '26.022116', 1); +INSERT INTO `yx_system_city` VALUES (3018, 623813, 2, 622734, '522730000000', '龙里县', '贵州,黔南,龙里', '106.979524', '26.453154', 1); +INSERT INTO `yx_system_city` VALUES (3019, 623901, 2, 622734, '522731000000', '惠水县', '贵州,黔南,惠水', '106.657089', '26.132061', 1); +INSERT INTO `yx_system_city` VALUES (3020, 624122, 2, 622734, '522732000000', '三都水族自治县', '贵州,黔南,三都', '107.869749', '25.983202', 1); +INSERT INTO `yx_system_city` VALUES (3021, 624374, 2, 624373, '530101000000', '市辖区', '云南,昆明', '102.832891', '24.880095', 1); +INSERT INTO `yx_system_city` VALUES (3022, 624375, 2, 624373, '530102000000', '五华区', '云南,昆明,五华', '102.832891', '24.880095', 1); +INSERT INTO `yx_system_city` VALUES (3023, 624486, 2, 624373, '530103000000', '盘龙区', '云南,昆明,盘龙', '102.832891', '24.880095', 1); +INSERT INTO `yx_system_city` VALUES (3024, 624599, 2, 624373, '530111000000', '官渡区', '云南,昆明,官渡', '102.832891', '24.880095', 1); +INSERT INTO `yx_system_city` VALUES (3025, 624730, 2, 624373, '530112000000', '西山区', '云南,昆明,西山', '102.832891', '24.880095', 1); +INSERT INTO `yx_system_city` VALUES (3026, 624860, 2, 624373, '530113000000', '东川区', '云南,昆明,东川', '103.187820', '26.082872', 1); +INSERT INTO `yx_system_city` VALUES (3027, 625034, 2, 624373, '530114000000', '呈贡区', '云南,昆明,呈贡', '102.832891', '24.880095', 1); +INSERT INTO `yx_system_city` VALUES (3028, 625111, 2, 624373, '530122000000', '晋宁县', '云南,昆明,晋宁', '102.832891', '24.880095', 1); +INSERT INTO `yx_system_city` VALUES (3029, 625255, 2, 624373, '530124000000', '富民县', '云南,昆明,富民', '102.497681', '25.222046', 1); +INSERT INTO `yx_system_city` VALUES (3030, 625337, 2, 624373, '530125000000', '宜良县', '云南,昆明,宜良', '103.141304', '24.919704', 1); +INSERT INTO `yx_system_city` VALUES (3031, 625486, 2, 624373, '530126000000', '石林彝族自治县', '云南,昆明,石林', '102.832891', '24.880095', 1); +INSERT INTO `yx_system_city` VALUES (3032, 625585, 2, 624373, '530127000000', '嵩明县', '云南,昆明,嵩明', '103.036911', '25.338642', 1); +INSERT INTO `yx_system_city` VALUES (3033, 625669, 2, 624373, '530128000000', '禄劝彝族苗族自治县', '云南,昆明,禄劝', '102.832891', '24.880095', 1); +INSERT INTO `yx_system_city` VALUES (3034, 625883, 2, 624373, '530129000000', '寻甸回族彝族自治县', '云南,昆明,寻甸', '102.832891', '24.880095', 1); +INSERT INTO `yx_system_city` VALUES (3035, 626074, 2, 624373, '530181000000', '安宁市', '云南,昆明,安宁', '102.832891', '24.880095', 1); +INSERT INTO `yx_system_city` VALUES (3036, 626182, 2, 626181, '530301000000', '市辖区', '云南,曲靖', '103.796167', '25.489999', 1); +INSERT INTO `yx_system_city` VALUES (3037, 626183, 2, 626181, '530302000000', '麒麟区', '云南,曲靖,麒麟', '103.805012', '25.495241', 1); +INSERT INTO `yx_system_city` VALUES (3038, 626343, 2, 626181, '530303000000', '沾益区', '云南,曲靖,沾益', '103.822324', '25.600507', 1); +INSERT INTO `yx_system_city` VALUES (3039, 626485, 2, 626181, '530321000000', '马龙县', '云南,曲靖,马龙', '103.578454', '25.428130', 1); +INSERT INTO `yx_system_city` VALUES (3040, 626569, 2, 626181, '530322000000', '陆良县', '云南,曲靖,陆良', '103.666663', '25.030051', 1); +INSERT INTO `yx_system_city` VALUES (3041, 626731, 2, 626181, '530323000000', '师宗县', '云南,曲靖,师宗', '103.985478', '24.822403', 1); +INSERT INTO `yx_system_city` VALUES (3042, 626852, 2, 626181, '530324000000', '罗平县', '云南,曲靖,罗平', '104.308675', '24.884626', 1); +INSERT INTO `yx_system_city` VALUES (3043, 627020, 2, 626181, '530325000000', '富源县', '云南,曲靖,富源', '104.255015', '25.674238', 1); +INSERT INTO `yx_system_city` VALUES (3044, 627194, 2, 626181, '530326000000', '会泽县', '云南,曲靖,会泽', '103.297361', '26.417947', 1); +INSERT INTO `yx_system_city` VALUES (3045, 627596, 2, 626181, '530381000000', '宣威市', '云南,曲靖,宣威', '104.104475', '26.219767', 1); +INSERT INTO `yx_system_city` VALUES (3046, 627982, 2, 627981, '530401000000', '市辖区', '云南,玉溪', '102.546543', '24.352036', 1); +INSERT INTO `yx_system_city` VALUES (3047, 627983, 2, 627981, '530402000000', '红塔区', '云南,玉溪,红塔', '102.540179', '24.341098', 1); +INSERT INTO `yx_system_city` VALUES (3048, 628099, 2, 627981, '530403000000', '江川区', '云南,玉溪,江川', '102.753734', '24.287534', 1); +INSERT INTO `yx_system_city` VALUES (3049, 628181, 2, 627981, '530422000000', '澄江县', '云南,玉溪,澄江', '102.908248', '24.673734', 1); +INSERT INTO `yx_system_city` VALUES (3050, 628228, 2, 627981, '530423000000', '通海县', '云南,玉溪,通海', '102.760039', '24.112205', 1); +INSERT INTO `yx_system_city` VALUES (3051, 628314, 2, 627981, '530424000000', '华宁县', '云南,玉溪,华宁', '102.928835', '24.192761', 1); +INSERT INTO `yx_system_city` VALUES (3052, 628397, 2, 627981, '530425000000', '易门县', '云南,玉溪,易门', '102.162531', '24.671651', 1); +INSERT INTO `yx_system_city` VALUES (3053, 628463, 2, 627981, '530426000000', '峨山彝族自治县', '云南,玉溪,峨山', '102.397333', '24.169401', 1); +INSERT INTO `yx_system_city` VALUES (3054, 628548, 2, 627981, '530427000000', '新平彝族傣族自治县', '云南,玉溪,新平', '101.990157', '24.070051', 1); +INSERT INTO `yx_system_city` VALUES (3055, 628684, 2, 627981, '530428000000', '元江哈尼族彝族傣族自治县', '云南,玉溪,元江', '101.998103', '23.596503', 1); +INSERT INTO `yx_system_city` VALUES (3056, 628777, 2, 628776, '530501000000', '市辖区', '云南,保山', '99.161761', '25.112046', 1); +INSERT INTO `yx_system_city` VALUES (3057, 628778, 2, 628776, '530502000000', '隆阳区', '云南,保山,隆阳', '99.165607', '25.121154', 1); +INSERT INTO `yx_system_city` VALUES (3058, 629117, 2, 628776, '530521000000', '施甸县', '云南,保山,施甸', '99.189221', '24.723064', 1); +INSERT INTO `yx_system_city` VALUES (3059, 629271, 2, 628776, '530523000000', '龙陵县', '云南,保山,龙陵', '98.689230', '24.586766', 1); +INSERT INTO `yx_system_city` VALUES (3060, 629403, 2, 628776, '530524000000', '昌宁县', '云南,保山,昌宁', '99.605142', '24.827839', 1); +INSERT INTO `yx_system_city` VALUES (3061, 629541, 2, 628776, '530581000000', '腾冲市', '云南,保山,腾冲', '98.497291', '25.017570', 1); +INSERT INTO `yx_system_city` VALUES (3062, 629782, 2, 629781, '530601000000', '市辖区', '云南,昭通', '103.717465', '27.338257', 1); +INSERT INTO `yx_system_city` VALUES (3063, 629783, 2, 629781, '530602000000', '昭阳区', '云南,昭通,昭阳', '103.706539', '27.320075', 1); +INSERT INTO `yx_system_city` VALUES (3064, 629988, 2, 629781, '530621000000', '鲁甸县', '云南,昭通,鲁甸', '103.558042', '27.186659', 1); +INSERT INTO `yx_system_city` VALUES (3065, 630098, 2, 629781, '530622000000', '巧家县', '云南,昭通,巧家', '102.930164', '26.908461', 1); +INSERT INTO `yx_system_city` VALUES (3066, 630299, 2, 629781, '530623000000', '盐津县', '云南,昭通,盐津', '104.234442', '28.108710', 1); +INSERT INTO `yx_system_city` VALUES (3067, 630404, 2, 629781, '530624000000', '大关县', '云南,昭通,大关', '103.891146', '27.747978', 1); +INSERT INTO `yx_system_city` VALUES (3068, 630498, 2, 629781, '530625000000', '永善县', '云南,昭通,永善', '103.638067', '28.229113', 1); +INSERT INTO `yx_system_city` VALUES (3069, 630656, 2, 629781, '530626000000', '绥江县', '云南,昭通,绥江', '103.968978', '28.592100', 1); +INSERT INTO `yx_system_city` VALUES (3070, 630704, 2, 629781, '530627000000', '镇雄县', '云南,昭通,镇雄', '104.873579', '27.441668', 1); +INSERT INTO `yx_system_city` VALUES (3071, 630989, 2, 629781, '530628000000', '彝良县', '云南,昭通,彝良', '104.048289', '27.625419', 1); +INSERT INTO `yx_system_city` VALUES (3072, 631144, 2, 629781, '530629000000', '威信县', '云南,昭通,威信', '105.049027', '27.846901', 1); +INSERT INTO `yx_system_city` VALUES (3073, 631242, 2, 629781, '530630000000', '水富县', '云南,昭通,水富', '104.416031', '28.629880', 1); +INSERT INTO `yx_system_city` VALUES (3074, 631277, 2, 631276, '530701000000', '市辖区', '云南,丽江', '100.227750', '26.855047', 1); +INSERT INTO `yx_system_city` VALUES (3075, 631278, 2, 631276, '530702000000', '古城区', '云南,丽江,古城', '100.225766', '26.877190', 1); +INSERT INTO `yx_system_city` VALUES (3076, 631349, 2, 631276, '530721000000', '玉龙纳西族自治县', '云南,丽江,玉龙', '100.236955', '26.821460', 1); +INSERT INTO `yx_system_city` VALUES (3077, 631469, 2, 631276, '530722000000', '永胜县', '云南,丽江,永胜', '100.750795', '26.684225', 1); +INSERT INTO `yx_system_city` VALUES (3078, 631634, 2, 631276, '530723000000', '华坪县', '云南,丽江,华坪', '101.266195', '26.629211', 1); +INSERT INTO `yx_system_city` VALUES (3079, 631704, 2, 631276, '530724000000', '宁蒗彝族自治县', '云南,丽江,宁蒗', '100.852001', '27.282071', 1); +INSERT INTO `yx_system_city` VALUES (3080, 631812, 2, 631811, '530801000000', '市辖区', '云南,普洱', '100.966512', '22.825065', 1); +INSERT INTO `yx_system_city` VALUES (3081, 631813, 2, 631811, '530802000000', '思茅区', '云南,普洱,思茅', '100.977165', '22.786910', 1); +INSERT INTO `yx_system_city` VALUES (3082, 631894, 2, 631811, '530821000000', '宁洱哈尼族彝族自治县', '云南,普洱,宁洱', '100.980485', '22.781242', 1); +INSERT INTO `yx_system_city` VALUES (3083, 631993, 2, 631811, '530822000000', '墨江哈尼族自治县', '云南,普洱,墨江', '101.692461', '23.431894', 1); +INSERT INTO `yx_system_city` VALUES (3084, 632177, 2, 631811, '530823000000', '景东彝族自治县', '云南,普洱,景东', '100.833877', '24.446731', 1); +INSERT INTO `yx_system_city` VALUES (3085, 632361, 2, 631811, '530824000000', '景谷傣族彝族自治县', '云南,普洱,景谷', '100.702871', '23.497028', 1); +INSERT INTO `yx_system_city` VALUES (3086, 632513, 2, 631811, '530825000000', '镇沅彝族哈尼族拉祜族自治县', '云南,普洱,镇沅', '101.108595', '24.004442', 1); +INSERT INTO `yx_system_city` VALUES (3087, 632634, 2, 631811, '530826000000', '江城哈尼族彝族自治县', '云南,普洱,江城', '101.862120', '22.585868', 1); +INSERT INTO `yx_system_city` VALUES (3088, 632693, 2, 631811, '530827000000', '孟连傣族拉祜族佤族自治县', '云南,普洱,孟连', '99.584157', '22.329100', 1); +INSERT INTO `yx_system_city` VALUES (3089, 632742, 2, 631811, '530828000000', '澜沧拉祜族自治县', '云南,普洱,澜沧', '99.931975', '22.555905', 1); +INSERT INTO `yx_system_city` VALUES (3090, 632924, 2, 631811, '530829000000', '西盟佤族自治县', '云南,普洱,西', '100.966512', '22.825065', 1); +INSERT INTO `yx_system_city` VALUES (3091, 632972, 2, 632971, '530901000000', '市辖区', '云南,临沧', '100.079583', '23.877573', 1); +INSERT INTO `yx_system_city` VALUES (3092, 632973, 2, 632971, '530902000000', '临翔区', '云南,临沧,临翔', '100.082523', '23.895137', 1); +INSERT INTO `yx_system_city` VALUES (3093, 633086, 2, 632971, '530921000000', '凤庆县', '云南,临沧,凤庆', '99.928460', '24.580424', 1); +INSERT INTO `yx_system_city` VALUES (3094, 633287, 2, 632971, '530922000000', '云县', '云南,临沧,云县', '100.123248', '24.437061', 1); +INSERT INTO `yx_system_city` VALUES (3095, 633498, 2, 632971, '530923000000', '永德县', '云南,临沧,永德', '99.259340', '24.018357', 1); +INSERT INTO `yx_system_city` VALUES (3096, 633629, 2, 632971, '530924000000', '镇康县', '云南,临沧,镇康', '98.825285', '23.762584', 1); +INSERT INTO `yx_system_city` VALUES (3097, 633711, 2, 632971, '530925000000', '双江拉祜族佤族布朗族傣族自治县', '云南,临沧,双江', '99.827698', '23.473499', 1); +INSERT INTO `yx_system_city` VALUES (3098, 633793, 2, 632971, '530926000000', '耿马傣族佤族自治县', '云南,临沧,耿马', '99.395366', '23.529249', 1); +INSERT INTO `yx_system_city` VALUES (3099, 633898, 2, 632971, '530927000000', '沧源佤族自治县', '云南,临沧,沧源', '99.246197', '23.146712', 1); +INSERT INTO `yx_system_city` VALUES (3100, 634007, 2, 634006, '532301000000', '楚雄市', '云南,楚雄,楚雄', '101.545906', '25.032889', 1); +INSERT INTO `yx_system_city` VALUES (3101, 634176, 2, 634006, '532322000000', '双柏县', '云南,楚雄,双柏', '101.641937', '24.688875', 1); +INSERT INTO `yx_system_city` VALUES (3102, 634269, 2, 634006, '532323000000', '牟定县', '云南,楚雄,牟定', '101.546566', '25.313122', 1); +INSERT INTO `yx_system_city` VALUES (3103, 634366, 2, 634006, '532324000000', '南华县', '云南,楚雄,南华', '101.273577', '25.192293', 1); +INSERT INTO `yx_system_city` VALUES (3104, 634505, 2, 634006, '532325000000', '姚安县', '云南,楚雄,姚安', '101.241728', '25.504173', 1); +INSERT INTO `yx_system_city` VALUES (3105, 634592, 2, 634006, '532326000000', '大姚县', '云南,楚雄,大姚', '101.336617', '25.729513', 1); +INSERT INTO `yx_system_city` VALUES (3106, 634734, 2, 634006, '532327000000', '永仁县', '云南,楚雄,永仁', '101.666133', '26.049464', 1); +INSERT INTO `yx_system_city` VALUES (3107, 634805, 2, 634006, '532328000000', '元谋县', '云南,楚雄,元谋', '101.874520', '25.704338', 1); +INSERT INTO `yx_system_city` VALUES (3108, 634894, 2, 634006, '532329000000', '武定县', '云南,楚雄,武定', '102.404338', '25.530389', 1); +INSERT INTO `yx_system_city` VALUES (3109, 635039, 2, 634006, '532331000000', '禄丰县', '云南,楚雄,禄丰', '102.079027', '25.150111', 1); +INSERT INTO `yx_system_city` VALUES (3110, 635220, 2, 635219, '532501000000', '个旧市', '云南,红河,个旧', '103.160034', '23.359121', 1); +INSERT INTO `yx_system_city` VALUES (3111, 635347, 2, 635219, '532502000000', '开远市', '云南,红河,开远', '103.267143', '23.714316', 1); +INSERT INTO `yx_system_city` VALUES (3112, 635435, 2, 635219, '532503000000', '蒙自市', '云南,红河,蒙自', '103.364905', '23.396201', 1); +INSERT INTO `yx_system_city` VALUES (3113, 635548, 2, 635219, '532504000000', '弥勒市', '云南,红河,弥勒', '103.414874', '24.411912', 1); +INSERT INTO `yx_system_city` VALUES (3114, 635698, 2, 635219, '532523000000', '屏边苗族自治县', '云南,红河,屏边', '103.687612', '22.983560', 1); +INSERT INTO `yx_system_city` VALUES (3115, 635786, 2, 635219, '532524000000', '建水县', '云南,红河,建水', '102.826557', '23.634700', 1); +INSERT INTO `yx_system_city` VALUES (3116, 635955, 2, 635219, '532525000000', '石屏县', '云南,红河,石屏', '102.494984', '23.705936', 1); +INSERT INTO `yx_system_city` VALUES (3117, 636080, 2, 635219, '532527000000', '泸西县', '云南,红河,泸西', '103.766196', '24.532025', 1); +INSERT INTO `yx_system_city` VALUES (3118, 636176, 2, 635219, '532528000000', '元阳县', '云南,红河,元阳', '102.835223', '23.219932', 1); +INSERT INTO `yx_system_city` VALUES (3119, 636329, 2, 635219, '532529000000', '红河县', '云南,红河,红河', '102.420600', '23.369161', 1); +INSERT INTO `yx_system_city` VALUES (3120, 636434, 2, 635219, '532530000000', '金平苗族瑶族傣族自治县', '云南,红河,金平', '103.226448', '22.779543', 1); +INSERT INTO `yx_system_city` VALUES (3121, 636546, 2, 635219, '532531000000', '绿春县', '云南,红河,绿春', '102.392463', '22.993718', 1); +INSERT INTO `yx_system_city` VALUES (3122, 636647, 2, 635219, '532532000000', '河口瑶族自治县', '云南,红河,河口', '103.960560', '22.509593', 1); +INSERT INTO `yx_system_city` VALUES (3123, 636689, 2, 636688, '532601000000', '文山市', '云南,文山,文山', '104.232510', '23.386306', 1); +INSERT INTO `yx_system_city` VALUES (3124, 636850, 2, 636688, '532622000000', '砚山县', '云南,文山,砚山', '104.337244', '23.605740', 1); +INSERT INTO `yx_system_city` VALUES (3125, 636970, 2, 636688, '532623000000', '西畴县', '云南,文山,西畴', '104.672597', '23.437782', 1); +INSERT INTO `yx_system_city` VALUES (3126, 637052, 2, 636688, '532624000000', '麻栗坡县', '云南,文山,麻栗坡', '104.702799', '23.125714', 1); +INSERT INTO `yx_system_city` VALUES (3127, 637166, 2, 636688, '532625000000', '马关县', '云南,文山,马关', '104.394158', '23.012915', 1); +INSERT INTO `yx_system_city` VALUES (3128, 637312, 2, 636688, '532626000000', '丘北县', '云南,文山,丘北', '104.195820', '24.041919', 1); +INSERT INTO `yx_system_city` VALUES (3129, 637426, 2, 636688, '532627000000', '广南县', '云南,文山,广南', '105.054981', '24.045941', 1); +INSERT INTO `yx_system_city` VALUES (3130, 637619, 2, 636688, '532628000000', '富宁县', '云南,文山,富宁', '105.630999', '23.625283', 1); +INSERT INTO `yx_system_city` VALUES (3131, 637779, 2, 637778, '532801000000', '景洪市', '云南,西双版纳,景洪', '100.771679', '22.000143', 1); +INSERT INTO `yx_system_city` VALUES (3132, 637910, 2, 637778, '532822000000', '勐海县', '云南,西双版纳,勐海', '100.452548', '21.957354', 1); +INSERT INTO `yx_system_city` VALUES (3133, 638015, 2, 637778, '532823000000', '勐腊县', '云南,西双版纳,勐腊', '101.564636', '21.459233', 1); +INSERT INTO `yx_system_city` VALUES (3134, 638093, 2, 638092, '532901000000', '大理市', '云南,大理,大理', '100.241369', '25.593067', 1); +INSERT INTO `yx_system_city` VALUES (3135, 638249, 2, 638092, '532922000000', '漾濞彝族自治县', '云南,大理,漾濞', '99.958015', '25.670148', 1); +INSERT INTO `yx_system_city` VALUES (3136, 638325, 2, 638092, '532923000000', '祥云县', '云南,大理,祥云', '100.550946', '25.483850', 1); +INSERT INTO `yx_system_city` VALUES (3137, 638475, 2, 638092, '532924000000', '宾川县', '云南,大理,宾川', '100.575412', '25.827182', 1); +INSERT INTO `yx_system_city` VALUES (3138, 638576, 2, 638092, '532925000000', '弥渡县', '云南,大理,弥渡', '100.490991', '25.343804', 1); +INSERT INTO `yx_system_city` VALUES (3139, 638674, 2, 638092, '532926000000', '南涧彝族自治县', '云南,大理,南涧', '100.509036', '25.043510', 1); +INSERT INTO `yx_system_city` VALUES (3140, 638764, 2, 638092, '532927000000', '巍山彝族回族自治县', '云南,大理,巍山', '100.307175', '25.227212', 1); +INSERT INTO `yx_system_city` VALUES (3141, 638858, 2, 638092, '532928000000', '永平县', '云南,大理,永平', '99.541236', '25.464681', 1); +INSERT INTO `yx_system_city` VALUES (3142, 638941, 2, 638092, '532929000000', '云龙县', '云南,大理,云龙', '99.371121', '25.885596', 1); +INSERT INTO `yx_system_city` VALUES (3143, 639039, 2, 638092, '532930000000', '洱源县', '云南,大理,洱源', '99.951054', '26.111160', 1); +INSERT INTO `yx_system_city` VALUES (3144, 639139, 2, 638092, '532931000000', '剑川县', '云南,大理,剑川', '99.905559', '26.537033', 1); +INSERT INTO `yx_system_city` VALUES (3145, 639241, 2, 638092, '532932000000', '鹤庆县', '云南,大理,鹤庆', '100.176498', '26.560231', 1); +INSERT INTO `yx_system_city` VALUES (3146, 639369, 2, 639368, '533102000000', '瑞丽市', '云南,德宏,瑞丽', '97.855477', '24.017836', 1); +INSERT INTO `yx_system_city` VALUES (3147, 639416, 2, 639368, '533103000000', '芒市', '云南,德宏,芒市', '98.588086', '24.433690', 1); +INSERT INTO `yx_system_city` VALUES (3148, 639524, 2, 639368, '533122000000', '梁河县', '云南,德宏,梁河', '98.296657', '24.804232', 1); +INSERT INTO `yx_system_city` VALUES (3149, 639600, 2, 639368, '533123000000', '盈江县', '云南,德宏,盈江', '97.931955', '24.705211', 1); +INSERT INTO `yx_system_city` VALUES (3150, 639719, 2, 639368, '533124000000', '陇川县', '云南,德宏,陇川', '97.792105', '24.182965', 1); +INSERT INTO `yx_system_city` VALUES (3151, 639803, 2, 639802, '533301000000', '泸水市', '云南,怒江,泸水', '98.853097', '25.852547', 1); +INSERT INTO `yx_system_city` VALUES (3152, 639889, 2, 639802, '533323000000', '福贡县', '云南,怒江,福贡', '98.869132', '26.901832', 1); +INSERT INTO `yx_system_city` VALUES (3153, 639956, 2, 639802, '533324000000', '贡山独龙族怒族自治县', '云南,怒江,贡山', '98.853097', '25.852547', 1); +INSERT INTO `yx_system_city` VALUES (3154, 639990, 2, 639802, '533325000000', '兰坪白族普米族自治县', '云南,怒江,兰坪', '99.416677', '26.453571', 1); +INSERT INTO `yx_system_city` VALUES (3155, 640108, 2, 640107, '533401000000', '香格里拉市', '云南,迪庆,香格里拉', '99.700836', '27.829743', 1); +INSERT INTO `yx_system_city` VALUES (3156, 640184, 2, 640107, '533422000000', '德钦县', '云南,迪庆,德钦', '98.911561', '28.486162', 1); +INSERT INTO `yx_system_city` VALUES (3157, 640239, 2, 640107, '533423000000', '维西傈僳族自治县', '云南,迪庆,维西', '99.287173', '27.177162', 1); +INSERT INTO `yx_system_city` VALUES (3158, 640334, 2, 640333, '540101000000', '市辖区', '西藏,拉萨', '91.140856', '29.645554', 1); +INSERT INTO `yx_system_city` VALUES (3159, 640335, 2, 640333, '540102000000', '城关区', '西藏,拉萨,城关', '91.140856', '29.645554', 1); +INSERT INTO `yx_system_city` VALUES (3160, 640399, 2, 640333, '540103000000', '堆龙德庆区', '西藏,拉萨,堆龙德庆', '91.140856', '29.645554', 1); +INSERT INTO `yx_system_city` VALUES (3161, 640441, 2, 640333, '540121000000', '林周县', '西藏,拉萨,林周', '91.140856', '29.645554', 1); +INSERT INTO `yx_system_city` VALUES (3162, 640497, 2, 640333, '540122000000', '当雄县', '西藏,拉萨,当雄', '91.140856', '29.645554', 1); +INSERT INTO `yx_system_city` VALUES (3163, 640534, 2, 640333, '540123000000', '尼木县', '西藏,拉萨,尼木', '91.140856', '29.645554', 1); +INSERT INTO `yx_system_city` VALUES (3164, 640575, 2, 640333, '540124000000', '曲水县', '西藏,拉萨,曲水', '91.140856', '29.645554', 1); +INSERT INTO `yx_system_city` VALUES (3165, 640599, 2, 640333, '540126000000', '达孜县', '西藏,拉萨,达孜', '91.140856', '29.645554', 1); +INSERT INTO `yx_system_city` VALUES (3166, 640626, 2, 640333, '540127000000', '墨竹工卡县', '西藏,拉萨,墨竹工卡', '91.140856', '29.645554', 1); +INSERT INTO `yx_system_city` VALUES (3167, 640676, 2, 640675, '540202000000', '桑珠孜区', '西藏,日喀则,桑珠孜', '88.887270', '29.270389', 1); +INSERT INTO `yx_system_city` VALUES (3168, 640865, 2, 640675, '540221000000', '南木林县', '西藏,日喀则,南木林', '89.099243', '29.682331', 1); +INSERT INTO `yx_system_city` VALUES (3169, 641029, 2, 640675, '540222000000', '江孜县', '西藏,日喀则,江孜', '89.605574', '28.911659', 1); +INSERT INTO `yx_system_city` VALUES (3170, 641204, 2, 640675, '540223000000', '定日县', '西藏,日喀则,定日', '87.126120', '28.658743', 1); +INSERT INTO `yx_system_city` VALUES (3171, 641393, 2, 640675, '540224000000', '萨迦县', '西藏,日喀则,萨迦', '88.021674', '28.899664', 1); +INSERT INTO `yx_system_city` VALUES (3172, 641512, 2, 640675, '540225000000', '拉孜县', '西藏,日喀则,拉孜', '87.637041', '29.081660', 1); +INSERT INTO `yx_system_city` VALUES (3173, 641622, 2, 640675, '540226000000', '昂仁县', '西藏,日喀则,昂仁', '87.236051', '29.294802', 1); +INSERT INTO `yx_system_city` VALUES (3174, 641825, 2, 640675, '540227000000', '谢通门县', '西藏,日喀则,谢通门', '88.261620', '29.432641', 1); +INSERT INTO `yx_system_city` VALUES (3175, 641940, 2, 640675, '540228000000', '白朗县', '西藏,日喀则,白朗', '89.261977', '29.107688', 1); +INSERT INTO `yx_system_city` VALUES (3176, 642063, 2, 640675, '540229000000', '仁布县', '西藏,日喀则,仁布', '89.841984', '29.230933', 1); +INSERT INTO `yx_system_city` VALUES (3177, 642146, 2, 640675, '540230000000', '康马县', '西藏,日喀则,康马', '89.681663', '28.555627', 1); +INSERT INTO `yx_system_city` VALUES (3178, 642203, 2, 640675, '540231000000', '定结县', '西藏,日喀则,定结', '87.765872', '28.364159', 1); +INSERT INTO `yx_system_city` VALUES (3179, 642284, 2, 640675, '540232000000', '仲巴县', '西藏,日喀则,仲巴', '84.031530', '29.770279', 1); +INSERT INTO `yx_system_city` VALUES (3180, 642356, 2, 640675, '540233000000', '亚东县', '西藏,日喀则,亚东', '88.907094', '27.484806', 1); +INSERT INTO `yx_system_city` VALUES (3181, 642389, 2, 640675, '540234000000', '吉隆县', '西藏,日喀则,吉隆', '85.297535', '28.852394', 1); +INSERT INTO `yx_system_city` VALUES (3182, 642437, 2, 640675, '540235000000', '聂拉木县', '西藏,日喀则,聂拉木', '85.982237', '28.155186', 1); +INSERT INTO `yx_system_city` VALUES (3183, 642489, 2, 640675, '540236000000', '萨嘎县', '西藏,日喀则,萨嘎', '85.232941', '29.328818', 1); +INSERT INTO `yx_system_city` VALUES (3184, 642536, 2, 640675, '540237000000', '岗巴县', '西藏,日喀则,岗巴', '88.520031', '28.274601', 1); +INSERT INTO `yx_system_city` VALUES (3185, 642572, 2, 642571, '540302000000', '卡若区', '西藏,昌都,卡若', '97.180437', '31.138507', 1); +INSERT INTO `yx_system_city` VALUES (3186, 642755, 2, 642571, '540321000000', '江达县', '西藏,昌都,江达', '98.218430', '31.499202', 1); +INSERT INTO `yx_system_city` VALUES (3187, 642864, 2, 642571, '540322000000', '贡觉县', '西藏,昌都,贡觉', '98.270970', '30.860099', 1); +INSERT INTO `yx_system_city` VALUES (3188, 643026, 2, 642571, '540323000000', '类乌齐县', '西藏,昌都,类乌齐', '96.600246', '31.211601', 1); +INSERT INTO `yx_system_city` VALUES (3189, 643119, 2, 642571, '540324000000', '丁青县', '西藏,昌都,丁青', '95.595761', '31.412405', 1); +INSERT INTO `yx_system_city` VALUES (3190, 643197, 2, 642571, '540325000000', '察雅县', '西藏,昌都,察雅', '97.568752', '30.653943', 1); +INSERT INTO `yx_system_city` VALUES (3191, 643349, 2, 642571, '540326000000', '八宿县', '西藏,昌都,八宿', '96.917836', '30.053209', 1); +INSERT INTO `yx_system_city` VALUES (3192, 643474, 2, 642571, '540327000000', '左贡县', '西藏,昌都,左贡', '97.841022', '29.671069', 1); +INSERT INTO `yx_system_city` VALUES (3193, 643613, 2, 642571, '540328000000', '芒康县', '西藏,昌都,芒康', '98.593113', '29.679908', 1); +INSERT INTO `yx_system_city` VALUES (3194, 643691, 2, 642571, '540329000000', '洛隆县', '西藏,昌都,洛隆', '95.824567', '30.741571', 1); +INSERT INTO `yx_system_city` VALUES (3195, 643769, 2, 642571, '540330000000', '边坝县', '西藏,昌都,边坝', '94.707800', '30.933652', 1); +INSERT INTO `yx_system_city` VALUES (3196, 643864, 2, 643863, '540402000000', '巴宜区', '西藏,林芝,巴宜', '94.360994', '29.653727', 1); +INSERT INTO `yx_system_city` VALUES (3197, 643943, 2, 643863, '540421000000', '工布江达县', '西藏,林芝,工布江达', '93.246077', '29.885280', 1); +INSERT INTO `yx_system_city` VALUES (3198, 644033, 2, 643863, '540422000000', '米林县', '西藏,林芝,米林', '94.213486', '29.215833', 1); +INSERT INTO `yx_system_city` VALUES (3199, 644109, 2, 643863, '540423000000', '墨脱县', '西藏,林芝,墨脱', '95.332241', '29.325734', 1); +INSERT INTO `yx_system_city` VALUES (3200, 644164, 2, 643863, '540424000000', '波密县', '西藏,林芝,波密', '95.768158', '29.858766', 1); +INSERT INTO `yx_system_city` VALUES (3201, 644260, 2, 643863, '540425000000', '察隅县', '西藏,林芝,察隅', '94.361490', '29.649128', 1); +INSERT INTO `yx_system_city` VALUES (3202, 644364, 2, 643863, '540426000000', '朗县', '西藏,林芝,朗县', '93.074702', '29.046337', 1); +INSERT INTO `yx_system_city` VALUES (3203, 644424, 2, 644423, '540501000000', '市辖区', '西藏,山南', '91.117212', '29.646922', 1); +INSERT INTO `yx_system_city` VALUES (3204, 644425, 2, 644423, '540502000000', '乃东区', '西藏,山南,乃东', '91.761539', '29.224904', 1); +INSERT INTO `yx_system_city` VALUES (3205, 644480, 2, 644423, '540521000000', '扎囊县', '西藏,山南,扎囊', '91.337250', '29.245114', 1); +INSERT INTO `yx_system_city` VALUES (3206, 644548, 2, 644423, '540522000000', '贡嘎县', '西藏,山南,贡嘎', '90.984140', '29.289455', 1); +INSERT INTO `yx_system_city` VALUES (3207, 644600, 2, 644423, '540523000000', '桑日县', '西藏,山南,桑日', '92.015818', '29.259189', 1); +INSERT INTO `yx_system_city` VALUES (3208, 644647, 2, 644423, '540524000000', '琼结县', '西藏,山南,琼结', '91.683881', '29.024625', 1); +INSERT INTO `yx_system_city` VALUES (3209, 644672, 2, 644423, '540525000000', '曲松县', '西藏,山南,曲松', '92.203739', '29.062826', 1); +INSERT INTO `yx_system_city` VALUES (3210, 644699, 2, 644423, '540526000000', '措美县', '西藏,山南,措美', '91.433509', '28.438202', 1); +INSERT INTO `yx_system_city` VALUES (3211, 644720, 2, 644423, '540527000000', '洛扎县', '西藏,山南,洛扎', '90.859992', '28.385713', 1); +INSERT INTO `yx_system_city` VALUES (3212, 644755, 2, 644423, '540528000000', '加查县', '西藏,山南,加查', '92.593993', '29.140290', 1); +INSERT INTO `yx_system_city` VALUES (3213, 644840, 2, 644423, '540529000000', '隆子县', '西藏,山南,隆子', '92.463305', '28.408552', 1); +INSERT INTO `yx_system_city` VALUES (3214, 644932, 2, 644423, '540530000000', '错那县', '西藏,山南,错那', '91.960139', '27.991716', 1); +INSERT INTO `yx_system_city` VALUES (3215, 644967, 2, 644423, '540531000000', '浪卡子县', '西藏,山南,浪卡子', '90.397977', '28.968031', 1); +INSERT INTO `yx_system_city` VALUES (3216, 645077, 2, 645076, '542421000000', '那曲县', '西藏,那曲,那曲', '92.053500', '31.469643', 1); +INSERT INTO `yx_system_city` VALUES (3217, 645231, 2, 645076, '542422000000', '嘉黎县', '西藏,那曲,嘉黎', '93.232528', '30.640815', 1); +INSERT INTO `yx_system_city` VALUES (3218, 645364, 2, 645076, '542423000000', '比如县', '西藏,那曲,比如', '93.679639', '31.480250', 1); +INSERT INTO `yx_system_city` VALUES (3219, 645550, 2, 645076, '542424000000', '聂荣县', '西藏,那曲,聂荣', '92.303346', '32.107772', 1); +INSERT INTO `yx_system_city` VALUES (3220, 645703, 2, 645076, '542425000000', '安多县', '西藏,那曲,安多', '91.682330', '32.265176', 1); +INSERT INTO `yx_system_city` VALUES (3221, 645791, 2, 645076, '542426000000', '申扎县', '西藏,那曲,申扎', '88.709853', '30.930505', 1); +INSERT INTO `yx_system_city` VALUES (3222, 645862, 2, 645076, '542427000000', '索县', '西藏,那曲,索县', '93.785631', '31.886918', 1); +INSERT INTO `yx_system_city` VALUES (3223, 645997, 2, 645076, '542428000000', '班戈县', '西藏,那曲,班戈', '90.009957', '31.392411', 1); +INSERT INTO `yx_system_city` VALUES (3224, 646094, 2, 645076, '542429000000', '巴青县', '西藏,那曲,巴青', '94.053463', '31.918563', 1); +INSERT INTO `yx_system_city` VALUES (3225, 646261, 2, 645076, '542430000000', '尼玛县', '西藏,那曲,尼玛', '87.236772', '31.784701', 1); +INSERT INTO `yx_system_city` VALUES (3226, 646353, 2, 645076, '542431000000', '双湖县', '西藏,那曲,双湖', '88.837642', '33.188515', 1); +INSERT INTO `yx_system_city` VALUES (3227, 646393, 2, 646392, '542521000000', '普兰县', '西藏,阿里,普兰', '81.176237', '30.294402', 1); +INSERT INTO `yx_system_city` VALUES (3228, 646407, 2, 646392, '542522000000', '札达县', '西藏,阿里,札达', '79.802706', '31.479217', 1); +INSERT INTO `yx_system_city` VALUES (3229, 646431, 2, 646392, '542523000000', '噶尔县', '西藏,阿里,噶尔', '80.096419', '32.491488', 1); +INSERT INTO `yx_system_city` VALUES (3230, 646451, 2, 646392, '542524000000', '日土县', '西藏,阿里,日土', '79.732427', '33.381359', 1); +INSERT INTO `yx_system_city` VALUES (3231, 646470, 2, 646392, '542525000000', '革吉县', '西藏,阿里,革吉', '81.145433', '32.387233', 1); +INSERT INTO `yx_system_city` VALUES (3232, 646495, 2, 646392, '542526000000', '改则县', '西藏,阿里,改则', '84.062590', '32.302713', 1); +INSERT INTO `yx_system_city` VALUES (3233, 646551, 2, 646392, '542527000000', '措勤县', '西藏,阿里,措勤', '85.159494', '31.016769', 1); +INSERT INTO `yx_system_city` VALUES (3234, 646580, 2, 646579, '610101000000', '市辖区', '陕西,西安', '108.940174', '34.341568', 1); +INSERT INTO `yx_system_city` VALUES (3235, 646581, 2, 646579, '610102000000', '新城区', '陕西,西安,新城', '108.940174', '34.341568', 1); +INSERT INTO `yx_system_city` VALUES (3236, 646694, 2, 646579, '610103000000', '碑林区', '陕西,西安,碑林', '108.940174', '34.341568', 1); +INSERT INTO `yx_system_city` VALUES (3237, 646800, 2, 646579, '610104000000', '莲湖区', '陕西,西安,莲湖', '108.940174', '34.341568', 1); +INSERT INTO `yx_system_city` VALUES (3238, 646944, 2, 646579, '610111000000', '灞桥区', '陕西,西安,灞桥', '108.940174', '34.341568', 1); +INSERT INTO `yx_system_city` VALUES (3239, 647214, 2, 646579, '610112000000', '未央区', '陕西,西安,未央', '108.940174', '34.341568', 1); +INSERT INTO `yx_system_city` VALUES (3240, 647486, 2, 646579, '610113000000', '雁塔区', '陕西,西安,雁塔', '108.940174', '34.341568', 1); +INSERT INTO `yx_system_city` VALUES (3241, 647710, 2, 646579, '610114000000', '阎良区', '陕西,西安,阎良', '108.940174', '34.341568', 1); +INSERT INTO `yx_system_city` VALUES (3242, 647821, 2, 646579, '610115000000', '临潼区', '陕西,西安,临潼', '108.940174', '34.341568', 1); +INSERT INTO `yx_system_city` VALUES (3243, 648113, 2, 646579, '610116000000', '长安区', '陕西,西安,长安', '108.940174', '34.341568', 1); +INSERT INTO `yx_system_city` VALUES (3244, 648645, 2, 646579, '610117000000', '高陵区', '陕西,西安,高陵', '108.940174', '34.341568', 1); +INSERT INTO `yx_system_city` VALUES (3245, 648756, 2, 646579, '610122000000', '蓝田县', '陕西,西安,蓝田', '108.940174', '34.341568', 1); +INSERT INTO `yx_system_city` VALUES (3246, 649123, 2, 646579, '610124000000', '周至县', '陕西,西安,周至', '108.940174', '34.341568', 1); +INSERT INTO `yx_system_city` VALUES (3247, 649424, 2, 646579, '610125000000', '户县', '陕西,西安,户县', '108.940174', '34.341568', 1); +INSERT INTO `yx_system_city` VALUES (3248, 649980, 2, 649979, '610201000000', '市辖区', '陕西,铜川', '108.945233', '34.896756', 1); +INSERT INTO `yx_system_city` VALUES (3249, 649981, 2, 649979, '610202000000', '王益区', '陕西,铜川,王益', '109.075578', '35.068964', 1); +INSERT INTO `yx_system_city` VALUES (3250, 650048, 2, 649979, '610203000000', '印台区', '陕西,铜川,印台', '109.099975', '35.114492', 1); +INSERT INTO `yx_system_city` VALUES (3251, 650189, 2, 649979, '610204000000', '耀州区', '陕西,铜川,耀州', '108.980514', '34.908916', 1); +INSERT INTO `yx_system_city` VALUES (3252, 650386, 2, 649979, '610222000000', '宜君县', '陕西,铜川,宜君', '109.116932', '35.398577', 1); +INSERT INTO `yx_system_city` VALUES (3253, 650576, 2, 650575, '610301000000', '市辖区', '陕西,宝鸡', '107.237974', '34.361979', 1); +INSERT INTO `yx_system_city` VALUES (3254, 650577, 2, 650575, '610302000000', '渭滨区', '陕西,宝鸡,渭滨', '107.149968', '34.371184', 1); +INSERT INTO `yx_system_city` VALUES (3255, 650747, 2, 650575, '610303000000', '金台区', '陕西,宝鸡,金台', '107.146806', '34.376069', 1); +INSERT INTO `yx_system_city` VALUES (3256, 650913, 2, 650575, '610304000000', '陈仓区', '陕西,宝鸡,陈仓', '107.387436', '34.354456', 1); +INSERT INTO `yx_system_city` VALUES (3257, 651278, 2, 650575, '610322000000', '凤翔县', '陕西,宝鸡,凤翔', '107.400737', '34.521218', 1); +INSERT INTO `yx_system_city` VALUES (3258, 651528, 2, 650575, '610323000000', '岐山县', '陕西,宝鸡,岐山', '107.621054', '34.443459', 1); +INSERT INTO `yx_system_city` VALUES (3259, 651697, 2, 650575, '610324000000', '扶风县', '陕西,宝鸡,扶风', '107.900219', '34.375411', 1); +INSERT INTO `yx_system_city` VALUES (3260, 651872, 2, 650575, '610326000000', '眉县', '陕西,宝鸡,眉县', '107.749767', '34.274247', 1); +INSERT INTO `yx_system_city` VALUES (3261, 652014, 2, 650575, '610327000000', '陇县', '陕西,宝鸡,陇县', '106.864397', '34.893050', 1); +INSERT INTO `yx_system_city` VALUES (3262, 652186, 2, 650575, '610328000000', '千阳县', '陕西,宝鸡,千阳', '107.132442', '34.642381', 1); +INSERT INTO `yx_system_city` VALUES (3263, 652294, 2, 650575, '610329000000', '麟游县', '陕西,宝鸡,麟游', '107.793525', '34.677902', 1); +INSERT INTO `yx_system_city` VALUES (3264, 652387, 2, 650575, '610330000000', '凤县', '陕西,宝鸡,凤县', '106.515756', '33.908469', 1); +INSERT INTO `yx_system_city` VALUES (3265, 652505, 2, 650575, '610331000000', '太白县', '陕西,宝鸡,太白', '107.319116', '34.058401', 1); +INSERT INTO `yx_system_city` VALUES (3266, 652582, 2, 652581, '610401000000', '市辖区', '陕西,咸阳', '108.708991', '34.329605', 1); +INSERT INTO `yx_system_city` VALUES (3267, 652583, 2, 652581, '610402000000', '秦都区', '陕西,咸阳,秦都', '108.706272', '34.329567', 1); +INSERT INTO `yx_system_city` VALUES (3268, 652779, 2, 652581, '610403000000', '杨陵区', '陕西,咸阳,杨陵', '108.084732', '34.272117', 1); +INSERT INTO `yx_system_city` VALUES (3269, 652863, 2, 652581, '610404000000', '渭城区', '陕西,咸阳,渭城', '108.737213', '34.361988', 1); +INSERT INTO `yx_system_city` VALUES (3270, 653042, 2, 652581, '610422000000', '三原县', '陕西,咸阳,三原', '108.940509', '34.617382', 1); +INSERT INTO `yx_system_city` VALUES (3271, 653234, 2, 652581, '610423000000', '泾阳县', '陕西,咸阳,泾阳', '108.842623', '34.527114', 1); +INSERT INTO `yx_system_city` VALUES (3272, 653470, 2, 652581, '610424000000', '乾县', '陕西,咸阳,乾县', '108.239473', '34.527551', 1); +INSERT INTO `yx_system_city` VALUES (3273, 653679, 2, 652581, '610425000000', '礼泉县', '陕西,咸阳,礼泉', '108.425018', '34.481764', 1); +INSERT INTO `yx_system_city` VALUES (3274, 653918, 2, 652581, '610426000000', '永寿县', '陕西,咸阳,永寿', '108.142311', '34.691979', 1); +INSERT INTO `yx_system_city` VALUES (3275, 654101, 2, 652581, '610427000000', '彬县', '陕西,咸阳,彬县', '108.077658', '35.043911', 1); +INSERT INTO `yx_system_city` VALUES (3276, 654369, 2, 652581, '610428000000', '长武县', '陕西,咸阳,长武', '107.798757', '35.205886', 1); +INSERT INTO `yx_system_city` VALUES (3277, 654525, 2, 652581, '610429000000', '旬邑县', '陕西,咸阳,旬邑', '108.333986', '35.111978', 1); +INSERT INTO `yx_system_city` VALUES (3278, 654661, 2, 652581, '610430000000', '淳化县', '陕西,咸阳,淳化', '108.580681', '34.799250', 1); +INSERT INTO `yx_system_city` VALUES (3279, 654876, 2, 652581, '610431000000', '武功县', '陕西,咸阳,武功', '108.200398', '34.260204', 1); +INSERT INTO `yx_system_city` VALUES (3280, 655081, 2, 652581, '610481000000', '兴平市', '陕西,咸阳,兴平', '108.490475', '34.299221', 1); +INSERT INTO `yx_system_city` VALUES (3281, 655296, 2, 655295, '610501000000', '市辖区', '陕西,渭南', '109.509786', '34.499995', 1); +INSERT INTO `yx_system_city` VALUES (3282, 655297, 2, 655295, '610502000000', '临渭区', '陕西,渭南,临渭', '109.492726', '34.498192', 1); +INSERT INTO `yx_system_city` VALUES (3283, 655724, 2, 655295, '610503000000', '华州区', '陕西,渭南,华州', '109.761417', '34.511949', 1); +INSERT INTO `yx_system_city` VALUES (3284, 655885, 2, 655295, '610522000000', '潼关县', '陕西,渭南,潼关', '110.246350', '34.544296', 1); +INSERT INTO `yx_system_city` VALUES (3285, 655919, 2, 655295, '610523000000', '大荔县', '陕西,渭南,大荔', '109.941658', '34.797184', 1); +INSERT INTO `yx_system_city` VALUES (3286, 656260, 2, 655295, '610524000000', '合阳县', '陕西,渭南,合阳', '110.149466', '35.237986', 1); +INSERT INTO `yx_system_city` VALUES (3287, 656494, 2, 655295, '610525000000', '澄城县', '陕西,渭南,澄城', '109.932350', '35.190245', 1); +INSERT INTO `yx_system_city` VALUES (3288, 656682, 2, 655295, '610526000000', '蒲城县', '陕西,渭南,蒲城', '109.586506', '34.955855', 1); +INSERT INTO `yx_system_city` VALUES (3289, 656988, 2, 655295, '610527000000', '白水县', '陕西,渭南,白水', '109.590671', '35.177452', 1); +INSERT INTO `yx_system_city` VALUES (3290, 657132, 2, 655295, '610528000000', '富平县', '陕西,渭南,富平', '109.180331', '34.751086', 1); +INSERT INTO `yx_system_city` VALUES (3291, 657425, 2, 655295, '610581000000', '韩城市', '陕西,渭南,韩城', '110.442847', '35.476788', 1); +INSERT INTO `yx_system_city` VALUES (3292, 657706, 2, 655295, '610582000000', '华阴市', '陕西,渭南,华阴', '110.092301', '34.566096', 1); +INSERT INTO `yx_system_city` VALUES (3293, 657849, 2, 657848, '610601000000', '市辖区', '陕西,延安', '109.489727', '36.585455', 1); +INSERT INTO `yx_system_city` VALUES (3294, 657850, 2, 657848, '610602000000', '宝塔区', '陕西,延安,宝塔', '109.493106', '36.591266', 1); +INSERT INTO `yx_system_city` VALUES (3295, 658235, 2, 657848, '610603000000', '安塞区', '陕西,延安,安塞', '109.489727', '36.585455', 1); +INSERT INTO `yx_system_city` VALUES (3296, 658462, 2, 657848, '610621000000', '延长县', '陕西,延安,延长', '110.012334', '36.579313', 1); +INSERT INTO `yx_system_city` VALUES (3297, 658765, 2, 657848, '610622000000', '延川县', '陕西,延安,延川', '110.193514', '36.878117', 1); +INSERT INTO `yx_system_city` VALUES (3298, 658951, 2, 657848, '610623000000', '子长县', '陕西,延安,子长', '109.675234', '37.142668', 1); +INSERT INTO `yx_system_city` VALUES (3299, 659327, 2, 657848, '610625000000', '志丹县', '陕西,延安,志丹', '108.768432', '36.822194', 1); +INSERT INTO `yx_system_city` VALUES (3300, 659450, 2, 657848, '610626000000', '吴起县', '陕西,延安,吴起', '108.175933', '36.927216', 1); +INSERT INTO `yx_system_city` VALUES (3301, 659554, 2, 657848, '610627000000', '甘泉县', '陕西,延安,甘泉', '109.351020', '36.276526', 1); +INSERT INTO `yx_system_city` VALUES (3302, 659632, 2, 657848, '610628000000', '富县', '陕西,延安,富县', '109.379711', '35.988010', 1); +INSERT INTO `yx_system_city` VALUES (3303, 659777, 2, 657848, '610629000000', '洛川县', '陕西,延安,洛川', '109.432369', '35.761975', 1); +INSERT INTO `yx_system_city` VALUES (3304, 660160, 2, 657848, '610630000000', '宜川县', '陕西,延安,宜川', '110.168963', '36.050178', 1); +INSERT INTO `yx_system_city` VALUES (3305, 660375, 2, 657848, '610631000000', '黄龙县', '陕西,延安,黄龙', '109.840373', '35.584467', 1); +INSERT INTO `yx_system_city` VALUES (3306, 660433, 2, 657848, '610632000000', '黄陵县', '陕西,延安,黄陵', '109.262961', '35.579428', 1); +INSERT INTO `yx_system_city` VALUES (3307, 660644, 2, 660643, '610701000000', '市辖区', '陕西,汉中', '107.023323', '33.067480', 1); +INSERT INTO `yx_system_city` VALUES (3308, 660645, 2, 660643, '610702000000', '汉台区', '陕西,汉中,汉台', '107.031856', '33.067771', 1); +INSERT INTO `yx_system_city` VALUES (3309, 660909, 2, 660643, '610721000000', '南郑县', '陕西,汉中,南郑', '106.936230', '32.999334', 1); +INSERT INTO `yx_system_city` VALUES (3310, 661244, 2, 660643, '610722000000', '城固县', '陕西,汉中,城固', '107.333930', '33.157131', 1); +INSERT INTO `yx_system_city` VALUES (3311, 661535, 2, 660643, '610723000000', '洋县', '陕西,汉中,洋县', '107.545837', '33.222739', 1); +INSERT INTO `yx_system_city` VALUES (3312, 661839, 2, 660643, '610724000000', '西乡县', '陕西,汉中,西乡', '107.766614', '32.983101', 1); +INSERT INTO `yx_system_city` VALUES (3313, 662072, 2, 660643, '610725000000', '勉县', '陕西,汉中,勉县', '106.673221', '33.153553', 1); +INSERT INTO `yx_system_city` VALUES (3314, 662289, 2, 660643, '610726000000', '宁强县', '陕西,汉中,宁强', '106.257171', '32.829694', 1); +INSERT INTO `yx_system_city` VALUES (3315, 662521, 2, 660643, '610727000000', '略阳县', '陕西,汉中,略阳', '106.156718', '33.327281', 1); +INSERT INTO `yx_system_city` VALUES (3316, 662704, 2, 660643, '610728000000', '镇巴县', '陕西,汉中,镇巴', '107.895035', '32.536704', 1); +INSERT INTO `yx_system_city` VALUES (3317, 662908, 2, 660643, '610729000000', '留坝县', '陕西,汉中,留坝', '106.920808', '33.617571', 1); +INSERT INTO `yx_system_city` VALUES (3318, 662993, 2, 660643, '610730000000', '佛坪县', '陕西,汉中,佛坪', '107.990539', '33.524359', 1); +INSERT INTO `yx_system_city` VALUES (3319, 663047, 2, 663046, '610801000000', '市辖区', '陕西,榆林', '109.734589', '38.285390', 1); +INSERT INTO `yx_system_city` VALUES (3320, 663048, 2, 663046, '610802000000', '榆阳区', '陕西,榆林,榆阳', '109.720309', '38.277029', 1); +INSERT INTO `yx_system_city` VALUES (3321, 663445, 2, 663046, '610803000000', '横山区', '陕西,榆林,横山', '109.294346', '37.962209', 1); +INSERT INTO `yx_system_city` VALUES (3322, 663827, 2, 663046, '610821000000', '神木县', '陕西,榆林,神木', '110.498868', '38.842498', 1); +INSERT INTO `yx_system_city` VALUES (3323, 664184, 2, 663046, '610822000000', '府谷县', '陕西,榆林,府谷', '111.067366', '39.028116', 1); +INSERT INTO `yx_system_city` VALUES (3324, 664441, 2, 663046, '610824000000', '靖边县', '陕西,榆林,靖边', '108.793988', '37.599438', 1); +INSERT INTO `yx_system_city` VALUES (3325, 664686, 2, 663046, '610825000000', '定边县', '陕西,榆林,定边', '107.601267', '37.594612', 1); +INSERT INTO `yx_system_city` VALUES (3326, 665047, 2, 663046, '610826000000', '绥德县', '陕西,榆林,绥德', '110.263362', '37.502940', 1); +INSERT INTO `yx_system_city` VALUES (3327, 665732, 2, 663046, '610827000000', '米脂县', '陕西,榆林,米脂', '110.183754', '37.755417', 1); +INSERT INTO `yx_system_city` VALUES (3328, 665953, 2, 663046, '610828000000', '佳县', '陕西,榆林,佳县', '110.491345', '38.019511', 1); +INSERT INTO `yx_system_city` VALUES (3329, 666627, 2, 663046, '610829000000', '吴堡县', '陕西,榆林,吴堡', '110.739673', '37.452068', 1); +INSERT INTO `yx_system_city` VALUES (3330, 666741, 2, 663046, '610830000000', '清涧县', '陕西,榆林,清涧', '110.121209', '37.088878', 1); +INSERT INTO `yx_system_city` VALUES (3331, 667106, 2, 663046, '610831000000', '子洲县', '陕西,榆林,子洲', '110.035250', '37.610683', 1); +INSERT INTO `yx_system_city` VALUES (3332, 667682, 2, 667681, '610901000000', '市辖区', '陕西,安康', '109.029022', '32.684714', 1); +INSERT INTO `yx_system_city` VALUES (3333, 667683, 2, 667681, '610902000000', '汉滨区', '陕西,安康,汉滨', '109.026836', '32.695173', 1); +INSERT INTO `yx_system_city` VALUES (3334, 668237, 2, 667681, '610921000000', '汉阴县', '陕西,安康,汉阴', '108.508745', '32.893026', 1); +INSERT INTO `yx_system_city` VALUES (3335, 668397, 2, 667681, '610922000000', '石泉县', '陕西,安康,石泉', '108.247887', '33.038408', 1); +INSERT INTO `yx_system_city` VALUES (3336, 668570, 2, 667681, '610923000000', '宁陕县', '陕西,安康,宁陕', '108.314283', '33.310527', 1); +INSERT INTO `yx_system_city` VALUES (3337, 668662, 2, 667681, '610924000000', '紫阳县', '陕西,安康,紫阳', '108.534229', '32.520246', 1); +INSERT INTO `yx_system_city` VALUES (3338, 668877, 2, 667681, '610925000000', '岚皋县', '陕西,安康,岚皋', '108.902049', '32.307001', 1); +INSERT INTO `yx_system_city` VALUES (3339, 669026, 2, 667681, '610926000000', '平利县', '陕西,安康,平利', '109.361864', '32.388854', 1); +INSERT INTO `yx_system_city` VALUES (3340, 669181, 2, 667681, '610927000000', '镇坪县', '陕西,安康,镇坪', '109.526873', '31.883672', 1); +INSERT INTO `yx_system_city` VALUES (3341, 669251, 2, 667681, '610928000000', '旬阳县', '陕西,安康,旬阳', '109.365265', '32.834086', 1); +INSERT INTO `yx_system_city` VALUES (3342, 669578, 2, 667681, '610929000000', '白河县', '陕西,安康,白河', '110.112629', '32.809026', 1); +INSERT INTO `yx_system_city` VALUES (3343, 669708, 2, 669707, '611001000000', '市辖区', '陕西,商洛', '109.940477', '33.870422', 1); +INSERT INTO `yx_system_city` VALUES (3344, 669709, 2, 669707, '611002000000', '商州区', '陕西,商洛,商州', '109.941241', '33.862703', 1); +INSERT INTO `yx_system_city` VALUES (3345, 670030, 2, 669707, '611021000000', '洛南县', '陕西,商洛,洛南', '110.148509', '34.090838', 1); +INSERT INTO `yx_system_city` VALUES (3346, 670291, 2, 669707, '611022000000', '丹凤县', '陕西,商洛,丹凤', '110.327331', '33.695783', 1); +INSERT INTO `yx_system_city` VALUES (3347, 670459, 2, 669707, '611023000000', '商南县', '陕西,商洛,商南', '110.881807', '33.530995', 1); +INSERT INTO `yx_system_city` VALUES (3348, 670594, 2, 669707, '611024000000', '山阳县', '陕西,商洛,山阳', '109.882290', '33.532172', 1); +INSERT INTO `yx_system_city` VALUES (3349, 670852, 2, 669707, '611025000000', '镇安县', '陕西,商洛,镇安', '109.152893', '33.423357', 1); +INSERT INTO `yx_system_city` VALUES (3350, 671028, 2, 669707, '611026000000', '柞水县', '陕西,商洛,柞水', '109.114207', '33.686110', 1); +INSERT INTO `yx_system_city` VALUES (3351, 671121, 2, 671120, '620101000000', '市辖区', '甘肃,兰州', '103.834303', '36.061089', 1); +INSERT INTO `yx_system_city` VALUES (3352, 671122, 2, 671120, '620102000000', '城关区', '甘肃,兰州,城关', '103.834303', '36.061089', 1); +INSERT INTO `yx_system_city` VALUES (3353, 671324, 2, 671120, '620103000000', '七里河区', '甘肃,兰州,七里河', '103.834303', '36.061089', 1); +INSERT INTO `yx_system_city` VALUES (3354, 671477, 2, 671120, '620104000000', '西固区', '甘肃,兰州,西固', '103.834303', '36.061089', 1); +INSERT INTO `yx_system_city` VALUES (3355, 671606, 2, 671120, '620105000000', '安宁区', '甘肃,兰州,安宁', '103.834303', '36.061089', 1); +INSERT INTO `yx_system_city` VALUES (3356, 671675, 2, 671120, '620111000000', '红古区', '甘肃,兰州,红古', '103.834303', '36.061089', 1); +INSERT INTO `yx_system_city` VALUES (3357, 671740, 2, 671120, '620121000000', '永登县', '甘肃,兰州,永登', '103.834303', '36.061089', 1); +INSERT INTO `yx_system_city` VALUES (3358, 671967, 2, 671120, '620122000000', '皋兰县', '甘肃,兰州,皋兰', '103.834303', '36.061089', 1); +INSERT INTO `yx_system_city` VALUES (3359, 672034, 2, 671120, '620123000000', '榆中县', '甘肃,兰州,榆中', '103.834303', '36.061089', 1); +INSERT INTO `yx_system_city` VALUES (3360, 672331, 2, 672330, '620201000000', '市辖区', '甘肃,嘉峪关', '98.289152', '39.773130', 1); +INSERT INTO `yx_system_city` VALUES (3361, 672386, 2, 672385, '620301000000', '市辖区', '甘肃,金昌', '102.188043', '38.520089', 1); +INSERT INTO `yx_system_city` VALUES (3362, 672387, 2, 672385, '620302000000', '金川区', '甘肃,金昌,金川', '102.194089', '38.521085', 1); +INSERT INTO `yx_system_city` VALUES (3363, 672439, 2, 672385, '620321000000', '永昌县', '甘肃,金昌,永昌', '101.984649', '38.243170', 1); +INSERT INTO `yx_system_city` VALUES (3364, 672578, 2, 672577, '620401000000', '市辖区', '甘肃,白银', '104.138559', '36.544756', 1); +INSERT INTO `yx_system_city` VALUES (3365, 672579, 2, 672577, '620402000000', '白银区', '甘肃,白银,白银', '104.148556', '36.535398', 1); +INSERT INTO `yx_system_city` VALUES (3366, 672670, 2, 672577, '620403000000', '平川区', '甘肃,白银,平川', '104.825208', '36.728304', 1); +INSERT INTO `yx_system_city` VALUES (3367, 672773, 2, 672577, '620421000000', '靖远县', '甘肃,白银,靖远', '104.676774', '36.571366', 1); +INSERT INTO `yx_system_city` VALUES (3368, 672978, 2, 672577, '620422000000', '会宁县', '甘肃,白银,会宁', '105.053358', '35.692823', 1); +INSERT INTO `yx_system_city` VALUES (3369, 673307, 2, 672577, '620423000000', '景泰县', '甘肃,白银,景泰', '104.063091', '37.183804', 1); +INSERT INTO `yx_system_city` VALUES (3370, 673464, 2, 673463, '620501000000', '市辖区', '甘肃,天水', '105.724947', '34.580863', 1); +INSERT INTO `yx_system_city` VALUES (3371, 673465, 2, 673463, '620502000000', '秦州区', '甘肃,天水,秦州', '105.724199', '34.580892', 1); +INSERT INTO `yx_system_city` VALUES (3372, 673952, 2, 673463, '620503000000', '麦积区', '甘肃,天水,麦积', '105.889557', '34.570384', 1); +INSERT INTO `yx_system_city` VALUES (3373, 674399, 2, 673463, '620521000000', '清水县', '甘肃,天水,清水', '106.137293', '34.749865', 1); +INSERT INTO `yx_system_city` VALUES (3374, 674684, 2, 673463, '620522000000', '秦安县', '甘肃,天水,秦安', '105.674983', '34.858916', 1); +INSERT INTO `yx_system_city` VALUES (3375, 675138, 2, 673463, '620523000000', '甘谷县', '甘肃,天水,甘谷', '105.340864', '34.745465', 1); +INSERT INTO `yx_system_city` VALUES (3376, 675568, 2, 673463, '620524000000', '武山县', '甘肃,天水,武山', '104.890782', '34.721380', 1); +INSERT INTO `yx_system_city` VALUES (3377, 675938, 2, 673463, '620525000000', '张家川回族自治县', '甘肃,天水,张家川', '106.204518', '34.988037', 1); +INSERT INTO `yx_system_city` VALUES (3378, 676216, 2, 676215, '620601000000', '市辖区', '甘肃,武威', '102.638011', '37.928264', 1); +INSERT INTO `yx_system_city` VALUES (3379, 676217, 2, 676215, '620602000000', '凉州区', '甘肃,武威,凉州', '102.642184', '37.928225', 1); +INSERT INTO `yx_system_city` VALUES (3380, 676751, 2, 676215, '620621000000', '民勤县', '甘肃,武威,民勤', '103.093792', '38.624350', 1); +INSERT INTO `yx_system_city` VALUES (3381, 677055, 2, 676215, '620622000000', '古浪县', '甘肃,武威,古浪', '102.897533', '37.470120', 1); +INSERT INTO `yx_system_city` VALUES (3382, 677344, 2, 676215, '620623000000', '天祝藏族自治县', '甘肃,武威,天祝', '103.141757', '36.971740', 1); +INSERT INTO `yx_system_city` VALUES (3383, 677569, 2, 677568, '620701000000', '市辖区', '甘肃,张掖', '100.449818', '38.925875', 1); +INSERT INTO `yx_system_city` VALUES (3384, 677570, 2, 677568, '620702000000', '甘州区', '甘肃,张掖,甘州', '100.478058', '38.929763', 1); +INSERT INTO `yx_system_city` VALUES (3385, 677865, 2, 677568, '620721000000', '肃南裕固族自治县', '甘肃,张掖,肃南', '99.615601', '38.836932', 1); +INSERT INTO `yx_system_city` VALUES (3386, 677983, 2, 677568, '620722000000', '民乐县', '甘肃,张掖,民乐', '100.812860', '38.430794', 1); +INSERT INTO `yx_system_city` VALUES (3387, 678174, 2, 677568, '620723000000', '临泽县', '甘肃,张掖,临泽', '100.164445', '39.152642', 1); +INSERT INTO `yx_system_city` VALUES (3388, 678270, 2, 677568, '620724000000', '高台县', '甘肃,张掖,高台', '99.819317', '39.377733', 1); +INSERT INTO `yx_system_city` VALUES (3389, 678427, 2, 677568, '620725000000', '山丹县', '甘肃,张掖,山丹', '101.088575', '38.784758', 1); +INSERT INTO `yx_system_city` VALUES (3390, 678561, 2, 678560, '620801000000', '市辖区', '甘肃,平凉', '106.665240', '35.543051', 1); +INSERT INTO `yx_system_city` VALUES (3391, 678562, 2, 678560, '620802000000', '崆峒区', '甘肃,平凉,崆峒', '106.674767', '35.542491', 1); +INSERT INTO `yx_system_city` VALUES (3392, 678825, 2, 678560, '620821000000', '泾川县', '甘肃,平凉,泾川', '107.367850', '35.332666', 1); +INSERT INTO `yx_system_city` VALUES (3393, 679066, 2, 678560, '620822000000', '灵台县', '甘肃,平凉,灵台', '107.621124', '35.065399', 1); +INSERT INTO `yx_system_city` VALUES (3394, 679271, 2, 678560, '620823000000', '崇信县', '甘肃,平凉,崇信', '107.035409', '35.302123', 1); +INSERT INTO `yx_system_city` VALUES (3395, 679368, 2, 678560, '620824000000', '华亭县', '甘肃,平凉,华亭', '106.653158', '35.218292', 1); +INSERT INTO `yx_system_city` VALUES (3396, 679507, 2, 678560, '620825000000', '庄浪县', '甘肃,平凉,庄浪', '106.036687', '35.202385', 1); +INSERT INTO `yx_system_city` VALUES (3397, 679825, 2, 678560, '620826000000', '静宁县', '甘肃,平凉,静宁', '105.732556', '35.521977', 1); +INSERT INTO `yx_system_city` VALUES (3398, 680192, 2, 680191, '620901000000', '市辖区', '甘肃,酒泉', '98.494483', '39.732410', 1); +INSERT INTO `yx_system_city` VALUES (3399, 680193, 2, 680191, '620902000000', '肃州区', '甘肃,酒泉,肃州', '98.507850', '39.745071', 1); +INSERT INTO `yx_system_city` VALUES (3400, 680365, 2, 680191, '620921000000', '金塔县', '甘肃,酒泉,金塔', '98.903270', '39.983599', 1); +INSERT INTO `yx_system_city` VALUES (3401, 680478, 2, 680191, '620922000000', '瓜州县', '甘肃,酒泉,瓜州', '95.782306', '40.520545', 1); +INSERT INTO `yx_system_city` VALUES (3402, 680582, 2, 680191, '620923000000', '肃北蒙古族自治县', '甘肃,酒泉,肃北', '94.876579', '39.512450', 1); +INSERT INTO `yx_system_city` VALUES (3403, 680615, 2, 680191, '620924000000', '阿克塞哈萨克族自治县', '甘肃,酒泉,阿克塞', '94.340204', '39.633943', 1); +INSERT INTO `yx_system_city` VALUES (3404, 680634, 2, 680191, '620981000000', '玉门市', '甘肃,酒泉,玉门', '97.045679', '40.291843', 1); +INSERT INTO `yx_system_city` VALUES (3405, 680736, 2, 680191, '620982000000', '敦煌市', '甘肃,酒泉,敦煌', '94.661967', '40.142128', 1); +INSERT INTO `yx_system_city` VALUES (3406, 680816, 2, 680815, '621001000000', '市辖区', '甘肃,庆阳', '107.643631', '35.709077', 1); +INSERT INTO `yx_system_city` VALUES (3407, 680817, 2, 680815, '621002000000', '西峰区', '甘肃,庆阳,西峰', '107.651077', '35.730652', 1); +INSERT INTO `yx_system_city` VALUES (3408, 680943, 2, 680815, '621021000000', '庆城县', '甘肃,庆阳,庆城', '107.881802', '36.016299', 1); +INSERT INTO `yx_system_city` VALUES (3409, 681132, 2, 680815, '621022000000', '环县', '甘肃,庆阳,环县', '107.308501', '36.568435', 1); +INSERT INTO `yx_system_city` VALUES (3410, 681414, 2, 680815, '621023000000', '华池县', '甘肃,庆阳,华池', '107.990035', '36.461355', 1); +INSERT INTO `yx_system_city` VALUES (3411, 681559, 2, 680815, '621024000000', '合水县', '甘肃,庆阳,合水', '108.019530', '35.819243', 1); +INSERT INTO `yx_system_city` VALUES (3412, 681665, 2, 680815, '621025000000', '正宁县', '甘肃,庆阳,正宁', '108.359976', '35.491890', 1); +INSERT INTO `yx_system_city` VALUES (3413, 681784, 2, 680815, '621026000000', '宁县', '甘肃,庆阳,宁县', '107.928369', '35.502177', 1); +INSERT INTO `yx_system_city` VALUES (3414, 682081, 2, 680815, '621027000000', '镇原县', '甘肃,庆阳,镇原', '107.200832', '35.677462', 1); +INSERT INTO `yx_system_city` VALUES (3415, 682323, 2, 682322, '621101000000', '市辖区', '甘肃,定西', '104.626282', '35.580662', 1); +INSERT INTO `yx_system_city` VALUES (3416, 682324, 2, 682322, '621102000000', '安定区', '甘肃,定西,安定', '104.610668', '35.580629', 1); +INSERT INTO `yx_system_city` VALUES (3417, 682673, 2, 682322, '621121000000', '通渭县', '甘肃,定西,通渭', '105.242061', '35.210831', 1); +INSERT INTO `yx_system_city` VALUES (3418, 683034, 2, 682322, '621122000000', '陇西县', '甘肃,定西,陇西', '104.634984', '35.003940', 1); +INSERT INTO `yx_system_city` VALUES (3419, 683278, 2, 682322, '621123000000', '渭源县', '甘肃,定西,渭源', '104.215467', '35.136755', 1); +INSERT INTO `yx_system_city` VALUES (3420, 683515, 2, 682322, '621124000000', '临洮县', '甘肃,定西,临洮', '103.859565', '35.394989', 1); +INSERT INTO `yx_system_city` VALUES (3421, 683869, 2, 682322, '621125000000', '漳县', '甘肃,定西,漳县', '104.471572', '34.848444', 1); +INSERT INTO `yx_system_city` VALUES (3422, 684024, 2, 682322, '621126000000', '岷县', '甘肃,定西,岷县', '104.036880', '34.438076', 1); +INSERT INTO `yx_system_city` VALUES (3423, 684416, 2, 684415, '621201000000', '市辖区', '甘肃,陇南', '104.921841', '33.400684', 1); +INSERT INTO `yx_system_city` VALUES (3424, 684417, 2, 684415, '621202000000', '武都区', '甘肃,陇南,武都', '104.926337', '33.392211', 1); +INSERT INTO `yx_system_city` VALUES (3425, 685162, 2, 684415, '621221000000', '成县', '甘肃,陇南,成县', '105.742203', '33.750477', 1); +INSERT INTO `yx_system_city` VALUES (3426, 685439, 2, 684415, '621222000000', '文县', '甘肃,陇南,文县', '104.683434', '32.943815', 1); +INSERT INTO `yx_system_city` VALUES (3427, 685772, 2, 684415, '621223000000', '宕昌县', '甘肃,陇南,宕昌', '104.393385', '34.047261', 1); +INSERT INTO `yx_system_city` VALUES (3428, 686138, 2, 684415, '621224000000', '康县', '甘肃,陇南,康县', '105.609169', '33.329136', 1); +INSERT INTO `yx_system_city` VALUES (3429, 686518, 2, 684415, '621225000000', '西和县', '甘肃,陇南,西和', '105.298756', '34.014215', 1); +INSERT INTO `yx_system_city` VALUES (3430, 686933, 2, 684415, '621226000000', '礼县', '甘肃,陇南,礼县', '105.178640', '34.189345', 1); +INSERT INTO `yx_system_city` VALUES (3431, 687542, 2, 684415, '621227000000', '徽县', '甘肃,陇南,徽县', '106.087780', '33.768826', 1); +INSERT INTO `yx_system_city` VALUES (3432, 687781, 2, 684415, '621228000000', '两当县', '甘肃,陇南,两当', '106.304967', '33.908917', 1); +INSERT INTO `yx_system_city` VALUES (3433, 687917, 2, 687916, '622901000000', '临夏市', '甘肃,临夏,临夏', '103.243021', '35.604376', 1); +INSERT INTO `yx_system_city` VALUES (3434, 687999, 2, 687916, '622921000000', '临夏县', '甘肃,临夏,临夏', '103.243021', '35.604376', 1); +INSERT INTO `yx_system_city` VALUES (3435, 688248, 2, 687916, '622922000000', '康乐县', '甘肃,临夏,康乐', '103.708354', '35.370505', 1); +INSERT INTO `yx_system_city` VALUES (3436, 688417, 2, 687916, '622923000000', '永靖县', '甘肃,临夏,永靖', '103.285854', '35.958306', 1); +INSERT INTO `yx_system_city` VALUES (3437, 688588, 2, 687916, '622924000000', '广河县', '甘肃,临夏,广河', '103.575834', '35.488052', 1); +INSERT INTO `yx_system_city` VALUES (3438, 688701, 2, 687916, '622925000000', '和政县', '甘肃,临夏,和政', '103.350997', '35.424603', 1); +INSERT INTO `yx_system_city` VALUES (3439, 688841, 2, 687916, '622926000000', '东乡族自治县', '甘肃,临夏,东乡族自治县', '103.389346', '35.663752', 1); +INSERT INTO `yx_system_city` VALUES (3440, 689096, 2, 687916, '622927000000', '积石山保安族东乡族撒拉族自治县', '甘肃,临夏,积石山', '102.875843', '35.717661', 1); +INSERT INTO `yx_system_city` VALUES (3441, 689266, 2, 689265, '623001000000', '合作市', '甘肃,甘南,合作', '102.910882', '35.000399', 1); +INSERT INTO `yx_system_city` VALUES (3442, 689327, 2, 689265, '623021000000', '临潭县', '甘肃,甘南,临潭', '103.353919', '34.692747', 1); +INSERT INTO `yx_system_city` VALUES (3443, 689488, 2, 689265, '623022000000', '卓尼县', '甘肃,甘南,卓尼', '103.507109', '34.589588', 1); +INSERT INTO `yx_system_city` VALUES (3444, 689610, 2, 689265, '623023000000', '舟曲县', '甘肃,甘南,舟曲', '104.371586', '33.785259', 1); +INSERT INTO `yx_system_city` VALUES (3445, 689845, 2, 689265, '623024000000', '迭部县', '甘肃,甘南,迭部', '103.221870', '34.055939', 1); +INSERT INTO `yx_system_city` VALUES (3446, 689913, 2, 689265, '623025000000', '玛曲县', '甘肃,甘南,玛曲', '102.072698', '33.997712', 1); +INSERT INTO `yx_system_city` VALUES (3447, 689966, 2, 689265, '623026000000', '碌曲县', '甘肃,甘南,碌曲', '102.487327', '34.590944', 1); +INSERT INTO `yx_system_city` VALUES (3448, 690005, 2, 689265, '623027000000', '夏河县', '甘肃,甘南,夏河', '102.521807', '35.202503', 1); +INSERT INTO `yx_system_city` VALUES (3449, 690096, 2, 690095, '630101000000', '市辖区', '青海,西宁', '101.778228', '36.617144', 1); +INSERT INTO `yx_system_city` VALUES (3450, 690097, 2, 690095, '630102000000', '城东区', '青海,西宁,城东', '101.778228', '36.617144', 1); +INSERT INTO `yx_system_city` VALUES (3451, 690164, 2, 690095, '630103000000', '城中区', '青海,西宁,城中', '101.778228', '36.617144', 1); +INSERT INTO `yx_system_city` VALUES (3452, 690235, 2, 690095, '630104000000', '城西区', '青海,西宁,城西', '101.778228', '36.617144', 1); +INSERT INTO `yx_system_city` VALUES (3453, 690283, 2, 690095, '630105000000', '城北区', '青海,西宁,城北', '101.778228', '36.617144', 1); +INSERT INTO `yx_system_city` VALUES (3454, 690357, 2, 690095, '630121000000', '大通回族土族自治县', '青海,西宁,大通', '101.679987', '36.930717', 1); +INSERT INTO `yx_system_city` VALUES (3455, 690689, 2, 690095, '630122000000', '湟中县', '青海,西宁,湟中', '101.778228', '36.617144', 1); +INSERT INTO `yx_system_city` VALUES (3456, 691114, 2, 690095, '630123000000', '湟源县', '青海,西宁,湟源', '101.778228', '36.617144', 1); +INSERT INTO `yx_system_city` VALUES (3457, 691279, 2, 691278, '630202000000', '乐都区', '青海,海东,乐都', '102.401725', '36.482058', 1); +INSERT INTO `yx_system_city` VALUES (3458, 691667, 2, 691278, '630203000000', '平安区', '青海,海东,平安', '102.108835', '36.500563', 1); +INSERT INTO `yx_system_city` VALUES (3459, 691796, 2, 691278, '630222000000', '民和回族土族自治县', '青海,海东,民和', '102.830892', '36.320321', 1); +INSERT INTO `yx_system_city` VALUES (3460, 692148, 2, 691278, '630223000000', '互助土族自治县', '青海,海东,互助', '101.959271', '36.844249', 1); +INSERT INTO `yx_system_city` VALUES (3461, 692479, 2, 691278, '630224000000', '化隆回族自治县', '青海,海东,化隆', '102.264143', '36.094908', 1); +INSERT INTO `yx_system_city` VALUES (3462, 692870, 2, 691278, '630225000000', '循化撒拉族自治县', '青海,海东,循化', '102.485646', '35.848586', 1); +INSERT INTO `yx_system_city` VALUES (3463, 693041, 2, 693040, '632221000000', '门源回族自治县', '青海,海北,门源', '101.622364', '37.376449', 1); +INSERT INTO `yx_system_city` VALUES (3464, 693186, 2, 693040, '632222000000', '祁连县', '青海,海北,祁连', '100.253211', '38.177112', 1); +INSERT INTO `yx_system_city` VALUES (3465, 693243, 2, 693040, '632223000000', '海晏县', '青海,海北,海晏', '100.994430', '36.896467', 1); +INSERT INTO `yx_system_city` VALUES (3466, 693286, 2, 693040, '632224000000', '刚察县', '青海,海北,刚察', '100.145833', '37.325470', 1); +INSERT INTO `yx_system_city` VALUES (3467, 693343, 2, 693342, '632321000000', '同仁县', '青海,黄南,同仁', '102.018323', '35.516063', 1); +INSERT INTO `yx_system_city` VALUES (3468, 693437, 2, 693342, '632322000000', '尖扎县', '青海,黄南,尖扎', '102.031183', '35.938299', 1); +INSERT INTO `yx_system_city` VALUES (3469, 693541, 2, 693342, '632323000000', '泽库县', '青海,黄南,泽库', '101.466689', '35.035313', 1); +INSERT INTO `yx_system_city` VALUES (3470, 693623, 2, 693342, '632324000000', '河南蒙古族自治县', '青海,黄南,河南', '102.015248', '35.519548', 1); +INSERT INTO `yx_system_city` VALUES (3471, 693673, 2, 693672, '632521000000', '共和县', '青海,海南,共和', '100.620031', '36.284107', 1); +INSERT INTO `yx_system_city` VALUES (3472, 693808, 2, 693672, '632522000000', '同德县', '青海,海南,同德', '100.578052', '35.254791', 1); +INSERT INTO `yx_system_city` VALUES (3473, 693906, 2, 693672, '632523000000', '贵德县', '青海,海南,贵德', '101.433298', '36.040150', 1); +INSERT INTO `yx_system_city` VALUES (3474, 694046, 2, 693672, '632524000000', '兴海县', '青海,海南,兴海', '99.987966', '35.588613', 1); +INSERT INTO `yx_system_city` VALUES (3475, 694121, 2, 693672, '632525000000', '贵南县', '青海,海南,贵南', '100.747503', '35.586715', 1); +INSERT INTO `yx_system_city` VALUES (3476, 694221, 2, 694220, '632621000000', '玛沁县', '青海,果洛,玛沁', '100.238888', '34.477433', 1); +INSERT INTO `yx_system_city` VALUES (3477, 694272, 2, 694220, '632622000000', '班玛县', '青海,果洛,班玛', '100.737138', '32.932723', 1); +INSERT INTO `yx_system_city` VALUES (3478, 694315, 2, 694220, '632623000000', '甘德县', '青海,果洛,甘德', '99.900905', '33.969219', 1); +INSERT INTO `yx_system_city` VALUES (3479, 694361, 2, 694220, '632624000000', '达日县', '青海,果洛,达日', '99.651392', '33.748921', 1); +INSERT INTO `yx_system_city` VALUES (3480, 694407, 2, 694220, '632625000000', '久治县', '青海,果洛,久治', '101.482831', '33.429471', 1); +INSERT INTO `yx_system_city` VALUES (3481, 694440, 2, 694220, '632626000000', '玛多县', '青海,果洛,玛多', '98.209206', '34.915946', 1); +INSERT INTO `yx_system_city` VALUES (3482, 694479, 2, 694478, '632701000000', '玉树市', '青海,玉树,玉树', '97.008785', '32.993107', 1); +INSERT INTO `yx_system_city` VALUES (3483, 694572, 2, 694478, '632722000000', '杂多县', '青海,玉树,杂多', '95.300723', '32.893185', 1); +INSERT INTO `yx_system_city` VALUES (3484, 694622, 2, 694478, '632723000000', '称多县', '青海,玉树,称多', '97.110832', '33.369218', 1); +INSERT INTO `yx_system_city` VALUES (3485, 694695, 2, 694478, '632724000000', '治多县', '青海,玉树,治多', '95.613080', '33.852751', 1); +INSERT INTO `yx_system_city` VALUES (3486, 694728, 2, 694478, '632725000000', '囊谦县', '青海,玉树,囊谦', '96.480650', '32.203246', 1); +INSERT INTO `yx_system_city` VALUES (3487, 694816, 2, 694478, '632726000000', '曲麻莱县', '青海,玉树,曲麻莱', '95.797367', '34.126429', 1); +INSERT INTO `yx_system_city` VALUES (3488, 694847, 2, 694846, '632801000000', '格尔木市', '青海,海西,格尔木', '94.928484', '36.406404', 1); +INSERT INTO `yx_system_city` VALUES (3489, 694932, 2, 694846, '632802000000', '德令哈市', '青海,海西,德令哈', '97.360985', '37.369436', 1); +INSERT INTO `yx_system_city` VALUES (3490, 695009, 2, 694846, '632821000000', '乌兰县', '青海,海西,乌兰', '98.480195', '36.929749', 1); +INSERT INTO `yx_system_city` VALUES (3491, 695060, 2, 694846, '632822000000', '都兰县', '青海,海西,都兰', '98.095844', '36.302496', 1); +INSERT INTO `yx_system_city` VALUES (3492, 695184, 2, 694846, '632823000000', '天峻县', '青海,海西,天峻', '99.022984', '37.300851', 1); +INSERT INTO `yx_system_city` VALUES (3493, 695261, 2, 695260, '640101000000', '市辖区', '宁夏,银川', '106.230909', '38.487193', 1); +INSERT INTO `yx_system_city` VALUES (3494, 695262, 2, 695260, '640104000000', '兴庆区', '宁夏,银川,兴庆', '106.230909', '38.487193', 1); +INSERT INTO `yx_system_city` VALUES (3495, 695412, 2, 695260, '640105000000', '西夏区', '宁夏,银川,西夏', '106.230909', '38.487193', 1); +INSERT INTO `yx_system_city` VALUES (3496, 695500, 2, 695260, '640106000000', '金凤区', '宁夏,银川,金凤', '106.230909', '38.487193', 1); +INSERT INTO `yx_system_city` VALUES (3497, 695575, 2, 695260, '640121000000', '永宁县', '宁夏,银川,永宁', '106.230909', '38.487193', 1); +INSERT INTO `yx_system_city` VALUES (3498, 695675, 2, 695260, '640122000000', '贺兰县', '宁夏,银川,贺兰', '106.230909', '38.487193', 1); +INSERT INTO `yx_system_city` VALUES (3499, 695767, 2, 695260, '640181000000', '灵武市', '宁夏,银川,灵武', '106.230909', '38.487193', 1); +INSERT INTO `yx_system_city` VALUES (3500, 695884, 2, 695883, '640201000000', '市辖区', '宁夏,石嘴山', '106.383303', '38.983236', 1); +INSERT INTO `yx_system_city` VALUES (3501, 695885, 2, 695883, '640202000000', '大武口区', '宁夏,石嘴山,大武口', '106.367861', '39.019060', 1); +INSERT INTO `yx_system_city` VALUES (3502, 695959, 2, 695883, '640205000000', '惠农区', '宁夏,石嘴山,惠农', '106.781176', '39.239302', 1); +INSERT INTO `yx_system_city` VALUES (3503, 696058, 2, 695883, '640221000000', '平罗县', '宁夏,石嘴山,平罗', '106.523474', '38.913544', 1); +INSERT INTO `yx_system_city` VALUES (3504, 696253, 2, 696252, '640301000000', '市辖区', '宁夏,吴忠', '106.198393', '37.997460', 1); +INSERT INTO `yx_system_city` VALUES (3505, 696254, 2, 696252, '640302000000', '利通区', '宁夏,吴忠,利通', '106.212566', '37.983458', 1); +INSERT INTO `yx_system_city` VALUES (3506, 696427, 2, 696252, '640303000000', '红寺堡区', '宁夏,吴忠,红寺堡', '106.062114', '37.425702', 1); +INSERT INTO `yx_system_city` VALUES (3507, 696505, 2, 696252, '640323000000', '盐池县', '宁夏,吴忠,盐池', '107.407359', '37.783205', 1); +INSERT INTO `yx_system_city` VALUES (3508, 696633, 2, 696252, '640324000000', '同心县', '宁夏,吴忠,同心', '105.914458', '36.980575', 1); +INSERT INTO `yx_system_city` VALUES (3509, 696803, 2, 696252, '640381000000', '青铜峡市', '宁夏,吴忠,青铜峡', '106.078818', '38.021302', 1); +INSERT INTO `yx_system_city` VALUES (3510, 696929, 2, 696928, '640401000000', '市辖区', '宁夏,固原', '106.242610', '36.015855', 1); +INSERT INTO `yx_system_city` VALUES (3511, 696930, 2, 696928, '640402000000', '原州区', '宁夏,固原,原州', '106.287782', '36.003740', 1); +INSERT INTO `yx_system_city` VALUES (3512, 697133, 2, 696928, '640422000000', '西吉县', '宁夏,固原,西吉', '105.729085', '35.963913', 1); +INSERT INTO `yx_system_city` VALUES (3513, 697457, 2, 696928, '640423000000', '隆德县', '宁夏,固原,隆德', '106.111595', '35.625915', 1); +INSERT INTO `yx_system_city` VALUES (3514, 697594, 2, 696928, '640424000000', '泾源县', '宁夏,固原,泾源', '106.330646', '35.498160', 1); +INSERT INTO `yx_system_city` VALUES (3515, 697714, 2, 696928, '640425000000', '彭阳县', '宁夏,固原,彭阳', '106.638340', '35.849565', 1); +INSERT INTO `yx_system_city` VALUES (3516, 697888, 2, 697887, '640501000000', '市辖区', '宁夏,中卫', '105.196902', '37.499972', 1); +INSERT INTO `yx_system_city` VALUES (3517, 697889, 2, 697887, '640502000000', '沙坡头区', '宁夏,中卫,沙坡头', '105.190536', '37.514564', 1); +INSERT INTO `yx_system_city` VALUES (3518, 698087, 2, 697887, '640521000000', '中宁县', '宁夏,中卫,中宁', '105.685285', '37.491505', 1); +INSERT INTO `yx_system_city` VALUES (3519, 698240, 2, 697887, '640522000000', '海原县', '宁夏,中卫,海原', '105.643487', '36.565033', 1); +INSERT INTO `yx_system_city` VALUES (3520, 698442, 2, 698441, '650101000000', '市辖区', '新疆,乌鲁木齐', '87.616848', '43.825592', 1); +INSERT INTO `yx_system_city` VALUES (3521, 698443, 2, 698441, '650102000000', '天山区', '新疆,乌鲁木齐,天山', '87.616848', '43.825592', 1); +INSERT INTO `yx_system_city` VALUES (3522, 698654, 2, 698441, '650103000000', '沙依巴克区', '新疆,乌鲁木齐,沙依巴克', '87.616848', '43.825592', 1); +INSERT INTO `yx_system_city` VALUES (3523, 698884, 2, 698441, '650104000000', '新市区', '新疆,乌鲁木齐,新市区', '87.616848', '43.825592', 1); +INSERT INTO `yx_system_city` VALUES (3524, 699054, 2, 698441, '650105000000', '水磨沟区', '新疆,乌鲁木齐,水磨沟', '87.616848', '43.825592', 1); +INSERT INTO `yx_system_city` VALUES (3525, 699229, 2, 698441, '650106000000', '头屯河区', '新疆,乌鲁木齐,头屯河', '87.616848', '43.825592', 1); +INSERT INTO `yx_system_city` VALUES (3526, 699313, 2, 698441, '650107000000', '达坂城区', '新疆,乌鲁木齐,达坂城', '87.616848', '43.825592', 1); +INSERT INTO `yx_system_city` VALUES (3527, 699363, 2, 698441, '650109000000', '米东区', '新疆,乌鲁木齐,米东', '87.616848', '43.825592', 1); +INSERT INTO `yx_system_city` VALUES (3528, 699535, 2, 698441, '650121000000', '乌鲁木齐县', '新疆,乌鲁木齐,乌鲁木齐', '87.616848', '43.825592', 1); +INSERT INTO `yx_system_city` VALUES (3529, 699584, 2, 699583, '650201000000', '市辖区', '新疆,克拉玛依', '84.889207', '45.579888', 1); +INSERT INTO `yx_system_city` VALUES (3530, 699585, 2, 699583, '650202000000', '独山子区', '新疆,克拉玛依,独山子', '84.886974', '44.328096', 1); +INSERT INTO `yx_system_city` VALUES (3531, 699606, 2, 699583, '650203000000', '克拉玛依区', '新疆,克拉玛依,克拉玛依', '84.867844', '45.602526', 1); +INSERT INTO `yx_system_city` VALUES (3532, 699730, 2, 699583, '650204000000', '白碱滩区', '新疆,克拉玛依,白碱滩', '85.131696', '45.687855', 1); +INSERT INTO `yx_system_city` VALUES (3533, 699752, 2, 699583, '650205000000', '乌尔禾区', '新疆,克拉玛依,乌尔禾', '85.693742', '46.089148', 1); +INSERT INTO `yx_system_city` VALUES (3534, 699774, 2, 699773, '650402000000', '高昌区', '新疆,吐鲁番,高昌', '89.182342', '42.947635', 1); +INSERT INTO `yx_system_city` VALUES (3535, 699884, 2, 699773, '650421000000', '鄯善县', '新疆,吐鲁番,鄯善', '90.213330', '42.868744', 1); +INSERT INTO `yx_system_city` VALUES (3536, 700000, 2, 699773, '650422000000', '托克逊县', '新疆,吐鲁番,托克逊', '88.653814', '42.792521', 1); +INSERT INTO `yx_system_city` VALUES (3537, 700071, 2, 700070, '650502000000', '伊州区', '新疆,哈密,伊州', '93.514916', '42.818501', 1); +INSERT INTO `yx_system_city` VALUES (3538, 700350, 2, 700070, '650521000000', '巴里坤哈萨克自治县', '新疆,哈密,巴里坤', '93.016625', '43.598763', 1); +INSERT INTO `yx_system_city` VALUES (3539, 700438, 2, 700070, '650522000000', '伊吾县', '新疆,哈密,伊吾', '94.697074', '43.254978', 1); +INSERT INTO `yx_system_city` VALUES (3540, 700490, 2, 700489, '652301000000', '昌吉市', '新疆,昌吉,昌吉', '87.304112', '44.013183', 1); +INSERT INTO `yx_system_city` VALUES (3541, 700685, 2, 700489, '652302000000', '阜康市', '新疆,昌吉,阜康', '87.946894', '44.168576', 1); +INSERT INTO `yx_system_city` VALUES (3542, 700805, 2, 700489, '652323000000', '呼图壁县', '新疆,昌吉,呼图壁', '86.898902', '44.191428', 1); +INSERT INTO `yx_system_city` VALUES (3543, 700956, 2, 700489, '652324000000', '玛纳斯县', '新疆,昌吉,玛纳斯', '86.213997', '44.303893', 1); +INSERT INTO `yx_system_city` VALUES (3544, 701230, 2, 700489, '652325000000', '奇台县', '新疆,昌吉,奇台', '89.593967', '44.022066', 1); +INSERT INTO `yx_system_city` VALUES (3545, 701375, 2, 700489, '652327000000', '吉木萨尔县', '新疆,昌吉,吉木萨尔', '89.180437', '44.000497', 1); +INSERT INTO `yx_system_city` VALUES (3546, 701474, 2, 700489, '652328000000', '木垒哈萨克自治县', '新疆,昌吉,木垒', '90.286028', '43.834689', 1); +INSERT INTO `yx_system_city` VALUES (3547, 701560, 2, 701559, '652701000000', '博乐市', '新疆,博尔塔拉,博乐', '82.051005', '44.853870', 1); +INSERT INTO `yx_system_city` VALUES (3548, 701834, 2, 701559, '652702000000', '阿拉山口市', '新疆,博尔塔拉,阿拉山口', '82.559396', '45.172228', 1); +INSERT INTO `yx_system_city` VALUES (3549, 701839, 2, 701559, '652722000000', '精河县', '新疆,博尔塔拉,精河', '82.894195', '44.600408', 1); +INSERT INTO `yx_system_city` VALUES (3550, 701978, 2, 701559, '652723000000', '温泉县', '新疆,博尔塔拉,温泉', '81.024816', '44.968857', 1); +INSERT INTO `yx_system_city` VALUES (3551, 702105, 2, 702104, '652801000000', '库尔勒市', '新疆,巴音郭楞,库尔勒', '86.174633', '41.725892', 1); +INSERT INTO `yx_system_city` VALUES (3552, 702357, 2, 702104, '652822000000', '轮台县', '新疆,巴音郭楞,轮台', '84.252156', '41.777702', 1); +INSERT INTO `yx_system_city` VALUES (3553, 702447, 2, 702104, '652823000000', '尉犁县', '新疆,巴音郭楞,尉犁', '86.261321', '41.343933', 1); +INSERT INTO `yx_system_city` VALUES (3554, 702573, 2, 702104, '652824000000', '若羌县', '新疆,巴音郭楞,若羌', '88.167152', '39.023242', 1); +INSERT INTO `yx_system_city` VALUES (3555, 702634, 2, 702104, '652825000000', '且末县', '新疆,巴音郭楞,且末', '85.528865', '38.147895', 1); +INSERT INTO `yx_system_city` VALUES (3556, 702727, 2, 702104, '652826000000', '焉耆回族自治县', '新疆,巴音郭楞,焉耆', '86.574067', '42.059759', 1); +INSERT INTO `yx_system_city` VALUES (3557, 702821, 2, 702104, '652827000000', '和静县', '新疆,巴音郭楞,和静', '86.384065', '42.323625', 1); +INSERT INTO `yx_system_city` VALUES (3558, 702995, 2, 702104, '652828000000', '和硕县', '新疆,巴音郭楞,和硕', '86.863963', '42.268371', 1); +INSERT INTO `yx_system_city` VALUES (3559, 703063, 2, 702104, '652829000000', '博湖县', '新疆,巴音郭楞,博湖', '86.631998', '41.980152', 1); +INSERT INTO `yx_system_city` VALUES (3560, 703120, 2, 703119, '652901000000', '阿克苏市', '新疆,阿克苏,阿克苏', '80.260605', '41.168779', 1); +INSERT INTO `yx_system_city` VALUES (3561, 703353, 2, 703119, '652922000000', '温宿县', '新疆,阿克苏,温宿', '80.238959', '41.276688', 1); +INSERT INTO `yx_system_city` VALUES (3562, 703576, 2, 703119, '652923000000', '库车县', '新疆,阿克苏,库车', '82.962016', '41.717906', 1); +INSERT INTO `yx_system_city` VALUES (3563, 703858, 2, 703119, '652924000000', '沙雅县', '新疆,阿克苏,沙雅', '82.781819', '41.221667', 1); +INSERT INTO `yx_system_city` VALUES (3564, 704059, 2, 703119, '652925000000', '新和县', '新疆,阿克苏,新和', '82.609220', '41.548118', 1); +INSERT INTO `yx_system_city` VALUES (3565, 704209, 2, 703119, '652926000000', '拜城县', '新疆,阿克苏,拜城', '81.874156', '41.796910', 1); +INSERT INTO `yx_system_city` VALUES (3566, 704413, 2, 703119, '652927000000', '乌什县', '新疆,阿克苏,乌什', '79.224445', '41.214652', 1); +INSERT INTO `yx_system_city` VALUES (3567, 704556, 2, 703119, '652928000000', '阿瓦提县', '新疆,阿克苏,阿瓦提', '80.373137', '40.644529', 1); +INSERT INTO `yx_system_city` VALUES (3568, 704733, 2, 703119, '652929000000', '柯坪县', '新疆,阿克苏,柯坪', '79.047291', '40.508340', 1); +INSERT INTO `yx_system_city` VALUES (3569, 704780, 2, 704779, '653001000000', '阿图什市', '新疆,克孜勒苏,阿图什', '76.168400', '39.716160', 1); +INSERT INTO `yx_system_city` VALUES (3570, 704893, 2, 704779, '653022000000', '阿克陶县', '新疆,克孜勒苏,阿克陶', '75.962509', '37.993697', 1); +INSERT INTO `yx_system_city` VALUES (3571, 705047, 2, 704779, '653023000000', '阿合奇县', '新疆,克孜勒苏,阿合奇', '78.446253', '40.936936', 1); +INSERT INTO `yx_system_city` VALUES (3572, 705084, 2, 704779, '653024000000', '乌恰县', '新疆,克孜勒苏,乌恰', '76.167819', '39.714526', 1); +INSERT INTO `yx_system_city` VALUES (3573, 705146, 2, 705145, '653101000000', '喀什市', '新疆,喀什,喀什', '75.989755', '39.470400', 1); +INSERT INTO `yx_system_city` VALUES (3574, 705344, 2, 705145, '653121000000', '疏附县', '新疆,喀什,疏附', '75.862814', '39.375044', 1); +INSERT INTO `yx_system_city` VALUES (3575, 705496, 2, 705145, '653122000000', '疏勒县', '新疆,喀什,疏勒', '76.048139', '39.401385', 1); +INSERT INTO `yx_system_city` VALUES (3576, 705764, 2, 705145, '653123000000', '英吉沙县', '新疆,喀什,英吉沙', '76.175729', '38.930382', 1); +INSERT INTO `yx_system_city` VALUES (3577, 705961, 2, 705145, '653124000000', '泽普县', '新疆,喀什,泽普', '77.260103', '38.184955', 1); +INSERT INTO `yx_system_city` VALUES (3578, 706133, 2, 705145, '653125000000', '莎车县', '新疆,喀什,莎车', '77.245761', '38.414217', 1); +INSERT INTO `yx_system_city` VALUES (3579, 706753, 2, 705145, '653126000000', '叶城县', '新疆,喀什,叶城', '77.413836', '37.882989', 1); +INSERT INTO `yx_system_city` VALUES (3580, 707143, 2, 705145, '653127000000', '麦盖提县', '新疆,喀什,麦盖提', '77.610105', '38.898666', 1); +INSERT INTO `yx_system_city` VALUES (3581, 707342, 2, 705145, '653128000000', '岳普湖县', '新疆,喀什,岳普湖', '76.773163', '39.224200', 1); +INSERT INTO `yx_system_city` VALUES (3582, 707464, 2, 705145, '653129000000', '伽师县', '新疆,喀什,伽师', '76.723720', '39.488182', 1); +INSERT INTO `yx_system_city` VALUES (3583, 707806, 2, 705145, '653130000000', '巴楚县', '新疆,喀什,巴楚', '78.549297', '39.785155', 1); +INSERT INTO `yx_system_city` VALUES (3584, 708055, 2, 705145, '653131000000', '塔什库尔干塔吉克自治县', '新疆,喀什,塔什库尔干', '75.989755', '39.470400', 1); +INSERT INTO `yx_system_city` VALUES (3585, 708118, 2, 708117, '653201000000', '和田市', '新疆,和田,和田', '79.913534', '37.112149', 1); +INSERT INTO `yx_system_city` VALUES (3586, 708305, 2, 708117, '653221000000', '和田县', '新疆,和田,和田', '79.913534', '37.112149', 1); +INSERT INTO `yx_system_city` VALUES (3587, 708528, 2, 708117, '653222000000', '墨玉县', '新疆,和田,墨玉', '79.728841', '37.277340', 1); +INSERT INTO `yx_system_city` VALUES (3588, 708940, 2, 708117, '653223000000', '皮山县', '新疆,和田,皮山', '78.283669', '37.621450', 1); +INSERT INTO `yx_system_city` VALUES (3589, 709155, 2, 708117, '653224000000', '洛浦县', '新疆,和田,洛浦', '80.188986', '37.073667', 1); +INSERT INTO `yx_system_city` VALUES (3590, 709393, 2, 708117, '653225000000', '策勒县', '新疆,和田,策勒', '80.806159', '36.998335', 1); +INSERT INTO `yx_system_city` VALUES (3591, 709538, 2, 708117, '653226000000', '于田县', '新疆,和田,于田', '81.677418', '36.857081', 1); +INSERT INTO `yx_system_city` VALUES (3592, 709746, 2, 708117, '653227000000', '民丰县', '新疆,和田,民丰', '82.695862', '37.064080', 1); +INSERT INTO `yx_system_city` VALUES (3593, 709793, 2, 709792, '654002000000', '伊宁市', '新疆,伊犁,伊宁', '81.277950', '43.908558', 1); +INSERT INTO `yx_system_city` VALUES (3594, 709978, 2, 709792, '654003000000', '奎屯市', '新疆,伊犁,奎屯', '84.903267', '44.426529', 1); +INSERT INTO `yx_system_city` VALUES (3595, 710057, 2, 709792, '654004000000', '霍尔果斯市', '新疆,伊犁,霍尔果斯', '80.420759', '44.201669', 1); +INSERT INTO `yx_system_city` VALUES (3596, 710090, 2, 709792, '654021000000', '伊宁县', '新疆,伊犁,伊宁', '81.277950', '43.908558', 1); +INSERT INTO `yx_system_city` VALUES (3597, 710275, 2, 709792, '654022000000', '察布查尔锡伯自治县', '新疆,伊犁,察布查尔', '81.151337', '43.840726', 1); +INSERT INTO `yx_system_city` VALUES (3598, 710410, 2, 709792, '654023000000', '霍城县', '新疆,伊犁,霍城', '80.874181', '44.053592', 1); +INSERT INTO `yx_system_city` VALUES (3599, 710612, 2, 709792, '654024000000', '巩留县', '新疆,伊犁,巩留', '82.231718', '43.482628', 1); +INSERT INTO `yx_system_city` VALUES (3600, 710730, 2, 709792, '654025000000', '新源县', '新疆,伊犁,新源', '83.260770', '43.429930', 1); +INSERT INTO `yx_system_city` VALUES (3601, 710868, 2, 709792, '654026000000', '昭苏县', '新疆,伊犁,昭苏', '81.130975', '43.157293', 1); +INSERT INTO `yx_system_city` VALUES (3602, 711013, 2, 709792, '654027000000', '特克斯县', '新疆,伊犁,特克斯', '81.836206', '43.217184', 1); +INSERT INTO `yx_system_city` VALUES (3603, 711105, 2, 709792, '654028000000', '尼勒克县', '新疆,伊犁,尼勒克', '82.511810', '43.800247', 1); +INSERT INTO `yx_system_city` VALUES (3604, 711219, 2, 711218, '654201000000', '塔城市', '新疆,塔城,塔城', '82.978928', '46.748523', 1); +INSERT INTO `yx_system_city` VALUES (3605, 711436, 2, 711218, '654202000000', '乌苏市', '新疆,塔城,乌苏', '84.713736', '44.418887', 1); +INSERT INTO `yx_system_city` VALUES (3606, 711820, 2, 711218, '654221000000', '额敏县', '新疆,塔城,额敏', '83.628303', '46.524673', 1); +INSERT INTO `yx_system_city` VALUES (3607, 712103, 2, 711218, '654223000000', '沙湾县', '新疆,塔城,沙湾', '85.619416', '44.326388', 1); +INSERT INTO `yx_system_city` VALUES (3608, 712601, 2, 711218, '654224000000', '托里县', '新疆,塔城,托里', '83.606951', '45.947638', 1); +INSERT INTO `yx_system_city` VALUES (3609, 712700, 2, 711218, '654225000000', '裕民县', '新疆,塔城,裕民', '82.982668', '46.201104', 1); +INSERT INTO `yx_system_city` VALUES (3610, 712777, 2, 711218, '654226000000', '和布克赛尔蒙古自治县', '新疆,塔城,和布克赛尔', '85.738335', '46.798895', 1); +INSERT INTO `yx_system_city` VALUES (3611, 712894, 2, 712893, '654301000000', '阿勒泰市', '新疆,阿勒泰,阿勒泰', '88.131842', '47.827309', 1); +INSERT INTO `yx_system_city` VALUES (3612, 713072, 2, 712893, '654321000000', '布尔津县', '新疆,阿勒泰,布尔津', '86.874897', '47.701850', 1); +INSERT INTO `yx_system_city` VALUES (3613, 713161, 2, 712893, '654322000000', '富蕴县', '新疆,阿勒泰,富蕴', '89.525504', '46.994115', 1); +INSERT INTO `yx_system_city` VALUES (3614, 713261, 2, 712893, '654323000000', '福海县', '新疆,阿勒泰,福海', '87.486703', '47.111919', 1); +INSERT INTO `yx_system_city` VALUES (3615, 713426, 2, 712893, '654324000000', '哈巴河县', '新疆,阿勒泰,哈巴河', '86.418621', '48.060846', 1); +INSERT INTO `yx_system_city` VALUES (3616, 713568, 2, 712893, '654325000000', '青河县', '新疆,阿勒泰,青河', '90.382961', '46.674205', 1); +INSERT INTO `yx_system_city` VALUES (3617, 713635, 2, 712893, '654326000000', '吉木乃县', '新疆,阿勒泰,吉木乃', '85.874096', '47.443101', 1); +INSERT INTO `yx_system_city` VALUES (3618, 713698, 2, 713697, '659001000000', '石河子市', '新疆,石河子', '86.080460', '44.305428', 1); +INSERT INTO `yx_system_city` VALUES (3619, 713842, 2, 713697, '659002000000', '阿拉尔市', '新疆,阿拉尔', '81.280525', '40.547653', 1); +INSERT INTO `yx_system_city` VALUES (3620, 714172, 2, 713697, '659003000000', '图木舒克市', '新疆,图木舒克', '79.074089', '39.868969', 1); +INSERT INTO `yx_system_city` VALUES (3621, 714310, 2, 713697, '659004000000', '五家渠市', '新疆,五家渠', '87.543243', '44.166756', 1); +INSERT INTO `yx_system_city` VALUES (3622, 714363, 2, 713697, '659006000000', '铁门关市', '新疆,铁门关', '85.669533', '41.863300', 1); +INSERT INTO `yx_system_city` VALUES (3648, 714403, 2, 714402, '0', '芳苑乡', '台湾,彰化,芳苑', '120.416000', '24.000000', 1); +INSERT INTO `yx_system_city` VALUES (3649, 714632, 2, 714402, '0', '芬园乡', '台湾,彰化,芬园', '120.416000', '24.000000', 1); +INSERT INTO `yx_system_city` VALUES (3650, 714701, 2, 714402, '0', '福兴乡', '台湾,彰化,福兴', '120.416000', '24.000000', 1); +INSERT INTO `yx_system_city` VALUES (3651, 714777, 2, 714402, '0', '和美镇', '台湾,彰化,和美', '120.416000', '24.000000', 1); +INSERT INTO `yx_system_city` VALUES (3652, 715055, 2, 714402, '0', '花坛乡', '台湾,彰化,花坛', '120.416000', '24.000000', 1); +INSERT INTO `yx_system_city` VALUES (3653, 715172, 2, 714402, '0', '鹿港镇', '台湾,彰化,鹿港', '120.416000', '24.000000', 1); +INSERT INTO `yx_system_city` VALUES (3654, 715490, 2, 714402, '0', '埤头乡', '台湾,彰化,埤头', '120.464542', '23.890392', 1); +INSERT INTO `yx_system_city` VALUES (3655, 715602, 2, 714402, '0', '埔心乡', '台湾,彰化,埔心', '120.416000', '24.000000', 1); +INSERT INTO `yx_system_city` VALUES (3656, 715745, 2, 714402, '0', '埔盐乡', '台湾,彰化,埔盐', '120.416000', '24.000000', 1); +INSERT INTO `yx_system_city` VALUES (3657, 715795, 2, 714402, '0', '伸港乡', '台湾,彰化,伸港', '120.416000', '24.000000', 1); +INSERT INTO `yx_system_city` VALUES (3658, 715960, 2, 714402, '0', '社头乡', '台湾,彰化,社头', '120.416000', '24.000000', 1); +INSERT INTO `yx_system_city` VALUES (3659, 716105, 2, 714402, '0', '田尾乡', '台湾,彰化,田尾', '120.416000', '24.000000', 1); +INSERT INTO `yx_system_city` VALUES (3660, 716202, 2, 714402, '0', '田中镇', '台湾,彰化,田中', '120.416000', '24.000000', 1); +INSERT INTO `yx_system_city` VALUES (3661, 716341, 2, 714402, '0', '线西乡', '台湾,彰化,线西', '120.416000', '24.000000', 1); +INSERT INTO `yx_system_city` VALUES (3662, 716421, 2, 714402, '0', '溪湖镇', '台湾,彰化,溪湖', '120.416000', '24.000000', 1); +INSERT INTO `yx_system_city` VALUES (3663, 716750, 2, 714402, '0', '秀水乡', '台湾,彰化,秀水', '120.416000', '24.000000', 1); +INSERT INTO `yx_system_city` VALUES (3664, 716874, 2, 714402, '0', '溪州乡', '台湾,彰化,溪州', '120.492906', '23.853578', 1); +INSERT INTO `yx_system_city` VALUES (3665, 717107, 2, 714402, '0', '永靖乡', '台湾,彰化,永靖', '120.416000', '24.000000', 1); +INSERT INTO `yx_system_city` VALUES (3666, 717238, 2, 714402, '0', '员林市', '台湾,彰化,员林市', '120.416000', '24.000000', 1); +INSERT INTO `yx_system_city` VALUES (3667, 717447, 2, 714402, '0', '竹塘乡', '台湾,彰化,竹塘', '120.416000', '24.000000', 1); +INSERT INTO `yx_system_city` VALUES (3668, 717532, 2, 717531, '0', '八里区', '台湾,新北,八里区', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (3669, 717645, 2, 717531, '0', '板桥区', '台湾,新北,板桥区', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (3670, 717902, 2, 717531, '0', '贡寮区', '台湾,新北,贡寮区', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (3671, 717955, 2, 717531, '0', '金山区', '台湾,新北,金山区', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (3672, 718036, 2, 717531, '0', '林口区', '台湾,新北,林口区', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (3673, 718195, 2, 717531, '0', '芦洲区', '台湾,新北,芦洲区', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (3674, 718266, 2, 717531, '0', '坪林区', '台湾,新北,坪林区', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (3675, 718327, 2, 717531, '0', '平溪区', '台湾,新北,平溪区', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (3676, 718375, 2, 717531, '0', '瑞芳区', '台湾,新北,瑞芳区', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (3677, 718490, 2, 717531, '0', '三重区', '台湾,新北,三重区', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (3678, 718786, 2, 717531, '0', '三峡区', '台湾,新北,三峡区', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (3679, 718879, 2, 717531, '0', '三芝区', '台湾,新北,三芝区', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (3680, 718980, 2, 717531, '0', '深坑区', '台湾,新北,深坑区', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (3681, 719023, 2, 717531, '0', '石碇区', '台湾,新北,石碇区', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (3682, 719115, 2, 717531, '0', '石门区', '台湾,新北,石门区', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (3683, 719155, 2, 717531, '0', '双溪区', '台湾,新北,双溪区', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (3684, 719243, 2, 717531, '0', '树林区', '台湾,新北,树林区', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (3685, 719382, 2, 717531, '0', '泰山区', '台湾,新北,泰山区', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (3686, 719498, 2, 717531, '0', '淡水区', '台湾,新北,淡水区', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (3687, 719731, 2, 717531, '0', '土城区', '台湾,新北,土城区', '121.465746', '25.012366', 1); +INSERT INTO `yx_system_city` VALUES (3688, 719869, 2, 719868, '0', '白沙乡', '台湾,澎湖,白沙', '119.566417', '23.569733', 1); +INSERT INTO `yx_system_city` VALUES (3689, 719890, 2, 719868, '0', '湖西乡', '台湾,澎湖,湖西', '119.566417', '23.569733', 1); +INSERT INTO `yx_system_city` VALUES (3690, 719916, 2, 719868, '0', '马公市', '台湾,澎湖,马公市', '119.566417', '23.569733', 1); +INSERT INTO `yx_system_city` VALUES (3691, 720065, 2, 719868, '0', '七美乡', '台湾,澎湖,七美', '119.566417', '23.569733', 1); +INSERT INTO `yx_system_city` VALUES (3692, 720090, 2, 719868, '0', '望安乡', '台湾,澎湖,望安', '119.566417', '23.569733', 1); +INSERT INTO `yx_system_city` VALUES (3693, 720102, 2, 719868, '0', '西屿乡', '台湾,澎湖,西屿', '119.566417', '23.569733', 1); +INSERT INTO `yx_system_city` VALUES (3694, 720119, 2, 720118, '0', '三地门乡', '台湾,屏东,三地门', '120.487928', '22.682802', 1); +INSERT INTO `yx_system_city` VALUES (3695, 720142, 2, 720118, '0', '狮子乡', '台湾,屏东,狮子', '120.487928', '22.682802', 1); +INSERT INTO `yx_system_city` VALUES (3696, 720163, 2, 720118, '0', '泰武乡', '台湾,屏东,泰武', '120.626012', '22.591307', 1); +INSERT INTO `yx_system_city` VALUES (3697, 720186, 2, 720118, '0', '万丹乡', '台湾,屏东,万丹', '120.486423', '22.588123', 1); +INSERT INTO `yx_system_city` VALUES (3698, 720415, 2, 720118, '0', '万峦乡', '台湾,屏东,万峦', '120.566478', '22.571966', 1); +INSERT INTO `yx_system_city` VALUES (3699, 720480, 2, 720118, '0', '雾臺乡', '台湾,屏东,雾臺', '120.727653', '22.743675', 1); +INSERT INTO `yx_system_city` VALUES (3700, 720502, 2, 720118, '0', '新埤乡', '台湾,屏东,新埤', '120.545190', '22.465998', 1); +INSERT INTO `yx_system_city` VALUES (3701, 720553, 2, 720118, '0', '新园乡', '台湾,屏东,新园', '120.459758', '22.544147', 1); +INSERT INTO `yx_system_city` VALUES (3702, 720649, 2, 720118, '0', '盐埔乡', '台湾,屏东,盐埔', '120.487928', '22.682802', 1); +INSERT INTO `yx_system_city` VALUES (3703, 720748, 2, 720118, '0', '竹田乡', '台湾,屏东,竹田', '120.487928', '22.682802', 1); +INSERT INTO `yx_system_city` VALUES (3704, 720835, 2, 720118, '0', '长治乡', '台湾,屏东,长治', '120.487928', '22.682802', 1); +INSERT INTO `yx_system_city` VALUES (3705, 720975, 2, 720118, '0', '潮州镇', '台湾,屏东,潮州', '120.487928', '22.682802', 1); +INSERT INTO `yx_system_city` VALUES (3706, 721293, 2, 720118, '0', '车城乡', '台湾,屏东,车城', '120.707694', '22.072115', 1); +INSERT INTO `yx_system_city` VALUES (3707, 721335, 2, 720118, '0', '春日乡', '台湾,屏东,春日', '120.622000', '22.368284', 1); +INSERT INTO `yx_system_city` VALUES (3708, 721344, 2, 720118, '0', '东港镇', '台湾,屏东,东港', '120.487928', '22.682802', 1); +INSERT INTO `yx_system_city` VALUES (3709, 721490, 2, 720118, '0', '枋寮乡', '台湾,屏东,枋寮', '120.487928', '22.682802', 1); +INSERT INTO `yx_system_city` VALUES (3710, 721617, 2, 720118, '0', '枋山乡', '台湾,屏东,枋山', '120.647762', '22.262550', 1); +INSERT INTO `yx_system_city` VALUES (3711, 721638, 2, 720118, '0', '高树乡', '台湾,屏东,高树', '120.595945', '22.825131', 1); +INSERT INTO `yx_system_city` VALUES (3712, 721805, 2, 720118, '0', '恆春镇', '台湾,屏东,恆春', '120.487928', '22.682802', 1); +INSERT INTO `yx_system_city` VALUES (3713, 721930, 2, 720118, '0', '佳冬乡', '台湾,屏东,佳冬', '120.545370', '22.417786', 1); +INSERT INTO `yx_system_city` VALUES (3714, 722025, 2, 722024, '0', '梧栖区', '台湾,臺中,梧栖区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3715, 722212, 2, 722024, '0', '乌日区', '台湾,臺中,乌日区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3716, 722402, 2, 722024, '0', '新社区', '台湾,臺中,新社区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3717, 722474, 2, 722024, '0', '西屯区', '台湾,臺中,西屯区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3718, 722699, 2, 722024, '0', '北屯区', '台湾,臺中,北屯区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3719, 722879, 2, 722024, '0', '中区', '台湾,臺中,中区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3720, 722923, 2, 722024, '0', '大肚区', '台湾,臺中,大肚区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3721, 723021, 2, 722024, '0', '大甲区', '台湾,臺中,大甲区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3722, 723211, 2, 722024, '0', '大里区', '台湾,臺中,大里区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3723, 723592, 2, 722024, '0', '大雅区', '台湾,臺中,大雅区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3724, 723756, 2, 722024, '0', '大安区', '台湾,臺中,大安区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3725, 723802, 2, 722024, '0', '东势区', '台湾,臺中,东势区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3726, 723966, 2, 722024, '0', '东区', '台湾,臺中,东区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3727, 724148, 2, 722024, '0', '丰原区', '台湾,臺中,丰原区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3728, 724424, 2, 722024, '0', '和平区', '台湾,臺中,和平区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3729, 724504, 2, 722024, '0', '后里区', '台湾,臺中,后里区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3730, 724656, 2, 722024, '0', '龙井区', '台湾,臺中,龙井区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3731, 724797, 2, 722024, '0', '南屯区', '台湾,臺中,南屯区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3732, 724872, 2, 722024, '0', '北区', '台湾,臺中,北区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3733, 725199, 2, 722024, '0', '清水区', '台湾,臺中,清水区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3734, 725489, 2, 725488, '0', '佳里区', '台湾,臺南,佳里区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3735, 725588, 2, 725488, '0', '将军区', '台湾,臺南,将军区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3736, 725620, 2, 725488, '0', '六甲区', '台湾,臺南,六甲区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3737, 725679, 2, 725488, '0', '柳营区', '台湾,臺南,柳营区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3738, 725795, 2, 725488, '0', '龙崎区', '台湾,臺南,龙崎区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3739, 725841, 2, 725488, '0', '麻豆区', '台湾,臺南,麻豆区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3740, 725927, 2, 725488, '0', '南化区', '台湾,臺南,南化区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3741, 725938, 2, 725488, '0', '楠西区', '台湾,臺南,楠西区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3742, 725973, 2, 725488, '0', '北区', '台湾,臺南,北区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3743, 726300, 2, 725488, '0', '七股区', '台湾,臺南,七股区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3744, 726338, 2, 725488, '0', '仁德区', '台湾,臺南,仁德区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3745, 726539, 2, 725488, '0', '善化区', '台湾,臺南,善化区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3746, 726675, 2, 725488, '0', '山上区', '台湾,臺南,山上区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3747, 726691, 2, 725488, '0', '南区', '台湾,臺南,南区', '120.679305', '24.133453', 1); +INSERT INTO `yx_system_city` VALUES (3748, 727041, 2, 725488, '0', '中西区', '台湾,臺南,中西区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3749, 727251, 2, 725488, '0', '下营区', '台湾,臺南,下营区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3750, 727339, 2, 725488, '0', '西港区', '台湾,臺南,西港区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3751, 727375, 2, 725488, '0', '新化区', '台湾,臺南,新化区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3752, 727425, 2, 725488, '0', '新市区', '台湾,臺南,新市区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3753, 727529, 2, 725488, '0', '新营区', '台湾,臺南,新营区', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3754, 727731, 2, 727730, '0', '北投区', '台湾,臺北,北投区', '121.517057', '25.048074', 1); +INSERT INTO `yx_system_city` VALUES (3755, 727897, 2, 727730, '0', '大同区', '台湾,臺北,大同区', '121.517057', '25.048074', 1); +INSERT INTO `yx_system_city` VALUES (3756, 728070, 2, 727730, '0', '大安区', '台湾,臺北,大安区', '121.517057', '25.048074', 1); +INSERT INTO `yx_system_city` VALUES (3757, 728116, 2, 727730, '0', '南港区', '台湾,臺北,南港区', '121.517057', '25.048074', 1); +INSERT INTO `yx_system_city` VALUES (3758, 728220, 2, 727730, '0', '内湖区', '台湾,臺北,内湖区', '121.517057', '25.048074', 1); +INSERT INTO `yx_system_city` VALUES (3759, 728340, 2, 727730, '0', '士林区', '台湾,臺北,士林区', '121.517057', '25.048074', 1); +INSERT INTO `yx_system_city` VALUES (3760, 728550, 2, 727730, '0', '松山区', '台湾,臺北,松山区', '121.517057', '25.048074', 1); +INSERT INTO `yx_system_city` VALUES (3761, 728713, 2, 727730, '0', '万华区', '台湾,臺北,万华区', '121.517057', '25.048074', 1); +INSERT INTO `yx_system_city` VALUES (3762, 728920, 2, 727730, '0', '文山区', '台湾,臺北,文山区', '121.517057', '25.048074', 1); +INSERT INTO `yx_system_city` VALUES (3763, 729073, 2, 727730, '0', '信义区', '台湾,臺北,信义区', '121.517057', '25.048074', 1); +INSERT INTO `yx_system_city` VALUES (3764, 729277, 2, 727730, '0', '中山区', '台湾,臺北,中山区', '121.517057', '25.048074', 1); +INSERT INTO `yx_system_city` VALUES (3765, 729583, 2, 727730, '0', '中正区', '台湾,臺北,中正区', '121.517057', '25.048074', 1); +INSERT INTO `yx_system_city` VALUES (3766, 729929, 2, 729928, '0', '卑南乡', '台湾,臺东,卑南', '121.117213', '22.781744', 1); +INSERT INTO `yx_system_city` VALUES (3767, 729994, 2, 729928, '0', '长滨乡', '台湾,臺东,长滨', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3768, 730033, 2, 729928, '0', '成功镇', '台湾,臺东,成功', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3769, 730107, 2, 729928, '0', '池上乡', '台湾,臺东,池上', '121.212999', '23.123275', 1); +INSERT INTO `yx_system_city` VALUES (3770, 730196, 2, 729928, '0', '达仁乡', '台湾,臺东,达仁', '120.878316', '22.296142', 1); +INSERT INTO `yx_system_city` VALUES (3771, 730219, 2, 729928, '0', '大武乡', '台湾,臺东,大武', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3772, 730268, 2, 729928, '0', '东河乡', '台湾,臺东,东河', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3773, 730308, 2, 729928, '0', '关山镇', '台湾,臺东,关山', '121.158084', '23.047483', 1); +INSERT INTO `yx_system_city` VALUES (3774, 730384, 2, 729928, '0', '海端乡', '台湾,臺东,海端', '121.172009', '23.101079', 1); +INSERT INTO `yx_system_city` VALUES (3775, 730409, 2, 729928, '0', '金峰乡', '台湾,臺东,金峰', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3776, 730416, 2, 729928, '0', '兰屿乡', '台湾,臺东,兰屿', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3777, 730423, 2, 729928, '0', '绿岛乡', '台湾,臺东,绿岛', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3778, 730438, 2, 729928, '0', '鹿野乡', '台湾,臺东,鹿野', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3779, 730510, 2, 729928, '0', '太麻里乡', '台湾,臺东,太麻里', '120.999365', '22.610919', 1); +INSERT INTO `yx_system_city` VALUES (3780, 730565, 2, 729928, '0', '臺东市', '台湾,臺东,臺东市', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3781, 730832, 2, 729928, '0', '延平乡', '台湾,臺东,延平', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3782, 730844, 2, 730843, '0', '八德区', '台湾,桃园,八德区', '121.083000', '25.000000', 1); +INSERT INTO `yx_system_city` VALUES (3783, 731212, 2, 730843, '0', '大溪区', '台湾,桃园,大溪区', '121.083000', '25.000000', 1); +INSERT INTO `yx_system_city` VALUES (3784, 731471, 2, 730843, '0', '大园区', '台湾,桃园,大园区', '121.083000', '25.000000', 1); +INSERT INTO `yx_system_city` VALUES (3785, 731767, 2, 730843, '0', '復兴区', '台湾,桃园,復兴区', '121.083000', '25.000000', 1); +INSERT INTO `yx_system_city` VALUES (3786, 731835, 2, 730843, '0', '观音区', '台湾,桃园,观音区', '121.083000', '25.000000', 1); +INSERT INTO `yx_system_city` VALUES (3787, 732079, 2, 730843, '0', '龟山区', '台湾,桃园,龟山区', '121.083000', '25.000000', 1); +INSERT INTO `yx_system_city` VALUES (3788, 732469, 2, 730843, '0', '龙潭区', '台湾,桃园,龙潭区', '121.083000', '25.000000', 1); +INSERT INTO `yx_system_city` VALUES (3789, 732800, 2, 730843, '0', '芦竹区', '台湾,桃园,芦竹区', '121.083000', '25.000000', 1); +INSERT INTO `yx_system_city` VALUES (3790, 733144, 2, 730843, '0', '平镇区', '台湾,桃园,平区', '121.083000', '25.000000', 1); +INSERT INTO `yx_system_city` VALUES (3791, 733179, 2, 730843, '0', '桃园区', '台湾,桃园,桃园区', '121.083000', '25.000000', 1); +INSERT INTO `yx_system_city` VALUES (3792, 733390, 2, 730843, '0', '新屋区', '台湾,桃园,新屋区', '121.083000', '25.000000', 1); +INSERT INTO `yx_system_city` VALUES (3793, 733537, 2, 730843, '0', '杨梅区', '台湾,桃园,杨梅区', '121.083000', '25.000000', 1); +INSERT INTO `yx_system_city` VALUES (3794, 733876, 2, 730843, '0', '中坜区', '台湾,桃园,中坜区', '121.083000', '25.000000', 1); +INSERT INTO `yx_system_city` VALUES (3795, 734180, 2, 734179, '0', '大同乡', '台湾,宜兰,大同', '121.500000', '24.600000', 1); +INSERT INTO `yx_system_city` VALUES (3796, 734246, 2, 734179, '0', '钓鱼臺', '台湾,宜兰,钓鱼臺', '121.500000', '24.600000', 1); +INSERT INTO `yx_system_city` VALUES (3797, 734248, 2, 734179, '0', '冬山乡', '台湾,宜兰,冬山', '121.500000', '24.600000', 1); +INSERT INTO `yx_system_city` VALUES (3798, 734579, 2, 734179, '0', '礁溪乡', '台湾,宜兰,礁溪', '121.500000', '24.600000', 1); +INSERT INTO `yx_system_city` VALUES (3799, 734681, 2, 734179, '0', '罗东镇', '台湾,宜兰,罗东', '121.500000', '24.600000', 1); +INSERT INTO `yx_system_city` VALUES (3800, 734842, 2, 734179, '0', '南澳乡', '台湾,宜兰,南澳', '121.500000', '24.600000', 1); +INSERT INTO `yx_system_city` VALUES (3801, 734865, 2, 734179, '0', '三星乡', '台湾,宜兰,三星', '121.500000', '24.600000', 1); +INSERT INTO `yx_system_city` VALUES (3802, 735104, 2, 734179, '0', '苏澳镇', '台湾,宜兰,苏澳', '121.500000', '24.600000', 1); +INSERT INTO `yx_system_city` VALUES (3803, 735319, 2, 734179, '0', '头城镇', '台湾,宜兰,头城', '121.500000', '24.600000', 1); +INSERT INTO `yx_system_city` VALUES (3804, 735419, 2, 734179, '0', '五结乡', '台湾,宜兰,五结', '121.796468', '24.685615', 1); +INSERT INTO `yx_system_city` VALUES (3805, 735620, 2, 734179, '0', '宜兰市', '台湾,宜兰,宜兰市', '121.500000', '24.600000', 1); +INSERT INTO `yx_system_city` VALUES (3806, 735851, 2, 734179, '0', '员山乡', '台湾,宜兰,员山', '121.500000', '24.600000', 1); +INSERT INTO `yx_system_city` VALUES (3807, 735970, 2, 734179, '0', '壮围乡', '台湾,宜兰,壮围', '121.500000', '24.600000', 1); +INSERT INTO `yx_system_city` VALUES (3808, 736052, 2, 736051, '0', '草屯镇', '台湾,南投,草屯', '120.830000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (3809, 736305, 2, 736051, '0', '国姓乡', '台湾,南投,国姓', '120.830000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (3810, 736356, 2, 736051, '0', '集集镇', '台湾,南投,集集', '120.830000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (3811, 736449, 2, 736051, '0', '鹿谷乡', '台湾,南投,鹿谷', '120.830000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (3812, 736522, 2, 736051, '0', '名间乡', '台湾,南投,名间', '120.830000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (3813, 736622, 2, 736051, '0', '南投市', '台湾,南投,南投市', '120.830000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (3814, 736887, 2, 736051, '0', '埔里镇', '台湾,南投,埔里', '120.830000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (3815, 737266, 2, 736051, '0', '仁爱乡', '台湾,南投,仁爱', '120.830000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (3816, 737337, 2, 736051, '0', '水里乡', '台湾,南投,水里', '120.830000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (3817, 737496, 2, 736051, '0', '信义乡', '台湾,南投,信义', '120.830000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (3818, 737533, 2, 736051, '0', '鱼池乡', '台湾,南投,鱼池', '120.830000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (3819, 737591, 2, 736051, '0', '中寮乡', '台湾,南投,中寮', '120.830000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (3820, 737625, 2, 736051, '0', '竹山镇', '台湾,南投,竹山', '120.830000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (3821, 737857, 2, 737856, '0', '东沙群岛', '台湾,南海岛,东沙群岛', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3822, 737859, 2, 737856, '0', '南沙群岛', '台湾,南海岛,南沙群岛', '0.000000', '0.000000', 1); +INSERT INTO `yx_system_city` VALUES (3823, 737862, 2, 737861, '0', '头屋乡', '台湾,苗栗,头屋', '120.818985', '24.561601', 1); +INSERT INTO `yx_system_city` VALUES (3824, 737894, 2, 737861, '0', '西湖乡', '台湾,苗栗,西湖', '120.743700', '24.556610', 1); +INSERT INTO `yx_system_city` VALUES (3825, 737948, 2, 737861, '0', '苑里镇', '台湾,苗栗,苑里', '120.818985', '24.561601', 1); +INSERT INTO `yx_system_city` VALUES (3826, 738050, 2, 737861, '0', '造桥乡', '台湾,苗栗,造桥', '120.818985', '24.561601', 1); +INSERT INTO `yx_system_city` VALUES (3827, 738158, 2, 737861, '0', '竹南镇', '台湾,苗栗,竹南', '120.872636', '24.685510', 1); +INSERT INTO `yx_system_city` VALUES (3828, 738454, 2, 737861, '0', '卓兰镇', '台湾,苗栗,卓兰', '120.823440', '24.309510', 1); +INSERT INTO `yx_system_city` VALUES (3829, 738528, 2, 737861, '0', '大湖乡', '台湾,苗栗,大湖', '120.863640', '24.422548', 1); +INSERT INTO `yx_system_city` VALUES (3830, 738619, 2, 737861, '0', '公馆乡', '台湾,苗栗,公馆', '120.818985', '24.561601', 1); +INSERT INTO `yx_system_city` VALUES (3831, 738695, 2, 737861, '0', '后龙镇', '台湾,苗栗,后龙', '120.786474', '24.612613', 1); +INSERT INTO `yx_system_city` VALUES (3832, 738882, 2, 737861, '0', '苗栗市', '台湾,苗栗,苗栗市', '120.819288', '24.561582', 1); +INSERT INTO `yx_system_city` VALUES (3833, 739250, 2, 737861, '0', '南庄乡', '台湾,苗栗,南庄', '120.818985', '24.561601', 1); +INSERT INTO `yx_system_city` VALUES (3834, 739302, 2, 737861, '0', '三湾乡', '台湾,苗栗,三湾', '120.818985', '24.561601', 1); +INSERT INTO `yx_system_city` VALUES (3835, 739369, 2, 737861, '0', '三义乡', '台湾,苗栗,三义', '120.765515', '24.413037', 1); +INSERT INTO `yx_system_city` VALUES (3836, 739419, 2, 737861, '0', '狮潭乡', '台湾,苗栗,狮潭', '120.918024', '24.540004', 1); +INSERT INTO `yx_system_city` VALUES (3837, 739465, 2, 737861, '0', '泰安乡', '台湾,苗栗,泰安', '120.818985', '24.561601', 1); +INSERT INTO `yx_system_city` VALUES (3838, 739487, 2, 737861, '0', '铜锣乡', '台湾,苗栗,铜锣', '120.786475', '24.489502', 1); +INSERT INTO `yx_system_city` VALUES (3839, 739564, 2, 737861, '0', '通霄镇', '台湾,苗栗,通霄', '120.676696', '24.489084', 1); +INSERT INTO `yx_system_city` VALUES (3840, 739642, 2, 737861, '0', '头份市', '台湾,苗栗,头份市', '120.818985', '24.561601', 1); +INSERT INTO `yx_system_city` VALUES (3841, 739958, 2, 739957, '0', '东区', '台湾,嘉义,东区', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (3842, 740140, 2, 739957, '0', '西区', '台湾,嘉义,西区', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (3843, 740511, 2, 740510, '0', '阿里山乡', '台湾,嘉义,阿里山', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (3844, 740536, 2, 740510, '0', '布袋镇', '台湾,嘉义,布袋', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (3845, 740625, 2, 740510, '0', '大林镇', '台湾,嘉义,大林', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (3846, 740746, 2, 740510, '0', '大埔乡', '台湾,嘉义,大埔', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (3847, 740792, 2, 740510, '0', '东石乡', '台湾,嘉义,东石', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (3848, 740845, 2, 740510, '0', '番路乡', '台湾,嘉义,番路', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (3849, 740943, 2, 740510, '0', '六脚乡', '台湾,嘉义,六脚', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (3850, 740975, 2, 740510, '0', '鹿草乡', '台湾,嘉义,鹿草', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (3851, 741010, 2, 740510, '0', '梅山乡', '台湾,嘉义,梅山', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (3852, 741137, 2, 740510, '0', '民雄乡', '台湾,嘉义,民雄', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (3853, 741312, 2, 740510, '0', '朴子市', '台湾,嘉义,朴子市', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (3854, 741451, 2, 740510, '0', '水上乡', '台湾,嘉义,水上', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (3855, 741550, 2, 740510, '0', '太保市', '台湾,嘉义,太保市', '120.332737', '23.459115', 1); +INSERT INTO `yx_system_city` VALUES (3856, 741646, 2, 740510, '0', '溪口乡', '台湾,嘉义,溪口', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (3857, 741688, 2, 740510, '0', '新港乡', '台湾,嘉义,新港', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (3858, 741750, 2, 740510, '0', '义竹乡', '台湾,嘉义,义竹', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (3859, 741785, 2, 740510, '0', '中埔乡', '台湾,嘉义,中埔', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (3860, 741936, 2, 740510, '0', '竹崎乡', '台湾,嘉义,竹崎', '120.452538', '23.481568', 1); +INSERT INTO `yx_system_city` VALUES (3861, 742127, 2, 742126, '0', '东区', '台湾,新竹,东区', '120.973544', '24.805226', 1); +INSERT INTO `yx_system_city` VALUES (3862, 742309, 2, 742126, '0', '北区', '台湾,新竹,北区', '120.968798', '24.806738', 1); +INSERT INTO `yx_system_city` VALUES (3863, 742637, 2, 742636, '0', '峨眉乡', '台湾,新竹,峨眉', '120.968798', '24.806738', 1); +INSERT INTO `yx_system_city` VALUES (3864, 742674, 2, 742636, '0', '关西镇', '台湾,新竹,关西', '120.968798', '24.806738', 1); +INSERT INTO `yx_system_city` VALUES (3865, 742797, 2, 742636, '0', '横山乡', '台湾,新竹,横山', '120.968798', '24.806738', 1); +INSERT INTO `yx_system_city` VALUES (3866, 742852, 2, 742636, '0', '湖口乡', '台湾,新竹,湖口', '120.968798', '24.806738', 1); +INSERT INTO `yx_system_city` VALUES (3867, 743201, 2, 742636, '0', '尖石乡', '台湾,新竹,尖石', '120.968798', '24.806738', 1); +INSERT INTO `yx_system_city` VALUES (3868, 743246, 2, 742636, '0', '芎林乡', '台湾,新竹,芎林', '120.968798', '24.806738', 1); +INSERT INTO `yx_system_city` VALUES (3869, 743298, 2, 742636, '0', '五峰乡', '台湾,新竹,五峰', '120.968798', '24.806738', 1); +INSERT INTO `yx_system_city` VALUES (3870, 743319, 2, 742636, '0', '新丰乡', '台湾,新竹,新丰', '120.968798', '24.806738', 1); +INSERT INTO `yx_system_city` VALUES (3871, 743414, 2, 742636, '0', '新埔镇', '台湾,新竹,新埔', '120.968798', '24.806738', 1); +INSERT INTO `yx_system_city` VALUES (3872, 743527, 2, 742636, '0', '竹北市', '台湾,新竹,竹北市', '120.968798', '24.806738', 1); +INSERT INTO `yx_system_city` VALUES (3873, 743565, 2, 742636, '0', '竹东镇', '台湾,新竹,竹东', '120.968798', '24.806738', 1); +INSERT INTO `yx_system_city` VALUES (3874, 743725, 2, 742636, '0', '宝山乡', '台湾,新竹,宝山', '120.968798', '24.806738', 1); +INSERT INTO `yx_system_city` VALUES (3875, 743888, 2, 742636, '0', '北埔乡', '台湾,新竹,北埔', '120.968798', '24.806738', 1); +INSERT INTO `yx_system_city` VALUES (3876, 743939, 2, 743938, '0', '卓溪乡', '台湾,花莲,卓溪', '121.301890', '23.344908', 1); +INSERT INTO `yx_system_city` VALUES (3877, 743956, 2, 743938, '0', '丰滨乡', '台湾,花莲,丰滨', '121.300000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (3878, 743993, 2, 743938, '0', '凤林镇', '台湾,花莲,凤林', '121.300000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (3879, 744128, 2, 743938, '0', '富里乡', '台湾,花莲,富里', '121.244694', '23.175468', 1); +INSERT INTO `yx_system_city` VALUES (3880, 744185, 2, 743938, '0', '光復乡', '台湾,花莲,光復', '121.300000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (3881, 744246, 2, 743938, '0', '花莲市', '台湾,花莲,花莲市', '121.606927', '23.981993', 1); +INSERT INTO `yx_system_city` VALUES (3882, 744625, 2, 743938, '0', '吉安乡', '台湾,花莲,吉安', '121.300000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (3883, 745050, 2, 743938, '0', '瑞穗乡', '台湾,花莲,瑞穗', '121.373373', '23.496080', 1); +INSERT INTO `yx_system_city` VALUES (3884, 745196, 2, 743938, '0', '寿丰乡', '台湾,花莲,寿丰', '121.506030', '23.869774', 1); +INSERT INTO `yx_system_city` VALUES (3885, 745354, 2, 743938, '0', '万荣乡', '台湾,花莲,万荣', '121.300000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (3886, 745363, 2, 743938, '0', '新城乡', '台湾,花莲,新城', '121.604120', '24.039243', 1); +INSERT INTO `yx_system_city` VALUES (3887, 745486, 2, 743938, '0', '秀林乡', '台湾,花莲,秀林', '121.300000', '23.830000', 1); +INSERT INTO `yx_system_city` VALUES (3888, 745532, 2, 743938, '0', '玉里镇', '台湾,花莲,玉里', '121.312109', '23.334236', 1); +INSERT INTO `yx_system_city` VALUES (3889, 745675, 2, 745674, '0', '阿莲区', '台湾,高雄,阿莲区', '120.311922', '22.620856', 1); +INSERT INTO `yx_system_city` VALUES (3890, 745715, 2, 745674, '0', '大寮区', '台湾,高雄,大寮区', '120.311922', '22.620856', 1); +INSERT INTO `yx_system_city` VALUES (3891, 746083, 2, 745674, '0', '大社区', '台湾,高雄,大社区', '120.311922', '22.620856', 1); +INSERT INTO `yx_system_city` VALUES (3892, 746199, 2, 745674, '0', '大树区', '台湾,高雄,大树区', '120.311922', '22.620856', 1); +INSERT INTO `yx_system_city` VALUES (3893, 746294, 2, 745674, '0', '凤山区', '台湾,高雄,凤山区', '120.311922', '22.620856', 1); +INSERT INTO `yx_system_city` VALUES (3894, 746624, 2, 745674, '0', '冈山区', '台湾,高雄,冈山区', '120.311922', '22.620856', 1); +INSERT INTO `yx_system_city` VALUES (3895, 746906, 2, 745674, '0', '鼓山区', '台湾,高雄,鼓山区', '120.311922', '22.620856', 1); +INSERT INTO `yx_system_city` VALUES (3896, 747053, 2, 745674, '0', '湖内区', '台湾,高雄,湖内区', '120.311922', '22.620856', 1); +INSERT INTO `yx_system_city` VALUES (3897, 747108, 2, 745674, '0', '甲仙区', '台湾,高雄,甲仙区', '120.587980', '23.083957', 1); +INSERT INTO `yx_system_city` VALUES (3898, 747150, 2, 745674, '0', '苓雅区', '台湾,高雄,苓雅区', '120.311922', '22.620856', 1); +INSERT INTO `yx_system_city` VALUES (3899, 747342, 2, 745674, '0', '林园区', '台湾,高雄,林园区', '120.311922', '22.620856', 1); +INSERT INTO `yx_system_city` VALUES (3900, 747481, 2, 745674, '0', '六龟区', '台湾,高雄,六龟区', '120.311922', '22.620856', 1); +INSERT INTO `yx_system_city` VALUES (3901, 747536, 2, 745674, '0', '路竹区', '台湾,高雄,路竹区', '120.311922', '22.620856', 1); +INSERT INTO `yx_system_city` VALUES (3902, 747643, 2, 745674, '0', '茂林区', '台湾,高雄,茂林区', '120.311922', '22.620856', 1); +INSERT INTO `yx_system_city` VALUES (3903, 747647, 2, 745674, '0', '美浓区', '台湾,高雄,美浓区', '120.542419', '22.894882', 1); +INSERT INTO `yx_system_city` VALUES (3904, 747764, 2, 745674, '0', '弥陀区', '台湾,高雄,弥陀区', '120.250672', '22.781561', 1); +INSERT INTO `yx_system_city` VALUES (3905, 747894, 2, 745674, '0', '那玛夏区', '台湾,高雄,那玛夏区', '120.311922', '22.620856', 1); +INSERT INTO `yx_system_city` VALUES (3906, 747902, 2, 745674, '0', '楠梓区', '台湾,高雄,楠梓区', '120.311922', '22.620856', 1); +INSERT INTO `yx_system_city` VALUES (3907, 748258, 2, 745674, '0', '内门区', '台湾,高雄,内门区', '120.311922', '22.620856', 1); +INSERT INTO `yx_system_city` VALUES (3908, 748344, 2, 745674, '0', '鸟松区', '台湾,高雄,鸟松区', '120.311922', '22.620856', 1); +INSERT INTO `yx_system_city` VALUES (3909, 748554, 2, 748553, '0', '安乐区', '台湾,基隆,安乐区', '121.746248', '25.130741', 1); +INSERT INTO `yx_system_city` VALUES (3910, 748581, 2, 748553, '0', '暖暖区', '台湾,基隆,暖暖区', '121.746248', '25.130741', 1); +INSERT INTO `yx_system_city` VALUES (3911, 748599, 2, 748553, '0', '七堵区', '台湾,基隆,七堵区', '121.746248', '25.130741', 1); +INSERT INTO `yx_system_city` VALUES (3912, 748670, 2, 748553, '0', '仁爱区', '台湾,基隆,仁爱区', '121.746248', '25.130741', 1); +INSERT INTO `yx_system_city` VALUES (3913, 748716, 2, 748553, '0', '信义区', '台湾,基隆,信义区', '121.746248', '25.130741', 1); +INSERT INTO `yx_system_city` VALUES (3914, 748920, 2, 748553, '0', '中山区', '台湾,基隆,中山区', '121.746248', '25.130741', 1); +INSERT INTO `yx_system_city` VALUES (3915, 749226, 2, 748553, '0', '中正区', '台湾,基隆,中正区', '121.768000', '25.151647', 1); +INSERT INTO `yx_system_city` VALUES (3916, 749572, 2, 749571, '0', '金城镇', '台湾,金门,金城', '118.317089', '24.432706', 1); +INSERT INTO `yx_system_city` VALUES (3917, 749647, 2, 749571, '0', '金湖镇', '台湾,金门,金湖', '118.317089', '24.432706', 1); +INSERT INTO `yx_system_city` VALUES (3918, 749752, 2, 749571, '0', '金宁乡', '台湾,金门,金宁', '118.317089', '24.432706', 1); +INSERT INTO `yx_system_city` VALUES (3919, 749810, 2, 749571, '0', '金沙镇', '台湾,金门,金沙', '118.317089', '24.432706', 1); +INSERT INTO `yx_system_city` VALUES (3920, 749894, 2, 749571, '0', '烈屿乡', '台湾,金门,烈屿', '118.317089', '24.432706', 1); +INSERT INTO `yx_system_city` VALUES (3921, 749928, 2, 749571, '0', '乌坵乡', '台湾,金门,乌坵', '118.317089', '24.432706', 1); +INSERT INTO `yx_system_city` VALUES (3922, 749931, 2, 749930, '0', '北竿乡', '台湾,连江,北竿', '119.539704', '26.197364', 1); +INSERT INTO `yx_system_city` VALUES (3923, 749938, 2, 749930, '0', '东引乡', '台湾,连江,东引', '119.539704', '26.197364', 1); +INSERT INTO `yx_system_city` VALUES (3924, 749941, 2, 749930, '0', '莒光乡', '台湾,连江,莒光', '119.539704', '26.197364', 1); +INSERT INTO `yx_system_city` VALUES (3925, 749947, 2, 749930, '0', '南竿乡', '台湾,连江,南竿', '119.539704', '26.197364', 1); +INSERT INTO `yx_system_city` VALUES (3926, 749958, 2, 749957, '0', '褒忠乡', '台湾,云林,褒忠', '120.309069', '23.695652', 1); +INSERT INTO `yx_system_city` VALUES (3927, 749991, 2, 749957, '0', '北港镇', '台湾,云林,北港', '120.296759', '23.572428', 1); +INSERT INTO `yx_system_city` VALUES (3928, 750170, 2, 749957, '0', '莿桐乡', '台湾,云林,莿桐', '120.497033', '23.757251', 1); +INSERT INTO `yx_system_city` VALUES (3929, 750218, 2, 749957, '0', '大埤乡', '台湾,云林,大埤', '120.527173', '23.696887', 1); +INSERT INTO `yx_system_city` VALUES (3930, 750291, 2, 749957, '0', '东势乡', '台湾,云林,东势', '120.527173', '23.696887', 1); +INSERT INTO `yx_system_city` VALUES (3931, 750363, 2, 749957, '0', '斗六市', '台湾,云林,斗六市', '120.527173', '23.696887', 1); +INSERT INTO `yx_system_city` VALUES (3932, 750795, 2, 749957, '0', '斗南镇', '台湾,云林,斗南', '120.527173', '23.696887', 1); +INSERT INTO `yx_system_city` VALUES (3933, 751009, 2, 749957, '0', '二崙乡', '台湾,云林,二崙', '120.527173', '23.696887', 1); +INSERT INTO `yx_system_city` VALUES (3934, 751071, 2, 749957, '0', '古坑乡', '台湾,云林,古坑', '120.558553', '23.644734', 1); +INSERT INTO `yx_system_city` VALUES (3935, 751147, 2, 749957, '0', '虎尾镇', '台湾,云林,虎尾', '120.429231', '23.707796', 1); +INSERT INTO `yx_system_city` VALUES (3936, 751400, 2, 749957, '0', '口湖乡', '台湾,云林,口湖', '120.178640', '23.585506', 1); +INSERT INTO `yx_system_city` VALUES (3937, 751493, 2, 749957, '0', '林内乡', '台湾,云林,林内', '120.527173', '23.696887', 1); +INSERT INTO `yx_system_city` VALUES (3938, 751555, 2, 749957, '0', '崙背乡', '台湾,云林,崙背', '120.527173', '23.696887', 1); +INSERT INTO `yx_system_city` VALUES (3939, 751674, 2, 749957, '0', '麦寮乡', '台湾,云林,麦寮', '120.527173', '23.696887', 1); +INSERT INTO `yx_system_city` VALUES (3940, 751764, 2, 749957, '0', '水林乡', '台湾,云林,水林', '120.241228', '23.571067', 1); +INSERT INTO `yx_system_city` VALUES (3941, 751832, 2, 749957, '0', '四湖乡', '台湾,云林,四湖', '120.220781', '23.635426', 1); +INSERT INTO `yx_system_city` VALUES (3942, 751907, 2, 749957, '0', '臺西乡', '台湾,云林,臺西', '120.196139', '23.702821', 1); +INSERT INTO `yx_system_city` VALUES (3943, 751956, 2, 749957, '0', '土库镇', '台湾,云林,土库', '120.527173', '23.696887', 1); +INSERT INTO `yx_system_city` VALUES (3944, 752034, 2, 749957, '0', '西螺镇', '台湾,云林,西螺', '120.457123', '23.797412', 1); +INSERT INTO `yx_system_city` VALUES (3945, 752149, 2, 749957, '0', '元长乡', '台湾,云林,元长', '120.311052', '23.649577', 1); +INSERT INTO `yx_system_city` VALUES (3946, 752150, 1, 714368, '', '香港特别行政区', '香港特别行政区', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3947, 752151, 2, 752150, '', '中西区', '中西区', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3948, 752152, 2, 752150, '', '东区', '东区', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3949, 752153, 2, 752150, '', '九龙城区', '九龙城区', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3950, 752154, 2, 752150, '', '观塘区', '香港,九龙,观塘', '114.231268', '22.309430', 1); +INSERT INTO `yx_system_city` VALUES (3951, 752155, 2, 752150, '', '南区', '香港,香港岛,南区', '114.174134', '22.246760', 1); +INSERT INTO `yx_system_city` VALUES (3953, 752156, 2, 752150, '', '深水埗区', '香港特别行政区,香港特别行政区,深水埗区', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3954, 752157, 2, 752150, '', '湾仔区', '湾仔区', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3955, 752158, 2, 752150, '', '黄大仙区', '黄大仙区', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3956, 752159, 2, 752150, '', '油尖旺区', '油尖旺区', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3957, 752160, 2, 752150, '', '离岛区', '离岛区', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3958, 752161, 2, 752150, '', '葵青区', '葵青区', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3959, 752162, 2, 752150, '', '北区', '北区', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3960, 752163, 2, 752150, '', '西贡区', '西贡区', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3961, 752164, 2, 752150, '', '沙田区', '沙田区', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3962, 752165, 2, 752150, '', '屯门区', '屯门区', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3963, 752166, 2, 752150, '', '大埔区', '大埔区', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3964, 752167, 2, 752150, '', '荃湾区', '荃湾区', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3965, 752168, 2, 752150, '', '元朗区', '元朗区', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3966, 752169, 1, 714390, '', '澳门特别行政区', '澳门特别行政区', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3967, 752170, 2, 752169, '', '澳门半岛', '澳门半岛', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3968, 752171, 2, 752169, '', '凼仔', '凼仔', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3969, 752172, 2, 752169, '', '路凼城', '路凼城', '', '', 1); +INSERT INTO `yx_system_city` VALUES (3970, 752173, 2, 752169, '', '路环', '路环', '', '', 1); + +-- ---------------------------- +-- Table structure for yx_system_config +-- ---------------------------- +DROP TABLE IF EXISTS `yx_system_config`; +CREATE TABLE `yx_system_config` ( + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '配置id', + `menu_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名称', + `value` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '默认值', + `sort` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '排序', + `status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '是否隐藏', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 227 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '配置表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_system_config +-- ---------------------------- +INSERT INTO `yx_system_config` VALUES (162, 'wechat_share_img', '', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (165, 'wechat_avatar', '', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (172, 'wechat_share_synopsis', 'springboot2前后端分离电商系统', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (174, 'api', 'http://你的H5端域名/api/wechat/serve', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (175, 'wechat_share_title', 'yshop电商系统', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (177, 'store_postage', '1', 0, 0); +INSERT INTO `yx_system_config` VALUES (178, 'store_free_postage', '1', 0, 0); +INSERT INTO `yx_system_config` VALUES (179, 'integral_ratio', '1', 0, 0); +INSERT INTO `yx_system_config` VALUES (180, 'store_brokerage_ratio', '70', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (182, 'user_extract_min_price', '1', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (183, 'store_brokerage_two', '30', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (184, 'site_url', 'http://127.0.0.1:8080', 0, 0); +INSERT INTO `yx_system_config` VALUES (185, 'api_url', 'http://127.0.0.1:8008', 0, 0); +INSERT INTO `yx_system_config` VALUES (186, 'order_cancel_job_time', '20', 0, 0); +INSERT INTO `yx_system_config` VALUES (187, 'wechat_appid', 'wxc061dee8806ff712', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (188, 'wechat_appsecret', '1111', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (189, 'wechat_encodingaeskey', 'yYuBUkC8BXImCXyu7O6hkzLj4TC5nxsWPfL4CQAZPNY', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (190, 'wechat_token', 'yshop', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (191, 'wxpay_mchId', '1111', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (192, 'wxpay_appId', '111111', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (193, 'wxpay_mchKey', '1111', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (194, 'wxapp_appId', '121221', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (195, 'wxapp_secret', '121212', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (196, 'wxpay_keyPath', 'http://localhost:8000/file/pic/list_30-20200110053337209.png', 0, 0); +INSERT INTO `yx_system_config` VALUES (198, 'store_brokerage_open', '1', 0, 0); +INSERT INTO `yx_system_config` VALUES (199, 'integral_full', '0', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (200, 'integral_max', '0', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (201, 'store_user_min_recharge', '1', 0, 0); +INSERT INTO `yx_system_config` VALUES (203, 'store_self_mention', '1', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (204, 'tengxun_map_key', '11111111111', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (205, 'wechat_id', '', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (206, 'wechat_type', '', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (207, 'wechat_encode', '', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (208, 'wechat_sourceid', '', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (209, 'wechat_name', '', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (210, 'wechat_qrcode', '', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (211, 'wx_native_app_appId', 'wx7c84ede33062d1e4', NULL, NULL); +INSERT INTO `yx_system_config` VALUES (212, 'file_store_mode', '1', 0, 0); +INSERT INTO `yx_system_config` VALUES (213, 'sms_access_key', 'yshopyshop', 0, 0); +INSERT INTO `yx_system_config` VALUES (214, 'sms_enable', '2', 0, 0); +INSERT INTO `yx_system_config` VALUES (215, 'sms_access_secret', 'yshop', 0, 0); +INSERT INTO `yx_system_config` VALUES (216, 'sms_region', 'cn-hangzhou', 0, 0); +INSERT INTO `yx_system_config` VALUES (217, 'sms_templateId', '111111111', 0, 0); +INSERT INTO `yx_system_config` VALUES (218, 'sms_sign', 'yshop', 0, 0); +INSERT INTO `yx_system_config` VALUES (219, 'exp_enable', '1', 0, 0); +INSERT INTO `yx_system_config` VALUES (220, 'exp_appId', '1607734', 0, 0); +INSERT INTO `yx_system_config` VALUES (221, 'exp_appKey', '33333333333333', 0, 0); +INSERT INTO `yx_system_config` VALUES (222, 'admin_api_url', 'http://127.0.0.1:8001', 0, 0); +INSERT INTO `yx_system_config` VALUES (223, 'imageArr', '[\"\"]', 0, 0); +INSERT INTO `yx_system_config` VALUES (224, 'wechat_ma_encodingaeskey', '', 0, 0); +INSERT INTO `yx_system_config` VALUES (225, 'wxapi', 'http://你的H5api端域名/api/wxapp/serve', 0, 0); +INSERT INTO `yx_system_config` VALUES (226, 'wechat_ma_token', '', 0, 0); + +-- ---------------------------- +-- Table structure for yx_system_group_data +-- ---------------------------- +DROP TABLE IF EXISTS `yx_system_group_data`; +CREATE TABLE `yx_system_group_data` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '组合数据详情ID', + `group_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '对应的数据名称', + `value` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '数据组对应的数据值(json数据)', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '添加数据时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `sort` int(11) NULL DEFAULT 0 COMMENT '数据排序', + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态(1:开启;2:关闭;)', + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 227 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '组合数据详情表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_system_group_data +-- ---------------------------- +INSERT INTO `yx_system_group_data` VALUES (177, 'yshop_home_banner', '{\"imageArr\":[\"https://image.dayouqiantu.cn/5c9f05aee5059.jpg\"],\"name\":\"banner2\",\"id\":177,\"pic\":\"https://image.dayouqiantu.cn/5c9f05aee5059.jpg\",\"sort\":1,\"url\":\"wwww\",\"status\":0}', '2020-06-25 18:54:35', '2020-09-15 07:54:44', 1, 0, 0); +INSERT INTO `yx_system_group_data` VALUES (180, 'yshop_home_menus', '{\"imageArr\":[\"https://image.dayouqiantu.cn/all.png\"],\"uniapp_url\":\"/pages/shop/GoodsList/index\",\"name\":\"全部商品\",\"id\":180,\"pic\":\"https://image.dayouqiantu.cn/all.png\",\"sort\":9,\"url\":\"/goods_list\",\"wxapp_url\":\"/pages/shop/GoodsClass/main\",\"status\":1}', '2020-06-25 18:54:35', NULL, 9, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (182, 'yshop_home_roll_news', '{\"uniapp_url\":\"/pages/shop/news/NewsList/index\",\"id\":182,\"pic\":\"https://i.loli.net/2019/10/18/DqOUgNf7wjuFpPT.png\",\"sort\":2,\"title\":\"分销、拼团、商户功能上线啦!\",\"url\":\"/news_list\",\"info\":\"yshop3.0\",\"wxapp_url\":\"/pages/shop/news/NewsList/main\",\"status\":1}', '2020-06-25 18:54:35', '2020-06-27 15:47:38', 2, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (183, 'yshop_hot_search', '{\"id\":183,\"title\":\"照片\"}', '2020-06-25 18:54:35', NULL, 0, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (184, 'yshop_hot_search', '{\"id\":184,\"title\":\"springboot\"}', '2020-06-25 18:54:35', NULL, 0, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (187, 'yshop_home_roll_news', '{\"uniapp_url\":\"/pages/shop/news/NewsList/index\",\"id\":187,\"sort\":1,\"url\":\"/news_list\",\"info\":\"yshop基于springboot2+Mybatisplus+jwt商城系统\",\"wxapp_url\":\"/pages/shop/news/NewsList/main\",\"status\":1}', '2020-06-25 18:54:35', '2020-06-27 15:47:22', 4, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (188, 'yshop_hot_search', '{\"id\":188,\"title\":\"打印\"}', '2020-06-25 18:54:35', NULL, 0, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (189, 'yshop_my_menus', '{\"imageArr\":[\"https://image.dayouqiantu.cn/5dec896eeb25a.png\"],\"uniapp_url\":\"/pages/user/UserVip/index\",\"name\":\"会员中心\",\"id\":189,\"pic\":\"https://image.dayouqiantu.cn/5dec896eeb25a.png\",\"sort\":9,\"url\":\"/user/vip\",\"wxapp_url\":\"/pages/user/UserVip/main\",\"status\":1}', '2020-06-25 18:54:35', NULL, 9, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (190, 'yshop_my_menus', '{\"imageArr\":[\"https://image.dayouqiantu.cn/5db428984d64d.png\"],\"uniapp_url\":\"/pages/user/coupon/UserCoupon/index\",\"name\":\"优惠券\",\"id\":190,\"pic\":\"https://image.dayouqiantu.cn/5db428984d64d.png\",\"sort\":8,\"url\":\"/user/get_coupon\",\"wxapp_url\":\"/pages/user/coupon/UserCoupon/main\",\"status\":1}', '2020-06-25 18:54:35', NULL, 8, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (191, 'yshop_my_menus', '{\"imageArr\":[\"https://image.dayouqiantu.cn/5db428a8d3ab0.png\"],\"uniapp_url\":\"/pages/shop/GoodsCollection/index\",\"name\":\"收藏商品\",\"id\":191,\"pic\":\"https://image.dayouqiantu.cn/5db428a8d3ab0.png\",\"sort\":7,\"url\":\"/collection\",\"wxapp_url\":\"/pages/shop/GoodsCollection/main\",\"status\":1}', '2020-06-25 18:54:35', NULL, 7, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (192, 'yshop_my_menus', '{\"imageArr\":[\"https://image.dayouqiantu.cn/5db428bd61b73.png\"],\"uniapp_url\":\"/pages/user/address/AddressManagement/index\",\"name\":\"地址管理\",\"id\":192,\"pic\":\"https://image.dayouqiantu.cn/5db428bd61b73.png\",\"sort\":6,\"url\":\"/user/add_manage\",\"wxapp_url\":\"/pages/user/address/AddressManagement/main\",\"status\":1}', '2020-06-25 18:54:35', NULL, 6, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (193, 'yshop_my_menus', '{\"imageArr\":[\"https://image.dayouqiantu.cn/5db428e28dd48.png\"],\"uniapp_url\":\"/pages/user/promotion/UserPromotion/index\",\"name\":\"我的推广\",\"id\":193,\"pic\":\"https://image.dayouqiantu.cn/5db428e28dd48.png\",\"sort\":5,\"url\":\"/user/user_promotion\",\"wxapp_url\":\"/pages/user/promotion/UserPromotion/main\",\"status\":1}', '2020-06-25 18:54:35', NULL, 5, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (194, 'yshop_my_menus', '{\"imageArr\":[\"https://image.dayouqiantu.cn/5db42a4208c55.png\"],\"uniapp_url\":\"/pages/user/UserAccount/index\",\"name\":\"我的余额\",\"id\":194,\"pic\":\"https://image.dayouqiantu.cn/5db42a4208c55.png\",\"sort\":4,\"url\":\"/user/account\",\"wxapp_url\":\"/pages/user/UserAccount/main\",\"status\":1}', '2020-06-25 18:54:35', NULL, 4, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (195, 'yshop_my_menus', '{\"imageArr\":[\"https://image.dayouqiantu.cn/5db428f410462.png\"],\"uniapp_url\":\"/pages/user/signIn/Integral/index\",\"name\":\"我的积分\",\"id\":195,\"pic\":\"https://image.dayouqiantu.cn/5db428f410462.png\",\"sort\":3,\"url\":\"/user/integral\",\"wxapp_url\":\"/pages/user/signIn/Integral/main\",\"status\":1}', '2020-06-25 18:54:35', NULL, 3, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (196, 'yshop_home_menus', '{\"imageArr\":[\"https://image.dayouqiantu.cn/xw.png\"],\"uniapp_url\":\"/pages/shop/news/NewsList/index\",\"name\":\"图文资讯\",\"id\":196,\"pic\":\"https://image.dayouqiantu.cn/xw.png\",\"sort\":8,\"url\":\"/news_list\",\"wxapp_url\":\"/pages/shop/news/NewsList/main\",\"status\":1}', '2020-06-25 18:54:35', '2020-06-26 18:26:24', 8, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (197, 'yshop_home_menus', '{\"imageArr\":[\"https://image.dayouqiantu.cn/colle.png\"],\"uniapp_url\":\"/pages/shop/GoodsCollection/index\",\"name\":\"我的收藏\",\"id\":197,\"pic\":\"https://image.dayouqiantu.cn/colle.png\",\"sort\":7,\"url\":\"/collection\",\"wxapp_url\":\"/pages/shop/GoodsCollection/main\",\"status\":1}', '2020-06-25 18:54:35', NULL, 7, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (199, 'yshop_home_menus', '{\"imageArr\":[\"https://image.dayouqiantu.cn/cou.png\"],\"uniapp_url\":\"/pages/user/coupon/GetCoupon/index\",\"name\":\"优惠券\",\"id\":199,\"pic\":\"https://image.dayouqiantu.cn/cou.png\",\"sort\":6,\"url\":\"/user/get_coupon\",\"wxapp_url\":\"/pages/user/coupon/GetCoupon/main\",\"status\":1}', '2020-06-25 18:54:35', '2020-06-26 18:26:36', 6, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (200, 'yshop_home_menus', '{\"imageArr\":[\"https://image.dayouqiantu.cn/62ac09d2914d36c65b9b59d2147d809a.png\"],\"uniapp_url\":\"/pages/activity/GoodsGroup/index\",\"name\":\"拼团专区\",\"id\":200,\"pic\":\"https://image.dayouqiantu.cn/62ac09d2914d36c65b9b59d2147d809a.png\",\"sort\":5,\"url\":\"/activity/group\",\"wxapp_url\":\"/pages/activity/GoodsGroup/main\",\"status\":1}', '2020-06-25 18:54:35', '2020-06-26 18:26:45', 5, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (201, 'yshop_my_menus', '{\"imageArr\":[\"https://image.dayouqiantu.cn/5ddb7a37d58d9.png\"],\"uniapp_url\":\"/pages/orderAdmin/OrderIndex/index\",\"name\":\"商户管理\",\"id\":201,\"pic\":\"https://image.dayouqiantu.cn/5ddb7a37d58d9.png\",\"sort\":2,\"url\":\"/customer/index\",\"wxapp_url\":\"/pages/orderAdmin/OrderIndex/main\",\"status\":1}', '2020-06-25 18:54:35', NULL, 2, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (202, 'yshop_sign_day_num', '{\"sign_num\":\"10\",\"id\":205,\"day\":\"第一天\"}', '2020-06-25 18:54:35', NULL, 9, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (203, 'yshop_sign_day_num', '{\"sign_num\":\"20\",\"id\":\"\",\"day\":\"第二天\"}', '2020-06-25 18:54:35', NULL, 8, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (204, 'yshop_sign_day_num', '{\"sign_num\":\"30\",\"id\":\"\",\"day\":\"第三天\"}', '2020-06-25 18:54:35', NULL, 7, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (205, 'yshop_sign_day_num', '{\"addTime\":\"\",\"sign_num\":\"40\",\"id\":\"\",\"sort\":\"\",\"value\":\"\",\"day\":\"第四天\",\"status\":\"\"}', '2020-06-25 18:54:35', NULL, 6, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (206, 'yshop_sign_day_num', '{\"addTime\":\"\",\"sign_num\":\"50\",\"id\":\"\",\"sort\":\"\",\"value\":\"\",\"day\":\"第五天\",\"status\":\"\"}', '2020-06-25 18:54:35', NULL, 5, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (207, 'yshop_sign_day_num', '{\"addTime\":\"\",\"sign_num\":\"60\",\"id\":\"\",\"sort\":\"\",\"value\":\"\",\"day\":\"第六天\",\"status\":\"\"}', '2020-06-25 18:54:35', NULL, 4, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (208, 'yshop_sign_day_num', '{\"addTime\":\"\",\"sign_num\":\"100\",\"id\":\"\",\"sort\":\"\",\"value\":\"\",\"day\":\"奖励\",\"status\":\"\"}', '2020-06-25 18:54:35', NULL, 3, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (209, 'yshop_home_menus', '{\"imageArr\":[\"https://image.dayouqiantu.cn/29ea4acebbf99e7eaf6f85af2b6d79ae.png\"],\"uniapp_url\":\"/pages/user/signIn/Sign/index\",\"name\":\"积分签到\",\"id\":209,\"pic\":\"https://image.dayouqiantu.cn/29ea4acebbf99e7eaf6f85af2b6d79ae.png\",\"sort\":4,\"url\":\"/user/sign\",\"wxapp_url\":\"/pages/user/signIn/Sign/main\",\"status\":1}', '2020-06-25 18:54:35', '2020-06-26 18:26:56', 4, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (210, 'yshop_seckill_time', '{\"continued\":2,\"id\":\"\",\"time\":5}', '2020-06-25 18:54:35', NULL, 0, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (211, 'yshop_seckill_time', '{\"addTime\":\"\",\"continued\":\"3\",\"id\":\"\",\"sort\":\"\",\"time\":\"7\",\"value\":\"\",\"status\":\"\"}', '2020-06-25 18:54:35', NULL, 0, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (212, 'yshop_seckill_time', '{\"addTime\":\"\",\"continued\":\"2\",\"id\":\"\",\"sort\":\"\",\"time\":\"10\",\"value\":\"\",\"status\":\"\"}', '2020-06-25 18:54:35', NULL, 0, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (213, 'yshop_seckill_time', '{\"addTime\":\"\",\"continued\":\"3\",\"id\":\"\",\"sort\":\"\",\"time\":\"12\",\"value\":\"\",\"status\":\"\"}', '2020-06-25 18:54:35', NULL, 0, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (214, 'yshop_seckill_time', '{\"continued\":\"10\",\"id\":214,\"time\":\"15\"}', '2020-06-25 18:54:35', '2020-09-05 17:16:06', 0, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (215, 'yshop_seckill_time', '{\"continued\":\"2\",\"id\":223,\"time\":\"19\"}', '2020-06-25 18:54:35', NULL, 0, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (216, 'yshop_home_menus', '{\"imageArr\":[\"https://image.dayouqiantu.cn/b0344c148141b50d68db9722708ea49e.png\"],\"uniapp_url\":\"/pages/activity/GoodsSeckill/index\",\"name\":\"秒杀专区\",\"id\":216,\"pic\":\"https://image.dayouqiantu.cn/b0344c148141b50d68db9722708ea49e.png\",\"sort\":3,\"url\":\"/activity/goods_seckill\",\"wxapp_url\":\"/pages/activity/GoodsSeckill/main\",\"status\":1}', '2020-06-25 18:54:35', '2020-06-26 18:27:06', 3, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (217, 'yshop_home_menus', '{\"imageArr\":[\"https://image.dayouqiantu.cn/bar.png\"],\"uniapp_url\":\"/pages/activity/GoodsBargain/index\",\"name\":\"砍价专区\",\"id\":217,\"pic\":\"https://image.dayouqiantu.cn/bar.png\",\"sort\":2,\"url\":\"/activity/bargain\",\"wxapp_url\":\"/pages/activity/GoodsBargain/main\",\"status\":1}', '2020-06-25 18:54:35', '2020-06-26 18:27:16', 2, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (218, 'yshop_my_menus', '{\"imageArr\":[\"https://image.dayouqiantu.cn/5dfd7b748e053.png\"],\"uniapp_url\":\"/pages/activity/BargainRecord/index\",\"name\":\"砍价记录\",\"id\":218,\"pic\":\"https://image.dayouqiantu.cn/5dfd7b748e053.png\",\"sort\":1,\"url\":\"/activity/bargain/record\",\"wxapp_url\":\"/pages/activity/BargainRecord/main\",\"status\":1}', '2020-06-25 18:54:35', NULL, 1, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (219, 'yshop_home_banner', '{\"name\":\"222\",\"id\":\"\",\"pic\":\"https://image.dayouqiantu.cn/5c9f117f624ee.jpg\",\"sort\":\"\",\"url\":\"/\",\"status\":\"\"}', '2020-06-25 18:54:35', NULL, 0, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (221, 'yshop_my_menus', '{\"imageArr\":[\"https://image.dayouqiantu.cn/5e60da498cfdd.png\"],\"uniapp_url\":\"/pages/orderAdmin/OrderCancellation/index\",\"name\":\"订单核销\",\"id\":221,\"pic\":\"https://image.dayouqiantu.cn/5e60da498cfdd.png\",\"sort\":0,\"url\":\"/order/order_cancellation\",\"wxapp_url\":\"\",\"status\":1}', '2020-06-25 18:54:35', '2020-09-15 15:46:36', 0, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (222, 'yshop_recharge_price_ways', '{\"give_price\":\"10\",\"price\":\"100\",\"id\":\"\",\"sort\":0,\"status\":1}', '2020-06-25 18:54:35', NULL, 1, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (223, 'yshop_recharge_price_ways', '{\"give_price\":\"1000\",\"price\":1,\"id\":223,\"sort\":0,\"status\":1}', '2020-06-25 18:54:35', '2020-09-12 18:34:21', 0, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (224, 'yshop_home_banner', '{\"imageArr\":[\"https://consoleapi.xinxintuan.co/file/pic/20200903171807647067.jpg\"],\"uniapp_url\":\"3\",\"name\":\"3\",\"id\":224,\"pic\":\"https://consoleapi.xinxintuan.co/file/pic/20200903171807647067.jpg\",\"sort\":0,\"url\":\"3\",\"wxapp_url\":\"\",\"status\":1}', '2020-09-03 17:13:59', '2020-09-15 07:54:11', 0, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (225, 'yshop_my_menus', '{\"imageArr\":[\"https://consoleapi.xinxintuan.co/file/pic/20200911093912577832.png\"],\"uniapp_url\":\"/pages/shop/GoodsFoot/index\",\"name\":\"我的足迹\",\"id\":225,\"pic\":\"https://consoleapi.xinxintuan.co/file/pic/20200911093912577832.png\",\"sort\":10,\"url\":\"\",\"wxapp_url\":\"\",\"status\":1}', '2020-09-11 09:39:21', '2020-09-11 09:40:49', 10, 1, 0); +INSERT INTO `yx_system_group_data` VALUES (226, 'yshop_home_banner', '{\"imageArr\":[\"https://consoleapi.xinxintuan.co/file/pic/20200915074139926178.jpg\"],\"uniapp_url\":\"\",\"name\":\"sdaas\",\"id\":\"\",\"pic\":\"https://consoleapi.xinxintuan.co/file/pic/20200915074139926178.jpg\",\"sort\":0,\"url\":\"\",\"wxapp_url\":\"\",\"status\":1}', '2020-09-15 07:41:46', NULL, 0, 1, 1); + +-- ---------------------------- +-- Table structure for yx_system_store +-- ---------------------------- +DROP TABLE IF EXISTS `yx_system_store`; +CREATE TABLE `yx_system_store` ( + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '门店名称', + `introduction` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '简介', + `phone` char(25) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '手机号码', + `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '省市区', + `detailed_address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '详细地址', + `image` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '门店logo', + `latitude` char(25) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '纬度', + `longitude` char(25) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '经度', + `valid_time` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '核销有效日期', + `day_time` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '每日营业开关时间', + `create_time` datetime(0) NOT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_show` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否显示', + `is_del` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除', + `day_time_end` datetime(0) NULL DEFAULT NULL, + `day_time_start` datetime(0) NULL DEFAULT NULL, + `valid_time_end` datetime(0) NULL DEFAULT NULL, + `valid_time_start` datetime(0) NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE, + INDEX `phone`(`phone`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '门店自提' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_system_store +-- ---------------------------- +INSERT INTO `yx_system_store` VALUES (3, 'yshop店铺', 'springboot商城', '15136175234', '河南省漯河市', '', 'https://image.dayouqiantu.cn/noMeal_tt.png', '33.54528', '113.9202', '2020-03-09 - 2020-04-30', '11:33:49 - 19:33:49', '2020-06-25 18:54:35', NULL, 0, 0, '2020-03-04 19:33:49', '2020-03-04 11:33:49', '2020-04-30 00:00:00', '2020-03-09 00:00:00'); +INSERT INTO `yx_system_store` VALUES (4, '信阳门店', '信阳门店', '15136275234', '河南省信阳市', '', 'https://image.dayouqiantu.cn/noMeal_tt.png', '32.11683', '114.05857', '2020-03-21 - 2020-03-31', '17:11:13 - 20:11:13', '2020-06-25 18:54:35', NULL, 1, 0, '2020-03-21 20:11:13', '2020-03-21 17:11:13', '2020-03-31 00:00:00', '2020-03-21 00:00:00'); +INSERT INTO `yx_system_store` VALUES (5, '郑州门店', '郑州门店', '15136175246', '河南省郑州', '', 'https://image.dayouqiantu.cn/noMeal_tt.png', '34.72468', '113.6401', '2020-03-21 - 2020-03-31', '17:11:13 - 20:11:15', '2020-06-25 18:54:35', '2020-06-26 10:51:21', 1, 1, '2020-03-21 20:11:15', '2020-03-21 17:11:13', '2020-03-31 00:00:00', '2020-03-21 00:00:00'); + +-- ---------------------------- +-- Table structure for yx_system_store_staff +-- ---------------------------- +DROP TABLE IF EXISTS `yx_system_store_staff`; +CREATE TABLE `yx_system_store_staff` ( + `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `uid` bigint(20) UNSIGNED NOT NULL COMMENT '微信用户id', + `nickname` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `avatar` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '店员头像', + `store_id` int(11) NOT NULL COMMENT '门店id', + `store_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `staff_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '店员名称', + `phone` char(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机号码', + `verify_status` tinyint(2) NOT NULL DEFAULT 0 COMMENT '核销开关', + `status` tinyint(2) NULL DEFAULT 1 COMMENT '状态', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '门店店员表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_system_store_staff +-- ---------------------------- +INSERT INTO `yx_system_store_staff` VALUES (2, 12, '会敲代码的喵2', 'https://image.dayouqiantu.cn/5dc2c7f3a104c.png', 4, '信阳门店', 'tttt', '15136175423', 1, 1, '2020-06-25 18:54:35', NULL, 1); +INSERT INTO `yx_system_store_staff` VALUES (3, 11, '会敲代码的喵88', 'https://image.dayouqiantu.cn/5dc2c7f3a104c.png', 5, '郑州门店', 'tttt', '16136175234', 1, 1, '2020-06-25 18:54:35', NULL, 1); +INSERT INTO `yx_system_store_staff` VALUES (4, 19, '15136175528', 'https://image.dayouqiantu.cn/5dc2c7f3a104c.png', 5, '郑州门店', '111', '15136175246', 1, 1, '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_store_staff` VALUES (5, 20, '15136171112', 'https://image.dayouqiantu.cn/5e79f6cfd33b6.png', 4, '信阳门店', '444', '44444', 1, 1, NULL, '2020-06-26 10:56:09', 0); +INSERT INTO `yx_system_store_staff` VALUES (6, 21, '15136175234', 'https://image.dayouqiantu.cn/5e79f6cfd33b6.png', 4, '信阳门店', '5555', '555555', 1, 1, '2020-06-26 10:53:46', NULL, 0); + +-- ---------------------------- +-- Table structure for yx_system_user_level +-- ---------------------------- +DROP TABLE IF EXISTS `yx_system_user_level`; +CREATE TABLE `yx_system_user_level` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `mer_id` int(11) NOT NULL DEFAULT 0 COMMENT '商户id', + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '会员名称', + `money` decimal(8, 2) NOT NULL DEFAULT 0.00 COMMENT '购买金额', + `valid_date` int(11) NOT NULL DEFAULT 0 COMMENT '有效时间', + `is_forever` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否为永久会员', + `is_pay` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否购买,1=购买,0=不购买', + `is_show` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否显示 1=显示,0=隐藏', + `grade` int(11) NOT NULL DEFAULT 0 COMMENT '会员等级', + `discount` decimal(8, 2) NOT NULL DEFAULT 0.00 COMMENT '享受折扣', + `image` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '会员卡背景', + `icon` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '会员图标', + `explain` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '说明', + `create_time` datetime(0) NOT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除.1=删除,0=未删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '设置用户等级表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_system_user_level +-- ---------------------------- +INSERT INTO `yx_system_user_level` VALUES (1, 0, '普通会员', 20.00, 0, 1, 0, 1, 1, 99.00, 'http://pic.dayouqiantu.cn/5c9ccca8cd632.jpg', 'http://pic.dayouqiantu.cn/5c9ccca8bc1e0.png', '普通会员', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_level` VALUES (2, 0, '青铜会员', 0.00, 0, 1, 0, 1, 2, 98.00, 'http://pic.dayouqiantu.cn/5c9ccca904016.jpg', 'http://pic.dayouqiantu.cn/5c9ccca8f0a30.png', '青铜会员', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_level` VALUES (3, 0, '黄铜会员', 0.00, 0, 1, 0, 1, 3, 95.00, 'http://pic.dayouqiantu.cn/5c9ccca8b27f1.jpg', 'http://pic.dayouqiantu.cn/5c9ccca8e9365.png', '黄铜会员', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_level` VALUES (4, 0, '白银会员', 0.00, 0, 1, 0, 1, 4, 94.00, 'http://pic.dayouqiantu.cn/5c9ccca8d6ae1.jpg', 'http://pic.dayouqiantu.cn/5c9ccca8a27f0.png', '白银会员', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_level` VALUES (5, 0, '黄金会员', 0.00, 0, 1, 0, 1, 5, 90.00, 'http://pic.dayouqiantu.cn/5c9ccca8b27f1.jpg', 'http://pic.dayouqiantu.cn/5c9ccca8aa5b9.png', '黄金会员', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_level` VALUES (6, 0, '钻石会员', 0.00, 0, 1, 0, 1, 6, 88.00, 'http://localhost:8000/file/pic/钻石-20200328094531898.jpg', 'http://pic.dayouqiantu.cn/5c9ccca90d2d3.png', '钻石会员', '2020-06-25 18:54:35', NULL, 1); + +-- ---------------------------- +-- Table structure for yx_system_user_task +-- ---------------------------- +DROP TABLE IF EXISTS `yx_system_user_task`; +CREATE TABLE `yx_system_user_task` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '任务名称', + `real_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '配置原名', + `task_type` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '任务类型', + `number` int(11) NOT NULL DEFAULT 0 COMMENT '限定数', + `level_id` int(11) NOT NULL DEFAULT 0 COMMENT '等级id', + `sort` int(11) NOT NULL DEFAULT 0 COMMENT '排序', + `is_show` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否显示', + `is_must` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否务必达成任务,1务必达成,0=满足其一', + `illustrate` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '任务说明', + `create_time` datetime(0) NOT NULL COMMENT '新增时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '等级任务设置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_system_user_task +-- ---------------------------- +INSERT INTO `yx_system_user_task` VALUES (1, '满足积分20分', '积分数', 'SatisfactionIntegral', 20, 1, 0, 1, 1, '', '2020-06-25 18:54:35', '2020-06-25 18:54:35', 0); +INSERT INTO `yx_system_user_task` VALUES (2, '消费满100元', '消费金额', 'ConsumptionAmount', 100, 1, 0, 1, 1, '', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_task` VALUES (3, '满足积分200分', '积分数', 'SatisfactionIntegral', 200, 2, 0, 1, 1, '', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_task` VALUES (4, '累计签到20天', '累计签到', 'CumulativeAttendance', 20, 2, 0, 1, 1, '', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_task` VALUES (5, '满足积分500分', '积分数', 'SatisfactionIntegral', 500, 3, 0, 1, 1, '', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_task` VALUES (6, '累计签到30天', '累计签到', 'CumulativeAttendance', 30, 3, 0, 1, 1, '', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_task` VALUES (7, '满足积分1000分', '积分数', 'SatisfactionIntegral', 1000, 4, 0, 1, 1, '', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_task` VALUES (8, '累计签到10天', '累计签到', 'CumulativeAttendance', 10, 4, 0, 1, 1, '', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_task` VALUES (9, '满足积分1200分', '积分数', 'SatisfactionIntegral', 1200, 5, 0, 1, 1, '', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_task` VALUES (10, '累计签到60天', '累计签到', 'CumulativeAttendance', 60, 5, 0, 1, 1, '', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_task` VALUES (11, '消费满10000元', '消费次数', 'ConsumptionAmount', 10000, 5, 0, 1, 1, '', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_task` VALUES (12, '满足积分2000分', '积分数', 'SatisfactionIntegral', 2000, 6, 0, 1, 1, '', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_task` VALUES (13, '消费满10000元', '消费次数', 'ConsumptionAmount', 10000, 6, 0, 1, 1, '', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_task` VALUES (14, '累计签到100天', '累计签到', 'CumulativeAttendance', 100, 6, 0, 1, 1, '', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_task` VALUES (15, '消费满1000元', '消费金额', 'ConsumptionAmount', 1000, 4, 0, 1, 1, '', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_task` VALUES (16, '累计签到2天', '累计签到', 'CumulativeAttendance', 2, 1, 0, 1, 1, '', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_task` VALUES (17, '消费满100元', '消费次数', 'ConsumptionAmount', 100, 2, 0, 1, 1, '', '2020-06-25 18:54:35', NULL, 0); +INSERT INTO `yx_system_user_task` VALUES (18, '消费满1000元', '消费金额', 'ConsumptionAmount', 1000, 3, 0, 1, 1, '', '2020-06-25 18:54:35', NULL, 0); + +-- ---------------------------- +-- Table structure for yx_user +-- ---------------------------- +DROP TABLE IF EXISTS `yx_user`; +CREATE TABLE `yx_user` ( + `uid` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '用户id', + `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户账户(跟accout一样)', + `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户密码(跟pwd)', + `real_name` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '真实姓名', + `birthday` int(11) NULL DEFAULT 0 COMMENT '生日', + `card_id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '身份证号码', + `mark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '用户备注', + `partner_id` int(11) NULL DEFAULT 0 COMMENT '合伙人id', + `group_id` int(11) NULL DEFAULT 0 COMMENT '用户分组id', + `nickname` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户昵称', + `avatar` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户头像', + `phone` char(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机号码', + `add_ip` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '添加ip', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '最后一次登录时间', + `last_ip` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '最后一次登录ip', + `now_money` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '用户余额', + `brokerage_price` decimal(8, 2) NOT NULL DEFAULT 0.00 COMMENT '佣金金额', + `integral` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '用户剩余积分', + `sign_num` int(11) NOT NULL DEFAULT 0 COMMENT '连续签到天数', + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '1为正常,0为禁止', + `level` tinyint(2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '等级', + `spread_uid` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '推广元id', + `spread_time` datetime(0) NULL DEFAULT NULL COMMENT '推广员关联时间', + `user_type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户类型', + `is_promoter` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否为推广员', + `pay_count` int(11) UNSIGNED NULL DEFAULT 0 COMMENT '用户购买次数', + `spread_count` int(11) NULL DEFAULT 0 COMMENT '下级人数', + `addres` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '详细地址', + `adminid` int(11) UNSIGNED NULL DEFAULT 0 COMMENT '管理员编号 ', + `login_type` varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '用户登陆类型,h5,wechat,routine', + `wx_profile` json NULL COMMENT '微信用户json信息', + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`uid`) USING BTREE, + UNIQUE INDEX `username`(`username`) USING BTREE, + INDEX `spreaduid`(`spread_uid`) USING BTREE, + INDEX `level`(`level`) USING BTREE, + INDEX `status`(`status`) USING BTREE, + INDEX `is_promoter`(`is_promoter`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_user +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_user_address +-- ---------------------------- +DROP TABLE IF EXISTS `yx_user_address`; +CREATE TABLE `yx_user_address` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '用户地址id', + `uid` bigint(20) UNSIGNED NOT NULL COMMENT '用户id', + `real_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '收货人姓名', + `phone` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '收货人电话', + `province` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '收货人所在省', + `city` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '收货人所在市', + `city_id` int(11) NULL DEFAULT NULL, + `district` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '收货人所在区', + `detail` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '收货人详细地址', + `post_code` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '邮编', + `longitude` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '经度', + `latitude` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '纬度', + `is_default` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否默认', + `is_del` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否删除', + `create_time` datetime(0) NOT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE, + INDEX `uid`(`uid`) USING BTREE, + INDEX `is_default`(`is_default`) USING BTREE, + INDEX `is_del`(`is_del`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 36 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户地址表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_user_address +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_user_bill +-- ---------------------------- +DROP TABLE IF EXISTS `yx_user_bill`; +CREATE TABLE `yx_user_bill` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '用户账单id', + `uid` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '用户uid', + `link_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '关联id', + `pm` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '0 = 支出 1 = 获得', + `title` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '账单标题', + `category` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '明细种类', + `type` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '明细类型', + `number` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '明细数字', + `balance` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '剩余', + `mark` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_time` datetime(0) NOT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '0 = 带确定 1 = 有效 -1 = 无效', + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE, + INDEX `openid`(`uid`) USING BTREE, + INDEX `status`(`status`) USING BTREE, + INDEX `add_time`(`create_time`) USING BTREE, + INDEX `pm`(`pm`) USING BTREE, + INDEX `type`(`category`, `type`, `link_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户账单表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_user_bill +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_user_enter +-- ---------------------------- +DROP TABLE IF EXISTS `yx_user_enter`; +CREATE TABLE `yx_user_enter` ( + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '商户申请ID', + `uid` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '用户ID', + `province` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '商户所在省', + `city` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '商户所在市', + `district` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '商户所在区', + `address` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '商户详细地址', + `merchant_name` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '商户名称', + `link_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', + `link_tel` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '商户电话', + `charter` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '商户证书', + `add_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '添加时间', + `apply_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '审核时间', + `success_time` int(11) NOT NULL COMMENT '通过时间', + `fail_message` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '未通过原因', + `fail_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '未通过时间', + `status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '-1 审核未通过 0未审核 1审核通过', + `is_lock` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '0 = 开启 1= 关闭', + `is_del` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `uid`(`uid`) USING BTREE, + INDEX `province`(`province`, `city`, `district`) USING BTREE, + INDEX `is_lock`(`is_lock`) USING BTREE, + INDEX `is_del`(`is_del`) USING BTREE, + INDEX `status`(`status`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户申请表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_user_enter +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_user_extract +-- ---------------------------- +DROP TABLE IF EXISTS `yx_user_extract`; +CREATE TABLE `yx_user_extract` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `uid` bigint(20) UNSIGNED NULL DEFAULT NULL, + `real_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '名称', + `extract_type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'bank' COMMENT 'bank = 银行卡 alipay = 支付宝wx=微信', + `bank_code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '银行卡', + `bank_address` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '开户地址', + `alipay_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '支付宝账号', + `extract_price` decimal(8, 2) UNSIGNED NULL DEFAULT 0.00 COMMENT '提现金额', + `mark` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `balance` decimal(8, 2) UNSIGNED NULL DEFAULT 0.00, + `fail_msg` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '无效原因', + `fail_time` datetime(0) NULL DEFAULT NULL, + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `status` tinyint(2) NULL DEFAULT 0 COMMENT '-1 未通过 0 审核中 1 已提现', + `wechat` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '微信号', + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE, + INDEX `extract_type`(`extract_type`) USING BTREE, + INDEX `status`(`status`) USING BTREE, + INDEX `add_time`(`create_time`) USING BTREE, + INDEX `openid`(`uid`) USING BTREE, + INDEX `fail_time`(`fail_time`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户提现表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_user_extract +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_user_group +-- ---------------------------- +DROP TABLE IF EXISTS `yx_user_group`; +CREATE TABLE `yx_user_group` ( + `id` smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, + `group_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户分组名称', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户分组表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_user_group +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_user_level +-- ---------------------------- +DROP TABLE IF EXISTS `yx_user_level`; +CREATE TABLE `yx_user_level` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `uid` bigint(20) NOT NULL DEFAULT 0 COMMENT '用户uid', + `level_id` int(11) NOT NULL DEFAULT 0 COMMENT '等级vip', + `grade` int(11) NOT NULL DEFAULT 0 COMMENT '会员等级', + `valid_time` int(11) NOT NULL DEFAULT 0 COMMENT '过期时间', + `is_forever` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否永久', + `mer_id` int(11) NOT NULL DEFAULT 0 COMMENT '商户id', + `status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:禁止,1:正常', + `mark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `remind` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否已通知', + `is_del` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除,0=未删除,1=删除', + `create_time` datetime(0) NOT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `discount` int(11) NOT NULL DEFAULT 0 COMMENT '享受折扣', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `id`(`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户等级记录表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_user_level +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_user_recharge +-- ---------------------------- +DROP TABLE IF EXISTS `yx_user_recharge`; +CREATE TABLE `yx_user_recharge` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `uid` bigint(20) NULL DEFAULT NULL COMMENT '充值用户UID', + `nickname` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '', + `order_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '订单号', + `price` decimal(8, 2) NULL DEFAULT NULL COMMENT '充值金额', + `give_price` decimal(8, 2) NULL DEFAULT 0.00 COMMENT '购买赠送金额', + `recharge_type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '充值类型', + `paid` tinyint(1) NULL DEFAULT NULL COMMENT '是否充值', + `pay_time` datetime(0) NULL DEFAULT NULL COMMENT '充值支付时间', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '充值时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `refund_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '退款金额', + `is_del` tinyint(4) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `order_id`(`order_id`) USING BTREE, + INDEX `uid`(`uid`) USING BTREE, + INDEX `recharge_type`(`recharge_type`) USING BTREE, + INDEX `paid`(`paid`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户充值表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_user_recharge +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_user_sign +-- ---------------------------- +DROP TABLE IF EXISTS `yx_user_sign`; +CREATE TABLE `yx_user_sign` ( + `int` bigint(20) NOT NULL AUTO_INCREMENT, + `uid` bigint(20) NOT NULL DEFAULT 0 COMMENT '用户uid', + `title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '签到说明', + `number` int(11) NOT NULL DEFAULT 0 COMMENT '获得积分', + `balance` int(11) NOT NULL DEFAULT 0 COMMENT '剩余积分', + `create_time` datetime(0) NOT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`int`) USING BTREE, + INDEX `uid`(`uid`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '签到记录表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_user_sign +-- ---------------------------- +INSERT INTO `yx_user_sign` VALUES (17, 43, '签到奖励', 10, 10, '2020-09-12 17:41:55', NULL, 0); +INSERT INTO `yx_user_sign` VALUES (18, 44, '签到奖励', 10, 0, '2020-09-13 22:21:57', NULL, 0); + +-- ---------------------------- +-- Table structure for yx_user_task_finish +-- ---------------------------- +DROP TABLE IF EXISTS `yx_user_task_finish`; +CREATE TABLE `yx_user_task_finish` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `task_id` int(11) NOT NULL DEFAULT 0 COMMENT '任务id', + `uid` bigint(20) NOT NULL DEFAULT 0 COMMENT '用户id', + `status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否有效', + `create_time` datetime(0) NOT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `is_del` tinyint(1) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `id`(`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户任务完成记录表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_user_task_finish +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_wechat_live +-- ---------------------------- +DROP TABLE IF EXISTS `yx_wechat_live`; +CREATE TABLE `yx_wechat_live` ( + `room_id` bigint(11) NOT NULL COMMENT '直播间id', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '直播间标题', + `cover_imge` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '背景图', + `share_imge` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分享图片', + `live_status` int(9) NULL DEFAULT NULL COMMENT '直播间状态', + `start_time` bigint(11) NULL DEFAULT NULL COMMENT '开始时间', + `end_time` bigint(11) NULL DEFAULT NULL COMMENT '预计结束时间', + `anchor_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主播昵称', + `anchor_wechat` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主播微信号', + `anchor_imge` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主播头像', + `type` tinyint(1) NULL DEFAULT NULL COMMENT '直播间类型 1:推流 0:手机直播', + `screen_type` tinyint(1) NULL DEFAULT NULL COMMENT '横屏、竖屏 【1:横屏,0:竖屏】', + `close_like` tinyint(1) NULL DEFAULT NULL COMMENT '是否关闭点赞 【0:开启,1:关闭】', + `close_comment` tinyint(1) NULL DEFAULT NULL COMMENT '是否关闭评论 【0:开启,1:关闭】', + `close_goods` tinyint(1) NULL DEFAULT NULL COMMENT '是否关闭货架 【0:开启,1:关闭】', + `product_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品id 多个,分割', + `close_replay` tinyint(1) NULL DEFAULT NULL COMMENT '是否关闭回放【0:开启,1:关闭】', + `close_share` tinyint(1) NULL DEFAULT NULL COMMENT '是否关闭分享【0:开启,1:关闭】', + `close_kf` tinyint(1) NULL DEFAULT NULL COMMENT '是否关闭客服【0:开启,1:关闭】', + PRIMARY KEY (`room_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信小程序直播表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_wechat_live +-- ---------------------------- +INSERT INTO `yx_wechat_live` VALUES (20, '专业打印', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807584910.jpg', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807584910.jpg', 107, 1599656400, 1599703200, '阳光正好', 'simpleton_boy', 'https://consoleapi.xinxintuan.co/file/pic/20200903171208889668.png', 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL); +INSERT INTO `yx_wechat_live` VALUES (21, '广告板定制', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807568739.jpg', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807568739.jpg', 103, 1599730609, 1599730645, 'yshop', 'simpleton_boy', 'https://consoleapi.xinxintuan.co/file/pic/20200903171208889668.png', 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL); +INSERT INTO `yx_wechat_live` VALUES (22, '户外写真背胶', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807625149.jpg', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807625149.jpg', 107, 1599832800, 1599904800, 'yshop', 'simpleton_boy', 'https://consoleapi.xinxintuan.co/file/pic/20200903171208889668.png', 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL); +INSERT INTO `yx_wechat_live` VALUES (23, '彩色复印-量大有优惠', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807647067.jpg', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807647067.jpg', 102, 1599865200, 1599926400, 'yshop', 'zimengzhiqiu', 'https://consoleapi.xinxintuan.co/file/pic/20200903171807647067.jpg', 0, 0, 0, 0, 0, '9,8', NULL, NULL, NULL); +INSERT INTO `yx_wechat_live` VALUES (26, 'X型展架', 'https://image.dayouqiantu.cn/5ca081af6183f.jpg', 'https://image.dayouqiantu.cn/5ca081af6183f.jpg', 102, 1599872400, 1599926400, 'yshop', 'zimengzhiqiu', 'https://consoleapi.xinxintuan.co/file/pic/20200903171208889668.png', 0, 0, 0, 0, 0, '9,8,7', NULL, NULL, NULL); + +-- ---------------------------- +-- Table structure for yx_wechat_live_goods +-- ---------------------------- +DROP TABLE IF EXISTS `yx_wechat_live_goods`; +CREATE TABLE `yx_wechat_live_goods` ( + `goods_id` bigint(9) NOT NULL COMMENT '直播商品id', + `product_id` bigint(9) NULL DEFAULT NULL COMMENT '关联商品id', + `cover_imge_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品图片', + `url` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品小程序路径', + `price_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '价格类型 1:一口价(只需要传入price,price2不传) 2:价格区间(price字段为左边界,price2字段为右边界,price和price2必传) 3:显示折扣价(price字段为原价,price2字段为现价, price和price2必传)', + `price` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `price2` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品名称', + `third_party_tag` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '1, 2:表示是为api添加商品,否则是直播控制台添加的商品', + `audit_id` bigint(20) NULL DEFAULT NULL COMMENT '审核单id', + `audit_status` int(1) UNSIGNED ZEROFILL NULL DEFAULT NULL COMMENT '审核状态 0:未审核,1:审核中,2:审核通过,3审核失败', + PRIMARY KEY (`goods_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信小程序直播商品表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_wechat_live_goods +-- ---------------------------- +INSERT INTO `yx_wechat_live_goods` VALUES (7, 6, 'https://image.dayouqiantu.cn/news.png', 'pages/shop/GoodsCon/index.html?id=30', '3', '76', '11', '印刷各种印刷', '2', 447137937, 2); +INSERT INTO `yx_wechat_live_goods` VALUES (8, 5, 'https://image.dayouqiantu.cn/pink.png', 'pages/shop/GoodsCon/index.html?id=30', '3', '30', '11', '广告版定制', '2', 447137941, 2); +INSERT INTO `yx_wechat_live_goods` VALUES (9, 4, 'https://image.dayouqiantu.cn/news.png', 'pages/shop/GoodsCon/index.html?id=30', '3', '23', '1', '户外写真背胶', '2', 447137947, 2); + +-- ---------------------------- +-- Table structure for yx_wechat_media +-- ---------------------------- +DROP TABLE IF EXISTS `yx_wechat_media`; +CREATE TABLE `yx_wechat_media` ( + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '微信视频音频id', + `type` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '回复类型', + `path` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '文件路径', + `media_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '微信服务器返回的id', + `url` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '地址', + `temporary` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否永久或者临时 0永久1临时', + `add_time` int(10) UNSIGNED NOT NULL COMMENT '添加时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `type`(`type`, `media_id`) USING BTREE, + INDEX `type_2`(`type`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '微信回复表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_wechat_media +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yx_wechat_menu +-- ---------------------------- +DROP TABLE IF EXISTS `yx_wechat_menu`; +CREATE TABLE `yx_wechat_menu` ( + `key` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `result` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '缓存数据', + `add_time` int(10) NULL DEFAULT NULL COMMENT '缓存时间', + PRIMARY KEY (`key`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '微信缓存表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_wechat_menu +-- ---------------------------- +INSERT INTO `yx_wechat_menu` VALUES ('wechat_menus', '[{\"subButtons\":[{\"name\":\"公众号演示\",\"type\":\"view\",\"url\":\"https://h5.dayouqiantu.cn\"}],\"name\":\"Yshop商城3\",\"type\":\"click\",\"key\":\"yshop\"},{\"subButtons\":[{\"appId\":\"wxa82b5b7fcb0ec161\",\"name\":\"小程序演示\",\"pagePath\":\"pages/index\",\"type\":\"miniprogram\",\"url\":\"pages/index\"}],\"name\":\"供货商城\",\"type\":\"click\",\"key\":\"supply\"},{\"subButtons\":[],\"name\":\"3333\",\"type\":\"click\",\"key\":\"2222\"}]', 1570435277); + +-- ---------------------------- +-- Table structure for yx_wechat_reply +-- ---------------------------- +DROP TABLE IF EXISTS `yx_wechat_reply`; +CREATE TABLE `yx_wechat_reply` ( + `id` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '微信关键字回复id', + `key` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '关键字', + `type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '回复类型', + `data` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '回复数据', + `status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '0=不可用 1 =可用', + `hide` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '是否隐藏', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `key`(`key`) USING BTREE, + INDEX `type`(`type`) USING BTREE, + INDEX `status`(`status`) USING BTREE, + INDEX `hide`(`hide`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '微信关键字回复表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_wechat_reply +-- ---------------------------- +INSERT INTO `yx_wechat_reply` VALUES (1, 'subscribe', 'text', '{\"content\":\"22222222222444499990000\"}', 1, NULL); + +-- ---------------------------- +-- Table structure for yx_wechat_template +-- ---------------------------- +DROP TABLE IF EXISTS `yx_wechat_template`; +CREATE TABLE `yx_wechat_template` ( + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '模板id', + `tempkey` char(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '模板编号', + `name` char(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '模板名', + `content` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '回复内容', + `tempid` char(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模板ID', + `create_time` datetime(0) NOT NULL COMMENT '添加时间', + `update_time` datetime(0) NULL DEFAULT NULL, + `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '状态', + `is_del` tinyint(1) NULL DEFAULT 0, + `type` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型:template:模板消息 subscribe:订阅消息', + PRIMARY KEY (`id`) USING BTREE, + INDEX `tempkey`(`tempkey`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '微信模板' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of yx_wechat_template +-- ---------------------------- +INSERT INTO `yx_wechat_template` VALUES (3, 'delivery_success', '订单发货提醒', '{{first.DATA}}\n订单编号:{{keyword1.DATA}}\n物流公司:{{keyword2.DATA}}\n物流单号:{{keyword3.DATA}}\n{{remark.DATA}}', 'NyrkeQ5TDFDq0GV0wkNA9L39GzPHfzbQqVLnbA5OTsY', '2020-06-25 18:54:35', '2020-07-06 15:52:09', 1, 1, NULL); +INSERT INTO `yx_wechat_template` VALUES (13, 'pay_success', '订单支付成功通知', '{{first.DATA}}\n订单编号:{{keyword1.DATA}}\n支付金额:{{keyword2.DATA}}\n{{remark.DATA}}', 'W5r2c2kzhbq8uxStkPAVx_sk-5aapMFCqe7b7KU5jXI', '2020-06-25 18:54:35', '2020-09-14 12:51:34', 1, 0, 'subscribe'); +INSERT INTO `yx_wechat_template` VALUES (14, 'recharge_success', '帐户资金变动提醒', '{{first.DATA}}\n变动类型:{{keyword1.DATA}}\n变动时间:{{keyword2.DATA}}\n变动金额:{{keyword3.DATA}}\n{{remark.DATA}}', 'ePF4RS3ONCEuS9AuPyqZ2Th_B-HZ6E1CIpnJRt7ACwI', '2020-06-25 18:54:35', '2020-07-06 15:51:54', 1, 0, NULL); +INSERT INTO `yx_wechat_template` VALUES (15, 'refund_success', '退款进度通知', '', 'jaDVkOdbbk01WcWSxp1_liEQen44-euhj7shxjDvLIc', '2020-07-06 15:53:10', NULL, 0, 0, NULL); + + + +-- ---------------------------- +-- Table structure for yx_store_canvas +-- ---------------------------- +DROP TABLE IF EXISTS `yx_store_canvas`; +CREATE TABLE `yx_store_canvas` ( + `canvas_id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT '画布id', + `terminal` tinyint(1) NOT NULL COMMENT '终端 1-小程序 2-H5 3-APP 4-PC', + `json` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '画布json数据', + `type` tinyint(1) NULL DEFAULT 1 COMMENT '类型 1-系统画布 2-自定义页面 3-商家店铺装修', + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '名称', + `shop_id` bigint(20) NULL DEFAULT 0 COMMENT '店铺id,当type=3的时候,值为具体的店铺id,其它情况为0', + `create_time` timestamp(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` timestamp(0) NULL DEFAULT NULL COMMENT '修改时间', + `is_del` tinyint(1) NULL DEFAULT NULL COMMENT '删除标识', + PRIMARY KEY (`canvas_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '画布信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of yx_store_canvas +-- ---------------------------- +INSERT INTO `yx_store_canvas` VALUES (11, 3, '[{\"title\":\"店铺头部\",\"type\":\"header\",\"componentContent\":{\"title\":\"Yshop\"},\"index\":0},{\"title\":\"搜索商品\",\"type\":\"search\",\"componentContent\":{},\"index\":1},{\"title\":\"轮播图\",\"type\":\"banner\",\"componentContent\":{\"bannerData\":[{\"pic\":\"./static/img/banner.f96c3f5.png\",\"name\":\"0\",\"sort\":0,\"url\":\"/\",\"status\":1}]},\"index\":2},{\"title\":\"滚动新闻\",\"type\":\"noticeBar\",\"componentContent\":{\"roll\":[{\"uniapp_url\":\"/pages/shop/news/NewsList/index\",\"url\":\"/news_list\",\"info\":\"yshop基于springboot2+Mybatisplus商城系统,3.0版本重构了代码,新增了运费模板、sku单独管理、商品券等\",\"wxapp_url\":\"/pages/shop/news/NewsList/main\"}]},\"index\":3},{\"title\":\"菜单\",\"type\":\"menu\",\"componentContent\":{\"menus\":[{\"imageArr\":[\"https://image.dayouqiantu.cn/5e85bfa61251d.png\"],\"uniapp_url\":\"/pages/shop/GoodsList/index\",\"name\":\"全部商品\",\"id\":180,\"pic\":\"https://image.dayouqiantu.cn/all.png\",\"sort\":9,\"url\":\"/goods_list\",\"wxapp_url\":\"/pages/shop/GoodsClass/main\",\"status\":1},{\"imageArr\":[\"https://image.dayouqiantu.cn/news.png\"],\"uniapp_url\":\"/pages/shop/news/NewsList/index\",\"name\":\"图文资讯\",\"id\":196,\"pic\":\"https://image.dayouqiantu.cn/xw.png\",\"sort\":8,\"url\":\"/news_list\",\"wxapp_url\":\"/pages/shop/news/NewsList/main\",\"status\":1},{\"imageArr\":[\"https://image.dayouqiantu.cn/5e4e939507b5e.png\"],\"uniapp_url\":\"/pages/shop/GoodsCollection/index\",\"name\":\"我的收藏\",\"id\":197,\"pic\":\"https://image.dayouqiantu.cn/colle.png\",\"sort\":7,\"url\":\"/collection\",\"wxapp_url\":\"/pages/shop/GoodsCollection/main\",\"status\":1},{\"imageArr\":[\"https://image.dayouqiantu.cn/coupon.png\"],\"uniapp_url\":\"\",\"name\":\"优惠券\",\"id\":199,\"pic\":\"https://image.dayouqiantu.cn/cou.png\",\"sort\":6,\"url\":\"/user/get_coupon\",\"wxapp_url\":\"/pages/user/coupon/GetCoupon/main\",\"status\":1},{\"imageArr\":[\"https://image.dayouqiantu.cn/pink.png\"],\"uniapp_url\":\"/pages/activity/GoodsGroup/index\",\"name\":\"拼团专区\",\"id\":200,\"pic\":\"https://image.dayouqiantu.cn/62ac09d2914d36c65b9b59d2147d809a.png\",\"sort\":5,\"url\":\"/activity/group\",\"wxapp_url\":\"/pages/activity/GoodsGroup/main\",\"status\":1},{\"imageArr\":[\"https://image.dayouqiantu.cn/sign.png\"],\"uniapp_url\":\"/pages/user/signIn/Sign/index\",\"name\":\"积分签到\",\"id\":209,\"pic\":\"https://image.dayouqiantu.cn/29ea4acebbf99e7eaf6f85af2b6d79ae.png\",\"sort\":4,\"url\":\"/user/sign\",\"wxapp_url\":\"/pages/user/signIn/Sign/main\",\"status\":1},{\"imageArr\":[\"https://image.dayouqiantu.cn/sekill.png\"],\"uniapp_url\":\"/pages/activity/GoodsSeckill/index\",\"name\":\"秒杀专区\",\"id\":216,\"pic\":\"https://image.dayouqiantu.cn/b0344c148141b50d68db9722708ea49e.png\",\"sort\":3,\"url\":\"/activity/goods_seckill\",\"wxapp_url\":\"/pages/activity/GoodsSeckill/main\",\"status\":1},{\"imageArr\":[\"https://image.dayouqiantu.cn/bargin.png\"],\"uniapp_url\":\"/pages/activity/GoodsBargain/index\",\"name\":\"砍价专区\",\"id\":217,\"pic\":\"https://image.dayouqiantu.cn/bar.png\",\"sort\":2,\"url\":\"/activity/bargain\",\"wxapp_url\":\"/pages/activity/GoodsBargain/main\",\"status\":1}]},\"index\":4},{\"title\":\"广告\",\"type\":\"adv\",\"componentContent\":{\"detail\":{\"list\":[{\"image\":\"https://wx.yixiang.co/static/images/index001.png\",\"url\":\"\",\"uniapp_url\":\"/pages/user/coupon/GetCoupon/index\",\"wxapp_url\":\"/pages/user/coupon/GetCoupon/index\",\"path_type\":1},{\"image\":\"https://wx.yixiang.co/static/images/index002.png\",\"url\":\"\",\"uniapp_url\":\"/pages/shop/GoodsList/index\",\"wxapp_url\":\"/pages/shop/GoodsList/index\",\"path_type\":1},{\"image\":\"https://wx.yixiang.co/static/images/index003.png\",\"url\":\"\",\"uniapp_url\":\"/pages/shop/GoodsList/index?title=\\\"积分商城\\\"&isIntegral=true\",\"wxapp_url\":\"/pages/shop/GoodsList/index?title=\\\"积分商城\\\"&isIntegral=true\",\"path_type\":1}],\"name\":\"\",\"style\":3}},\"index\":5},{\"title\":\"热门榜单\",\"type\":\"hotCommodity\",\"componentContent\":{},\"index\":6},{\"title\":\"为您推荐\",\"type\":\"promotionGood\",\"componentContent\":{},\"index\":7}]', 1, '1', 0, '2021-02-25 19:36:06', '2021-02-25 22:39:55', 0); + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/sql/新增售后相关sql增量sql b/sql/新增售后相关sql增量sql new file mode 100644 index 0000000..40ac3c3 --- /dev/null +++ b/sql/新增售后相关sql增量sql @@ -0,0 +1,50 @@ +CREATE TABLE `yx_store_after_sales_status` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `store_after_sales_id` bigint(20) DEFAULT NULL COMMENT '售后id', + `change_type` tinyint(1) DEFAULT NULL COMMENT '操作类型', + `change_message` varchar(128) COLLATE utf8_bin DEFAULT NULL COMMENT '操作备注', + `change_time` datetime DEFAULT NULL COMMENT '操作时间', + `operator` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '操作人', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='售后订单操作详情表'; + +CREATE TABLE `yx_store_after_sales_item` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id', + `store_after_sales_id` bigint(20) DEFAULT NULL COMMENT '售后id', + `product_id` bigint(20) DEFAULT NULL COMMENT '商品id', + `cart_info` text COLLATE utf8_bin NOT NULL COMMENT '退货东西的详情信息', + `is_del` bit(1) DEFAULT NULL COMMENT '逻辑删除', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='售后子表'; + + +CREATE TABLE `yx_store_after_sales` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `order_code` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '订单号', + `refund_amount` decimal(32,8) DEFAULT NULL COMMENT '退款金额', + `service_type` tinyint(1) DEFAULT NULL COMMENT '服务类型0仅退款1退货退款', + `reasons` text COLLATE utf8_bin COMMENT '申请原因', + `explains` text COLLATE utf8_bin COMMENT '说明', + `explain_img` text COLLATE utf8_bin COMMENT '说明图片->多个用逗号分割', + `shipper_code` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT '物流公司编码', + `delivery_sn` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '物流单号', + `delivery_name` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '物流名称', + `state` tinyint(1) DEFAULT NULL COMMENT '状态 0已提交等待平台审核 1平台已审核 等待用户发货/退款 2 用户已发货 3退款成功', + `sales_state` tinyint(1) DEFAULT NULL COMMENT '售后状态-0正常1用户取消2商家拒绝', + `create_time` datetime DEFAULT NULL COMMENT '添加时间', + `is_del` tinyint(1) DEFAULT NULL COMMENT '逻辑删除', + `user_id` bigint(20) DEFAULT NULL COMMENT '用户id', + `consignee` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT '商家收货人', + `phone_number` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT '商家手机号', + `address` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT '商家地址', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='售后记录表'; + + +ALTER TABLE yx_store_order_cart_info ADD COLUMN is_after_sales tinyint(1) unsigned zerofill DEFAULT '0' COMMENT '是否能售后 0不能1能'; + + +INSERT INTO `menu` VALUES (266, b'0', '售后', 'shop/afterSeals/index', 53, 44, 'order', 'afterSeals', b'0', b'0', 'AfterSeals', '2021-06-30 15:23:38', 'yxStoreAfterSales:list', 1, '2021-06-30 15:33:14', 0); +INSERT INTO `menu` VALUES (267, b'0', '新增', NULL, 266, 999, NULL, NULL, b'0', b'0', '-', '2021-06-30 15:34:17', 'yxStoreAfterSales:add', 2, NULL, 0); +INSERT INTO `menu` VALUES (268, b'0', '修改', NULL, 266, 999, NULL, NULL, b'0', b'0', '-', '2021-06-30 15:34:39', 'yxStoreAfterSales:edit', 2, NULL, 0); +INSERT INTO `menu` VALUES (269, b'0', '删除', NULL, 266, 999, NULL, NULL, b'0', b'0', '-', '2021-06-30 15:34:55', 'yxStoreAfterSales:del', 2, NULL, 0); \ No newline at end of file diff --git a/yshop-admin/Dockerfile b/yshop-admin/Dockerfile new file mode 100644 index 0000000..f8c3fa6 --- /dev/null +++ b/yshop-admin/Dockerfile @@ -0,0 +1,18 @@ +FROM moxm/java:1.8-full as builder + +MAINTAINER wangiegie@gmail.com + +ENV TZ=Asia/Shanghai +ENV JAVA_OPTS="-Xms128m -Xmx256m -Djava.security.egd=file:/dev/./urandom" + +RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +RUN mkdir -p /yshop-admin + +WORKDIR /yshop-admin + +EXPOSE 8001 + +ADD ./target/yshop-admin-3.2.jar ./ + +CMD java $JAVA_OPTS -jar yshop-admin-3.2.jar --spring.profiles.active=docker diff --git a/yshop-admin/pom.xml b/yshop-admin/pom.xml new file mode 100644 index 0000000..221cc10 --- /dev/null +++ b/yshop-admin/pom.xml @@ -0,0 +1,112 @@ + + + + yshop + co.yixiang + 3.2 + + 4.0.0 + + yshop-admin + 后台管理模块 + + + 0.10.6 + + + + + + co.yixiang + yshop-generator + 3.2 + + + co.yixiang + yshop-common + + + + + co.yixiang + yshop-shop + 3.2 + + + org.springframework.boot + spring-boot-starter-websocket + + + + + + io.jsonwebtoken + jjwt + 0.9.1 + + + + + + + + + + + + + + + + + + + + org.quartz-scheduler + quartz + + + + co.yixiang + yshop-weixin + 3.2 + + + org.springframework.boot + spring-boot-starter-security + + + + + org.springframework.security + spring-security-core + + + org.springframework.security + spring-security-web + + + org.springframework.security + spring-security-config + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + diff --git a/yshop-admin/src/main/java/co/yixiang/AppRun.java b/yshop-admin/src/main/java/co/yixiang/AppRun.java new file mode 100644 index 0000000..f3c881d --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/AppRun.java @@ -0,0 +1,69 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang; + +import co.yixiang.annotation.AnonymousAccess; +import co.yixiang.utils.SpringContextHolder; +import com.binarywang.spring.starter.wxjava.miniapp.config.WxMaAutoConfiguration; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; +import org.springframework.boot.web.servlet.server.ServletWebServerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.transaction.annotation.EnableTransactionManagement; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author hupeng + * @date 2018/11/15 9:20:19 + */ +@EnableAsync +@RestController +@SpringBootApplication(exclude = {WxMaAutoConfiguration.class}) +@EnableTransactionManagement +@MapperScan(basePackages ={"co.yixiang.modules.*.service.mapper", "co.yixiang.config"}) +public class AppRun { + + public static void main(String[] args) { + SpringApplication.run(AppRun.class, args); + System.out.println( + " __ \n" + + " __ __ ___ / / ___ ___ \n" + + " / // /(_-< / _ \\/ _ \\ / _ \\ \n" + + " \\_, //___//_//_/\\___// .__/ \n" + + "/___/ /_/ \n "+ + + "\n意象yshop电商系统管理后台启动成功 \n官网:https://www.yixiang.co 提供技术支持゙ \n"); + } + + @Bean + public SpringContextHolder springContextHolder() { + return new SpringContextHolder(); + } + + @Bean + public ServletWebServerFactory webServerFactory() { + TomcatServletWebServerFactory fa = new TomcatServletWebServerFactory(); + fa.addConnectorCustomizers(connector -> connector.setProperty("relaxedQueryChars", "[]{}")); + return fa; + } + + /** + * 访问首页提示 + * @return / + */ + @GetMapping("/") + @AnonymousAccess + public String index() { + return "Backend service started successfully"; + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/config/ConfigurerAdapter.java b/yshop-admin/src/main/java/co/yixiang/config/ConfigurerAdapter.java new file mode 100644 index 0000000..9c45002 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/config/ConfigurerAdapter.java @@ -0,0 +1,69 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import java.lang.reflect.Array; +import java.util.Arrays; + +/** + * WebMvcConfigurer + * + * @author hupeng + * @date 2018-11-30 + */ +@Configuration(proxyBeanMethods = false) +@EnableWebMvc +public class ConfigurerAdapter implements WebMvcConfigurer { + + @Value("${file.path}") + private String path; + + @Value("${file.avatar}") + private String avatar; + + @Bean + public CorsFilter corsFilter() { + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + CorsConfiguration config = new CorsConfiguration(); + // 允许cookies跨域 + config.setAllowCredentials(true); + // #允许向该服务器提交请求的URI,*表示全部允许,在SpringMVC中,如果设成*,会自动转成当前请求头中的Origin + config.addAllowedOriginPattern("*"); + // #允许访问的头信息,*表示全部 + config.addAllowedHeader("*"); + // 预检请求的缓存时间(秒),即在这个时间段里,对于相同的跨域请求不会再预检了 + config.setMaxAge(18000L); + // 允许提交请求的方法类型,*表示全部允许 + config.addAllowedMethod("OPTIONS"); + config.addAllowedMethod("HEAD"); + config.addAllowedMethod("GET"); + config.addAllowedMethod("PUT"); + config.addAllowedMethod("POST"); + config.addAllowedMethod("DELETE"); + config.addAllowedMethod("PATCH"); + source.registerCorsConfiguration("/**", config); + return new CorsFilter(source); + } + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + String avatarUtl = "file:" + avatar.replace("\\","/"); + String pathUtl = "file:" + path.replace("\\","/"); + registry.addResourceHandler("/avatar/**").addResourceLocations(avatarUtl).setCachePeriod(0); + registry.addResourceHandler("/file/**").addResourceLocations(pathUtl).setCachePeriod(0); + registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/").setCachePeriod(0); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/config/CorsFilter.java b/yshop-admin/src/main/java/co/yixiang/config/CorsFilter.java new file mode 100644 index 0000000..24b4d7e --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/config/CorsFilter.java @@ -0,0 +1,47 @@ +//package co.yixiang.config; +// +///** +// * @author :LionCity +// * @date :Created in 2020-12-21 13:38 +// * @description: +// * @modified By: +// * @version: +// */ +//import java.io.IOException; +// +//import javax.servlet.FilterChain; +//import javax.servlet.ServletException; +//import javax.servlet.http.HttpFilter; +//import javax.servlet.http.HttpServletRequest; +//import javax.servlet.http.HttpServletResponse; +// +//import co.yixiang.utils.StringUtils; +//import org.springframework.core.annotation.Order; +//import org.springframework.http.HttpHeaders; +//import org.springframework.stereotype.Component; +// +//@Component +//@Order(-9999) +//public class CorsFilter extends HttpFilter { +// +// /** +// * +// */ +// private static final long serialVersionUID = -8387103310559517243L; +// +// @Override +// protected void doFilter(HttpServletRequest req, HttpServletResponse res, FilterChain chain) throws IOException, ServletException { +// +// String origin = req.getHeader(HttpHeaders.ORIGIN); +// +// if (!StringUtils.isEmpty(origin)){ +// res.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, origin); +// res.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, "Origin, x-requested-with, Content-Type, Accept, Authorization"); +// res.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true"); +// res.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET, POST, PUT, OPTIONS, DELETE"); +// res.addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "Cache-Control, Content-Language, Content-Type, Expires, Last-Modified, Pragma"); +// res.addHeader(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "60"); +// } +// super.doFilter(req, res, chain); +// } +//} diff --git a/yshop-admin/src/main/java/co/yixiang/config/DataScope.java b/yshop-admin/src/main/java/co/yixiang/config/DataScope.java new file mode 100644 index 0000000..4801cc5 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/config/DataScope.java @@ -0,0 +1,95 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.config; + +import co.yixiang.modules.system.domain.Dept; +import co.yixiang.modules.system.service.DeptService; +import co.yixiang.modules.system.service.RoleService; +import co.yixiang.modules.system.service.UserService; +import co.yixiang.modules.system.service.dto.RoleSmallDto; +import co.yixiang.modules.system.service.dto.UserDto; +import co.yixiang.utils.SecurityUtils; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * 数据权限配置 + * @author hupeng + * @date 2019-4-1 + */ +@Component +public class DataScope { + + private final String[] scopeType = {"全部","本级","自定义"}; + + private final UserService userService; + + private final RoleService roleService; + + private final DeptService deptService; + + public DataScope(UserService userService, RoleService roleService, DeptService deptService) { + this.userService = userService; + this.roleService = roleService; + this.deptService = deptService; + } + + public Set getDeptIds() { + + UserDto user = userService.findByName(SecurityUtils.getUsername()); + + // 用于存储部门id + Set deptIds = new HashSet<>(); + + // 查询用户角色 + List roleSet = roleService.findByUsersId(user.getId()); + + for (RoleSmallDto role : roleSet) { + + if (scopeType[0].equals(role.getDataScope())) { + return new HashSet<>() ; + } + + // 存储本级的数据权限 + if (scopeType[1].equals(role.getDataScope())) { + deptIds.add(user.getDept().getId()); + } + + // 存储自定义的数据权限 + if (scopeType[2].equals(role.getDataScope())) { + Set depts = deptService.findByRoleIds(role.getId()); + for (Dept dept : depts) { + deptIds.add(dept.getId()); + List deptChildren = deptService.findByPid(dept.getId()); + if (deptChildren != null && deptChildren.size() != 0) { + deptIds.addAll(getDeptChildren(deptChildren)); + } + } + } + } + return deptIds; + } + + + public List getDeptChildren(List deptList) { + List list = new ArrayList<>(); + deptList.forEach(dept -> { + if (dept!=null && dept.getEnabled()){ + List depts = deptService.findByPid(dept.getId()); + if(deptList.size() != 0){ + list.addAll(getDeptChildren(depts)); + } + list.add(dept.getId()); + } + } + ); + return list; + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/config/MybatisPlusConfig.java b/yshop-admin/src/main/java/co/yixiang/config/MybatisPlusConfig.java new file mode 100644 index 0000000..c089a24 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/config/MybatisPlusConfig.java @@ -0,0 +1,22 @@ +package co.yixiang.config; + + +import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * MybatisPlus配置 + * + */ +@Configuration(proxyBeanMethods = false) +public class MybatisPlusConfig { + + /** + * mybatis-plus分页插件 + */ + @Bean + public PaginationInterceptor paginationInterceptor() { + return new PaginationInterceptor(); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/config/WebSocketConfig.java b/yshop-admin/src/main/java/co/yixiang/config/WebSocketConfig.java new file mode 100644 index 0000000..69d4583 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/config/WebSocketConfig.java @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.socket.server.standard.ServerEndpointExporter; + +/** + * @author: ZhangHouYing + * @date: 2019-08-24 15:44 + */ +@Configuration(proxyBeanMethods = false) +public class WebSocketConfig { + + @Bean + public ServerEndpointExporter serverEndpointExporter() { + return new ServerEndpointExporter(); + } + +} diff --git a/yshop-admin/src/main/java/co/yixiang/config/thread/AsyncTaskExecutePool.java b/yshop-admin/src/main/java/co/yixiang/config/thread/AsyncTaskExecutePool.java new file mode 100644 index 0000000..929c25d --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/config/thread/AsyncTaskExecutePool.java @@ -0,0 +1,60 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.config.thread; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.AsyncConfigurer; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +import java.util.concurrent.Executor; +import java.util.concurrent.ThreadPoolExecutor; + +/** + * 异步任务线程池装配类 + * @author https://juejin.im/entry/5abb8f6951882555677e9da2 + * @date 2019年10月31日15:06:18 + */ +@Slf4j +@Configuration(proxyBeanMethods = false) +public class AsyncTaskExecutePool implements AsyncConfigurer { + + /** 注入配置类 */ + private final AsyncTaskProperties config; + + public AsyncTaskExecutePool(AsyncTaskProperties config) { + this.config = config; + } + + @Override + public Executor getAsyncExecutor() { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + //核心线程池大小 + executor.setCorePoolSize(config.getCorePoolSize()); + //最大线程数 + executor.setMaxPoolSize(config.getMaxPoolSize()); + //队列容量 + executor.setQueueCapacity(config.getQueueCapacity()); + //活跃时间 + executor.setKeepAliveSeconds(config.getKeepAliveSeconds()); + //线程名字前缀 + executor.setThreadNamePrefix("el-async-"); + // setRejectedExecutionHandler:当pool已经达到max size的时候,如何处理新任务 + // CallerRunsPolicy:不在新线程中执行任务,而是由调用者所在的线程来执行 + executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); + executor.initialize(); + return executor; + } + + @Override + public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { + return (throwable, method, objects) -> { + log.error("===="+throwable.getMessage()+"====", throwable); + log.error("exception method:"+method.getName()); + }; + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/config/thread/AsyncTaskProperties.java b/yshop-admin/src/main/java/co/yixiang/config/thread/AsyncTaskProperties.java new file mode 100644 index 0000000..f84a4be --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/config/thread/AsyncTaskProperties.java @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.config.thread; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * 线程池配置属性类 + * @author https://juejin.im/entry/5abb8f6951882555677e9da2 + * @date 2019年10月31日14:58:18 + */ +@Data +@Component +@ConfigurationProperties(prefix = "task.pool") +public class AsyncTaskProperties { + + private int corePoolSize; + + private int maxPoolSize; + + private int keepAliveSeconds; + + private int queueCapacity; +} diff --git a/yshop-admin/src/main/java/co/yixiang/config/thread/TheadFactoryName.java b/yshop-admin/src/main/java/co/yixiang/config/thread/TheadFactoryName.java new file mode 100644 index 0000000..ca78a6a --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/config/thread/TheadFactoryName.java @@ -0,0 +1,53 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.config.thread; + +import org.springframework.stereotype.Component; + +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * 自定义线程名称 + * @author hupeng + * @date 2019年10月31日17:49:55 + */ +@Component +public class TheadFactoryName implements ThreadFactory { + + private static final AtomicInteger POOL_NUMBER = new AtomicInteger(1); + private final ThreadGroup group; + private final AtomicInteger threadNumber = new AtomicInteger(1); + private final String namePrefix; + + public TheadFactoryName() { + this("el-pool"); + } + + private TheadFactoryName(String name){ + SecurityManager s = System.getSecurityManager(); + group = (s != null) ? s.getThreadGroup() : + Thread.currentThread().getThreadGroup(); + //此时namePrefix就是 name + 第几个用这个工厂创建线程池的 + this.namePrefix = name + + POOL_NUMBER.getAndIncrement(); + } + + @Override + public Thread newThread(Runnable r) { + //此时线程的名字 就是 namePrefix + -thread- + 这个线程池中第几个执行的线程 + Thread t = new Thread(group, r, + namePrefix + "-thread-"+threadNumber.getAndIncrement(), + 0); + if (t.isDaemon()) { + t.setDaemon(false); + } + if (t.getPriority() != Thread.NORM_PRIORITY) { + t.setPriority(Thread.NORM_PRIORITY); + } + return t; + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/config/thread/ThreadPoolExecutorUtil.java b/yshop-admin/src/main/java/co/yixiang/config/thread/ThreadPoolExecutorUtil.java new file mode 100644 index 0000000..9f1411a --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/config/thread/ThreadPoolExecutorUtil.java @@ -0,0 +1,32 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.config.thread; + +import co.yixiang.utils.SpringContextHolder; + +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * 用于获取自定义线程池 + * @author hupeng + * @date 2019年10月31日18:16:47 + */ +public class ThreadPoolExecutorUtil { + + public static ThreadPoolExecutor getPoll(){ + AsyncTaskProperties properties = SpringContextHolder.getBean(AsyncTaskProperties.class); + return new ThreadPoolExecutor( + properties.getCorePoolSize(), + properties.getMaxPoolSize(), + properties.getKeepAliveSeconds(), + TimeUnit.SECONDS, + new ArrayBlockingQueue<>(properties.getQueueCapacity()), + new TheadFactoryName() + ); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/handler/ApiErr.java b/yshop-admin/src/main/java/co/yixiang/handler/ApiErr.java new file mode 100644 index 0000000..6fe5b29 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/handler/ApiErr.java @@ -0,0 +1,36 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.handler; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author hupeng + * @since 2019-10-02 + */ +@Data +class ApiErr { + + private Integer status; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime timestamp; + private String msg; + + private ApiErr() { + timestamp = LocalDateTime.now(); + } + + public ApiErr(Integer status, String message) { + this(); + this.status = status; + this.msg = message; + } +} + + diff --git a/yshop-admin/src/main/java/co/yixiang/handler/ApiError.java b/yshop-admin/src/main/java/co/yixiang/handler/ApiError.java new file mode 100644 index 0000000..94ebac4 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/handler/ApiError.java @@ -0,0 +1,43 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.handler; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author Zheng Jie + * @date 2018-11-23 + */ +@Data +class ApiError { + + private Integer status = 400; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime timestamp; + private String message; + + private ApiError() { + timestamp = LocalDateTime.now(); + } + + public static ApiError error(String message){ + ApiError apiError = new ApiError(); + apiError.setMessage(message); + return apiError; + } + + public static ApiError error(Integer status, String message){ + ApiError apiError = new ApiError(); + apiError.setStatus(status); + apiError.setMessage(message); + return apiError; + } +} + + diff --git a/yshop-admin/src/main/java/co/yixiang/handler/GlobalExceptionHandler.java b/yshop-admin/src/main/java/co/yixiang/handler/GlobalExceptionHandler.java new file mode 100644 index 0000000..99f9a83 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/handler/GlobalExceptionHandler.java @@ -0,0 +1,130 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.handler; + +import co.yixiang.exception.BadRequestException; +import co.yixiang.exception.EntityExistException; +import co.yixiang.exception.EntityNotFoundException; +import co.yixiang.exception.ErrorRequestException; +import co.yixiang.utils.ThrowableUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +import java.util.Objects; + +import static org.springframework.http.HttpStatus.NOT_FOUND; +import static org.springframework.http.HttpStatus.valueOf; + +/** + * @author Zheng Jie + * @date 2018-11-23 + */ +@Slf4j +@RestControllerAdvice +@SuppressWarnings("unchecked") +public class GlobalExceptionHandler { + + /** + * 处理所有不可知的异常 + */ + @ExceptionHandler(Throwable.class) + public ResponseEntity handleException(Throwable e){ + // 打印堆栈信息 + log.error(ThrowableUtil.getStackTrace(e)); + return buildResponseEntity(ApiError.error(e.getMessage())); + } + + /** + * BadCredentialsException + */ + @ExceptionHandler(BadCredentialsException.class) + public ResponseEntity badCredentialsException(BadCredentialsException e){ + // 打印堆栈信息 + String message = "坏的凭证".equals(e.getMessage()) ? "用户名或密码不正确" : e.getMessage(); + log.error(message); + return buildResponseEntity(ApiError.error(message)); + } + + /** + * 处理自定义异常 + */ + @ExceptionHandler(value = BadRequestException.class) + public ResponseEntity badRequestException(BadRequestException e) { + // 打印堆栈信息 + log.error(ThrowableUtil.getStackTrace(e)); + return buildResponseEntity(ApiError.error(e.getStatus(),e.getMessage())); + } + + /** + * 处理自定义异常 + * @param e + * @return + */ + @ExceptionHandler(value = ErrorRequestException.class) + public ResponseEntity errorRequestException(ErrorRequestException e) { + // 打印堆栈信息 + log.error(ThrowableUtil.getStackTrace(e)); + ApiErr apiError = new ApiErr(e.getStatus(),e.getMessage()); + return buildResponseEntity2(apiError); + } + + /** + * 处理 EntityExist + */ + @ExceptionHandler(value = EntityExistException.class) + public ResponseEntity entityExistException(EntityExistException e) { + // 打印堆栈信息 + log.error(ThrowableUtil.getStackTrace(e)); + return buildResponseEntity(ApiError.error(e.getMessage())); + } + + /** + * 处理 EntityNotFound + */ + @ExceptionHandler(value = EntityNotFoundException.class) + public ResponseEntity entityNotFoundException(EntityNotFoundException e) { + // 打印堆栈信息 + log.error(ThrowableUtil.getStackTrace(e)); + return buildResponseEntity(ApiError.error(NOT_FOUND.value(),e.getMessage())); + } + + /** + * 处理所有接口数据验证异常 + */ + @ExceptionHandler(MethodArgumentNotValidException.class) + public ResponseEntity handleMethodArgumentNotValidException(MethodArgumentNotValidException e){ + // 打印堆栈信息 + log.error(ThrowableUtil.getStackTrace(e)); + String[] str = Objects.requireNonNull(e.getBindingResult().getAllErrors().get(0).getCodes())[1].split("\\."); + String message = e.getBindingResult().getAllErrors().get(0).getDefaultMessage(); + String msg = "不能为空"; + if(msg.equals(message)){ + message = str[1] + ":" + message; + } + return buildResponseEntity(ApiError.error(message)); + } + + /** + * 统一返回 + */ + private ResponseEntity buildResponseEntity(ApiError apiError) { + return new ResponseEntity<>(apiError, valueOf(apiError.getStatus())); + } + + /** + * 统一返回 + * @param apiError + * @return + */ + private ResponseEntity buildResponseEntity2(ApiErr apiError) { + return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus())); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/monitor/config/VisitsInitialization.java b/yshop-admin/src/main/java/co/yixiang/modules/monitor/config/VisitsInitialization.java new file mode 100644 index 0000000..9abe0e0 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/monitor/config/VisitsInitialization.java @@ -0,0 +1,26 @@ +package co.yixiang.modules.monitor.config; + +import co.yixiang.modules.monitor.service.VisitsService; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; + +/** + * 初始化站点统计 + * @author Zheng Jie + */ +//@Component +public class VisitsInitialization implements ApplicationRunner { + + private final VisitsService visitsService; + + public VisitsInitialization(VisitsService visitsService) { + this.visitsService = visitsService; + } + + @Override + public void run(ApplicationArguments args){ + System.out.println("--------------- 初始化站点统计,如果存在今日统计则跳过 ---------------"); + visitsService.save(); + System.out.println("--------------- 初始化站点统计完成 ---------------"); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/monitor/domain/Visits.java b/yshop-admin/src/main/java/co/yixiang/modules/monitor/domain/Visits.java new file mode 100644 index 0000000..e4ba27f --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/monitor/domain/Visits.java @@ -0,0 +1,35 @@ +package co.yixiang.modules.monitor.domain; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * pv 与 ip 统计 + * + * @author Zheng Jie + * @date 2018-12-13 + */ +@Data +@TableName( "visits") +public class Visits implements Serializable { + + @TableId + private Long id; + + private String date; + + private Long pvCounts; + + private Long ipCounts; + + @TableField(fill = FieldFill.INSERT) + private Timestamp createTime; + + private String weekDay; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/monitor/domain/vo/RedisVo.java b/yshop-admin/src/main/java/co/yixiang/modules/monitor/domain/vo/RedisVo.java new file mode 100644 index 0000000..02cd0ca --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/monitor/domain/vo/RedisVo.java @@ -0,0 +1,24 @@ +package co.yixiang.modules.monitor.domain.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @author Zheng Jie + * @date 2018-12-10 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class RedisVo implements Serializable { + + @NotBlank + private String key; + + @NotBlank + private String value; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/monitor/rest/LimitController.java b/yshop-admin/src/main/java/co/yixiang/modules/monitor/rest/LimitController.java new file mode 100644 index 0000000..d81a038 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/monitor/rest/LimitController.java @@ -0,0 +1,34 @@ +package co.yixiang.modules.monitor.rest; + +import co.yixiang.annotation.AnonymousAccess; +import co.yixiang.annotation.Limit; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.concurrent.atomic.AtomicInteger; + +/** + * @author / + * 接口限流测试类 + */ +@RestController +@RequestMapping("/api/limit") +@Api(tags = "系统:限流测试管理") +public class LimitController { + + private static final AtomicInteger ATOMIC_INTEGER = new AtomicInteger(); + + /** + * 测试限流注解,下面配置说明该接口 60秒内最多只能访问 10次,保存到redis的键名为 limit_test, + */ + @GetMapping + @AnonymousAccess + @ApiOperation("测试") + @Limit(key = "test", period = 60, count = 10, name = "testLimit", prefix = "limit") + public int testLimit() { + return ATOMIC_INTEGER.incrementAndGet(); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/monitor/rest/RedisController.java b/yshop-admin/src/main/java/co/yixiang/modules/monitor/rest/RedisController.java new file mode 100644 index 0000000..3efbcfb --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/monitor/rest/RedisController.java @@ -0,0 +1,55 @@ +package co.yixiang.modules.monitor.rest; + +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.monitor.domain.vo.RedisVo; +import co.yixiang.modules.monitor.service.RedisService; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author Zheng Jie + * @date 2018-12-10 + */ +@Api(tags = "redis缓存管理") +@RestController +@RequestMapping("api") +public class RedisController { + + @Autowired + private RedisService redisService; + + @Log("查询Redis缓存") + @GetMapping(value = "/redis") + @PreAuthorize("hasAnyRole('ADMIN','REDIS_ALL','REDIS_SELECT')") + public ResponseEntity getRedis(String key, Pageable pageable){ + return new ResponseEntity(redisService.findByKey(key,pageable), HttpStatus.OK); + } + + @ForbidSubmit + @Log("删除Redis缓存") + @DeleteMapping(value = "/redis") + @PreAuthorize("hasAnyRole('ADMIN','REDIS_ALL','REDIS_DELETE')") + public ResponseEntity delete(@RequestBody RedisVo resources){ + redisService.delete(resources.getKey()); + return new ResponseEntity(HttpStatus.OK); + } + + @ForbidSubmit + @Log("清空Redis缓存") + @DeleteMapping(value = "/redis/all") + @PreAuthorize("hasAnyRole('ADMIN','REDIS_ALL','REDIS_DELETE')") + public ResponseEntity deleteAll(){ + redisService.flushdb(); + return new ResponseEntity(HttpStatus.OK); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/monitor/rest/VisitsController.java b/yshop-admin/src/main/java/co/yixiang/modules/monitor/rest/VisitsController.java new file mode 100644 index 0000000..6ce3a61 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/monitor/rest/VisitsController.java @@ -0,0 +1,47 @@ +package co.yixiang.modules.monitor.rest; + +import co.yixiang.modules.monitor.service.VisitsService; +import co.yixiang.utils.RequestHolder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author Zheng Jie + * @date 2018-12-13 + */ +@RestController +@RequestMapping("/api/visits") +@Api(tags = "系统:访问记录管理") +public class VisitsController { + + private final VisitsService visitsService; + + public VisitsController(VisitsService visitsService) { + this.visitsService = visitsService; + } + + @PostMapping + @ApiOperation("创建访问记录") + public ResponseEntity create(){ + visitsService.count(RequestHolder.getHttpServletRequest()); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @GetMapping + @ApiOperation("查询") + public ResponseEntity get(){ + return new ResponseEntity<>(visitsService.get(),HttpStatus.OK); + } + + @GetMapping(value = "/chartData") + @ApiOperation("查询图表数据") + public ResponseEntity getChartData(){ + return new ResponseEntity<>(visitsService.getChartData(),HttpStatus.OK); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/monitor/service/RedisService.java b/yshop-admin/src/main/java/co/yixiang/modules/monitor/service/RedisService.java new file mode 100644 index 0000000..0838343 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/monitor/service/RedisService.java @@ -0,0 +1,44 @@ +package co.yixiang.modules.monitor.service; + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +/** + * 可自行扩展 + * @author Zheng Jie + * @date 2018-12-10 + */ +public interface RedisService { + + /** + * findById + * @param key + * @return + */ + Page findByKey(String key, Pageable pageable); + + /** + * 查询验证码的值 + * @param key + * @return + */ + String getCodeVal(String key); + + /** + * 保存验证码 + * @param key + * @param val + */ + void saveCode(String key, Object val); + + /** + * delete + * @param key + */ + void delete(String key); + + /** + * 清空所有缓存 + */ + void flushdb(); +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/monitor/service/VisitsService.java b/yshop-admin/src/main/java/co/yixiang/modules/monitor/service/VisitsService.java new file mode 100644 index 0000000..74ebb41 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/monitor/service/VisitsService.java @@ -0,0 +1,38 @@ +package co.yixiang.modules.monitor.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.monitor.domain.Visits; +import org.springframework.scheduling.annotation.Async; + +import javax.servlet.http.HttpServletRequest; + +/** + * @author Zheng Jie + * @date 2018-12-13 + */ +public interface VisitsService extends BaseService { + + /** + * 提供给定时任务,每天0点执行 + */ + void save(); + + /** + * 新增记录 + * @param request / + */ + @Async + void count(HttpServletRequest request); + + /** + * 获取数据 + * @return / + */ + Object get(); + + /** + * getChartData + * @return / + */ + Object getChartData(); +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/monitor/service/impl/RedisServiceImpl.java b/yshop-admin/src/main/java/co/yixiang/modules/monitor/service/impl/RedisServiceImpl.java new file mode 100644 index 0000000..a6b06b5 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/monitor/service/impl/RedisServiceImpl.java @@ -0,0 +1,87 @@ +package co.yixiang.modules.monitor.service.impl; + +import co.yixiang.modules.monitor.domain.vo.RedisVo; +import co.yixiang.modules.monitor.service.RedisService; +import co.yixiang.utils.PageUtil; +import co.yixiang.utils.ShopKeyUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.Pageable; +import org.springframework.data.redis.connection.DataType; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * @author Zheng Jie + * @date 2018-12-10 + */ +@Service +public class RedisServiceImpl implements RedisService { + + @Autowired + RedisTemplate redisTemplate; + + @Value("${loginCode.expiration}") + private Long expiration; + + @Override + public Page findByKey(String key, Pageable pageable){ + List redisVos = new ArrayList<>(); + if(!"*".equals(key)){ + key = "*" + key + "*"; + } + for (Object s : redisTemplate.keys(key)) { + // 过滤掉权限的缓存 + if (s.toString().indexOf("role::loadPermissionByUser") != -1 + || s.toString().indexOf("user::loadUserByUsername") != -1 + || s.toString().indexOf("wechat") != -1 + || s.toString().indexOf("wxpay") != -1 + || s.toString().indexOf(ShopKeyUtils.getSiteUrl()) != -1) { + continue; + } + DataType dataType = redisTemplate.type(s.toString()); + if(!"string".equals(dataType.code())) { + continue; + } + RedisVo redisVo = new RedisVo(s.toString(),redisTemplate.opsForValue().get(s.toString()).toString()); + redisVos.add(redisVo); + } + Page page = new PageImpl( + PageUtil.toPage(pageable.getPageNumber(),pageable.getPageSize(),redisVos), + pageable, + redisVos.size()); + return page; + } + + @Override + public void delete(String key) { + redisTemplate.delete(key); + } + + @Override + public void flushdb() { + redisTemplate.getConnectionFactory().getConnection().flushDb(); + } + + @Override + public String getCodeVal(String key) { + try { + String value = redisTemplate.opsForValue().get(key).toString(); + return value; + }catch (Exception e){ + return ""; + } + } + + @Override + public void saveCode(String key, Object val) { + redisTemplate.opsForValue().set(key,val); + redisTemplate.expire(key,expiration, TimeUnit.MINUTES); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/monitor/service/impl/VisitsServiceImpl.java b/yshop-admin/src/main/java/co/yixiang/modules/monitor/service/impl/VisitsServiceImpl.java new file mode 100644 index 0000000..4d076df --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/monitor/service/impl/VisitsServiceImpl.java @@ -0,0 +1,102 @@ +package co.yixiang.modules.monitor.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.logging.service.mapper.LogMapper; +import co.yixiang.modules.monitor.domain.Visits; +import co.yixiang.modules.monitor.service.VisitsService; +import co.yixiang.modules.monitor.service.mapper.VisitsMapper; +import co.yixiang.utils.StringUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletRequest; +import java.time.LocalDate; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author hupeng + * @date 2018-12-13 + */ +@Slf4j +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class VisitsServiceImpl extends BaseServiceImpl implements VisitsService { + + + private final LogMapper logMapper; + + private final VisitsMapper visitsMapper; + + public VisitsServiceImpl(LogMapper logMapper, VisitsMapper visitsMapper) { + this.logMapper = logMapper; + this.visitsMapper = visitsMapper; + } + + + @Override + public void save() { + LocalDate localDate = LocalDate.now(); + Visits visits = this.getOne(new LambdaQueryWrapper() + .eq(Visits::getDate,localDate.toString())); + if(visits == null){ + visits = new Visits(); + visits.setWeekDay(StringUtils.getWeekDay()); + visits.setPvCounts(1L); + visits.setIpCounts(1L); + visits.setDate(localDate.toString()); + this.save(visits); + } + } + + @Override + public void count(HttpServletRequest request) { + LocalDate localDate = LocalDate.now(); + Visits visits = this.getOne(new LambdaQueryWrapper() + .eq(Visits::getDate,localDate.toString())); + if (visits == null) { + visits = new Visits(); + visits.setPvCounts(1L); + } else { + visits.setPvCounts(visits.getPvCounts()+1); + } + long ipCounts = logMapper.findIp(localDate.toString(), localDate.plusDays(1).toString()); + visits.setIpCounts(ipCounts); + this.saveOrUpdate(visits); + } + + @Override + public Object get() { + Map map = new HashMap<>(4); + LocalDate localDate = LocalDate.now(); + Visits visits = this.getOne(new LambdaQueryWrapper() + .eq(Visits::getDate,localDate.toString())); + List list = visitsMapper.findAllVisits(localDate.minusDays(6).toString(),localDate.plusDays(1).toString()); + + long recentVisits = 0, recentIp = 0; + for (Visits data : list) { + recentVisits += data.getPvCounts(); + recentIp += data.getIpCounts(); + } + map.put("newVisits",visits.getPvCounts()); + map.put("newIp",visits.getIpCounts()); + map.put("recentVisits",recentVisits); + map.put("recentIp",recentIp); + return map; + } + + @Override + public Object getChartData() { + Map map = new HashMap<>(3); +// LocalDate localDate = LocalDate.now(); +// List list = visitsRepository.findAllVisits(localDate.minusDays(6).toString(),localDate.plusDays(1).toString()); +// map.put("weekDays",list.stream().map(Visits::getWeekDay).collect(Collectors.toList())); +// map.put("visitsData",list.stream().map(Visits::getPvCounts).collect(Collectors.toList())); +// map.put("ipData",list.stream().map(Visits::getIpCounts).collect(Collectors.toList())); + return map; + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/monitor/service/mapper/VisitsMapper.java b/yshop-admin/src/main/java/co/yixiang/modules/monitor/service/mapper/VisitsMapper.java new file mode 100644 index 0000000..6a0b5b3 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/monitor/service/mapper/VisitsMapper.java @@ -0,0 +1,15 @@ +package co.yixiang.modules.monitor.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.monitor.domain.Visits; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface VisitsMapper extends CoreMapper { + @Select("select * FROM visits where create_time between #{time1} and #{time2}") + List findAllVisits(@Param("time1") String time1, @Param("time2")String time2); +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/quartz/config/JobRunner.java b/yshop-admin/src/main/java/co/yixiang/modules/quartz/config/JobRunner.java new file mode 100644 index 0000000..c781a3b --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/quartz/config/JobRunner.java @@ -0,0 +1,44 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.quartz.config; + +import co.yixiang.modules.quartz.domain.QuartzJob; +import co.yixiang.modules.quartz.service.QuartzJobService; +import co.yixiang.modules.quartz.utils.QuartzManage; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @author hupeng + * @date 2019-01-07 + */ +@Component +public class JobRunner implements ApplicationRunner { + + private final QuartzJobService quartzJobService; + + private final QuartzManage quartzManage; + + public JobRunner(QuartzJobService quartzJobService, QuartzManage quartzManage) { + this.quartzJobService = quartzJobService; + this.quartzManage = quartzManage; + } + + /** + * 项目启动时重新激活启用的定时任务 + * @param applicationArguments / + */ + @Override + public void run(ApplicationArguments applicationArguments){ + System.out.println("--------------------注入定时任务---------------------"); + List quartzJobs = quartzJobService.findByIsPauseIsFalse(); + quartzJobs.forEach(quartzManage::addJob); + System.out.println("--------------------定时任务注入完成---------------------"); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/quartz/config/QuartzConfig.java b/yshop-admin/src/main/java/co/yixiang/modules/quartz/config/QuartzConfig.java new file mode 100644 index 0000000..47df605 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/quartz/config/QuartzConfig.java @@ -0,0 +1,62 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.quartz.config; + +import org.quartz.Scheduler; +import org.quartz.spi.TriggerFiredBundle; +import org.springframework.beans.factory.config.AutowireCapableBeanFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.quartz.AdaptableJobFactory; +import org.springframework.scheduling.quartz.SchedulerFactoryBean; +import org.springframework.stereotype.Component; + +/** + * 定时任务配置 + * @author / + * @date 2019-01-07 + */ +@Configuration(proxyBeanMethods = false) +public class QuartzConfig { + + /** + * 解决Job中注入Spring Bean为null的问题 + */ + @Component("quartzJobFactory") + public static class QuartzJobFactory extends AdaptableJobFactory { + + private final AutowireCapableBeanFactory capableBeanFactory; + + public QuartzJobFactory(AutowireCapableBeanFactory capableBeanFactory) { + this.capableBeanFactory = capableBeanFactory; + } + + @Override + protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception { + + //调用父类的方法 + Object jobInstance = super.createJobInstance(bundle); + capableBeanFactory.autowireBean(jobInstance); + return jobInstance; + } + } + + /** + * 注入scheduler到spring + * @param quartzJobFactory / + * @return Scheduler + * @throws Exception / + */ + @Bean(name = "scheduler") + public Scheduler scheduler(QuartzJobFactory quartzJobFactory) throws Exception { + SchedulerFactoryBean factoryBean=new SchedulerFactoryBean(); + factoryBean.setJobFactory(quartzJobFactory); + factoryBean.afterPropertiesSet(); + Scheduler scheduler=factoryBean.getScheduler(); + scheduler.start(); + return scheduler; + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/quartz/domain/QuartzJob.java b/yshop-admin/src/main/java/co/yixiang/modules/quartz/domain/QuartzJob.java new file mode 100644 index 0000000..b5c6d52 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/quartz/domain/QuartzJob.java @@ -0,0 +1,65 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.quartz.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** +* @author hupeng +* @date 2020-05-13 +*/ + +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("quartz_job") +public class QuartzJob extends BaseDomain { + + public static final String JOB_KEY = "JOB_KEY"; + + /** 定时任务ID */ + @TableId + private Long id; + + + /** Spring Bean名称 */ + private String beanName; + + + /** cron 表达式 */ + private String cronExpression; + + + /** 状态:1暂停、0启用 */ + private Boolean isPause; + + + /** 任务名称 */ + private String jobName; + + + /** 方法名称 */ + private String methodName; + + + /** 参数 */ + private String params; + + + /** 备注 */ + private String remark; + + + + public void copy(QuartzJob source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/quartz/domain/QuartzLog.java b/yshop-admin/src/main/java/co/yixiang/modules/quartz/domain/QuartzLog.java new file mode 100644 index 0000000..5bee2eb --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/quartz/domain/QuartzLog.java @@ -0,0 +1,65 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.quartz.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-13 +*/ + +@Data +@TableName("quartz_log") +public class QuartzLog extends BaseDomain { + + /** 任务日志ID */ + @TableId + private Long id; + + + /** 任务名称 */ + private String baenName; + + + + /** cron表达式 */ + private String cronExpression; + + + /** 异常详细 */ + private String exceptionDetail; + + + /** 状态 */ + private Boolean isSuccess; + + + /** 任务名称 */ + private String jobName; + + + /** 方法名称 */ + private String methodName; + + + /** 参数 */ + private String params; + + + /** 耗时(毫秒) */ + private Long time; + + + public void copy(QuartzLog source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/quartz/rest/QuartzJobController.java b/yshop-admin/src/main/java/co/yixiang/modules/quartz/rest/QuartzJobController.java new file mode 100644 index 0000000..b94c9ac --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/quartz/rest/QuartzJobController.java @@ -0,0 +1,150 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.quartz.rest; + +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.exception.BadRequestException; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.quartz.domain.QuartzJob; +import co.yixiang.modules.quartz.service.QuartzJobService; +import co.yixiang.modules.quartz.service.QuartzLogService; +import co.yixiang.modules.quartz.service.dto.QuartzJobDto; +import co.yixiang.modules.quartz.service.dto.QuartzJobQueryCriteria; +import co.yixiang.modules.quartz.service.dto.QuartzLogDto; +import co.yixiang.modules.quartz.service.dto.QuartzLogQueryCriteria; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; + +/** + * @author hupeng + * @date 2019-01-07 + */ +@Slf4j +@RestController +@Api(tags = "系统:定时任务管理") +@RequestMapping("/api/jobs") +public class QuartzJobController { + + private static final String ENTITY_NAME = "quartzJob"; + + private final QuartzJobService quartzJobService; + private final IGenerator generator; + private final QuartzLogService quartzLogService; + + + + public QuartzJobController(QuartzJobService quartzJobService, IGenerator generator, QuartzLogService quartzLogService) { + this.quartzJobService = quartzJobService; + this.generator = generator; + this.quartzLogService = quartzLogService; + } + + @Log("查询定时任务") + @ApiOperation("查询定时任务") + @GetMapping + @PreAuthorize("@el.check('admin','timing:list')") + public ResponseEntity getJobs(QuartzJobQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(quartzJobService.queryAll(criteria,pageable), HttpStatus.OK); + } + + @Log("导出任务数据") + @ApiOperation("导出任务数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('admin','timing:list')") + public void download(HttpServletResponse response, QuartzJobQueryCriteria criteria) throws IOException { + quartzJobService.download(generator.convert(quartzJobService.queryAll(criteria),QuartzJobDto.class), response); + } + + @Log("导出日志数据") + @ApiOperation("导出日志数据") + @GetMapping(value = "/logs/download") + @PreAuthorize("@el.check('admin','timing:list')") + public void downloadLog(HttpServletResponse response, QuartzLogQueryCriteria criteria) throws IOException { + quartzLogService.download(generator.convert(quartzLogService.queryAll(criteria), QuartzLogDto.class), response); + } + + @ApiOperation("查询任务执行日志") + @GetMapping(value = "/logs") + @PreAuthorize("@el.check('admin','timing:list')") + public ResponseEntity getJobLogs(QuartzLogQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(quartzLogService.queryAll(criteria,pageable), HttpStatus.OK); + } + + @ForbidSubmit + @Log("新增定时任务") + @ApiOperation("新增定时任务") + @PostMapping + @PreAuthorize("@el.check('admin','timing:add')") + public ResponseEntity create(@Validated @RequestBody QuartzJob resources){ + if (resources.getId() != null) { + throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); + } + return new ResponseEntity<>(quartzJobService.save(resources),HttpStatus.CREATED); + } + + @ForbidSubmit + @Log("修改定时任务") + @ApiOperation("修改定时任务") + @PutMapping + @PreAuthorize("@el.check('admin','timing:edit')") + public ResponseEntity update(@Validated @RequestBody QuartzJob resources){ + quartzJobService.updateById(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("更改定时任务状态") + @ApiOperation("更改定时任务状态") + @PutMapping(value = "/{id}") + @PreAuthorize("@el.check('admin','timing:edit')") + public ResponseEntity updateIsPause(@PathVariable Long id){ + quartzJobService.updateIsPause(quartzJobService.getOne(new LambdaQueryWrapper() + .eq(QuartzJob::getId,id))); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("执行定时任务") + @ApiOperation("执行定时任务") + @PutMapping(value = "/exec/{id}") + @PreAuthorize("@el.check('admin','timing:edit')") + public ResponseEntity execution(@PathVariable Long id){ + quartzJobService.execution(quartzJobService.getOne(new LambdaQueryWrapper().eq(QuartzJob::getId,id))); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除定时任务") + @ApiOperation("删除定时任务") + @DeleteMapping + @PreAuthorize("@el.check('admin','timing:del')") + public ResponseEntity delete(@RequestBody Integer[] ids){ + quartzJobService.removeByIds(new ArrayList<>(Arrays.asList(ids))); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/QuartzJobService.java b/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/QuartzJobService.java new file mode 100644 index 0000000..bb8c5f6 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/QuartzJobService.java @@ -0,0 +1,67 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.quartz.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.quartz.domain.QuartzJob; +import co.yixiang.modules.quartz.service.dto.QuartzJobDto; +import co.yixiang.modules.quartz.service.dto.QuartzJobQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * @author hupeng + * @date 2020-05-13 + */ +public interface QuartzJobService extends BaseService{ + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(QuartzJobQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(QuartzJobQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + + /** + * 更改定时任务状态 + * @param quartzJob / + */ + void updateIsPause(QuartzJob quartzJob); + + /** + * 立即执行定时任务 + * @param quartzJob / + */ + void execution(QuartzJob quartzJob); + + /** + * 查询启用的任务 + * @return List + */ + List findByIsPauseIsFalse(); + void removeByIds(List idList); +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/QuartzLogService.java b/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/QuartzLogService.java new file mode 100644 index 0000000..8fa8350 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/QuartzLogService.java @@ -0,0 +1,47 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.quartz.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.quartz.domain.QuartzLog; +import co.yixiang.modules.quartz.service.dto.QuartzLogDto; +import co.yixiang.modules.quartz.service.dto.QuartzLogQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +public interface QuartzLogService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(QuartzLogQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(QuartzLogQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/dto/QuartzJobDto.java b/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/dto/QuartzJobDto.java new file mode 100644 index 0000000..155f237 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/dto/QuartzJobDto.java @@ -0,0 +1,47 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.quartz.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class QuartzJobDto implements Serializable { + + /** 定时任务ID */ + private Long id; + + /** Bean名称 */ + private String beanName; + + /** cron 表达式 */ + private String cronExpression; + + /** 状态:1暂停、0启用 */ + private Boolean isPause; + + /** 任务名称 */ + private String jobName; + + /** 方法名称 */ + private String methodName; + + /** 参数 */ + private String params; + + /** 备注 */ + private String remark; + + /** 创建日期 */ + private Timestamp createTime; + +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/dto/QuartzJobQueryCriteria.java b/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/dto/QuartzJobQueryCriteria.java new file mode 100644 index 0000000..5269188 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/dto/QuartzJobQueryCriteria.java @@ -0,0 +1,32 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.quartz.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +import java.sql.Timestamp; +import java.util.List; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class QuartzJobQueryCriteria{ + + @Query(type = Query.Type.INNER_LIKE) + private String jobName; + + @Query + private Boolean isSuccess; + + @Query + private Boolean isPause; + + @Query(type = Query.Type.BETWEEN) + private List createTime; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/dto/QuartzLogDto.java b/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/dto/QuartzLogDto.java new file mode 100644 index 0000000..f5bf806 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/dto/QuartzLogDto.java @@ -0,0 +1,46 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.quartz.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class QuartzLogDto implements Serializable { + + /** 定时任务名称 */ + private String baenName; + + /** Bean名称 */ + private Timestamp createTime; + + /** cron表达式 */ + private String cronExpression; + + /** 异常详细 */ + private String exceptionDetail; + + /** 状态 */ + private Boolean isSuccess; + + /** 任务名称 */ + private String jobName; + + /** 方法名称 */ + private String methodName; + + /** 参数 */ + private String params; + + /** 耗时(毫秒) */ + private Long time; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/dto/QuartzLogQueryCriteria.java b/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/dto/QuartzLogQueryCriteria.java new file mode 100644 index 0000000..09697b9 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/dto/QuartzLogQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.quartz.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class QuartzLogQueryCriteria{ +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/impl/QuartzJobServiceImpl.java b/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/impl/QuartzJobServiceImpl.java new file mode 100644 index 0000000..7f39b61 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/impl/QuartzJobServiceImpl.java @@ -0,0 +1,168 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + */ +package co.yixiang.modules.quartz.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.exception.BadRequestException; +import co.yixiang.modules.quartz.domain.QuartzJob; +import co.yixiang.modules.quartz.service.QuartzJobService; +import co.yixiang.modules.quartz.service.dto.QuartzJobDto; +import co.yixiang.modules.quartz.service.dto.QuartzJobQueryCriteria; +import co.yixiang.modules.quartz.service.mapper.QuartzJobMapper; +import co.yixiang.modules.quartz.utils.QuartzManage; +import co.yixiang.utils.FileUtil; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; + +/** + * @author hupeng + * @date 2020-05-13 + */ +@Service +@AllArgsConstructor +//@CacheConfig(cacheNames = "quartzJob") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class QuartzJobServiceImpl extends BaseServiceImpl implements QuartzJobService { + + private final IGenerator generator; + private final QuartzManage quartzManage; + + @Override + //@Cacheable + public Map queryAll(QuartzJobQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), QuartzJobDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(QuartzJobQueryCriteria criteria) { + return baseMapper.selectList(QueryHelpPlus.getPredicate(QuartzJob.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (QuartzJobDto quartzJob : all) { + Map map = new LinkedHashMap<>(); + map.put("Spring Bean名称", quartzJob.getBeanName()); + map.put("cron 表达式", quartzJob.getCronExpression()); + map.put("状态:1暂停、0启用", quartzJob.getIsPause()); + map.put("任务名称", quartzJob.getJobName()); + map.put("方法名称", quartzJob.getMethodName()); + map.put("参数", quartzJob.getParams()); + map.put("备注", quartzJob.getRemark()); + map.put("创建日期", quartzJob.getCreateTime()); + map.put("Spring Bean名称", quartzJob.getBeanName()); + map.put("cron 表达式", quartzJob.getCronExpression()); + map.put("状态:1暂停、0启用", quartzJob.getIsPause()); + map.put("任务名称", quartzJob.getJobName()); + map.put("方法名称", quartzJob.getMethodName()); + map.put("参数", quartzJob.getParams()); + map.put("备注", quartzJob.getRemark()); + map.put("创建日期", quartzJob.getCreateTime()); + map.put("Spring Bean名称", quartzJob.getBeanName()); + map.put("cron 表达式", quartzJob.getCronExpression()); + map.put("状态:1暂停、0启用", quartzJob.getIsPause()); + map.put("任务名称", quartzJob.getJobName()); + map.put("方法名称", quartzJob.getMethodName()); + map.put("参数", quartzJob.getParams()); + map.put("备注", quartzJob.getRemark()); + map.put("创建日期", quartzJob.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + /** + * 更改定时任务状态 + * + * @param quartzJob / + */ + @Override + public void updateIsPause(QuartzJob quartzJob) { + if (quartzJob.getId().equals(1L)) { + throw new BadRequestException("该任务不可操作"); + } + if (quartzJob.getIsPause()) { + quartzManage.resumeJob(quartzJob); + quartzJob.setIsPause(false); + } else { + quartzManage.pauseJob(quartzJob); + quartzJob.setIsPause(true); + } + this.saveOrUpdate(quartzJob); + } + + @Override + public boolean save(QuartzJob quartzJob) { + quartzManage.addJob(quartzJob); + return retBool(baseMapper.insert(quartzJob)); + } + + @Override + public boolean updateById(QuartzJob quartzJob) { + quartzManage.updateJobCron(quartzJob); + return retBool(baseMapper.updateById(quartzJob)); + } + + /** + * 立即执行定时任务 + * + * @param quartzJob / + */ + @Override + public void execution(QuartzJob quartzJob) { + if (quartzJob.getId().equals(1L)) { + throw new BadRequestException("该任务不可操作"); + } + quartzManage.runJobNow(quartzJob); + } + + /** + * 查询启用的任务 + * + * @return List + */ + @Override + public List findByIsPauseIsFalse() { + QuartzJobQueryCriteria criteria = new QuartzJobQueryCriteria(); + criteria.setIsPause(false); + return baseMapper.selectList(QueryHelpPlus.getPredicate(QuartzJob.class, criteria)); + } + + @Override + public void removeByIds(List idList) { + idList.forEach(id -> { + QuartzJob quartzJob = baseMapper.selectById(id); + quartzManage.deleteJob(quartzJob); + }); + baseMapper.deleteBatchIds(idList); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/impl/QuartzLogServiceImpl.java b/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/impl/QuartzLogServiceImpl.java new file mode 100644 index 0000000..27a1c1b --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/impl/QuartzLogServiceImpl.java @@ -0,0 +1,100 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.quartz.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.quartz.domain.QuartzLog; +import co.yixiang.modules.quartz.service.QuartzLogService; +import co.yixiang.modules.quartz.service.dto.QuartzLogDto; +import co.yixiang.modules.quartz.service.dto.QuartzLogQueryCriteria; +import co.yixiang.modules.quartz.service.mapper.QuartzLogMapper; +import co.yixiang.utils.FileUtil; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Service +@AllArgsConstructor +//@CacheConfig(cacheNames = "quartzLog") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class QuartzLogServiceImpl extends BaseServiceImpl implements QuartzLogService { + + private final IGenerator generator; + + @Override + //@Cacheable + public Map queryAll(QuartzLogQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), QuartzLogDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(QuartzLogQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(QuartzLog.class, criteria)); + } + + /** + * 导出数据 + * + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (QuartzLogDto quartzLog : all) { + Map map = new LinkedHashMap<>(); + map.put(" baenName", quartzLog.getBaenName()); + map.put(" createTime", quartzLog.getCreateTime()); + map.put(" cronExpression", quartzLog.getCronExpression()); + map.put(" exceptionDetail", quartzLog.getExceptionDetail()); + map.put(" isSuccess", quartzLog.getIsSuccess()); + map.put(" jobName", quartzLog.getJobName()); + map.put(" methodName", quartzLog.getMethodName()); + map.put(" params", quartzLog.getParams()); + map.put(" time", quartzLog.getTime()); + map.put("任务名称", quartzLog.getBaenName()); + map.put("Bean名称 ", quartzLog.getCreateTime()); + map.put("cron表达式", quartzLog.getCronExpression()); + map.put("异常详细 ", quartzLog.getExceptionDetail()); + map.put("状态", quartzLog.getIsSuccess()); + map.put("任务名称", quartzLog.getJobName()); + map.put("方法名称", quartzLog.getMethodName()); + map.put("参数", quartzLog.getParams()); + map.put("耗时(毫秒)", quartzLog.getTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/mapper/QuartzJobMapper.java b/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/mapper/QuartzJobMapper.java new file mode 100644 index 0000000..1e31a00 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/mapper/QuartzJobMapper.java @@ -0,0 +1,19 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.quartz.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.quartz.domain.QuartzJob; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Repository +public interface QuartzJobMapper extends CoreMapper { + +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/mapper/QuartzLogMapper.java b/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/mapper/QuartzLogMapper.java new file mode 100644 index 0000000..196d792 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/quartz/service/mapper/QuartzLogMapper.java @@ -0,0 +1,19 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.quartz.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.quartz.domain.QuartzLog; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Repository +public interface QuartzLogMapper extends CoreMapper { + +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/quartz/task/TestTask.java b/yshop-admin/src/main/java/co/yixiang/modules/quartz/task/TestTask.java new file mode 100644 index 0000000..4d2a1f5 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/quartz/task/TestTask.java @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.quartz.task; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * 测试用 + * @author hupeng + * @date 2019-01-08 + */ +@Slf4j +@Component +public class TestTask { + + public void run(){ + log.info("执行成功"); + } + + public void run1(String str){ + log.info("执行成功,参数为: {}" + str); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/quartz/task/VisitsTask.java b/yshop-admin/src/main/java/co/yixiang/modules/quartz/task/VisitsTask.java new file mode 100644 index 0000000..52a3a42 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/quartz/task/VisitsTask.java @@ -0,0 +1,22 @@ +package co.yixiang.modules.quartz.task; + +import co.yixiang.modules.monitor.service.VisitsService; +import org.springframework.stereotype.Component; + +/** + * @author Zheng Jie + * @date 2018-12-25 + */ +@Component +public class VisitsTask { + + private final VisitsService visitsService; + + public VisitsTask(VisitsService visitsService) { + this.visitsService = visitsService; + } + + public void run(){ + visitsService.save(); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/quartz/utils/ExecutionJob.java b/yshop-admin/src/main/java/co/yixiang/modules/quartz/utils/ExecutionJob.java new file mode 100644 index 0000000..e7641c6 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/quartz/utils/ExecutionJob.java @@ -0,0 +1,78 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.quartz.utils; + +import co.yixiang.config.thread.ThreadPoolExecutorUtil; +import co.yixiang.modules.quartz.domain.QuartzJob; +import co.yixiang.modules.quartz.domain.QuartzLog; +import co.yixiang.modules.quartz.service.QuartzJobService; +import co.yixiang.modules.quartz.service.QuartzLogService; +import co.yixiang.utils.SpringContextHolder; +import co.yixiang.utils.ThrowableUtil; +import org.quartz.JobExecutionContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.scheduling.annotation.Async; +import org.springframework.scheduling.quartz.QuartzJobBean; + +import java.util.concurrent.Future; +import java.util.concurrent.ThreadPoolExecutor; + +/** + * 参考人人开源,https://gitee.com/renrenio/renren-security + * @author / + * @date 2019-01-07 + */ +@Async +public class ExecutionJob extends QuartzJobBean { + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + /** 该处仅供参考 */ + private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll(); + + @Override + @SuppressWarnings("unchecked") + protected void executeInternal(JobExecutionContext context) { + QuartzJob quartzJob = (QuartzJob) context.getMergedJobDataMap().get(QuartzJob.JOB_KEY); + // 获取spring bean + QuartzLogService quartzLogService = SpringContextHolder.getBean(QuartzLogService.class); + QuartzJobService quartzJobService = SpringContextHolder.getBean(QuartzJobService.class); + + QuartzLog log = new QuartzLog(); + log.setJobName(quartzJob.getJobName()); + log.setBaenName(quartzJob.getBeanName()); + log.setMethodName(quartzJob.getMethodName()); + log.setParams(quartzJob.getParams()); + long startTime = System.currentTimeMillis(); + log.setCronExpression(quartzJob.getCronExpression()); + try { + // 执行任务 + logger.info("任务准备执行,任务名称:{}", quartzJob.getJobName()); + QuartzRunnable task = new QuartzRunnable(quartzJob.getBeanName(), quartzJob.getMethodName(), + quartzJob.getParams()); + Future future = EXECUTOR.submit(task); + future.get(); + long times = System.currentTimeMillis() - startTime; + log.setTime(times); + // 任务状态 + log.setIsSuccess(true); + logger.info("任务执行完毕,任务名称:{} 总共耗时:{} 毫秒", quartzJob.getJobName(), times); + } catch (Exception e) { + logger.error("任务执行失败,任务名称:{}" + quartzJob.getJobName(), e); + long times = System.currentTimeMillis() - startTime; + log.setTime(times); + // 任务状态 0:成功 1:失败 + log.setIsSuccess(false); + log.setExceptionDetail(ThrowableUtil.getStackTrace(e)); + quartzJob.setIsPause(false); + //更新状态 + quartzJobService.updateIsPause(quartzJob); + } finally { + quartzLogService.save(log); + } + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/quartz/utils/QuartzManage.java b/yshop-admin/src/main/java/co/yixiang/modules/quartz/utils/QuartzManage.java new file mode 100644 index 0000000..58536ea --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/quartz/utils/QuartzManage.java @@ -0,0 +1,173 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.quartz.utils; + +import co.yixiang.exception.BadRequestException; +import co.yixiang.modules.quartz.domain.QuartzJob; +import lombok.extern.slf4j.Slf4j; +import org.quartz.CronScheduleBuilder; +import org.quartz.CronTrigger; +import org.quartz.JobBuilder; +import org.quartz.JobDataMap; +import org.quartz.JobDetail; +import org.quartz.JobKey; +import org.quartz.Scheduler; +import org.quartz.Trigger; +import org.quartz.TriggerKey; +import org.quartz.impl.triggers.CronTriggerImpl; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.Date; + +import static org.quartz.TriggerBuilder.newTrigger; + +/** + * @author hupeng + * @date 2019-01-07 + */ +@Slf4j +@Component +public class QuartzManage { + + private static final String JOB_NAME = "TASK_"; + + @Resource(name = "scheduler") + private Scheduler scheduler; + + public void addJob(QuartzJob quartzJob){ + try { + // 构建job信息 + JobDetail jobDetail = JobBuilder.newJob(ExecutionJob.class). + withIdentity(JOB_NAME + quartzJob.getId()).build(); + + //通过触发器名和cron 表达式创建 Trigger + Trigger cronTrigger = newTrigger() + .withIdentity(JOB_NAME + quartzJob.getId()) + .startNow() + .withSchedule(CronScheduleBuilder.cronSchedule(quartzJob.getCronExpression())) + .build(); + + cronTrigger.getJobDataMap().put(QuartzJob.JOB_KEY, quartzJob); + + //重置启动时间 + ((CronTriggerImpl)cronTrigger).setStartTime(new Date()); + + //执行定时任务 + scheduler.scheduleJob(jobDetail,cronTrigger); + + // 暂停任务 + if (quartzJob.getIsPause()) { + pauseJob(quartzJob); + } + } catch (Exception e){ + log.error("创建定时任务失败", e); + throw new BadRequestException("创建定时任务失败"); + } + } + + /** + * 更新job cron表达式 + * @param quartzJob / + */ + public void updateJobCron(QuartzJob quartzJob){ + try { + TriggerKey triggerKey = TriggerKey.triggerKey(JOB_NAME + quartzJob.getId()); + CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey); + // 如果不存在则创建一个定时任务 + if(trigger == null){ + addJob(quartzJob); + trigger = (CronTrigger) scheduler.getTrigger(triggerKey); + } + CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(quartzJob.getCronExpression()); + trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build(); + //重置启动时间 + ((CronTriggerImpl)trigger).setStartTime(new Date()); + trigger.getJobDataMap().put(QuartzJob.JOB_KEY,quartzJob); + + scheduler.rescheduleJob(triggerKey, trigger); + // 暂停任务 + if (quartzJob.getIsPause()) { + pauseJob(quartzJob); + } + } catch (Exception e){ + log.error("更新定时任务失败", e); + throw new BadRequestException("更新定时任务失败"); + } + + } + + /** + * 删除一个job + * @param quartzJob / + */ + public void deleteJob(QuartzJob quartzJob){ + try { + JobKey jobKey = JobKey.jobKey(JOB_NAME + quartzJob.getId()); + scheduler.pauseJob(jobKey); + scheduler.deleteJob(jobKey); + } catch (Exception e){ + log.error("删除定时任务失败", e); + throw new BadRequestException("删除定时任务失败"); + } + } + + /** + * 恢复一个job + * @param quartzJob / + */ + public void resumeJob(QuartzJob quartzJob){ + try { + TriggerKey triggerKey = TriggerKey.triggerKey(JOB_NAME + quartzJob.getId()); + CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey); + // 如果不存在则创建一个定时任务 + if(trigger == null) { + addJob(quartzJob); + } + JobKey jobKey = JobKey.jobKey(JOB_NAME + quartzJob.getId()); + scheduler.resumeJob(jobKey); + } catch (Exception e){ + log.error("恢复定时任务失败", e); + throw new BadRequestException("恢复定时任务失败"); + } + } + + /** + * 立即执行job + * @param quartzJob / + */ + public void runJobNow(QuartzJob quartzJob){ + try { + TriggerKey triggerKey = TriggerKey.triggerKey(JOB_NAME + quartzJob.getId()); + CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey); + // 如果不存在则创建一个定时任务 + if(trigger == null) { + addJob(quartzJob); + } + JobDataMap dataMap = new JobDataMap(); + dataMap.put(QuartzJob.JOB_KEY, quartzJob); + JobKey jobKey = JobKey.jobKey(JOB_NAME + quartzJob.getId()); + scheduler.triggerJob(jobKey,dataMap); + } catch (Exception e){ + log.error("定时任务执行失败", e); + throw new BadRequestException("定时任务执行失败"); + } + } + + /** + * 暂停一个job + * @param quartzJob / + */ + public void pauseJob(QuartzJob quartzJob){ + try { + JobKey jobKey = JobKey.jobKey(JOB_NAME + quartzJob.getId()); + scheduler.pauseJob(jobKey); + } catch (Exception e){ + log.error("定时任务暂停失败", e); + throw new BadRequestException("定时任务暂停失败"); + } + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/quartz/utils/QuartzRunnable.java b/yshop-admin/src/main/java/co/yixiang/modules/quartz/utils/QuartzRunnable.java new file mode 100644 index 0000000..9a79939 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/quartz/utils/QuartzRunnable.java @@ -0,0 +1,49 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.quartz.utils; + +import co.yixiang.utils.SpringContextHolder; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.util.ReflectionUtils; + +import java.lang.reflect.Method; +import java.util.concurrent.Callable; + +/** + * 执行定时任务 + * @author / + */ +@Slf4j +public class QuartzRunnable implements Callable { + + private Object target; + private Method method; + private String params; + + QuartzRunnable(String beanName, String methodName, String params) + throws NoSuchMethodException, SecurityException { + this.target = SpringContextHolder.getBean(beanName); + this.params = params; + + if (StringUtils.isNotBlank(params)) { + this.method = target.getClass().getDeclaredMethod(methodName, String.class); + } else { + this.method = target.getClass().getDeclaredMethod(methodName); + } + } + + @Override + public Object call() throws Exception { + ReflectionUtils.makeAccessible(method); + if (StringUtils.isNotBlank(params)) { + method.invoke(target, params); + } else { + method.invoke(target); + } + return null; + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/security/config/SecurityConfig.java b/yshop-admin/src/main/java/co/yixiang/modules/security/config/SecurityConfig.java new file mode 100644 index 0000000..9757ff2 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/security/config/SecurityConfig.java @@ -0,0 +1,139 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.security.config; + +import co.yixiang.annotation.AnonymousAccess; +import co.yixiang.modules.security.security.JwtAccessDeniedHandler; +import co.yixiang.modules.security.security.JwtAuthenticationEntryPoint; +import co.yixiang.modules.security.security.TokenConfigurer; +import co.yixiang.modules.security.security.TokenUtil; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpMethod; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.config.core.GrantedAuthorityDefaults; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.web.filter.CorsFilter; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.mvc.method.RequestMappingInfo; +import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; + +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * @author hupeng + */ +@Configuration(proxyBeanMethods = false) +@EnableWebSecurity +@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) +public class SecurityConfig extends WebSecurityConfigurerAdapter { + + private final TokenUtil tokenUtil; + private final CorsFilter corsFilter; + private final JwtAuthenticationEntryPoint authenticationErrorHandler; + private final JwtAccessDeniedHandler jwtAccessDeniedHandler; + private final ApplicationContext applicationContext; + + public SecurityConfig(TokenUtil tokenUtil, CorsFilter corsFilter, JwtAuthenticationEntryPoint authenticationErrorHandler, JwtAccessDeniedHandler jwtAccessDeniedHandler, ApplicationContext applicationContext) { + this.tokenUtil = tokenUtil; + this.corsFilter = corsFilter; + this.authenticationErrorHandler = authenticationErrorHandler; + this.jwtAccessDeniedHandler = jwtAccessDeniedHandler; + this.applicationContext = applicationContext; + } + + @Bean + GrantedAuthorityDefaults grantedAuthorityDefaults() { + // 去除 ROLE_ 前缀 + return new GrantedAuthorityDefaults(""); + } + + @Bean + public PasswordEncoder passwordEncoder() { + // 密码加密方式 + return new BCryptPasswordEncoder(); + } + + @Override + protected void configure(HttpSecurity httpSecurity) throws Exception { + // 搜寻匿名标记 url: @AnonymousAccess + Map handlerMethodMap = applicationContext.getBean(RequestMappingHandlerMapping.class).getHandlerMethods(); + Set anonymousUrls = new HashSet<>(); + for (Map.Entry infoEntry : handlerMethodMap.entrySet()) { + HandlerMethod handlerMethod = infoEntry.getValue(); + AnonymousAccess anonymousAccess = handlerMethod.getMethodAnnotation(AnonymousAccess.class); + if (null != anonymousAccess) { + anonymousUrls.addAll(infoEntry.getKey().getPatternsCondition().getPatterns()); + } + } + httpSecurity + // 禁用 CSRF + .csrf().disable() + .addFilterBefore(corsFilter, UsernamePasswordAuthenticationFilter.class) + // 授权异常 + .exceptionHandling() + .authenticationEntryPoint(authenticationErrorHandler) + .accessDeniedHandler(jwtAccessDeniedHandler) + + // 防止iframe 造成跨域 + .and() + .headers() + .frameOptions() + .disable() + + // 不创建会话 + .and() + .sessionManagement() + .sessionCreationPolicy(SessionCreationPolicy.STATELESS) + + .and() + .authorizeRequests() + // 静态资源等等 + .antMatchers( + HttpMethod.GET, + "/*.html", + "/**/*.html", + "/**/*.css", + "/**/*.js", + "/webSocket/**" + ).permitAll() + // swagger 文档 + .antMatchers("/swagger-ui.html").permitAll() + .antMatchers("/swagger-resources/**").permitAll() + .antMatchers("/webjars/**").permitAll() + .antMatchers("/*/api-docs").permitAll() + .antMatchers("/v2/api-docs-ext").permitAll() + //.antMatchers("/api/wxmp/**").permitAll() + + // 文件 + .antMatchers("/avatar/**").permitAll() + .antMatchers("/file/**").permitAll() + // 阿里巴巴 druid + .antMatchers("/druid/**").permitAll() + .antMatchers("/api/canvas/**").permitAll() + // 放行OPTIONS请求 + .antMatchers(HttpMethod.OPTIONS, "/**").permitAll() + + // 自定义匿名访问所有url放行 : 允许匿名和带权限以及登录用户访问 + .antMatchers(anonymousUrls.toArray(new String[0])).permitAll() + // 所有请求都需要认证 + .anyRequest().authenticated() + .and().apply(securityConfigurerAdapter()); + } + + private TokenConfigurer securityConfigurerAdapter() { + return new TokenConfigurer(tokenUtil); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/security/config/SecurityProperties.java b/yshop-admin/src/main/java/co/yixiang/modules/security/config/SecurityProperties.java new file mode 100644 index 0000000..a09351b --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/security/config/SecurityProperties.java @@ -0,0 +1,43 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.security.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +/** + * Jwt参数配置 + * @author hupeng + * @date 2019年11月28日 + */ +@Data +@Configuration(proxyBeanMethods = false) +@ConfigurationProperties(prefix = "jwt") +public class SecurityProperties { + + /** Request Headers : Authorization */ + private String header; + + /** 令牌前缀,最后留个空格 Bearer */ + private String tokenStartWith; + + /** 必须使用最少88位的Base64对该令牌进行编码 */ + private String base64Secret; + private String secret; + /** 令牌过期时间 此处单位/毫秒 */ + private Long tokenValidityInSeconds; + + /** 在线用户 key,根据 key 查询 redis 中在线用户的数据 */ + private String onlineKey; + + /** 验证码 key */ + private String codeKey; + + public String getTokenStartWith() { + return tokenStartWith + " "; + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/security/rest/AuthController.java b/yshop-admin/src/main/java/co/yixiang/modules/security/rest/AuthController.java new file mode 100644 index 0000000..8de2b96 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/security/rest/AuthController.java @@ -0,0 +1,161 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + */ +package co.yixiang.modules.security.rest; + +import cn.hutool.core.util.IdUtil; +import cn.hutool.crypto.asymmetric.KeyType; +import cn.hutool.crypto.asymmetric.RSA; +import co.yixiang.annotation.AnonymousAccess; +import co.yixiang.exception.BadRequestException; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.security.config.SecurityProperties; +import co.yixiang.modules.security.security.TokenUtil; +import co.yixiang.modules.security.security.vo.AuthUser; +import co.yixiang.modules.security.security.vo.JwtUser; +import co.yixiang.modules.security.service.OnlineUserService; +import co.yixiang.utils.RedisUtils; +import co.yixiang.utils.SecurityUtils; +import co.yixiang.utils.StringUtils; +import com.wf.captcha.ArithmeticCaptcha; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * @author hupeng + * @date 2018-11-23 + * 授权、根据token获取用户详细信息 + */ +@Slf4j +@RestController +@RequestMapping("/auth") +@Api(tags = "系统:系统授权接口") +public class AuthController { + + @Value("${loginCode.expiration}") + private Long expiration; + @Value("${rsa.private_key}") + private String privateKey; + @Value("${single.login}") + private Boolean singleLogin; + private final SecurityProperties properties; + private final RedisUtils redisUtils; + private final UserDetailsService userDetailsService; + private final OnlineUserService onlineUserService; + private final TokenUtil tokenUtil; + private final AuthenticationManagerBuilder authenticationManagerBuilder; + + public AuthController(SecurityProperties properties, RedisUtils redisUtils, UserDetailsService userDetailsService, OnlineUserService onlineUserService, TokenUtil tokenUtil, AuthenticationManagerBuilder authenticationManagerBuilder) { + this.properties = properties; + this.redisUtils = redisUtils; + this.userDetailsService = userDetailsService; + this.onlineUserService = onlineUserService; + this.tokenUtil = tokenUtil; + this.authenticationManagerBuilder = authenticationManagerBuilder; + } + + @Log("用户登录") + @ApiOperation("登录授权") + @AnonymousAccess + @PostMapping(value = "/login") + public ResponseEntity login(@Validated @RequestBody AuthUser authUser, HttpServletRequest request){ + // 密码解密 + RSA rsa = new RSA(privateKey, null); + String password = new String(rsa.decrypt(authUser.getPassword(), KeyType.PrivateKey)); + // 查询验证码 + String code = (String) redisUtils.get(authUser.getUuid()); + // 清除验证码 + redisUtils.del(authUser.getUuid()); + if (StringUtils.isBlank(code)) { + throw new BadRequestException("验证码不存在或已过期"); + } + if (StringUtils.isBlank(authUser.getCode()) || !authUser.getCode().equalsIgnoreCase(code)) { + throw new BadRequestException("验证码错误"); + } + UsernamePasswordAuthenticationToken authenticationToken = + new UsernamePasswordAuthenticationToken(authUser.getUsername(), password); + + Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken); + SecurityContextHolder.getContext().setAuthentication(authentication); + // 生成令牌 + final UserDetails userDetails = (UserDetails) authentication.getPrincipal(); + String token = tokenUtil.generateToken(userDetails); + final JwtUser jwtUser = (JwtUser) authentication.getPrincipal(); + // 保存在线信息 + onlineUserService.save(jwtUser, token, request); + // 返回 token 与 用户信息 + Map authInfo = new HashMap(2){{ + put("token", properties.getTokenStartWith() + token); + put("user", jwtUser); + }}; + if(singleLogin){ + //踢掉之前已经登录的token + onlineUserService.checkLoginOnUser(authUser.getUsername(),token); + } + return ResponseEntity.ok(authInfo); + } + + @ApiOperation("获取用户信息") + @GetMapping(value = "/info") + public ResponseEntity getUserInfo(){ + JwtUser jwtUser = (JwtUser)userDetailsService.loadUserByUsername(SecurityUtils.getUsername()); + return ResponseEntity.ok(jwtUser); + } + + @AnonymousAccess + @ApiOperation("获取验证码") + @GetMapping(value = "/code") + public ResponseEntity getCode(){ + // 算术类型 https://gitee.com/whvse/EasyCaptcha + ArithmeticCaptcha captcha = new ArithmeticCaptcha(111, 36); + // 几位数运算,默认是两位 + captcha.setLen(2); + // 获取运算的结果 + String result =""; + try { + result = new Double(Double.parseDouble(captcha.text())).intValue()+""; + }catch (Exception e){ + result = captcha.text(); + } + String uuid = properties.getCodeKey() + IdUtil.simpleUUID(); + // 保存 + redisUtils.set(uuid, result, expiration, TimeUnit.MINUTES); + // 验证码信息 + Map imgResult = new HashMap(2){{ + put("img", captcha.toBase64()); + put("uuid", uuid); + }}; + return ResponseEntity.ok(imgResult); + } + + @ApiOperation("退出登录") + @AnonymousAccess + @DeleteMapping(value = "/logout") + public ResponseEntity logout(HttpServletRequest request){ + onlineUserService.logout(tokenUtil.getToken(request)); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/security/rest/OnlineController.java b/yshop-admin/src/main/java/co/yixiang/modules/security/rest/OnlineController.java new file mode 100644 index 0000000..15429b8 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/security/rest/OnlineController.java @@ -0,0 +1,83 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.security.rest; + +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.security.service.OnlineUserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Set; + +/** + * @author hupeng + */ +@RestController +@RequestMapping("/auth/online") +@Api(tags = "系统:在线用户管理") +public class OnlineController { + + private final OnlineUserService onlineUserService; + + public OnlineController(OnlineUserService onlineUserService) { + this.onlineUserService = onlineUserService; + } + + @ApiOperation("查询在线用户") + @GetMapping + @PreAuthorize("@el.check('auth_online')") + public ResponseEntity getAll(@RequestParam(value = "filter",defaultValue = "") String filter, + @RequestParam(value = "type",defaultValue = "0") int type, + Pageable pageable){ + return new ResponseEntity<>(onlineUserService.getAll(filter, type,pageable),HttpStatus.OK); + } + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check()") + public void download(HttpServletResponse response, + @RequestParam(value = "filter",defaultValue = "") String filter, + @RequestParam(value = "type",defaultValue = "0") int type) throws IOException { + onlineUserService.download(onlineUserService.getAll(filter,type), response); + } + + @ForbidSubmit + @ApiOperation("踢出用户") + @DeleteMapping + @PreAuthorize("@el.check()") + public ResponseEntity delete(@RequestBody Set keys) throws Exception { + for (String key : keys) { + onlineUserService.kickOut(key); + } + return new ResponseEntity<>(HttpStatus.OK); + } + + @ForbidSubmit + @ApiOperation("踢出移动端用户") + @PostMapping("/delete" ) + @PreAuthorize("@el.check()") + public ResponseEntity deletet(@RequestBody Set keys) throws Exception { + for (String key : keys) { + onlineUserService.kickOutT(key); + } + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/security/security/JwtAccessDeniedHandler.java b/yshop-admin/src/main/java/co/yixiang/modules/security/security/JwtAccessDeniedHandler.java new file mode 100644 index 0000000..9668535 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/security/security/JwtAccessDeniedHandler.java @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.security.security; + +import org.springframework.security.access.AccessDeniedException; +import org.springframework.security.web.access.AccessDeniedHandler; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @author hupeng + */ +@Component +public class JwtAccessDeniedHandler implements AccessDeniedHandler { + + @Override + public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException { + //当用户在没有授权的情况下访问受保护的REST资源时,将调用此方法发送403 Forbidden响应 + response.sendError(HttpServletResponse.SC_FORBIDDEN, accessDeniedException.getMessage()); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/security/security/JwtAuthenticationEntryPoint.java b/yshop-admin/src/main/java/co/yixiang/modules/security/security/JwtAuthenticationEntryPoint.java new file mode 100644 index 0000000..c4a6a5f --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/security/security/JwtAuthenticationEntryPoint.java @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.security.security; + +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.AuthenticationEntryPoint; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @author hupeng + */ +@Component +public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint { + + @Override + public void commence(HttpServletRequest request, + HttpServletResponse response, + AuthenticationException authException) throws IOException { + // 当用户尝试访问安全的REST资源而不提供任何凭据时,将调用此方法发送401 响应 + response.sendError(HttpServletResponse.SC_UNAUTHORIZED, authException==null?"Unauthorized":authException.getMessage()); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/security/security/TokenConfigurer.java b/yshop-admin/src/main/java/co/yixiang/modules/security/security/TokenConfigurer.java new file mode 100644 index 0000000..197ce74 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/security/security/TokenConfigurer.java @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.security.security; + +import org.springframework.security.config.annotation.SecurityConfigurerAdapter; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.web.DefaultSecurityFilterChain; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; + +/** + * @author / + */ +public class TokenConfigurer extends SecurityConfigurerAdapter { + + private final TokenUtil tokenUtil; + + public TokenConfigurer(TokenUtil tokenUtil){ + this.tokenUtil = tokenUtil; + } + + @Override + public void configure(HttpSecurity http) { + TokenFilter customFilter = new TokenFilter(tokenUtil); + http.addFilterBefore(customFilter, UsernamePasswordAuthenticationFilter.class); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/security/security/TokenFilter.java b/yshop-admin/src/main/java/co/yixiang/modules/security/security/TokenFilter.java new file mode 100644 index 0000000..bfe4a3f --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/security/security/TokenFilter.java @@ -0,0 +1,75 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + */ +package co.yixiang.modules.security.security; + +import co.yixiang.modules.security.config.SecurityProperties; +import co.yixiang.modules.security.service.OnlineUserService; +import co.yixiang.modules.user.vo.OnlineUser; +import co.yixiang.utils.SpringContextHolder; +import co.yixiang.utils.StringUtils; +import io.jsonwebtoken.ExpiredJwtException; +import lombok.extern.slf4j.Slf4j; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; +import org.springframework.web.filter.GenericFilterBean; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; + +/** + * @author / + */ +@Slf4j +public class TokenFilter extends GenericFilterBean { + + private final TokenUtil tokenUtil; + + TokenFilter(TokenUtil tokenUtil) { + this.tokenUtil = tokenUtil; + } + + @Override + public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) + throws IOException, ServletException { + HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; + + String requestRri = httpServletRequest.getRequestURI(); + + // 验证 token 是否存在 + OnlineUser onlineUser = null; + String authToken = ""; + try { + SecurityProperties properties = SpringContextHolder.getBean(SecurityProperties.class); + OnlineUserService onlineUserService = SpringContextHolder.getBean(OnlineUserService.class); + authToken = tokenUtil.getToken(httpServletRequest); + if (authToken == null) { + filterChain.doFilter(httpServletRequest, servletResponse); + return; + } + onlineUser = onlineUserService.getOne(properties.getOnlineKey() + authToken); + } catch (ExpiredJwtException e) { + log.error(e.getMessage()); + } + + String username = StringUtils.isNotBlank(authToken) ? tokenUtil.getUsernameFromToken(authToken) : null; + if (onlineUser != null && username != null && SecurityContextHolder.getContext().getAuthentication() == null && tokenUtil.validateToken(authToken)) { + UserDetails userDetails = tokenUtil.getUserDetails(authToken); + UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities()); + authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(httpServletRequest)); + SecurityContextHolder.getContext().setAuthentication(authentication); + log.debug("set Authentication to security context for '{}', uri: {}", authentication.getName(), requestRri); + } else { + tokenUtil.removeToken(authToken); + log.debug("no valid JWT token found, uri: {}", requestRri); + } + filterChain.doFilter(httpServletRequest, servletResponse); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/security/security/TokenProvider.java b/yshop-admin/src/main/java/co/yixiang/modules/security/security/TokenProvider.java new file mode 100644 index 0000000..bc16e3d --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/security/security/TokenProvider.java @@ -0,0 +1,118 @@ +package co.yixiang.modules.security.security; /** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + *//* + +package co.yixiang.modules.security.security; + +import co.yixiang.modules.security.config.SecurityProperties; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.ExpiredJwtException; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.MalformedJwtException; +import io.jsonwebtoken.SignatureAlgorithm; +import io.jsonwebtoken.UnsupportedJwtException; +import io.jsonwebtoken.io.Decoders; +import io.jsonwebtoken.security.Keys; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.User; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import java.security.Key; +import java.util.Arrays; +import java.util.Collection; +import java.util.Date; +import java.util.stream.Collectors; + +*/ +/** + * @author / + *//* + +@Slf4j +@Component +public class TokenProvider implements InitializingBean { + + private final SecurityProperties properties; + private static final String AUTHORITIES_KEY = "auth"; + private Key key; + + public TokenProvider(SecurityProperties properties) { + this.properties = properties; + } + + + @Override + public void afterPropertiesSet() { + byte[] keyBytes = Decoders.BASE64.decode(properties.getBase64Secret()); + this.key = Keys.hmacShaKeyFor(keyBytes); + } + + public String createToken(Authentication authentication) { + String authorities = authentication.getAuthorities().stream() + .map(GrantedAuthority::getAuthority) + .collect(Collectors.joining(",")); + + long now = (new Date()).getTime(); + Date validity = new Date(now + properties.getTokenValidityInSeconds()); + + return Jwts.builder() + .setSubject(authentication.getName()) + .claim(AUTHORITIES_KEY, authorities) + .signWith(key, SignatureAlgorithm.HS512) + .setExpiration(validity) + .compact(); + } + + Authentication getAuthentication(String token) { + Claims claims = Jwts.parser() + .setSigningKey(key) + .parseClaimsJws(token) + .getBody(); + + Collection authorities = + Arrays.stream(claims.get(AUTHORITIES_KEY).toString().split(",")) + .map(SimpleGrantedAuthority::new) + .collect(Collectors.toList()); + + User principal = new User(claims.getSubject(), "", authorities); + + return new UsernamePasswordAuthenticationToken(principal, token, authorities); + } + + boolean validateToken(String authToken) { + try { + Jwts.parser().setSigningKey(key).parseClaimsJws(authToken); + return true; + } catch (io.jsonwebtoken.security.SecurityException | MalformedJwtException e) { + log.info("Invalid JWT signature."); + e.printStackTrace(); + } catch (ExpiredJwtException e) { + log.info("Expired JWT token."); + e.printStackTrace(); + } catch (UnsupportedJwtException e) { + log.info("Unsupported JWT token."); + e.printStackTrace(); + } catch (IllegalArgumentException e) { + log.info("JWT token compact of handler are invalid."); + e.printStackTrace(); + } + return false; + } + + public String getToken(HttpServletRequest request){ + final String requestHeader = request.getHeader(properties.getHeader()); + if (requestHeader != null && requestHeader.startsWith(properties.getTokenStartWith())) { + return requestHeader.substring(7); + } + return null; + } +} +*/ diff --git a/yshop-admin/src/main/java/co/yixiang/modules/security/security/TokenUtil.java b/yshop-admin/src/main/java/co/yixiang/modules/security/security/TokenUtil.java new file mode 100644 index 0000000..cf9a9b8 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/security/security/TokenUtil.java @@ -0,0 +1,238 @@ + +package co.yixiang.modules.security.security; + +import co.yixiang.modules.security.config.SecurityProperties; +import co.yixiang.modules.security.security.vo.JwtUser; +import co.yixiang.utils.RedisUtils; +import co.yixiang.utils.StringUtils; +import com.alibaba.fastjson.JSON; +import com.google.gson.Gson; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import java.util.Base64; +import java.util.Date; + +/** + * Token 工具类 + * + * @author lioncity + */ + +@Component +public class TokenUtil { + @Autowired + private SecurityProperties properties; + + /** + * Logger + */ + + protected static final Logger LOGGER = LoggerFactory.getLogger(TokenUtil.class); + + + /** + * 权限缓存前缀 + */ + private static final String REDIS_PREFIX_AUTH = "auth:"; + + /** + * 用户信息缓存前缀 + */ + private static final String REDIS_PREFIX_USER = "user-details:"; + + /** + * redis repository + */ + @Autowired + private RedisUtils redisUtils; + + /** + * 获取用户名 + * + * @param token Token + * @return String + */ + + public String getUsernameFromToken(String token) { + Claims claims = getClaimsFromToken(token); + return claims != null ? claims.getSubject() : null; + } + + /** + * 获取过期时间 + * + * @param token Token + * @return Date + */ + + public Date getExpiredFromToken(String token) { + Claims claims = getClaimsFromToken(token); + return claims != null ? claims.getExpiration() : null; + } + + /** + * 获得 Claims + * + * @param token Token + * @return Claims + */ + + private Claims getClaimsFromToken(String token) { + Claims claims; + try { + claims = Jwts.parser() + .setSigningKey(properties.getSecret()) + .parseClaimsJws(token) + .getBody(); + } catch (Exception e) { + LOGGER.warn("getClaimsFromToken exception", e); + claims = null; + } + return claims; + } + + /** + * 计算过期时间 + * + * @return Date + */ + private Date generateExpired() { + return new Date(System.currentTimeMillis() + properties.getTokenValidityInSeconds() * 1000); + } + + /** + * 判断 Token 是否过期 + * + * @param token Token + * @return Boolean + */ + + private Boolean isTokenExpired(String token) { + Date expirationDate = getExpiredFromToken(token); + return expirationDate.before(new Date()); + } + + /** + * 生成 Token + * + * @param userDetails 用户信息 + * @return String + */ + + public String generateToken(UserDetails userDetails) { + String secret=properties.getSecret(); + String token = Jwts.builder() + .setSubject(userDetails.getUsername()) + .setExpiration(generateExpired()) + .signWith(SignatureAlgorithm.HS512, secret) + .compact(); + + String key = REDIS_PREFIX_AUTH + userDetails.getUsername() + ":" + token; + redisUtils.set(key, token, properties.getTokenValidityInSeconds() / 1000); + putUserDetails(userDetails); + return token; + } + + /** + * 验证 Token + * + * @param token Token + * @return Boolean + */ + + public Boolean validateToken(String token) { + final String username = getUsernameFromToken(token); + String key = REDIS_PREFIX_AUTH + username+ ":" + token; + Object data = redisUtils.get(key); + String redisToken = data == null ? null : data.toString(); + return StringUtils.isNotEmpty(token) && !isTokenExpired(token) && token.equals(redisToken); + } + + /** + * 移除 Token + * + * @param token Token + */ + + public void removeToken(String token) { + final String username = getUsernameFromToken(token); + String key = REDIS_PREFIX_AUTH + username+ ":" + token; + redisUtils.del(key); + delUserDetails(username); + } + + /** + * 获得用户信息 Json 字符串 + * + * @param token Token + * @return String + */ + + protected String getUserDetailsString(String token) { + final String username = getUsernameFromToken(token); + String key = REDIS_PREFIX_USER + username; + Object data = redisUtils.get(key); + return data == null ? null : data.toString(); + } + + /** + * 获得用户信息 + * + * @param token Token + * @return UserDetails + */ + + public UserDetails getUserDetails(String token) { + String userDetailsString = getUserDetailsString(token); + if (userDetailsString != null) { + return new Gson().fromJson(userDetailsString, JwtUser.class); + } + return null; + } + + /** + * 存储用户信息 + * + * @param userDetails 用户信息 + */ + + private void putUserDetails(UserDetails userDetails) { + String key = REDIS_PREFIX_USER + userDetails.getUsername(); + redisUtils.set(key, new Gson().toJson(userDetails), properties.getTokenValidityInSeconds() / 1000); + } + + + /** + * 删除用户信息 + * + * @param username 用户名 + */ + + private void delUserDetails(String username) { + String key = REDIS_PREFIX_USER + username; + redisUtils.del(key); + } + + public String getToken(HttpServletRequest request) { + final String requestHeader = request.getHeader(properties.getHeader()); + if (requestHeader != null && requestHeader.startsWith(properties.getTokenStartWith())) { + return requestHeader.substring(7); + } + return null; + } + + public static void main(String[] args) { + String key = Base64.getEncoder().encodeToString("123".getBytes()); + Claims claims = Jwts.parser().setSigningKey(key) + .parseClaimsJws("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsInNjb3BlIjpbImFwcCIsIndyaXRlIl0sInVpbiI6MSwiZXhwIjoxNTc1MDE1ODgzLCJhdXRob3JpdGllcyI6WyJST0xFX1VTRVIiXSwianRpIjoiYjdiYjQ1NTQtNTQ4OS00YTg5LWI3NjQtNzNjODI0YzljNGMyIiwiY2xpZW50X2lkIjoibHZoYWliYW8ifQ.x7QZxRAR1wuX_YNLi6EzRJ1iaKr1rIEUgjtYF0oSx5k").getBody(); + System.out.println(JSON.toJSONString(claims)); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/security/security/vo/AuthUser.java b/yshop-admin/src/main/java/co/yixiang/modules/security/security/vo/AuthUser.java new file mode 100644 index 0000000..1c1e334 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/security/security/vo/AuthUser.java @@ -0,0 +1,35 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.security.security.vo; + +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; + +/** + * @author hupeng + * @date 2018-11-30 + */ +@Getter +@Setter +public class AuthUser { + + @NotBlank + private String username; + + @NotBlank + private String password; + + private String code; + + private String uuid = ""; + + @Override + public String toString() { + return "{username=" + username + ", password= ******}"; + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/security/security/vo/JwtUser.java b/yshop-admin/src/main/java/co/yixiang/modules/security/security/vo/JwtUser.java new file mode 100644 index 0000000..e45f572 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/security/security/vo/JwtUser.java @@ -0,0 +1,90 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.security.security.vo; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; + +import java.sql.Timestamp; +import java.util.Collection; +import java.util.Date; +import java.util.stream.Collectors; + +/** + * @author hupeng + * @date 2018-11-23 + */ +@Getter +@AllArgsConstructor +public class JwtUser implements UserDetails { + + private final Long id; + + private final String username; + + private final String nickName; + + private final String sex; + + @JsonIgnore + private final String password; + + private final String avatar; + + private final String email; + + private final String phone; + + private final String dept; + + private final String job; + + @JsonIgnore + private final Collection authorities; + private final boolean enabled; + + private Timestamp createTime; + + @JsonIgnore + private final Date lastPasswordResetDate; + + @JsonIgnore + @Override + public boolean isAccountNonExpired() { + return true; + } + + @JsonIgnore + @Override + public boolean isAccountNonLocked() { + return true; + } + + @JsonIgnore + @Override + public boolean isCredentialsNonExpired() { + return true; + } + + @JsonIgnore + @Override + public String getPassword() { + return password; + } + + @Override + public boolean isEnabled() { + return enabled; + } + + public Collection getRoles() { + return authorities.stream().map(GrantedAuthority::getAuthority).collect(Collectors.toSet()); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/security/service/OnlineUserService.java b/yshop-admin/src/main/java/co/yixiang/modules/security/service/OnlineUserService.java new file mode 100644 index 0000000..2eada19 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/security/service/OnlineUserService.java @@ -0,0 +1,189 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + */ +package co.yixiang.modules.security.service; + +import cn.hutool.core.util.StrUtil; +import co.yixiang.constant.ShopConstants; +import co.yixiang.modules.security.config.SecurityProperties; +import co.yixiang.modules.security.security.vo.JwtUser; +import co.yixiang.modules.user.vo.OnlineUser; +import co.yixiang.utils.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.*; + +/** + * @author hupeng + * @Date 2019年10月26日21:56:27 + */ +@Service +@Slf4j +public class OnlineUserService { + + private final SecurityProperties properties; + private RedisUtils redisUtils; + + public OnlineUserService(SecurityProperties properties, RedisUtils redisUtils) { + this.properties = properties; + this.redisUtils = redisUtils; + } + + /** + * 保存在线用户信息 + * @param jwtUser / + * @param token / + * @param request / + */ + public void save(JwtUser jwtUser, String token, HttpServletRequest request) { + String job = jwtUser.getDept() + "/" + jwtUser.getJob(); + String ip = StringUtils.getIp(request); + String browser = StringUtils.getBrowser(request); + String address = StringUtils.getCityInfo(ip); + OnlineUser onlineUser = null; + try { + onlineUser = new OnlineUser(jwtUser.getUsername(), jwtUser.getNickName(), job, browser, ip, address, EncryptUtils.desEncrypt(token), new Date()); + } catch (Exception e) { + e.printStackTrace(); + } + redisUtils.set(properties.getOnlineKey() + token, onlineUser, properties.getTokenValidityInSeconds() / 1000); + } + + /** + * 查询全部数据 + * @param filter / + * @param pageable / + * @return / + */ + public Map getAll(String filter, int type, Pageable pageable) { + List onlineUsers = getAll(filter, type); + return PageUtil.toPage( + PageUtil.toPage(pageable.getPageNumber(), pageable.getPageSize(), onlineUsers), + onlineUsers.size() + ); + } + + /** + * 查询全部数据,不分页 + * @param filter / + * @return / + */ + public List getAll(String filter, int type) { + List keys = null; + if (type == 1) { + keys = redisUtils.scan(ShopConstants.YSHOP_APP_LOGIN_USER + "*"); + } else { + keys = redisUtils.scan(properties.getOnlineKey() + "*"); + } + + + Collections.reverse(keys); + List onlineUsers = new ArrayList<>(); + for (String key : keys) { + OnlineUser onlineUser = (OnlineUser) redisUtils.get(key); + if (StringUtils.isNotBlank(filter)) { + if (onlineUser.toString().contains(filter)) { + onlineUsers.add(onlineUser); + } + } else { + onlineUsers.add(onlineUser); + } + } + onlineUsers.sort((o1, o2) -> o2.getLoginTime().compareTo(o1.getLoginTime())); + return onlineUsers; + } + + /** + * 踢出用户 + * @param key / + * @throws Exception / + */ + public void kickOut(String key) throws Exception { + key = properties.getOnlineKey() + EncryptUtils.desDecrypt(key); + redisUtils.del(key); + + } + + /** + * 踢出移动端用户 + * @param key / + * @throws Exception / + */ + public void kickOutT(String key) throws Exception { + String[] split = StrUtil.split(key, ":"); + String keyt = ShopConstants.YSHOP_APP_LOGIN_USER + split[0] + ":" + EncryptUtils.desDecrypt(split[1]); + redisUtils.del(keyt); + + } + + /** + * 退出登录 + * @param token / + */ + public void logout(String token) { + String key = properties.getOnlineKey() + token; + redisUtils.del(key); + } + + /** + * 导出 + * @param all / + * @param response / + * @throws IOException / + */ + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (OnlineUser user : all) { + Map map = new LinkedHashMap<>(); + map.put("用户名", user.getUserName()); + map.put("用户昵称", user.getNickName()); + map.put("登录IP", user.getIp()); + map.put("登录地点", user.getAddress()); + map.put("浏览器", user.getBrowser()); + map.put("登录日期", user.getLoginTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + /** + * 查询用户 + * @param key / + * @return / + */ + public OnlineUser getOne(String key) { + return (OnlineUser) redisUtils.get(key); + } + + /** + * 检测用户是否在之前已经登录,已经登录踢下线 + * @param userName 用户名 + */ + public void checkLoginOnUser(String userName, String igoreToken) { + List onlineUsers = getAll(userName, 0); + if (onlineUsers == null || onlineUsers.isEmpty()) { + return; + } + for (OnlineUser onlineUser : onlineUsers) { + if (onlineUser.getUserName().equals(userName)) { + try { + String token = EncryptUtils.desDecrypt(onlineUser.getKey()); + if (StringUtils.isNotBlank(igoreToken) && !igoreToken.equals(token)) { + this.kickOut(onlineUser.getKey()); + } else if (StringUtils.isBlank(igoreToken)) { + this.kickOut(onlineUser.getKey()); + } + } catch (Exception e) { + log.error("checkUser is error", e); + } + } + } + } + +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/security/service/UserDetailsServiceImpl.java b/yshop-admin/src/main/java/co/yixiang/modules/security/service/UserDetailsServiceImpl.java new file mode 100644 index 0000000..e7bf58a --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/security/service/UserDetailsServiceImpl.java @@ -0,0 +1,71 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.security.service; + +import co.yixiang.exception.BadRequestException; +import co.yixiang.modules.security.security.vo.JwtUser; +import co.yixiang.modules.system.service.RoleService; +import co.yixiang.modules.system.service.UserService; +import co.yixiang.modules.system.service.dto.DeptSmallDto; +import co.yixiang.modules.system.service.dto.JobSmallDto; +import co.yixiang.modules.system.service.dto.UserDto; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Optional; + +/** + * @author hupeng + * @date 2018-11-22 + */ +@Service("userDetailsService") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class UserDetailsServiceImpl implements UserDetailsService { + + private final UserService userService; + + private final RoleService roleService; + + public UserDetailsServiceImpl(UserService userService, RoleService roleService) { + this.userService = userService; + this.roleService = roleService; + } + + @Override + public UserDetails loadUserByUsername(String username){ + UserDto user = userService.findByName(username); + if (user == null) { + throw new BadRequestException("账号不存在"); + } else { + if (!user.getEnabled()) { + throw new BadRequestException("账号未激活"); + } + return createJwtUser(user); + } + } + + private UserDetails createJwtUser(UserDto user) { + return new JwtUser( + user.getId(), + user.getUsername(), + user.getNickName(), + user.getSex(), + user.getPassword(), + user.getAvatar(), + user.getEmail(), + user.getPhone(), + Optional.ofNullable(user.getDept()).map(DeptSmallDto::getName).orElse(null), + Optional.ofNullable(user.getJob()).map(JobSmallDto::getName).orElse(null), + roleService.mapToGrantedAuthorities(user), + user.getEnabled(), + user.getCreateTime(), + user.getLastPasswordResetTime() + ); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/domain/Dept.java b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/Dept.java new file mode 100644 index 0000000..0caaf53 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/Dept.java @@ -0,0 +1,56 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("dept") +public class Dept extends BaseDomain { + + /** ID */ + @TableId(value = "id",type= IdType.AUTO) + private Long id; + + + /** 名称 */ + @NotBlank(message = "部门名称不能为空") + private String name; + + + /** 上级部门 */ + @NotNull(message = "上级部门不能为空") + private Long pid; + + + /** 状态 */ + private Boolean enabled; + + + + + public void copy(Dept source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/domain/Dict.java b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/Dict.java new file mode 100644 index 0000000..39f3f7b --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/Dict.java @@ -0,0 +1,49 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("dict") +public class Dict extends BaseDomain { + + /** 字典ID */ + @TableId + private Long id; + + + /** 字典名称 */ + @NotBlank(message = "字典名称不能为空") + private String name; + + + /** 描述 */ + private String remark; + + + + + public void copy(Dict source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/domain/DictDetail.java b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/DictDetail.java new file mode 100644 index 0000000..c517bc6 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/DictDetail.java @@ -0,0 +1,56 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +@TableName("dict_detail") +public class DictDetail extends BaseDomain { + + /** 字典详细 */ + @TableId + private Long id; + + + /** 字典标签 */ + private String label; + + + /** 字典值 */ + private String value; + + + /** 排序 */ + private String sort; + + + /** 字典id */ + private Long dictId; + + @TableField(exist = false) + private Dict dict; + + + + + public void copy(DictDetail source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/domain/Job.java b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/Job.java new file mode 100644 index 0000000..d757f89 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/Job.java @@ -0,0 +1,59 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("job") +public class Job extends BaseDomain { + + /** 岗位ID */ + @TableId + private Long id; + + /** 岗位名称 */ + @NotBlank(message = "岗位名称不能为空") + private String name; + + + /** 岗位状态 */ + private Boolean enabled; + + @TableField(exist = false) + private Dept dept; + + /** 岗位排序 */ + private Long sort; + + + /** 部门ID */ + private Long deptId; + + + + + public void copy(Job source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/domain/Menu.java b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/Menu.java new file mode 100644 index 0000000..9f8037e --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/Menu.java @@ -0,0 +1,92 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("menu") +public class Menu extends BaseDomain { + + /** ID */ + @TableId + private Long id; + + + /** 是否外链 */ + private Boolean iFrame; + + + /** 菜单名称 */ + @NotBlank(message = "请填写菜单名称") + private String name; + + + /** 组件 */ + private String component; + + + /** 上级菜单ID */ + @NotNull(message = "上级菜单ID不能为空") + private Long pid; + + + /** 排序 */ + @NotNull(message = "排序不能为空") + private Long sort; + + + /** 图标 */ + private String icon; + + + /** 链接地址 */ + private String path; + + + /** 缓存 */ + private Boolean cache; + + + /** 是否隐藏 */ + private Boolean hidden; + + + /** 组件名称 */ + private String componentName; + + + + + /** 权限 */ + private String permission; + + + /** 类型,目录、菜单、按钮 */ + private Integer type; + + + public void copy(Menu source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/domain/Role.java b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/Role.java new file mode 100644 index 0000000..5c312d9 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/Role.java @@ -0,0 +1,67 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import java.util.Set; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("role") +public class Role extends BaseDomain { + + /** ID */ + @TableId + private Long id; + + + /** 名称 */ + @NotBlank(message = "请填写角色名称") + private String name; + + + /** 备注 */ + private String remark; + + + /** 数据权限 */ + private String dataScope; + + + /** 角色级别 */ + private Integer level; + + @TableField(exist = false) + private Set menus; + + @TableField(exist = false) + private Set depts; + + + /** 功能权限 */ + private String permission; + + + public void copy(Role source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/domain/RolesDepts.java b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/RolesDepts.java new file mode 100644 index 0000000..50e33b7 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/RolesDepts.java @@ -0,0 +1,36 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-16 +*/ +@Data +@TableName("roles_depts") +public class RolesDepts implements Serializable { + + /** 角色ID */ + private Long roleId; + + /** 部门ID */ + private Long deptId; + + + public void copy(RolesDepts source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/domain/RolesMenus.java b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/RolesMenus.java new file mode 100644 index 0000000..e29a5e2 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/RolesMenus.java @@ -0,0 +1,36 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-16 +*/ +@Data +@TableName("roles_menus") +public class RolesMenus implements Serializable { + + /** 菜单ID */ + private Long menuId; + + + /** 角色ID */ + private Long roleId; + + public void copy(RolesMenus source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/domain/User.java b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/User.java new file mode 100644 index 0000000..3100df2 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/User.java @@ -0,0 +1,122 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; +import java.sql.Timestamp; +import java.util.Objects; +import java.util.Set; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Getter +@Setter +@TableName("user") +public class User extends BaseDomain { + + /** 系统用户ID */ + @TableId + private Long id; + + + /** 头像 */ + private Long avatarId; + + + /** 邮箱 */ + private String email; + + + /** 状态:1启用、0禁用 */ + private Boolean enabled; + + /** 用户头像 */ + @TableField(exist = false) + private String avatar; + + /** 用户角色 */ + @TableField(exist = false) + private Set roles; + + /** 用户职位*/ + @TableField(exist = false) + private Job job; + + /** 用户部门*/ + @TableField(exist = false) + private Dept dept; + + /** 密码 */ + private String password; + + + /** 用户名 */ + @NotBlank(message = "请填写用户名称") + private String username; + + + /** 部门名称 */ + private Long deptId; + + + /** 手机号码 */ + @NotBlank(message = "请输入手机号码") + private String phone; + + + /** 岗位名称 */ + private Long jobId; + + + + /** 最后修改密码的日期 */ + private Timestamp lastPasswordResetTime; + + + /** 昵称 */ + private String nickName; + + + /** 性别 */ + private String sex; + + public @interface Update {} + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(id, user.id) && + Objects.equals(username, user.username); + } + + @Override + public int hashCode() { + return Objects.hash(id, username); + } + public void copy(User source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/domain/UserAvatar.java b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/UserAvatar.java new file mode 100644 index 0000000..2a5bad7 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/UserAvatar.java @@ -0,0 +1,54 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +@TableName("user_avatar") +public class UserAvatar implements Serializable { + + @TableId + private Long id; + + + /** 真实文件名 */ + private String realName; + + + /** 路径 */ + private String path; + + + /** 大小 */ + private String size; + + + /** 创建时间 */ + @TableField(fill= FieldFill.INSERT) + private Timestamp createTime; + + + public void copy(UserAvatar source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/domain/UsersRoles.java b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/UsersRoles.java new file mode 100644 index 0000000..473084f --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/UsersRoles.java @@ -0,0 +1,36 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-16 +*/ +@Data +@TableName("users_roles") +public class UsersRoles implements Serializable { + + /** 用户ID */ + private Long userId; + + + /** 角色ID */ + private Long roleId; + + public void copy(UsersRoles source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/domain/vo/MenuMetaVo.java b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/vo/MenuMetaVo.java new file mode 100644 index 0000000..307ebb0 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/vo/MenuMetaVo.java @@ -0,0 +1,26 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.system.domain.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author hupeng + * @date 2018-12-20 + */ +@Data +@AllArgsConstructor +public class MenuMetaVo implements Serializable { + + private String title; + + private String icon; + + private Boolean noCache; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/domain/vo/MenuVo.java b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/vo/MenuVo.java new file mode 100644 index 0000000..37e8291 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/vo/MenuVo.java @@ -0,0 +1,38 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.system.domain.vo; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 构建前端路由时用到 + * @author hupeng + * @date 2018-12-20 + */ +@Data +@JsonInclude(JsonInclude.Include.NON_EMPTY) +public class MenuVo implements Serializable { + + private String name; + + private String path; + + private Boolean hidden; + + private String redirect; + + private String component; + + private Boolean alwaysShow; + + private MenuMetaVo meta; + + private List children; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/domain/vo/UserPassVo.java b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/vo/UserPassVo.java new file mode 100644 index 0000000..67cc586 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/domain/vo/UserPassVo.java @@ -0,0 +1,21 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.system.domain.vo; + +import lombok.Data; + +/** + * 修改密码的 Vo 类 + * @author hupeng + * @date 2019年7月11日13:59:49 + */ +@Data +public class UserPassVo { + + private String oldPass; + + private String newPass; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/rest/DeptController.java b/yshop-admin/src/main/java/co/yixiang/modules/system/rest/DeptController.java new file mode 100644 index 0000000..e87c7fa --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/rest/DeptController.java @@ -0,0 +1,137 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.system.rest; + +import cn.hutool.core.collection.CollectionUtil; +import co.yixiang.config.DataScope; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.exception.BadRequestException; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.system.domain.Dept; +import co.yixiang.modules.system.service.DeptService; +import co.yixiang.modules.system.service.dto.DeptDto; +import co.yixiang.modules.system.service.dto.DeptQueryCriteria; +import co.yixiang.utils.ValidationUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +/** +* @author hupeng +* @date 2019-03-25 +*/ +@RestController +@Api(tags = "系统:部门管理") +@RequestMapping("/api/dept") +public class DeptController { + + private final DeptService deptService; + + private final DataScope dataScope; + + private final IGenerator generator; + + private static final String ENTITY_NAME = "dept"; + + public DeptController(DeptService deptService, DataScope dataScope, IGenerator generator) { + this.deptService = deptService; + this.dataScope = dataScope; + this.generator = generator; + } + + @Log("导出部门数据") + @ApiOperation("导出部门数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('admin','dept:list')") + public void download(HttpServletResponse response, DeptQueryCriteria criteria) throws IOException { + deptService.download(generator.convert(deptService.queryAll(criteria), DeptDto.class), response); + } + + @Log("查询部门") + @ApiOperation("查询部门") + @GetMapping + @PreAuthorize("@el.check('user:list','admin','dept:list')") + public ResponseEntity getDepts(DeptQueryCriteria criteria){ + // 数据权限 + criteria.setIds(dataScope.getDeptIds()); + List deptDtos = generator.convert(deptService.queryAll(criteria),DeptDto.class); + return new ResponseEntity<>(deptService.buildTree(deptDtos),HttpStatus.OK); + } + + @Log("新增部门") + @ApiOperation("新增部门") + @PostMapping + @PreAuthorize("@el.check('admin','dept:add')") + public ResponseEntity create(@Validated @RequestBody Dept resources){ + if (resources.getId() != null) { + throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); + } + return new ResponseEntity<>(deptService.save(resources),HttpStatus.CREATED); + } + + @Log("修改部门") + @ApiOperation("修改部门") + @PutMapping + @PreAuthorize("@el.check('admin','dept:edit')") + public ResponseEntity update(@Validated @RequestBody Dept resources){ + if(resources.getId().equals(resources.getPid())) { + throw new BadRequestException("上级不能为自己"); + } + Dept dept = deptService.getOne(new LambdaQueryWrapper() + .eq(Dept::getId,resources.getId())); + ValidationUtil.isNull( dept.getId(),"Dept","id",resources.getId()); + resources.setId(dept.getId()); + deptService.saveOrUpdate(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除部门") + @ApiOperation("删除部门") + @DeleteMapping + @PreAuthorize("@el.check('admin','dept:del')") + public ResponseEntity delete(@RequestBody Set ids){ + List deptIds = new ArrayList<>(); + for (Long id : ids) { + List deptList = deptService.findByPid(id); + Dept dept = deptService.getOne(new LambdaQueryWrapper().eq(Dept::getId,id)); + if(null!=dept){ + deptIds.add(dept.getId()); + } + if(CollectionUtil.isNotEmpty(deptList)){ + for(Dept d:deptList){ + deptIds.add(d.getId()); + } + } + } + + deptService.delDepts(deptIds); +// try { +// deptService.delDepts(deptIds); +// }catch (Throwable e){ +// throw new BadRequestException( "所选部门中存在岗位或者角色关联,请取消关联后再试"); +// } + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/rest/DictController.java b/yshop-admin/src/main/java/co/yixiang/modules/system/rest/DictController.java new file mode 100644 index 0000000..e78a994 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/rest/DictController.java @@ -0,0 +1,108 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.system.rest; + +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.exception.BadRequestException; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.system.domain.Dict; +import co.yixiang.modules.system.service.DictService; +import co.yixiang.modules.system.service.dto.DictDto; +import co.yixiang.modules.system.service.dto.DictQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** +* @author hupeng +* @date 2019-04-10 +*/ +@Api(tags = "系统:字典管理") +@RestController +@RequestMapping("/api/dict") +public class DictController { + + private final DictService dictService; + private final IGenerator generator; + + private static final String ENTITY_NAME = "dict"; + + public DictController(DictService dictService, IGenerator generator) { + this.dictService = dictService; + this.generator = generator; + } + + @Log("导出字典数据") + @ApiOperation("导出字典数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('admin','dict:list')") + public void download(HttpServletResponse response, DictQueryCriteria criteria) throws IOException { + dictService.download(generator.convert(dictService.queryAll(criteria), DictDto.class), response); + } + + @Log("查询字典") + @ApiOperation("查询字典") + @GetMapping(value = "/all") + @PreAuthorize("@el.check('admin','dict:list')") + public ResponseEntity all(){ + return new ResponseEntity<>(dictService.queryAll(new DictQueryCriteria()),HttpStatus.OK); + } + + @Log("查询字典") + @ApiOperation("查询字典") + @GetMapping + @PreAuthorize("@el.check('admin','dict:list')") + public ResponseEntity getDicts(DictQueryCriteria resources, Pageable pageable){ + return new ResponseEntity<>(dictService.queryAll(resources,pageable),HttpStatus.OK); + } + + @Log("新增字典") + @ApiOperation("新增字典") + @PostMapping + @PreAuthorize("@el.check('admin','dict:add')") + public ResponseEntity create(@Validated @RequestBody Dict resources){ + if (resources.getId() != null) { + throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); + } + return new ResponseEntity<>(dictService.save(resources),HttpStatus.CREATED); + } + + @ForbidSubmit + @Log("修改字典") + @ApiOperation("修改字典") + @PutMapping + @PreAuthorize("@el.check('admin','dict:edit')") + public ResponseEntity update(@Validated @RequestBody Dict resources){ + dictService.saveOrUpdate(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除字典") + @ApiOperation("删除字典") + @DeleteMapping(value = "/{id}") + @PreAuthorize("@el.check('admin','dict:del')") + public ResponseEntity delete(@PathVariable Long id){ + dictService.removeById(id); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/rest/DictDetailController.java b/yshop-admin/src/main/java/co/yixiang/modules/system/rest/DictDetailController.java new file mode 100644 index 0000000..29e8c1b --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/rest/DictDetailController.java @@ -0,0 +1,104 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.system.rest; + +import co.yixiang.exception.BadRequestException; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.system.domain.DictDetail; +import co.yixiang.modules.system.service.DictDetailService; +import co.yixiang.modules.system.service.dto.DictDetailQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.data.web.PageableDefault; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.HashMap; +import java.util.Map; + +/** +* @author hupeng +* @date 2019-04-10 +*/ +@RestController +@Api(tags = "系统:字典详情管理") +@RequestMapping("/api/dictDetail") +public class DictDetailController { + + private final DictDetailService dictDetailService; + private static final String ENTITY_NAME = "dictDetail"; + + public DictDetailController(DictDetailService dictDetailService) { + this.dictDetailService = dictDetailService; + } + + @Log("查询字典详情") + @ApiOperation("查询字典详情") + @GetMapping + public ResponseEntity getDictDetails(DictDetailQueryCriteria criteria, + @PageableDefault(sort = {"sort"}, direction = Sort.Direction.ASC) Pageable pageable){ + return new ResponseEntity<>(dictDetailService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("查询多个字典详情") + @ApiOperation("查询多个字典详情") + @GetMapping(value = "/map") + public ResponseEntity getDictDetailMaps(DictDetailQueryCriteria criteria, + @PageableDefault(sort = {"sort"}, direction = Sort.Direction.ASC) Pageable pageable){ + String[] names = criteria.getDictName().split(","); + Map map = new HashMap<>(names.length); + for (String name : names) { + criteria.setDictName(name); + map.put(name,dictDetailService.queryAll(criteria,pageable).get("content")); + } + return new ResponseEntity<>(map,HttpStatus.OK); + } + + @Log("新增字典详情") + @ApiOperation("新增字典详情") + @PostMapping + @PreAuthorize("@el.check('admin','dict:add')") + public ResponseEntity create(@Validated @RequestBody DictDetail resources){ + if (resources.getId() != null) { + throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); + } + resources.setDictId(resources.getDict().getId()); + return new ResponseEntity<>(dictDetailService.save(resources),HttpStatus.CREATED); + } + + @ForbidSubmit + @Log("修改字典详情") + @ApiOperation("修改字典详情") + @PutMapping + @PreAuthorize("@el.check('admin','dict:edit')") + public ResponseEntity update(@Validated @RequestBody DictDetail resources){ + dictDetailService.saveOrUpdate(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除字典详情") + @ApiOperation("删除字典详情") + @DeleteMapping(value = "/{id}") + @PreAuthorize("@el.check('admin','dict:del')") + public ResponseEntity delete(@PathVariable Long id){ + dictDetailService.removeById(id); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/rest/JobController.java b/yshop-admin/src/main/java/co/yixiang/modules/system/rest/JobController.java new file mode 100644 index 0000000..2a750aa --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/rest/JobController.java @@ -0,0 +1,113 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.system.rest; + +import co.yixiang.config.DataScope; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.exception.BadRequestException; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.system.domain.Job; +import co.yixiang.modules.system.service.JobService; +import co.yixiang.modules.system.service.dto.JobDto; +import co.yixiang.modules.system.service.dto.JobQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Set; + +/** +* @author hupeng +* @date 2019-03-29 +*/ +@Api(tags = "系统:岗位管理") +@RestController +@RequestMapping("/api/job") +public class JobController { + + private final JobService jobService; + + private final DataScope dataScope; + + private final IGenerator generator; + + private static final String ENTITY_NAME = "job"; + + public JobController(JobService jobService, DataScope dataScope, IGenerator generator) { + this.jobService = jobService; + this.dataScope = dataScope; + this.generator = generator; + } + + @Log("导出岗位数据") + @ApiOperation("导出岗位数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('admin','job:list')") + public void download(HttpServletResponse response, JobQueryCriteria criteria) throws IOException { + jobService.download(generator.convert(jobService.queryAll(criteria), JobDto.class), response); + } + + @Log("查询岗位") + @ApiOperation("查询岗位") + @GetMapping + @PreAuthorize("@el.check('admin','job:list','user:list')") + public ResponseEntity getJobs(JobQueryCriteria criteria, Pageable pageable){ + // 数据权限 + criteria.setDeptIds(dataScope.getDeptIds()); + return new ResponseEntity<>(jobService.queryAll(criteria, pageable),HttpStatus.OK); + } + + @Log("新增岗位") + @ApiOperation("新增岗位") + @PostMapping + @PreAuthorize("@el.check('admin','job:add')") + public ResponseEntity create(@Validated @RequestBody Job resources){ + if (resources.getId() != null) { + throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); + } + resources.setDeptId(resources.getDept().getId()); + return new ResponseEntity<>(jobService.save(resources),HttpStatus.CREATED); + } + + @ForbidSubmit + @Log("修改岗位") + @ApiOperation("修改岗位") + @PutMapping + @PreAuthorize("@el.check('admin','job:edit')") + public ResponseEntity update(@Validated @RequestBody Job resources){ + resources.setDeptId(resources.getDept().getId()); + jobService.saveOrUpdate(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除岗位") + @ApiOperation("删除岗位") + @DeleteMapping + @PreAuthorize("@el.check('admin','job:del')") + public ResponseEntity delete(@RequestBody Set ids){ + try { + jobService.removeByIds(ids); + }catch (Throwable e){ + throw new BadRequestException( "所选岗位存在用户关联,请取消关联后再试"); + } + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/rest/MenuController.java b/yshop-admin/src/main/java/co/yixiang/modules/system/rest/MenuController.java new file mode 100644 index 0000000..1db17fa --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/rest/MenuController.java @@ -0,0 +1,140 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.system.rest; + +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.exception.BadRequestException; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.system.domain.Menu; +import co.yixiang.modules.system.service.MenuService; +import co.yixiang.modules.system.service.RoleService; +import co.yixiang.modules.system.service.UserService; +import co.yixiang.modules.system.service.dto.MenuDto; +import co.yixiang.modules.system.service.dto.MenuQueryCriteria; +import co.yixiang.modules.system.service.dto.UserDto; +import co.yixiang.utils.SecurityUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * @author hupeng + * @date 2018-12-03 + */ +@Api(tags = "系统:菜单管理") +@RestController +@RequestMapping("/api/menus") +@SuppressWarnings("unchecked") +public class MenuController { + + private final MenuService menuService; + + private final UserService userService; + + private final RoleService roleService; + + private final IGenerator generator; + + private static final String ENTITY_NAME = "menu"; + + public MenuController(MenuService menuService, UserService userService, RoleService roleService, IGenerator generator) { + this.menuService = menuService; + this.userService = userService; + this.roleService = roleService; + this.generator = generator; + } + + @ForbidSubmit + @Log("导出菜单数据") + @ApiOperation("导出菜单数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('menu:list')") + public void download(HttpServletResponse response, MenuQueryCriteria criteria) throws IOException { + menuService.download(generator.convert(menuService.queryAll(criteria),MenuDto.class), response); + } + + @ApiOperation("获取前端所需菜单") + @GetMapping(value = "/build") + public ResponseEntity buildMenus(){ + UserDto user = userService.findByName(SecurityUtils.getUsername()); + List menuDtoList = menuService.findByRoles(roleService.findByUsersId(user.getId())); + List menuDtos = (List) menuService.buildTree(menuDtoList).get("content"); + return new ResponseEntity<>(menuService.buildMenus(menuDtos),HttpStatus.OK); + } + + @ApiOperation("返回全部的菜单") + @GetMapping(value = "/tree") + @PreAuthorize("@el.check('menu:list','roles:list')") + public ResponseEntity getMenuTree(){ + return new ResponseEntity<>(menuService.getMenuTree(menuService.findByPid(0L)),HttpStatus.OK); + } + + @Log("查询菜单") + @ApiOperation("查询菜单") + @GetMapping + @PreAuthorize("@el.check('menu:list')") + public ResponseEntity getMenus(MenuQueryCriteria criteria){ + List menuDtoList = generator.convert(menuService.queryAll(criteria),MenuDto.class); + return new ResponseEntity<>(menuService.buildTree(menuDtoList),HttpStatus.OK); + } + + @ForbidSubmit + @Log("新增菜单") + @ApiOperation("新增菜单") + @PostMapping + @PreAuthorize("@el.check('menu:add')") + public ResponseEntity create(@Validated @RequestBody Menu resources){ + if (resources.getId() != null) { + throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); + } + + return new ResponseEntity<>(menuService.create(resources),HttpStatus.CREATED); + } + + @ForbidSubmit + @Log("修改菜单") + @ApiOperation("修改菜单") + @PutMapping + @PreAuthorize("@el.check('menu:edit')") + public ResponseEntity update(@Validated @RequestBody Menu resources){ + menuService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除菜单") + @ApiOperation("删除菜单") + @DeleteMapping + @PreAuthorize("@el.check('menu:del')") + public ResponseEntity delete(@RequestBody Set ids){ + Set menuSet = new HashSet<>(); + for (Long id : ids) { + List menuList = menuService.findByPid(id); + menuSet.add(menuService.getOne(new LambdaQueryWrapper().eq(Menu::getId,id))); + menuSet = menuService.getDeleteMenus(menuList, menuSet); + } + menuService.delete(menuSet); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/rest/RoleController.java b/yshop-admin/src/main/java/co/yixiang/modules/system/rest/RoleController.java new file mode 100644 index 0000000..83c6c65 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/rest/RoleController.java @@ -0,0 +1,172 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.system.rest; + +import cn.hutool.core.lang.Dict; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.exception.BadRequestException; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.system.domain.Role; +import co.yixiang.modules.system.service.RoleService; +import co.yixiang.modules.system.service.UserService; +import co.yixiang.modules.system.service.dto.RoleDto; +import co.yixiang.modules.system.service.dto.RoleQueryCriteria; +import co.yixiang.modules.system.service.dto.RoleSmallDto; +import co.yixiang.modules.system.service.dto.UserDto; +import co.yixiang.utils.SecurityUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.data.web.PageableDefault; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * @author hupeng + * @date 2018-12-03 + */ +@Api(tags = "系统:角色管理") +@RestController +@RequestMapping("/api/roles") +public class RoleController { + + private final RoleService roleService; + private final UserService userService; + private final IGenerator generator; + + private static final String ENTITY_NAME = "role"; + + public RoleController(RoleService roleService, UserService userService, IGenerator generator) { + this.roleService = roleService; + this.userService = userService; + this.generator = generator; + } + + @ApiOperation("获取单个role") + @GetMapping(value = "/{id}") + @PreAuthorize("@el.check('roles:list')") + public ResponseEntity getRoles(@PathVariable Long id){ + return new ResponseEntity<>(roleService.findById(id), HttpStatus.OK); + } + + @Log("导出角色数据") + @ApiOperation("导出角色数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('role:list')") + public void download(HttpServletResponse response, RoleQueryCriteria criteria) throws IOException { + roleService.download(generator.convert(roleService.queryAll(criteria),RoleDto.class), response); + } + + @ApiOperation("返回全部的角色") + @GetMapping(value = "/all") + @PreAuthorize("@el.check('roles:list','user:add','user:edit')") + public ResponseEntity getAll(RoleQueryCriteria criteria ,@PageableDefault(value = 2000, sort = {"level"}, direction = Sort.Direction.ASC) Pageable pageable){ + return new ResponseEntity<>(roleService.queryAlls(criteria,pageable),HttpStatus.OK); + } + + @Log("查询角色") + @ApiOperation("查询角色") + @GetMapping + @PreAuthorize("@el.check('roles:list')") + public ResponseEntity getRoles(RoleQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(roleService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @ApiOperation("获取用户级别") + @GetMapping(value = "/level") + public ResponseEntity getLevel(){ + return new ResponseEntity<>(Dict.create().set("level", getLevels(null)),HttpStatus.OK); + } + + @ForbidSubmit + @Log("新增角色") + @ApiOperation("新增角色") + @PostMapping + @PreAuthorize("@el.check('roles:add')") + public ResponseEntity create(@Validated @RequestBody Role resources){ + if (resources.getId() != null) { + throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); + } + getLevels(resources.getLevel()); + return new ResponseEntity<>(roleService.create(resources),HttpStatus.CREATED); + } + + @ForbidSubmit + @Log("修改角色") + @ApiOperation("修改角色") + @PutMapping + @PreAuthorize("@el.check('roles:edit')") + public ResponseEntity update(@Validated @RequestBody Role resources){ + getLevels(resources.getLevel()); + roleService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("修改角色菜单") + @ApiOperation("修改角色菜单") + @PutMapping(value = "/menu") + @PreAuthorize("@el.check('roles:edit')") + public ResponseEntity updateMenu(@RequestBody Role resources){ + RoleDto role = roleService.findById(resources.getId()); + getLevels(role.getLevel()); + roleService.updateMenu(resources,role); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除角色") + @ApiOperation("删除角色") + @DeleteMapping + @PreAuthorize("@el.check('roles:del')") + public ResponseEntity delete(@RequestBody Set ids){ + for (Long id : ids) { + RoleDto role = roleService.findById(id); + getLevels(role.getLevel()); + } + try { + roleService.delete(ids); + } catch (Throwable e){ + throw new BadRequestException("所选角色存在用户关联,请取消关联后再试"); + } + return new ResponseEntity<>(HttpStatus.OK); + } + + /** + * 获取用户的角色级别 + * @return / + */ + private int getLevels(Integer level){ + UserDto user = userService.findByName(SecurityUtils.getUsername()); + List levels = roleService.findByUsersId(user.getId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()); + int min = Collections.min(levels); + if(level != null){ + if(level < min){ + throw new BadRequestException("权限不足,你的角色级别:" + min + ",低于操作的角色级别:" + level); + } + } + return min; + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/rest/SysUserController.java b/yshop-admin/src/main/java/co/yixiang/modules/system/rest/SysUserController.java new file mode 100644 index 0000000..1078067 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/rest/SysUserController.java @@ -0,0 +1,240 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.system.rest; + +import cn.hutool.crypto.asymmetric.KeyType; +import cn.hutool.crypto.asymmetric.RSA; +import co.yixiang.config.DataScope; +import co.yixiang.constant.ShopConstants; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.exception.BadRequestException; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.system.domain.User; +import co.yixiang.modules.system.domain.vo.UserPassVo; +import co.yixiang.modules.system.service.DeptService; +import co.yixiang.modules.system.service.RoleService; +import co.yixiang.modules.system.service.UserService; +import co.yixiang.modules.system.service.dto.RoleSmallDto; +import co.yixiang.modules.system.service.dto.UserDto; +import co.yixiang.modules.system.service.dto.UserQueryCriteria; +import co.yixiang.tools.domain.VerificationCode; +import co.yixiang.tools.service.VerificationCodeService; +import co.yixiang.utils.PageUtil; +import co.yixiang.utils.SecurityUtils; +import co.yixiang.utils.YshopConstant; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.util.CollectionUtils; +import org.springframework.util.ObjectUtils; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * @author hupeng + * @date 2018-11-23 + */ +@Api(tags = "系统:用户管理") +@RestController +@RequestMapping("/api/users") +public class SysUserController { + + @Value("${rsa.private_key}") + private String privateKey; + private final PasswordEncoder passwordEncoder; + private final UserService userService; + private final DataScope dataScope; + private final DeptService deptService; + private final RoleService roleService; + private final VerificationCodeService verificationCodeService; + private final IGenerator generator; + + public SysUserController(PasswordEncoder passwordEncoder, UserService userService, DataScope dataScope, DeptService deptService, RoleService roleService, VerificationCodeService verificationCodeService, IGenerator generator) { + this.passwordEncoder = passwordEncoder; + this.userService = userService; + this.dataScope = dataScope; + this.deptService = deptService; + this.roleService = roleService; + this.verificationCodeService = verificationCodeService; + this.generator = generator; + } + + @Log("导出用户数据") + @ApiOperation("导出用户数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('admin','user:list')") + public void download(HttpServletResponse response, UserQueryCriteria criteria) throws IOException { + userService.download(generator.convert(userService.queryAll(criteria), UserDto.class), response); + } + + @Log("查询用户") + @ApiOperation("查询用户") + @GetMapping + @PreAuthorize("@el.check('admin','user:list')") + public ResponseEntity getUsers(UserQueryCriteria criteria, Pageable pageable){ + Set deptSet = new HashSet<>(); + Set result = new HashSet<>(); + if (!ObjectUtils.isEmpty(criteria.getDeptId())) { + deptSet.add(criteria.getDeptId()); + deptSet.addAll(dataScope.getDeptChildren(deptService.findByPid(criteria.getDeptId()))); + } + // 数据权限 + Set deptIds = dataScope.getDeptIds(); + // 查询条件不为空并且数据权限不为空则取交集 + if (!CollectionUtils.isEmpty(deptIds) && !CollectionUtils.isEmpty(deptSet)){ + // 取交集 + result.addAll(deptSet); + result.retainAll(deptIds); + // 若无交集,则代表无数据权限 + criteria.setDeptIds(result); + if(result.size() == 0){ + return new ResponseEntity<>(PageUtil.toPage(null,0),HttpStatus.OK); + } else { + return new ResponseEntity<>(userService.queryAll(criteria,pageable),HttpStatus.OK); + } + // 否则取并集 + } else { + result.addAll(deptSet); + result.addAll(deptIds); + criteria.setDeptIds(result); + return new ResponseEntity<>(userService.queryAll(criteria,pageable),HttpStatus.OK); + } + } + + @ForbidSubmit + @Log("新增用户") + @ApiOperation("新增用户") + @PostMapping + @PreAuthorize("@el.check('admin','user:add')") + public ResponseEntity create(@Validated @RequestBody User resources){ + checkLevel(resources); + // 默认密码 123456 + resources.setPassword(passwordEncoder.encode(ShopConstants.YSHOP_DEFAULT_PWD)); + return new ResponseEntity<>(userService.create(resources),HttpStatus.CREATED); + } + + @ForbidSubmit + @Log("修改用户") + @ApiOperation("修改用户") + @PutMapping + @PreAuthorize("@el.check('admin','user:edit')") + public ResponseEntity update(@Validated @RequestBody User resources){ + checkLevel(resources); + userService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("修改用户:个人中心") + @ApiOperation("修改用户:个人中心") + @PutMapping(value = "center") + public ResponseEntity center(@Validated(User.Update.class) @RequestBody User resources){ + UserDto userDto = userService.findByName(SecurityUtils.getUsername()); + if(!resources.getId().equals(userDto.getId())){ + throw new BadRequestException("不能修改他人资料"); + } + userService.saveOrUpdate(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除用户") + @ApiOperation("删除用户") + @DeleteMapping + @PreAuthorize("@el.check('admin','user:del')") + public ResponseEntity delete(@RequestBody Set ids){ + UserDto user = userService.findByName(SecurityUtils.getUsername()); + for (Long id : ids) { + Integer currentLevel = Collections.min(roleService.findByUsersId(user.getId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList())); + Integer optLevel = Collections.min(roleService.findByUsersId(id).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList())); + if (currentLevel > optLevel) { + throw new BadRequestException("角色权限不足,不能删除:" + userService.findByName(SecurityUtils.getUsername()).getUsername()); + } + } + userService.delete(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + @ForbidSubmit + @ApiOperation("修改密码") + @PostMapping(value = "/updatePass") + public ResponseEntity updatePass(@RequestBody UserPassVo passVo){ + // 密码解密 + RSA rsa = new RSA(privateKey, null); + String oldPass = new String(rsa.decrypt(passVo.getOldPass(), KeyType.PrivateKey)); + String newPass = new String(rsa.decrypt(passVo.getNewPass(), KeyType.PrivateKey)); + UserDto user = userService.findByName(SecurityUtils.getUsername()); + if(!passwordEncoder.matches(oldPass, user.getPassword())){ + throw new BadRequestException("修改失败,旧密码错误"); + } + if(passwordEncoder.matches(newPass, user.getPassword())){ + throw new BadRequestException("新密码不能与旧密码相同"); + } + userService.updatePass(user.getUsername(),passwordEncoder.encode(newPass)); + return new ResponseEntity<>(HttpStatus.OK); + } + + @ForbidSubmit + @ApiOperation("修改头像") + @PostMapping(value = "/updateAvatar") + public ResponseEntity updateAvatar(@RequestParam MultipartFile file){ + userService.updateAvatar(file); + return new ResponseEntity<>(HttpStatus.OK); + } + + @ForbidSubmit + @Log("修改邮箱") + @ApiOperation("修改邮箱") + @PostMapping(value = "/updateEmail/{code}") + public ResponseEntity updateEmail(@PathVariable String code,@RequestBody User user){ + // 密码解密 + RSA rsa = new RSA(privateKey, null); + String password = new String(rsa.decrypt(user.getPassword(), KeyType.PrivateKey)); + UserDto userDto = userService.findByName(SecurityUtils.getUsername()); + if(!passwordEncoder.matches(password, userDto.getPassword())){ + throw new BadRequestException("密码错误"); + } + VerificationCode verificationCode = new VerificationCode(code, YshopConstant.RESET_MAIL,"email",user.getEmail()); + verificationCodeService.validated(verificationCode); + userService.updateEmail(userDto.getUsername(),user.getEmail()); + return new ResponseEntity<>(HttpStatus.OK); + } + + /** + * 如果当前用户的角色级别低于创建用户的角色级别,则抛出权限不足的错误 + * @param resources / + */ + private void checkLevel(User resources) { + UserDto user = userService.findByName(SecurityUtils.getUsername()); + Integer currentLevel = Collections.min(roleService.findByUsersId(user.getId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList())); + Integer optLevel = roleService.findByRoles(resources.getRoles()); + if (currentLevel > optLevel) { + throw new BadRequestException("角色权限不足"); + } + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/DeptService.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/DeptService.java new file mode 100644 index 0000000..17c5798 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/DeptService.java @@ -0,0 +1,86 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.system.domain.Dept; +import co.yixiang.modules.system.service.dto.DeptDto; +import co.yixiang.modules.system.service.dto.DeptQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +public interface DeptService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(DeptQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(DeptQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + /** + * 根据PID查询 + * @param pid / + * @return / + */ + List findByPid(long pid); + + /** + * 构建树形数据 + * @param deptDtos 原始数据 + * @return / + */ + Object buildTree(List deptDtos); + + /** + * 删除部门 + * @param deptIds + */ + void delDepts(List deptIds); + + /** + * 获取待删除的部门 + * @param deptList / + * @param deptDtos / + * @return / + */ + /*Set getDeleteDepts(List deptList, Set deptDtos);*/ + + /** + * 根据角色ID查询 + * @param id / + * @return / + */ + Set findByRoleIds(Long id); +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/DictDetailService.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/DictDetailService.java new file mode 100644 index 0000000..b2de049 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/DictDetailService.java @@ -0,0 +1,50 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.system.domain.DictDetail; +import co.yixiang.modules.system.service.dto.DictDetailDto; +import co.yixiang.modules.system.service.dto.DictDetailQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +public interface DictDetailService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(DictDetailQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(DictDetailQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/DictService.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/DictService.java new file mode 100644 index 0000000..508ffea --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/DictService.java @@ -0,0 +1,50 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.system.domain.Dict; +import co.yixiang.modules.system.service.dto.DictDto; +import co.yixiang.modules.system.service.dto.DictQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +public interface DictService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(DictQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(DictQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/JobService.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/JobService.java new file mode 100644 index 0000000..9b7565b --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/JobService.java @@ -0,0 +1,50 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.system.domain.Job; +import co.yixiang.modules.system.service.dto.JobDto; +import co.yixiang.modules.system.service.dto.JobQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +public interface JobService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(JobQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(JobQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/MenuService.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/MenuService.java new file mode 100644 index 0000000..c6c7096 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/MenuService.java @@ -0,0 +1,111 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.system.domain.Menu; +import co.yixiang.modules.system.domain.vo.MenuVo; +import co.yixiang.modules.system.service.dto.MenuDto; +import co.yixiang.modules.system.service.dto.MenuQueryCriteria; +import co.yixiang.modules.system.service.dto.RoleSmallDto; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +public interface MenuService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(MenuQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(MenuQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + /** + * 构建菜单树 + * @param menuDtos 原始数据 + * @return / + */ + Map buildTree(List menuDtos); + + /** + * 构建菜单树 + * @param menuDtos / + * @return / + */ + List buildMenus(List menuDtos); + + /** + * 获取菜单树 + * @param menus / + * @return / + */ + Object getMenuTree(List menus); + + + /** + * 获取待删除的菜单 + * @param menuList / + * @param menuSet / + * @return / + */ + Set getDeleteMenus(List menuList, Set menuSet); + + /** + * 根据pid查询 + * @param pid / + * @return / + */ + List findByPid(long pid); + + /** + * 根据角色查询 + * @param roles / + * @return / + */ + List findByRoles(List roles); + + /** + * 删除 + * @param menuSet / + */ + void delete(Set menuSet); + + /** + * 编辑 + * @param resources / + */ + void update(Menu resources); + + Object create(Menu resources); +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/RoleService.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/RoleService.java new file mode 100644 index 0000000..aa67e8a --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/RoleService.java @@ -0,0 +1,113 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.system.domain.Role; +import co.yixiang.modules.system.service.dto.RoleDto; +import co.yixiang.modules.system.service.dto.RoleQueryCriteria; +import co.yixiang.modules.system.service.dto.RoleSmallDto; +import co.yixiang.modules.system.service.dto.UserDto; +import org.springframework.data.domain.Pageable; +import org.springframework.security.core.authority.SimpleGrantedAuthority; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +public interface RoleService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(RoleQueryCriteria criteria, Pageable pageable); + + + /** + * 查询数据分页 + * @param pageable 分页参数 + * @return Map + */ + Object queryAlls(RoleQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(RoleQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + /** + * 根据用户ID查询 + * @param id 用户ID + * @return / + */ + List findByUsersId(Long id); + + /** + * 根据角色查询角色级别 + * @param roles / + * @return / + */ + Integer findByRoles(Set roles); + + /** + * 根据ID查询 + * @param id / + * @return / + */ + RoleDto findById(long id); + + /** + * 修改绑定的菜单 + * @param resources / + * @param roleDto / + */ + void updateMenu(Role resources, RoleDto roleDto); + + /** + * 创建 + * @param resources / + * @return / + */ + RoleDto create(Role resources); + + /** + * 编辑 + * @param resources / + */ + void update(Role resources); + + /** + * 获取用户权限信息 + * @param user 用户信息 + * @return 权限信息 + */ + Collection mapToGrantedAuthorities(UserDto user); + + void delete(Set ids); +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/RolesDeptsService.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/RolesDeptsService.java new file mode 100644 index 0000000..6431cd4 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/RolesDeptsService.java @@ -0,0 +1,19 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service; +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.system.domain.RolesDepts; + +/** +* @author hupeng +* @date 2020-05-16 +*/ +public interface RolesDeptsService extends BaseService{ + +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/RolesMenusService.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/RolesMenusService.java new file mode 100644 index 0000000..b3e143a --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/RolesMenusService.java @@ -0,0 +1,19 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service; +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.system.domain.RolesMenus; + +/** +* @author hupeng +* @date 2020-05-16 +*/ +public interface RolesMenusService extends BaseService{ + +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/UserAvatarService.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/UserAvatarService.java new file mode 100644 index 0000000..d441964 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/UserAvatarService.java @@ -0,0 +1,52 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.system.domain.UserAvatar; +import co.yixiang.modules.system.service.dto.UserAvatarDto; +import co.yixiang.modules.system.service.dto.UserAvatarQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +public interface UserAvatarService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(UserAvatarQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(UserAvatarQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + UserAvatar saveFile(UserAvatar userAvatar); +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/UserService.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/UserService.java new file mode 100644 index 0000000..fbbd641 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/UserService.java @@ -0,0 +1,94 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.system.domain.User; +import co.yixiang.modules.system.service.dto.UserDto; +import co.yixiang.modules.system.service.dto.UserQueryCriteria; +import org.springframework.data.domain.Pageable; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +public interface UserService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(UserQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(UserQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + /** + * 根据用户名查询 + * @param userName / + * @return / + */ + UserDto findByName(String userName); + + /** + * 修改密码 + * @param username 用户名 + * @param encryptPassword 密码 + */ + void updatePass(String username, String encryptPassword); + + /** + * 修改头像 + * @param multipartFile 文件 + */ + void updateAvatar(MultipartFile multipartFile); + + /** + * 修改邮箱 + * @param username 用户名 + * @param email 邮箱 + */ + void updateEmail(String username, String email); + + /** + * 新增用户 + * @param resources / + * @return / + */ + boolean create(User resources); + + /** + * 编辑用户 + * @param resources / + */ + void update(User resources); + + void delete(Set ids); +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/UsersRolesService.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/UsersRolesService.java new file mode 100644 index 0000000..2e46414 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/UsersRolesService.java @@ -0,0 +1,19 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service; +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.system.domain.UsersRoles; + +/** +* @author hupeng +* @date 2020-05-16 +*/ +public interface UsersRolesService extends BaseService{ + +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DeptDto.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DeptDto.java new file mode 100644 index 0000000..5e2b20c --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DeptDto.java @@ -0,0 +1,49 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.dto; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.List; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Getter +@Setter +public class DeptDto implements Serializable { + + /** ID */ + private Long id; + + /** 名称 */ + private String name; + + /** 上级部门 */ + private Long pid; + + /** 状态 */ + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private List children; + + /** 创建日期 */ + private Timestamp createTime; + + public String getLabel() { + return name; + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DeptQueryCriteria.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DeptQueryCriteria.java new file mode 100644 index 0000000..a693ed1 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DeptQueryCriteria.java @@ -0,0 +1,39 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +import java.sql.Timestamp; +import java.util.List; +import java.util.Set; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +public class DeptQueryCriteria{ + + @Query(type = Query.Type.IN, propName="id") + private Set ids; + + @Query(type = Query.Type.INNER_LIKE) + private String name; + + @Query + private Boolean enabled; + + @Query + private Long pid; + + @Query(type = Query.Type.BETWEEN) + private List createTime; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DeptSmallDto.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DeptSmallDto.java new file mode 100644 index 0000000..c8556d0 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DeptSmallDto.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.system.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2019-6-10 16:32:18 +*/ +@Data +public class DeptSmallDto implements Serializable { + + private Long id; + + private String name; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DictDetailDto.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DictDetailDto.java new file mode 100644 index 0000000..5796287 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DictDetailDto.java @@ -0,0 +1,40 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +public class DictDetailDto implements Serializable { + + /** 字典详细 */ + private Long id; + + /** 字典标签 */ + private String label; + + /** 字典值 */ + private String value; + + /** 排序 */ + private String sort; + + /** 字典id */ + private Long dictId; + + /** 创建日期 */ + private Timestamp createTime; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DictDetailQueryCriteria.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DictDetailQueryCriteria.java new file mode 100644 index 0000000..aaebba2 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DictDetailQueryCriteria.java @@ -0,0 +1,25 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +public class DictDetailQueryCriteria{ + + @Query(type = Query.Type.INNER_LIKE) + private String label; + + private String dictName; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DictDto.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DictDto.java new file mode 100644 index 0000000..9032a70 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DictDto.java @@ -0,0 +1,37 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.List; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +public class DictDto implements Serializable { + + /** 字典ID */ + private Long id; + + /** 字典名称 */ + private String name; + + private List dictDetails; + + /** 描述 */ + private String remark; + + /** 创建日期 */ + private Timestamp createTime; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DictQueryCriteria.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DictQueryCriteria.java new file mode 100644 index 0000000..4958527 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DictQueryCriteria.java @@ -0,0 +1,23 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +public class DictQueryCriteria{ + + @Query(blurry = "name,remark") + private String blurry; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DictSmallDto.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DictSmallDto.java new file mode 100644 index 0000000..8b4cdc7 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/DictSmallDto.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.system.service.dto; + +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2019-04-10 +*/ +@Getter +@Setter +public class DictSmallDto implements Serializable { + + private Long id; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/JobDto.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/JobDto.java new file mode 100644 index 0000000..94bbf6d --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/JobDto.java @@ -0,0 +1,41 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +public class JobDto implements Serializable { + + private Long id; + + private Long sort; + + private String name; + + private Boolean enabled; + + private DeptDto dept; + + private String deptSuperiorName; + + private Timestamp createTime; + +// public JobDto(String name, Boolean enabled) { +// this.name = name; +// this.enabled = enabled; +// } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/JobQueryCriteria.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/JobQueryCriteria.java new file mode 100644 index 0000000..2eb0314 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/JobQueryCriteria.java @@ -0,0 +1,38 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.system.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.sql.Timestamp; +import java.util.List; +import java.util.Set; + +/** +* @author hupeng +* @date 2019-6-4 14:49:34 +*/ +@Data +@NoArgsConstructor +public class JobQueryCriteria { + + @Query(type = Query.Type.INNER_LIKE) + private String name; + + @Query + private Boolean enabled; + + @Query + private Long deptId; + + @Query(propName = "deptId", type = Query.Type.IN) + private Set deptIds; + + @Query(type = Query.Type.BETWEEN) + private List createTime; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/JobSmallDto.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/JobSmallDto.java new file mode 100644 index 0000000..decd780 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/JobSmallDto.java @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.system.service.dto; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2019-6-10 16:32:18 +*/ +@Data +@NoArgsConstructor +public class JobSmallDto implements Serializable { + + private Long id; + + private String name; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/MenuDto.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/MenuDto.java new file mode 100644 index 0000000..0f32570 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/MenuDto.java @@ -0,0 +1,53 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.List; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +public class MenuDto implements Serializable { + + private Long id; + + private Integer type; + + private String permission; + + private String name; + + private Long sort; + + private String path; + + private String component; + + private Long pid; + + private Boolean iFrame; + + private Boolean cache; + + private Boolean hidden; + + private String componentName; + + private String icon; + + private List children; + + private Timestamp createTime; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/MenuQueryCriteria.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/MenuQueryCriteria.java new file mode 100644 index 0000000..3b2afc8 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/MenuQueryCriteria.java @@ -0,0 +1,19 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +public class MenuQueryCriteria{ +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/PermissionDto.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/PermissionDto.java new file mode 100644 index 0000000..e35cbc3 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/PermissionDto.java @@ -0,0 +1,43 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.system.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.List; + +/** + * @author hupeng + * @date 2018-12-03 + */ +@Data +public class PermissionDto implements Serializable{ + + private Long id; + + private String name; + + private Long pid; + + private String alias; + + private Timestamp createTime; + + private List children; + + @Override + public String toString() { + return "Permission{" + + "id=" + id + + ", name='" + name + '\'' + + ", pid=" + pid + + ", alias='" + alias + '\'' + + ", createTime=" + createTime + + '}'; + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/PermissionQueryCriteria.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/PermissionQueryCriteria.java new file mode 100644 index 0000000..d7e5734 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/PermissionQueryCriteria.java @@ -0,0 +1,20 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.system.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +/** + * 公共查询类 + */ +@Data +public class PermissionQueryCriteria { + + // 多字段模糊 + @Query(blurry = "name,alias") + private String blurry; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/RoleDto.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/RoleDto.java new file mode 100644 index 0000000..48c35e3 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/RoleDto.java @@ -0,0 +1,47 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.dto; + +import co.yixiang.modules.system.domain.Menu; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.Set; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +public class RoleDto implements Serializable { + + /** ID */ + private Long id; + + /** 名称 */ + private String name; + + /** 备注 */ + private String remark; + + /** 数据权限 */ + private String dataScope; + + /** 角色级别 */ + private Integer level; + + private Set menus; + + /** 创建日期 */ + private Timestamp createTime; + + /** 功能权限 */ + private String permission; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/RoleQueryCriteria.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/RoleQueryCriteria.java new file mode 100644 index 0000000..e7eeead --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/RoleQueryCriteria.java @@ -0,0 +1,19 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +public class RoleQueryCriteria{ +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/RoleSmallDto.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/RoleSmallDto.java new file mode 100644 index 0000000..0e23cbf --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/RoleSmallDto.java @@ -0,0 +1,26 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.system.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author hupeng + * @date 2018-11-23 + */ +@Data +public class RoleSmallDto implements Serializable { + + private Long id; + + private String name; + + private Integer level; + + private String dataScope; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/UserAvatarDto.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/UserAvatarDto.java new file mode 100644 index 0000000..f0f2936 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/UserAvatarDto.java @@ -0,0 +1,36 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +public class UserAvatarDto implements Serializable { + + private Long id; + + /** 真实文件名 */ + private String realName; + + /** 路径 */ + private String path; + + /** 大小 */ + private String size; + + /** 创建时间 */ + private Timestamp createTime; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/UserAvatarQueryCriteria.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/UserAvatarQueryCriteria.java new file mode 100644 index 0000000..55e3271 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/UserAvatarQueryCriteria.java @@ -0,0 +1,19 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +public class UserAvatarQueryCriteria{ +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/UserDto.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/UserDto.java new file mode 100644 index 0000000..651fc2b --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/UserDto.java @@ -0,0 +1,60 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.dto; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.Set; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +public class UserDto implements Serializable { + + + @ApiModelProperty(hidden = true) + private Long id; + + private String username; + + private String nickName; + + private String sex; + + private String avatar; + + private String email; + + private String phone; + + private Boolean enabled; + + @JsonIgnore + private String password; + + private Timestamp lastPasswordResetTime; + + @ApiModelProperty(hidden = true) + private Set roles; + + @ApiModelProperty(hidden = true) + private JobSmallDto job; + + private DeptSmallDto dept; + + private Long deptId; + + private Timestamp createTime; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/UserQueryCriteria.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/UserQueryCriteria.java new file mode 100644 index 0000000..93f636b --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/dto/UserQueryCriteria.java @@ -0,0 +1,41 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +import java.sql.Timestamp; +import java.util.List; +import java.util.Set; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Data +public class UserQueryCriteria{ + + @Query + private Long id; + + @Query(propName = "deptId", type = Query.Type.IN) + private Set deptIds; + + @Query(blurry = "email,username,nickName") + private String blurry; + + @Query + private Boolean enabled; + + private Long deptId; + + @Query(type = Query.Type.BETWEEN) + private List createTime; +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/DeptServiceImpl.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/DeptServiceImpl.java new file mode 100644 index 0000000..7b52626 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/DeptServiceImpl.java @@ -0,0 +1,211 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.exception.BadRequestException; +import co.yixiang.modules.system.domain.Dept; +import co.yixiang.modules.system.domain.Job; +import co.yixiang.modules.system.domain.RolesDepts; +import co.yixiang.modules.system.service.DeptService; +import co.yixiang.modules.system.service.dto.DeptDto; +import co.yixiang.modules.system.service.dto.DeptQueryCriteria; +import co.yixiang.modules.system.service.mapper.DeptMapper; +import co.yixiang.modules.system.service.mapper.JobMapper; +import co.yixiang.modules.system.service.mapper.RolesDeptsMapper; +import co.yixiang.utils.FileUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Service +@AllArgsConstructor +//@CacheConfig(cacheNames = "dept") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class DeptServiceImpl extends BaseServiceImpl implements DeptService { + + private final IGenerator generator; + + private final DeptMapper deptMapper; + private final JobMapper jobMapper; + private final RolesDeptsMapper rolesDeptsMapper; + + @Override + //@Cacheable + public Map queryAll(DeptQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), DeptDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(DeptQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(Dept.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (DeptDto dept : all) { + Map map = new LinkedHashMap<>(); + map.put("名称", dept.getName()); + map.put("上级部门", dept.getPid()); + map.put("状态", dept.getEnabled()); + map.put("创建日期", dept.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + /** + * 根据PID查询 + * + * @param pid / + * @return / + */ + @Override +// @Cacheable(key = "#p0") + public List findByPid(long pid) { + DeptQueryCriteria criteria = new DeptQueryCriteria(); + criteria.setPid(pid); + return baseMapper.selectList(QueryHelpPlus.getPredicate(Dept.class, criteria)); + } + + /** + * 构建树形数据 + * + * @param deptDtos 原始数据 + * @return / + */ + @Override + public Object buildTree(List deptDtos) { + Set trees = new LinkedHashSet<>(); + Set depts= new LinkedHashSet<>(); + List deptNames = deptDtos.stream().map(DeptDto::getName).collect(Collectors.toList()); + boolean isChild; + DeptQueryCriteria criteria = new DeptQueryCriteria(); + List deptList = this.queryAll(criteria); + for (DeptDto deptDto : deptDtos) { + isChild = false; + if ("0".equals(deptDto.getPid().toString())) { + trees.add(deptDto); + } + for (DeptDto it : deptDtos) { + if (it.getPid().equals(deptDto.getId())) { + isChild = true; + if (deptDto.getChildren() == null) { + deptDto.setChildren(new ArrayList<>()); + } + deptDto.getChildren().add(it); + } + } + if(isChild) { + depts.add(deptDto); + for (Dept dept : deptList) { + if(dept.getId().equals(deptDto.getPid()) && !deptNames.contains(dept.getName())){ + depts.add(deptDto); + } + } + } + } + + if (CollectionUtils.isEmpty(trees)) { + trees = depts; + } + + Integer totalElements = deptDtos.size(); + + Map map = new HashMap<>(2); + map.put("totalElements",totalElements); + map.put("content",CollectionUtils.isEmpty(trees)? deptDtos :trees); + return map; + } + + /** + * 删除部门 + * @param deptIds + */ + @Override + public void delDepts(List deptIds){ + int jobCount = jobMapper.selectCount(Wrappers.lambdaQuery().in(Job::getDeptId,deptIds)); + int roleCount = rolesDeptsMapper.selectCount(Wrappers.lambdaQuery() + .in(RolesDepts::getDeptId,deptIds)); + if(jobCount > 0) { + throw new BadRequestException( "所选部门中存在与岗位关联,请取消关联后再试"); + } + if(roleCount > 0) { + throw new BadRequestException( "所选部门中存在与角色关联,请取消关联后再试"); + } + this.removeByIds(deptIds); + } + + /** + * 获取待删除的部门 + * + * @param deptList / + * @param deptDtos / + * @return / + */ +/* @Override + public Set getDeleteDepts(List deptList, Set deptDtos) { + + for (Dept dept : deptList) { + deptDtos.add((DeptDto)generator.convert(deptList,DeptDto.class)); + List depts = Collections.singletonList(this.getOne(new LambdaQueryWrapper().eq("id", dept.getId()))); + if(depts!=null && depts.size()!=0){ + getDeleteDepts(depts, deptDtos); + } + } + return deptDtos; + }*/ + + /** + * 根据角色ID查询 + * + * @param id / + * @return / + */ + @Override + public Set findByRoleIds(Long id) { + return deptMapper.findDeptByRoleId(id); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/DictDetailServiceImpl.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/DictDetailServiceImpl.java new file mode 100644 index 0000000..706725c --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/DictDetailServiceImpl.java @@ -0,0 +1,84 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.system.domain.DictDetail; +import co.yixiang.modules.system.service.DictDetailService; +import co.yixiang.modules.system.service.dto.DictDetailDto; +import co.yixiang.modules.system.service.dto.DictDetailQueryCriteria; +import co.yixiang.modules.system.service.mapper.DictDetailMapper; +import co.yixiang.utils.FileUtil; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Service +@AllArgsConstructor +//@CacheConfig(cacheNames = "dictDetail") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class DictDetailServiceImpl extends BaseServiceImpl implements DictDetailService { + + private final IGenerator generator; + + @Override + //@Cacheable + public Map queryAll(DictDetailQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), DictDetailDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(DictDetailQueryCriteria criteria){ + List list = baseMapper.selectDictDetailList(criteria.getLabel(),criteria.getDictName()); + return list; + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (DictDetailDto dictDetail : all) { + Map map = new LinkedHashMap<>(); + map.put("字典标签", dictDetail.getLabel()); + map.put("字典值", dictDetail.getValue()); + map.put("排序", dictDetail.getSort()); + map.put("字典id", dictDetail.getDictId()); + map.put("创建日期", dictDetail.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/DictServiceImpl.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/DictServiceImpl.java new file mode 100644 index 0000000..98e2c42 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/DictServiceImpl.java @@ -0,0 +1,98 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.system.domain.Dict; +import co.yixiang.modules.system.service.DictService; +import co.yixiang.modules.system.service.dto.DictDetailDto; +import co.yixiang.modules.system.service.dto.DictDto; +import co.yixiang.modules.system.service.dto.DictQueryCriteria; +import co.yixiang.modules.system.service.mapper.DictMapper; +import co.yixiang.utils.FileUtil; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Service +@AllArgsConstructor +//@CacheConfig(cacheNames = "dict") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class DictServiceImpl extends BaseServiceImpl implements DictService { + + private final IGenerator generator; + + @Override + //@Cacheable + public Map queryAll(DictQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), DictDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(DictQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(Dict.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (DictDto dict : all) { + if(CollectionUtil.isNotEmpty(dict.getDictDetails())){ + for (DictDetailDto dictDetail : dict.getDictDetails()) { + Map map = new LinkedHashMap<>(); + map.put("字典名称", dict.getName()); + map.put("字典描述", dict.getRemark()); + map.put("字典标签", dictDetail.getLabel()); + map.put("字典值", dictDetail.getValue()); + map.put("创建日期", dictDetail.getCreateTime()); + list.add(map); + } + } else { + Map map = new LinkedHashMap<>(); + map.put("字典名称", dict.getName()); + map.put("字典描述", dict.getRemark()); + map.put("字典标签", null); + map.put("字典值", null); + map.put("创建日期", dict.getCreateTime()); + list.add(map); + } + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/JobServiceImpl.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/JobServiceImpl.java new file mode 100644 index 0000000..d9f329d --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/JobServiceImpl.java @@ -0,0 +1,98 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.system.domain.Job; +import co.yixiang.modules.system.service.DeptService; +import co.yixiang.modules.system.service.JobService; +import co.yixiang.modules.system.service.dto.JobDto; +import co.yixiang.modules.system.service.dto.JobQueryCriteria; +import co.yixiang.modules.system.service.mapper.JobMapper; +import co.yixiang.utils.FileUtil; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@SuppressWarnings("unchecked") +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class JobServiceImpl extends BaseServiceImpl implements JobService { + + private final IGenerator generator; + + private final DeptService deptService; + + @Override + //@Cacheable + public Map queryAll(JobQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), JobDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(JobQueryCriteria criteria){ + List jobList = baseMapper.selectList(QueryHelpPlus.getPredicate(Job.class, criteria)); + if(criteria.getDeptIds().size()==0){ + for (Job job : jobList) { + job.setDept(deptService.getById(job.getDeptId())); + } + }else { + //断权限范围 + for (Long deptId : criteria.getDeptIds()) { + for (Job job : jobList) { + if(deptId.equals(job.getDeptId())){ + job.setDept(deptService.getById(job.getDeptId())); + } + } + } + } + return jobList; + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (JobDto job : all) { + Map map = new LinkedHashMap<>(); + map.put("岗位名称", job.getName()); + map.put("岗位状态", job.getEnabled()); + map.put("岗位排序", job.getSort()); + map.put("创建日期", job.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/MenuServiceImpl.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/MenuServiceImpl.java new file mode 100644 index 0000000..86e359d --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/MenuServiceImpl.java @@ -0,0 +1,372 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.YshopException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.exception.BadRequestException; +import co.yixiang.exception.EntityExistException; +import co.yixiang.modules.system.domain.Menu; +import co.yixiang.modules.system.domain.vo.MenuMetaVo; +import co.yixiang.modules.system.domain.vo.MenuVo; +import co.yixiang.modules.system.service.MenuService; +import co.yixiang.modules.system.service.dto.MenuDto; +import co.yixiang.modules.system.service.dto.MenuQueryCriteria; +import co.yixiang.modules.system.service.dto.RoleSmallDto; +import co.yixiang.modules.system.service.mapper.MenuMapper; +import co.yixiang.modules.system.service.mapper.RoleMapper; +import co.yixiang.utils.FileUtil; +import co.yixiang.utils.StringUtils; +import co.yixiang.utils.ValidationUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Service +@AllArgsConstructor +@CacheConfig(cacheNames = "menu") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class MenuServiceImpl extends BaseServiceImpl implements MenuService { + + private final IGenerator generator; + private final MenuMapper menuMapper; + private final RoleMapper roleMapper; + + @Override + @Cacheable + public Map queryAll(MenuQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), MenuDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + @Cacheable + public List queryAll(MenuQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(Menu.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (MenuDto menu : all) { + Map map = new LinkedHashMap<>(); + map.put("是否外链", menu.getIFrame()); + map.put("菜单名称", menu.getName()); + map.put("组件", menu.getComponent()); + map.put("上级菜单ID", menu.getPid()); + map.put("排序", menu.getSort()); + map.put("图标", menu.getIcon()); + map.put("链接地址", menu.getPath()); + map.put("缓存", menu.getCache()); + map.put("是否隐藏", menu.getHidden()); + map.put("组件名称", menu.getComponentName()); + map.put("创建日期", menu.getCreateTime()); + map.put("权限", menu.getPermission()); + map.put("类型", menu.getType()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + /** + * 构建菜单树 + * + * @param menuDtos 原始数据 + * @return / + */ + @Override + public Map buildTree(List menuDtos) { + List trees = new ArrayList<>(); + Set ids = new HashSet<>(); + for (MenuDto menuDto : menuDtos) { + if (menuDto.getPid() == 0) { + trees.add(menuDto); + } + for (MenuDto it : menuDtos) { + if (it.getPid().equals(menuDto.getId())) { + if (menuDto.getChildren() == null) { + menuDto.setChildren(new ArrayList<>()); + } + menuDto.getChildren().add(it); + ids.add(it.getId()); + } + } + } + Map map = new HashMap<>(2); + if(trees.size() == 0){ + trees = menuDtos.stream().filter(s -> !ids.contains(s.getId())).collect(Collectors.toList()); + } + map.put("content",trees); + map.put("totalElements", menuDtos.size()); + return map; + } + + /** + * 构建菜单树 + * + * @param menuDtos / + * @return / + */ + @Override + public List buildMenus(List menuDtos) { + List list = new LinkedList<>(); + menuDtos.forEach(menuDTO -> { + if (menuDTO!=null){ + List menuDtoList = menuDTO.getChildren(); + MenuVo menuVo = new MenuVo(); + menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponentName()) ? menuDTO.getComponentName() : menuDTO.getName()); + // 一级目录需要加斜杠,不然会报警告 + menuVo.setPath(menuDTO.getPid() == 0 ? "/" + menuDTO.getPath() :menuDTO.getPath()); + menuVo.setHidden(menuDTO.getHidden()); + // 如果不是外链 + if(!menuDTO.getIFrame()){ + if(menuDTO.getPid() == 0){ + menuVo.setComponent(StrUtil.isEmpty(menuDTO.getComponent())?"Layout":menuDTO.getComponent()); + }else if(!StrUtil.isEmpty(menuDTO.getComponent())){ + menuVo.setComponent(menuDTO.getComponent()); + } + } + menuVo.setMeta(new MenuMetaVo(menuDTO.getName(),menuDTO.getIcon(),!menuDTO.getCache())); + if(menuDtoList !=null && menuDtoList.size()!=0){ + menuVo.setAlwaysShow(true); + menuVo.setRedirect("noredirect"); + menuVo.setChildren(buildMenus(menuDtoList)); + // 处理是一级菜单并且没有子菜单的情况 + } else if(menuDTO.getPid() == 0){ + MenuVo menuVo1 = new MenuVo(); + menuVo1.setMeta(menuVo.getMeta()); + // 非外链 + if(!menuDTO.getIFrame()){ + menuVo1.setPath("index"); + menuVo1.setName(menuVo.getName()); + menuVo1.setComponent(menuVo.getComponent()); + } else { + menuVo1.setPath(menuDTO.getPath()); + } + menuVo.setName(null); + menuVo.setMeta(null); + menuVo.setComponent("Layout"); + List list1 = new ArrayList<>(); + list1.add(menuVo1); + menuVo.setChildren(list1); + } + list.add(menuVo); + } + } + ); + return list; + } + + /** + * 获取菜单树 + * + * @param menus / + * @return / + */ + @Override + @Cacheable(key = "'tree'") + public Object getMenuTree(List menus) { + List> list = new LinkedList<>(); + menus.forEach(menu -> { + if (menu!=null){ + List menuList = menuMapper.findByPid(menu.getId()); + Map map = new HashMap<>(16); + map.put("id",menu.getId()); + map.put("label",menu.getName()); + if(menuList!=null && menuList.size()!=0){ + map.put("children",getMenuTree(menuList)); + } + list.add(map); + } + } + ); + return list; + } + + /** + * 获取待删除的菜单 + * + * @param menuList / + * @param menuSet / + * @return / + */ + @Override + public Set getDeleteMenus(List menuList, Set menuSet) { + // 递归找出待删除的菜单 + for (Menu menu1 : menuList) { + menuSet.add(menu1); + List menus = menuMapper.findByPid(menu1.getId()); + if(menus!=null && menus.size()!=0){ + getDeleteMenus(menus, menuSet); + } + } + return menuSet; + } + + /** + * 根据pid查询 + * + * @param pid / + * @return / + */ + @Override + @Cacheable(key = "'pid:'+#p0") + public List findByPid(long pid) { + return menuMapper.findByPid(pid); + } + + /** + * 根据角色查询 + * + * @param roles / + * @return / + */ + @Override + public List findByRoles(List roles) { + List roleIds = roles.stream().map(i ->{ + Long role = i.getId(); + return role; + }).collect(Collectors.toList()); + List list = menuMapper.selectListByRoles(roleIds); + + return generator.convert(list,MenuDto.class); + } + + /** + * 删除 + * + * @param menuSet / + */ + @Override + @CacheEvict(allEntries = true) + public void delete(Set menuSet) { + for (Menu menu : menuSet) { + roleMapper.untiedMenu(menu.getId()); + this.removeById(menu.getId()); + } + } + + /** + * 编辑 + * + * @param resources / + */ + @Override + @CacheEvict(allEntries = true) + public void update(Menu resources) { + if(resources.getId().equals(resources.getPid())) { + throw new BadRequestException("上级不能为自己"); + } + Menu menu = this.getById(resources.getId()); + ValidationUtil.isNull(menu.getId(),"Permission","id",resources.getId()); + + isExitHttp(resources); + + Menu menu1 = this.getOne(new LambdaQueryWrapper() + .eq(Menu::getName,resources.getName())); + + if(menu1 != null && !menu1.getId().equals(menu.getId())){ + throw new EntityExistException(Menu.class,"name",resources.getName()); + } + + if(StringUtils.isNotBlank(resources.getComponentName())&&resources.getType()!=1&& !resources.getIFrame()){ + int menuCount = this.lambdaQuery().eq(Menu::getComponentName,resources.getComponentName()).count(); + if(menuCount > 1) { + throw new YshopException("请保持菜单组件名称唯一"); + } + menu1 = this.getOne(new LambdaQueryWrapper() + .eq(Menu::getComponentName,resources.getComponentName())); + if(menu1 != null && !menu1.getId().equals(menu.getId())){ + throw new EntityExistException(Menu.class,"componentName",resources.getComponentName()); + } + } + + menu.setId(resources.getId()); + menu.setName(resources.getName()); + menu.setComponent(resources.getComponent()); + menu.setPath(resources.getPath()); + menu.setIcon(resources.getIcon()); + menu.setIFrame(resources.getIFrame()); + menu.setPid(resources.getPid()); + menu.setSort(resources.getSort()); + menu.setCache(resources.getCache()); + menu.setHidden(resources.getHidden()); + menu.setComponentName(resources.getComponentName()); + menu.setPermission(resources.getPermission()); + menu.setType(resources.getType()); + this.saveOrUpdate(menu); + } + + @Override + @CacheEvict(allEntries = true) + public MenuDto create(Menu resources) { + isExitHttp(resources); + if(this.getOne(new LambdaQueryWrapper().eq(Menu::getName,resources.getName())) != null){ + throw new EntityExistException(Menu.class,"name",resources.getName()); + } + if(StringUtils.isNotBlank(resources.getComponentName())){ + if(this.getOne(new LambdaQueryWrapper().eq(Menu::getComponentName,resources.getComponentName())) != null){ + throw new EntityExistException(Menu.class,"componentName",resources.getComponentName()); + } + } + this.save(resources); + return generator.convert(resources,MenuDto.class); + } + + /** + * 公共方法提取出来 + * @param resources + */ + private void isExitHttp(Menu resources){ + if(resources.getIFrame()){ + String http = "http://", https = "https://"; + if (!(resources.getPath().toLowerCase().startsWith(http)||resources.getPath().toLowerCase().startsWith(https))) { + throw new BadRequestException("外链必须以http://或者https://开头"); + } + } + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/RoleServiceImpl.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/RoleServiceImpl.java new file mode 100644 index 0000000..41ad3b9 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/RoleServiceImpl.java @@ -0,0 +1,290 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.system.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.exception.EntityExistException; +import co.yixiang.modules.system.domain.Dept; +import co.yixiang.modules.system.domain.Menu; +import co.yixiang.modules.system.domain.Role; +import co.yixiang.modules.system.domain.RolesDepts; +import co.yixiang.modules.system.domain.RolesMenus; +import co.yixiang.modules.system.service.RoleService; +import co.yixiang.modules.system.service.RolesDeptsService; +import co.yixiang.modules.system.service.RolesMenusService; +import co.yixiang.modules.system.service.dto.RoleDto; +import co.yixiang.modules.system.service.dto.RoleQueryCriteria; +import co.yixiang.modules.system.service.dto.RoleSmallDto; +import co.yixiang.modules.system.service.dto.UserDto; +import co.yixiang.modules.system.service.mapper.DeptMapper; +import co.yixiang.modules.system.service.mapper.MenuMapper; +import co.yixiang.modules.system.service.mapper.RoleMapper; +import co.yixiang.utils.FileUtil; +import co.yixiang.utils.StringUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; + +/** + * @author hupeng + * @date 2020-05-14 + */ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class RoleServiceImpl extends BaseServiceImpl implements RoleService { + + private final IGenerator generator; + private final RoleMapper roleMapper; + private final MenuMapper menuMapper; + private final DeptMapper deptMapper; + private final RolesMenusService rolesMenusService; + private final RolesDeptsService rolesDeptsService; + + @Override + public Map queryAll(RoleQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), RoleDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + /** + * 查询数据分页 + * + * @param pageable 分页参数 + * @return Object + */ + @Override + public Object queryAlls(RoleQueryCriteria criteria, Pageable pageable) { + List roleList = baseMapper.selectList(QueryHelpPlus.getPredicate(Role.class, criteria)); + return roleList; + } + + + @Override + public List queryAll(RoleQueryCriteria criteria) { + List roleList = baseMapper.selectList(QueryHelpPlus.getPredicate(Role.class, criteria)); + for (Role role : roleList) { + role.setMenus(menuMapper.findMenuByRoleId(role.getId())); + role.setDepts(deptMapper.findDeptByRoleId(role.getId())); + } + return roleList; + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (RoleDto role : all) { + Map map = new LinkedHashMap<>(); + map.put("名称", role.getName()); + map.put("备注", role.getRemark()); + map.put("数据权限", role.getDataScope()); + map.put("角色级别", role.getLevel()); + map.put("创建日期", role.getCreateTime()); + map.put("功能权限", role.getPermission()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + /** + * 根据用户ID查询 + * + * @param id 用户ID + * @return / + */ +// @Cacheable(key = "'findByUsers_Id:' + #p0") + @Override + public List findByUsersId(Long id) { + List roles = roleMapper.selectListByUserId(id); + return generator.convert(roles, RoleSmallDto.class); + } + + /** + * 根据角色查询角色级别 + * + * @param roles / + * @return / + */ + @Override + public Integer findByRoles(Set roles) { + Set roleDtos = new HashSet<>(); + for (Role role : roles) { + roleDtos.add(findById(role.getId())); + } + return Collections.min(roleDtos.stream().map(RoleDto::getLevel).collect(Collectors.toList())); + } + + /** + * 根据ID查询 + * + * @param id / + * @return / + */ + @Override + public RoleDto findById(long id) { + Role role = this.getById(id); + role.setMenus(menuMapper.findMenuByRoleId(role.getId())); + role.setDepts(deptMapper.findDeptByRoleId(role.getId())); + return generator.convert(role, RoleDto.class); + } + + /** + * 修改绑定的菜单 + * + * @param resources / + * @param roleDto / + */ + @Override +// @CacheEvict(allEntries = true) + public void updateMenu(Role resources, RoleDto roleDto) { + if (resources.getMenus().size() > 0) { + List rolesMenusList = resources.getMenus().stream().map(i -> { + RolesMenus rolesMenus = new RolesMenus(); + rolesMenus.setRoleId(resources.getId()); + rolesMenus.setMenuId(i.getId()); + return rolesMenus; + }).collect(Collectors.toList()); + rolesMenusService.remove(new LambdaQueryWrapper().eq(RolesMenus::getRoleId, resources.getId())); + rolesMenusService.saveBatch(rolesMenusList); + } + } + + + @Override +// @CacheEvict(allEntries = true) + @Transactional(rollbackFor = Exception.class) + public RoleDto create(Role resources) { + if (this.getOne(new LambdaQueryWrapper().eq(Role::getName, resources.getName())) != null) { + throw new EntityExistException(Role.class, "username", resources.getName()); + } + + if (this.getOne(new LambdaQueryWrapper().eq(Role::getName, resources.getName())) != null) { + throw new EntityExistException(Role.class, "username", resources.getName()); + } + this.save(resources); + if (resources.getDepts().size() > 0) { + List rolesDeptsList = resources.getDepts().stream().map(i -> { + RolesDepts rolesDepts = new RolesDepts(); + rolesDepts.setRoleId(resources.getId()); + rolesDepts.setDeptId(i.getId()); + return rolesDepts; + }).collect(Collectors.toList()); + rolesDeptsService.saveBatch(rolesDeptsList); + } + return generator.convert(resources, RoleDto.class); + } + + @Override +// @CacheEvict(allEntries = true) + @Transactional(rollbackFor = Exception.class) + public void update(Role resources) { + Role role = this.getById(resources.getId()); + + Role role1 = this.getOne(new LambdaQueryWrapper().eq(Role::getName, resources.getName())); + + if (role1 != null && !role1.getId().equals(role.getId())) { + throw new EntityExistException(Role.class, "username", resources.getName()); + } + role1 = this.getOne(new LambdaQueryWrapper().eq(Role::getPermission, resources.getPermission())); + if (role1 != null && !role1.getId().equals(role.getId())) { + throw new EntityExistException(Role.class, "permission", resources.getPermission()); + } + role.setName(resources.getName()); + role.setRemark(resources.getRemark()); + role.setDataScope(resources.getDataScope()); + if (resources.getDepts().size() > 0) { + List rolesDeptsList = resources.getDepts().stream().map(i -> { + RolesDepts rolesDepts = new RolesDepts(); + rolesDepts.setRoleId(resources.getId()); + rolesDepts.setDeptId(i.getId()); + return rolesDepts; + }).collect(Collectors.toList()); + rolesDeptsService.remove(new LambdaQueryWrapper().eq(RolesDepts::getRoleId, resources.getId())); + rolesDeptsService.saveBatch(rolesDeptsList); + } + role.setLevel(resources.getLevel()); + role.setPermission(resources.getPermission()); + this.saveOrUpdate(role); + } + + /** + * 获取用户权限信息 + * + * @param user 用户信息 + * @return 权限信息 + */ + @Override +// @Cacheable(key = "'loadPermissionByUser:' + #p0.username") + public Collection mapToGrantedAuthorities(UserDto user) { + Set roles = roleMapper.findByUsers_Id(user.getId()); + for (Role role : roles) { + Set menuSet = menuMapper.findMenuByRoleId(role.getId()); + role.setMenus(menuSet); + Set deptSet = deptMapper.findDeptByRoleId(role.getId()); + role.setDepts(deptSet); + } + Set permissions = roles.stream().filter(role -> StringUtils.isNotBlank(role.getPermission())).map(Role::getPermission).collect(Collectors.toSet()); +// permissions.addAll( +// roles.stream().flatMap(role -> role.getMenus().stream()) +// .filter(menu -> StringUtils.isNotBlank(menu.getPermission())) +// .map(Menu::getPermission).collect(Collectors.toSet()) +// ); + roles.stream().flatMap(role -> role.getMenus().stream()) + .filter(menu -> StringUtils.isNotBlank(menu.getPermission())) + .forEach(menu -> { + // 添加基于Permission的权限信息 + for (String permission : StringUtils.split(menu.getPermission(), ",")) { + permissions.add(permission); + } + }); + + return permissions.stream().map(SimpleGrantedAuthority::new) + .collect(Collectors.toList()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Set ids) { + for (Long id : ids) { + rolesMenusService.lambdaUpdate().eq(RolesMenus::getRoleId, id).remove(); + rolesDeptsService.lambdaUpdate().eq(RolesDepts::getRoleId, id).remove(); + } + this.removeByIds(ids); + } + +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/RolesDeptsServiceImpl.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/RolesDeptsServiceImpl.java new file mode 100644 index 0000000..cf51d83 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/RolesDeptsServiceImpl.java @@ -0,0 +1,31 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.modules.system.domain.RolesDepts; +import co.yixiang.modules.system.service.RolesDeptsService; +import co.yixiang.modules.system.service.mapper.RolesDeptsMapper; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + + +/** +* @author hupeng +* @date 2020-05-16 +*/ +@Service +@AllArgsConstructor +//@CacheConfig(cacheNames = "rolesDepts") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class RolesDeptsServiceImpl extends BaseServiceImpl implements RolesDeptsService { + +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/RolesMenusServiceImpl.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/RolesMenusServiceImpl.java new file mode 100644 index 0000000..afddb39 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/RolesMenusServiceImpl.java @@ -0,0 +1,31 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.modules.system.domain.RolesMenus; +import co.yixiang.modules.system.service.RolesMenusService; +import co.yixiang.modules.system.service.mapper.RolesMenusMapper; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + + +/** +* @author hupeng +* @date 2020-05-16 +*/ +@Service +@AllArgsConstructor +//@CacheConfig(cacheNames = "rolesMenus") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class RolesMenusServiceImpl extends BaseServiceImpl implements RolesMenusService { + +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/SysUserServiceImpl.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/SysUserServiceImpl.java new file mode 100644 index 0000000..3e9d77b --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/SysUserServiceImpl.java @@ -0,0 +1,307 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.impl; + +import cn.hutool.core.date.DateUtil; +import co.yixiang.api.YshopException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.exception.EntityExistException; +import co.yixiang.modules.system.domain.Role; +import co.yixiang.modules.system.domain.User; +import co.yixiang.modules.system.domain.UserAvatar; +import co.yixiang.modules.system.domain.UsersRoles; +import co.yixiang.modules.system.service.DeptService; +import co.yixiang.modules.system.service.JobService; +import co.yixiang.modules.system.service.UserAvatarService; +import co.yixiang.modules.system.service.UserService; +import co.yixiang.modules.system.service.UsersRolesService; +import co.yixiang.modules.system.service.dto.UserDto; +import co.yixiang.modules.system.service.dto.UserQueryCriteria; +import co.yixiang.modules.system.service.mapper.RoleMapper; +import co.yixiang.modules.system.service.mapper.SysUserMapper; +import co.yixiang.utils.FileUtil; +import co.yixiang.utils.RedisUtils; +import co.yixiang.utils.SecurityUtils; +import co.yixiang.utils.StringUtils; +import co.yixiang.utils.ValidationUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Service +//@AllArgsConstructor +//@CacheConfig(cacheNames = "user") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class SysUserServiceImpl extends BaseServiceImpl implements UserService { + + @Value("${file.avatar}") + private String avatar; + + private final IGenerator generator; + private final SysUserMapper userMapper; + private final UserAvatarService userAvatarService; + private final JobService jobService; + private final DeptService deptService; + private final RoleMapper roleMapper; + private final RedisUtils redisUtils; + private final UsersRolesService usersRolesService; + + public SysUserServiceImpl(IGenerator generator, SysUserMapper userMapper, UserAvatarService userAvatarService, JobService jobService, DeptService deptService, RoleMapper roleMapper, RedisUtils redisUtils, UsersRolesService usersRolesService) { + this.generator = generator; + this.userMapper = userMapper; + this.userAvatarService = userAvatarService; + this.jobService = jobService; + this.deptService = deptService; + this.roleMapper = roleMapper; + this.redisUtils = redisUtils; + this.usersRolesService = usersRolesService; + } + + @Override + //@Cacheable + public Map queryAll(UserQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), UserDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(UserQueryCriteria criteria){ + List userList = baseMapper.selectList(QueryHelpPlus.getPredicate(User.class, criteria)); + for (User user : userList) { + user.setJob(jobService.getById(user.getJobId())); + user.setDept(deptService.getById(user.getDeptId())); + user.setRoles(roleMapper.findByUsers_Id(user.getId())); + } + return userList; + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (UserDto user : all) { + Map map = new LinkedHashMap<>(); + map.put("邮箱", user.getEmail()); + map.put("状态:1启用、0禁用", user.getEnabled()); + map.put("密码", user.getPassword()); + map.put("用户名", user.getUsername()); + map.put("部门名称", user.getDeptId()); + map.put("手机号码", user.getPhone()); + map.put("创建日期", user.getCreateTime()); + map.put("最后修改密码的日期", user.getLastPasswordResetTime()); + map.put("昵称", user.getNickName()); + map.put("性别", user.getSex()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + /** + * 根据用户名查询 + * + * @param userName / + * @return / + */ + @Override + public UserDto findByName(String userName) { + User user = userMapper.findByName(userName); + + if(user == null) { + throw new YshopException("当前用户不存在"); + } + //用户所属岗位 + user.setJob(jobService.getById(user.getJobId())); + //用户所属部门 + user.setDept(deptService.getById(user.getDeptId())); + return generator.convert(user, UserDto.class); + } + + /** + * 修改密码 + * + * @param username 用户名 + * @param encryptPassword 密码 + */ + @Override + public void updatePass(String username, String encryptPassword) { + userMapper.updatePass(encryptPassword, DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"),username); + } + + /** + * 修改头像 + * + * @param multipartFile 文件 + */ + @Override + public void updateAvatar(MultipartFile multipartFile) { + User user = this.getOne(new LambdaQueryWrapper() + .eq(User::getUsername,SecurityUtils.getUsername())); + UserAvatar userAvatar = userAvatarService.getOne(new LambdaQueryWrapper() + .eq(UserAvatar::getId,user.getAvatarId())); + String oldPath = ""; + if(userAvatar != null){ + oldPath = userAvatar.getPath(); + } else { + userAvatar = new UserAvatar(); + } + File file = FileUtil.upload(multipartFile, avatar); + assert file != null; + userAvatar.setRealName(file.getName()); + userAvatar.setPath(file.getPath()); + userAvatar.setSize(FileUtil.getSize(multipartFile.getSize())); + userAvatarService.saveOrUpdate(userAvatar); + user.setAvatarId(userAvatar.getId()); + this.saveOrUpdate(user); + if(StringUtils.isNotBlank(oldPath)){ + FileUtil.del(oldPath); + } + + } + + /** + * 修改邮箱 + * + * @param username 用户名 + * @param email 邮箱 + */ + @Override + public void updateEmail(String username, String email) { + userMapper.updateEmail(email, username); + } + + /** + * 新增用户 + * + * @param resources / + * @return / + */ + @Override + //@CacheEvict(allEntries = true) + @Transactional(rollbackFor = Exception.class) + public boolean create(User resources) { + User userName = this.getOne(new LambdaQueryWrapper() + .eq(User::getUsername,resources.getUsername())); + if(userName != null){ + throw new EntityExistException(User.class,"username",resources.getUsername()); + } + User userEmail = this.getOne(new LambdaQueryWrapper() + .eq(User::getEmail,resources.getEmail())); + if(userEmail != null){ + throw new EntityExistException(User.class,"email",resources.getEmail()); + } + resources.setDeptId(resources.getDept().getId()); + resources.setJobId(resources.getJob().getId()); + boolean result = this.save(resources); + UsersRoles usersRoles = new UsersRoles(); + usersRoles.setUserId(resources.getId()); + Set set = resources.getRoles(); + for (Role roleIds : set ) { + usersRoles.setRoleId(roleIds.getId()); + } + if (result) { + usersRolesService.save(usersRoles); + } + return result; + } + + /** + * 编辑用户 + * + * @param resources / + */ + @Override + //@CacheEvict(allEntries = true) + @Transactional(rollbackFor = Exception.class) + public void update(User resources) { + User user = this.getOne(new LambdaQueryWrapper() + .eq(User::getId,resources.getId())); + ValidationUtil.isNull(user.getId(),"User","id",resources.getId()); + User user1 = this.getOne(new LambdaQueryWrapper() + .eq(User::getUsername,resources.getUsername())); + User user2 = this.getOne(new LambdaQueryWrapper() + .eq(User::getEmail,resources.getEmail())); + + if(user1 !=null&&!user.getId().equals(user1.getId())){ + throw new EntityExistException(User.class,"username",resources.getUsername()); + } + + if(user2!=null&&!user.getId().equals(user2.getId())){ + throw new EntityExistException(User.class,"email",resources.getEmail()); + } + user.setUsername(resources.getUsername()); + user.setEmail(resources.getEmail()); + user.setEnabled(resources.getEnabled()); + user.setDeptId(resources.getDept().getId()); + user.setJobId(resources.getJob().getId()); + user.setPhone(resources.getPhone()); + user.setNickName(resources.getNickName()); + user.setSex(resources.getSex()); + boolean result = this.saveOrUpdate(user); + usersRolesService.lambdaUpdate().eq(UsersRoles ::getUserId,resources.getId()).remove(); + UsersRoles usersRoles = new UsersRoles(); + usersRoles.setUserId(resources.getId()); + Set set = resources.getRoles(); + for (Role roleIds : set ) { + usersRoles.setRoleId(roleIds.getId()); + } + if (result) { + usersRolesService.save(usersRoles); + } + + // 如果用户的角色改变了,需要手动清理下缓存 + if (!resources.getRoles().equals(user.getRoles())) { + String key = "role::loadPermissionByUser:" + user.getUsername(); + redisUtils.del(key); + key = "role::findByUsers_Id:" + user.getId(); + redisUtils.del(key); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Set ids) { + for (Long id : ids) { + usersRolesService.lambdaUpdate().eq(UsersRoles ::getUserId,id).remove(); + } + this.removeByIds(ids); + } + +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/UserAvatarServiceImpl.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/UserAvatarServiceImpl.java new file mode 100644 index 0000000..cc0dc19 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/UserAvatarServiceImpl.java @@ -0,0 +1,93 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.system.domain.UserAvatar; +import co.yixiang.modules.system.service.UserAvatarService; +import co.yixiang.modules.system.service.dto.UserAvatarDto; +import co.yixiang.modules.system.service.dto.UserAvatarQueryCriteria; +import co.yixiang.modules.system.service.mapper.UserAvatarMapper; +import co.yixiang.utils.FileUtil; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Service +@AllArgsConstructor +//@CacheConfig(cacheNames = "userAvatar") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class UserAvatarServiceImpl extends BaseServiceImpl implements UserAvatarService { + + private final IGenerator generator; + + @Override + //@Cacheable + public Map queryAll(UserAvatarQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), UserAvatarDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(UserAvatarQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(UserAvatar.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (UserAvatarDto userAvatar : all) { + Map map = new LinkedHashMap<>(); + map.put("真实文件名", userAvatar.getRealName()); + map.put("路径", userAvatar.getPath()); + map.put("大小", userAvatar.getSize()); + map.put("创建时间", userAvatar.getCreateTime()); + map.put("真实文件名", userAvatar.getRealName()); + map.put("路径", userAvatar.getPath()); + map.put("大小", userAvatar.getSize()); + map.put("创建时间", userAvatar.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + public UserAvatar saveFile(UserAvatar userAvatar) { + //todo + return null; + } +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/UsersRolesServiceImpl.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/UsersRolesServiceImpl.java new file mode 100644 index 0000000..3d96edc --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/impl/UsersRolesServiceImpl.java @@ -0,0 +1,30 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.modules.system.domain.UsersRoles; +import co.yixiang.modules.system.service.UsersRolesService; +import co.yixiang.modules.system.service.mapper.UsersRolesMapper; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +/** +* @author hupeng +* @date 2020-05-16 +*/ +@Service +@AllArgsConstructor +//@CacheConfig(cacheNames = "usersRoles") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class UsersRolesServiceImpl extends BaseServiceImpl implements UsersRolesService { + +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/DeptMapper.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/DeptMapper.java new file mode 100644 index 0000000..a91846e --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/DeptMapper.java @@ -0,0 +1,31 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.system.domain.Dept; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.Set; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Repository +public interface DeptMapper extends CoreMapper { + + @Select("select m.* from dept m LEFT JOIN roles_depts t on m.id= t.dept_id LEFT JOIN role r on r.id = t.role_id where r.id = ${roleId}") + Set findDeptByRoleId(@Param("roleId") Long roleId); + + @Select("select * from dept m LEFT JOIN roles_depts t on m.id= t.dept_id LEFT JOIN role r on r.id = t.role_id where r.id = #{roleId}") + Set findDeptByRoleIds(@Param("roleIds") Set roleId); +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/DictDetailMapper.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/DictDetailMapper.java new file mode 100644 index 0000000..23565df --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/DictDetailMapper.java @@ -0,0 +1,28 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.system.domain.DictDetail; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Repository +public interface DictDetailMapper extends CoreMapper { + + @Select("") + List selectDictDetailList(@Param("label") String label,@Param("dictName") String dictName); +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/DictMapper.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/DictMapper.java new file mode 100644 index 0000000..c1b562b --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/DictMapper.java @@ -0,0 +1,22 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.system.domain.Dict; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Repository +public interface DictMapper extends CoreMapper { + +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/JobMapper.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/JobMapper.java new file mode 100644 index 0000000..9d8969b --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/JobMapper.java @@ -0,0 +1,22 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.system.domain.Job; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Repository +public interface JobMapper extends CoreMapper { + +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/MenuMapper.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/MenuMapper.java new file mode 100644 index 0000000..20dd042 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/MenuMapper.java @@ -0,0 +1,42 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.system.domain.Menu; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.List; +import java.util.Set; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Repository +@Mapper +public interface MenuMapper extends CoreMapper { + + + /** + * 根据菜单的 PID 查询 + * @param pid / + * @return / + */ + @Select("SELECT * from menu m where m.pid = #{pid} and m.is_del = 0 ") + List findByPid(@Param("pid") long pid); + + @Select("select m.* from menu m LEFT JOIN roles_menus t on m.id= t.menu_id LEFT JOIN role r on r.id = t.role_id where r.id = #{roleId} and m.is_del=0") + Set findMenuByRoleId(@Param("roleId") Long roleId); + @Select("") + List selectListByRoles(@Param("roleIds") List roleIds); +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/RoleMapper.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/RoleMapper.java new file mode 100644 index 0000000..234f58c --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/RoleMapper.java @@ -0,0 +1,55 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.system.domain.Role; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.List; +import java.util.Set; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Repository +public interface RoleMapper extends CoreMapper { + + /** + * 根据用户ID查询 + * @param id 用户ID + * @return + */ + @Select( "SELECT r.id,r.create_time,r.data_scope,r.`level`,r.`name`,r.permission,r.remark " + + "FROM role r LEFT OUTER JOIN users_roles u1 ON r.id = u1.role_id " + + "LEFT OUTER JOIN user u2 ON u1.user_id = u2.id "+ + "WHERE u2.id = #{id}") + Set findByUsers_Id(@Param("id") Long id); + + /** + * 解绑角色菜单 + * @param id 菜单ID + */ + @Delete("delete from roles_menus where menu_id = #{id}") + void untiedMenu(@Param("id") Long id); + + /** + * 根据用户ID查询 + * + * @param id 用户ID + * @return + */ + @Select("select m.* from role m LEFT JOIN users_roles t on m.id= t.role_id LEFT JOIN `user` r on r.id = t.user_id where r.id = #{id}") + List selectListByUserId(@Param("id") Long id); + +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/RolesDeptsMapper.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/RolesDeptsMapper.java new file mode 100644 index 0000000..cdd8bce --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/RolesDeptsMapper.java @@ -0,0 +1,22 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.system.domain.RolesDepts; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-16 +*/ +@Repository +public interface RolesDeptsMapper extends CoreMapper { + +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/RolesMenusMapper.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/RolesMenusMapper.java new file mode 100644 index 0000000..6235ddb --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/RolesMenusMapper.java @@ -0,0 +1,22 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.system.domain.RolesMenus; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-16 +*/ +@Repository +public interface RolesMenusMapper extends CoreMapper { + +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/SysUserMapper.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/SysUserMapper.java new file mode 100644 index 0000000..3e28375 --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/SysUserMapper.java @@ -0,0 +1,50 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.system.domain.User; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Repository +public interface SysUserMapper extends CoreMapper { + + /** + * 修改密码 + * @param username 用户名 + * @param password 密码 + * @param lastPasswordResetTime / + */ + @Update("update `user` set password = #{password} , last_password_reset_time = #{lastPasswordResetTime} where username = #{username}") + void updatePass( @Param("password") String password,@Param("lastPasswordResetTime") String lastPasswordResetTime, @Param("username") String username); + + /** + * 修改邮箱 + * @param username 用户名 + * @param email 邮箱 + */ + @Update("update `user` set email = #{email} where username = #{username}") + void updateEmail(@Param("email") String email, @Param("username") String username); + + /** + * 根据用户名查询用户信息 + * @param userName 用户名 + */ + @Select("SELECT u.id,u.nick_name,u.sex,u.dept_id,u.enabled,u.create_time,u.phone,u.email,u.job_id ,u.`password` ,u.username,ua.real_name avatar FROM `user` " + + " u LEFT JOIN user_avatar ua ON u.avatar_id = ua.id WHERE u.username = #{username}") + User findByName(String userName); + +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/UserAvatarMapper.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/UserAvatarMapper.java new file mode 100644 index 0000000..30ce7cc --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/UserAvatarMapper.java @@ -0,0 +1,22 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.system.domain.UserAvatar; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-14 +*/ +@Repository +public interface UserAvatarMapper extends CoreMapper { + +} diff --git a/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/UsersRolesMapper.java b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/UsersRolesMapper.java new file mode 100644 index 0000000..d86ffcc --- /dev/null +++ b/yshop-admin/src/main/java/co/yixiang/modules/system/service/mapper/UsersRolesMapper.java @@ -0,0 +1,22 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.system.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.system.domain.UsersRoles; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-16 +*/ +@Repository +public interface UsersRolesMapper extends CoreMapper { + +} diff --git a/yshop-admin/src/main/resources/banner.txt b/yshop-admin/src/main/resources/banner.txt new file mode 100644 index 0000000..13dced1 --- /dev/null +++ b/yshop-admin/src/main/resources/banner.txt @@ -0,0 +1,12 @@ + __ + __ __ ___ / / ___ ___ + / // /(_-< / _ \/ _ \ / _ \ + \_, //___//_//_/\___// .__/ +/___/ /_/ + + :: Application Version:: ${yshop.version} + :: Spring Boot :: ${spring-boot.version} + + + + diff --git a/yshop-admin/src/main/resources/config/application-dev.yml b/yshop-admin/src/main/resources/config/application-dev.yml new file mode 100644 index 0000000..de87592 --- /dev/null +++ b/yshop-admin/src/main/resources/config/application-dev.yml @@ -0,0 +1,100 @@ +#配置数据源 +spring: + application: + name: yshop-system + datasource: + druid: + type: com.alibaba.druid.pool.DruidDataSource + driverClassName: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://localhost:3306/yshopb2c?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull + username: root + password: 123456 + + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 FROM DUAL + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + webStatFilter: + enabled: true + statViewServlet: + enabled: true + # 设置白名单,不填则允许所有访问 + allow: + url-pattern: /druid/* + # 控制台管理用户名和密码 + login-username: admin + login-password: 123456 + filter: + stat: + enabled: true + # 慢SQL记录 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true + redis: + #数据库索引 + database: 2 + host: 127.0.0.1 + port: 6379 + password: + #连接超时时间 + timeout: 5000 + +# 是否限制单用户登录 +single: + login: false + +#jwt +jwt: + header: Authorization + # 令牌前缀 + token-start-with: Bearer + secret: k09BQnaF + # 必须使用最少88位的Base64对该令牌进行编码 + base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI= + # 令牌过期时间 此处单位/毫秒 ,默认4小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html + token-validity-in-seconds: 14400000 + # 在线用户key + online-key: online-token + # 验证码 + code-key: code-key + + +#是否允许生成代码,生产环境设置为false +generator: + enabled: true + +#是否开启 swagger-ui +swagger: + enabled: true + title: yshop商城管理后台API + serverUrl: + version: 3.2 + +# 文件存储路径 +file: + path: D:\yshop\file\ + avatar: D:\yshop\avatar\ + # 文件大小 /M + maxSize: 100 + avatarMaxSize: 5 + + diff --git a/yshop-admin/src/main/resources/config/application-docker.yml b/yshop-admin/src/main/resources/config/application-docker.yml new file mode 100644 index 0000000..bb1a682 --- /dev/null +++ b/yshop-admin/src/main/resources/config/application-docker.yml @@ -0,0 +1,106 @@ +#配置数据源 +spring: + application: + name: yshop-system + datasource: + druid: + type: com.alibaba.druid.pool.DruidDataSource + driverClassName: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://localhost:3366/yshopb2c?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull + username: yshopb2c + password: bkfGfAimifjPZtNE + + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 FROM DUAL + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + webStatFilter: + enabled: true + statViewServlet: + enabled: true + # 设置白名单,不填则允许所有访问 + allow: + url-pattern: /druid/* + # 控制台管理用户名和密码 + login-username: admin + login-password: 123456 + filter: + stat: + enabled: true + # 慢SQL记录 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true + + redis: + #数据库索引 + database: 5 + host: 127.0.0.1 + port: 6399 # Redis服务器连接端口 + password: 6379@@6379 # Redis服务器连接密码(默认为空) + #连接超时时间 + timeout: 5000 + +# 是否限制单用户登录 +single: + login: false + +#jwt +jwt: + header: Authorization + # 令牌前缀 + token-start-with: Bearer + secret: k09BQnaF + # 必须使用最少88位的Base64对该令牌进行编码 + base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI= + # 令牌过期时间 此处单位/毫秒 ,默认2小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html + token-validity-in-seconds: 7200000 + # 在线用户key + online-key: online-token + # 验证码 + code-key: code-key + +#是否允许生成代码,生产环境设置为false +generator: + enabled: false + +#如果生产环境要开启swagger,需要配置请求地址 +#springfox: +# documentation: +# swagger: +# v2: +# host: # 接口域名或外网ip + +#是否开启 swagger-ui,生产环境默认不开启 +swagger: + enabled: true + title: yshop商城管理后台API + serverUrl: http://127.0.0.1:8000 + version: 3.2 + + +file: + path: /www/wwwroot/thapi.xinxintuan.co/upload/file/ + avatar: /www/wwwroot/thapi.xinxintuan.co/upload/avatar/ + # 文件大小 /M + maxSize: 100 + avatarMaxSize: 5 + diff --git a/yshop-admin/src/main/resources/config/application-prod.yml b/yshop-admin/src/main/resources/config/application-prod.yml new file mode 100644 index 0000000..a73771f --- /dev/null +++ b/yshop-admin/src/main/resources/config/application-prod.yml @@ -0,0 +1,106 @@ +#配置数据源 +spring: + application: + name: yshop-system + datasource: + druid: + type: com.alibaba.druid.pool.DruidDataSource + driverClassName: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://localhost:3366/yshopb2c?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull + username: yshopb2c + password: bkfGfAimifjPZtNE + + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 FROM DUAL + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + webStatFilter: + enabled: true + statViewServlet: + enabled: true + # 设置白名单,不填则允许所有访问 + allow: + url-pattern: /druid/* + # 控制台管理用户名和密码 + login-username: admin + login-password: 123456 + filter: + stat: + enabled: true + # 慢SQL记录 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true + + redis: + #数据库索引 + database: 5 + host: 127.0.0.1 + port: 6379 # Redis服务器连接端口 + password: # Redis服务器连接密码(默认为空) + #连接超时时间 + timeout: 5000 + +# 是否限制单用户登录 +single: + login: false + +#jwt +jwt: + header: Authorization + # 令牌前缀 + token-start-with: Bearer + secret: k09BQnaF + # 必须使用最少88位的Base64对该令牌进行编码 + base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI= + # 令牌过期时间 此处单位/毫秒 ,默认2小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html + token-validity-in-seconds: 7200000 + # 在线用户key + online-key: online-token + # 验证码 + code-key: code-key + +#是否允许生成代码,生产环境设置为false +generator: + enabled: false + +#如果生产环境要开启swagger,需要配置请求地址 +#springfox: +# documentation: +# swagger: +# v2: +# host: # 接口域名或外网ip + +#是否开启 swagger-ui,生产环境默认不开启 +swagger: + enabled: true + title: yshop商城管理后台API + serverUrl: http://127.0.0.1:8000 + version: 3.2 + + +file: + path: /home/yshop/file/ + avatar: /home/yshop/avatar/ + # 文件大小 /M + maxSize: 100 + avatarMaxSize: 5 + diff --git a/yshop-admin/src/main/resources/config/application.yml b/yshop-admin/src/main/resources/config/application.yml new file mode 100644 index 0000000..ca98f4d --- /dev/null +++ b/yshop-admin/src/main/resources/config/application.yml @@ -0,0 +1,75 @@ +server: + port: 8001 + +spring: + freemarker: + check-template-location: false + profiles: + active: dev + jackson: + time-zone: GMT+8 + data: + redis: + repositories: + enabled: false + +task: + pool: + # 核心线程池大小 + core-pool-size: 10 + # 最大线程数 + max-pool-size: 30 + # 活跃时间 + keep-alive-seconds: 60 + # 队列容量 + queue-capacity: 50 + +#七牛云 +qiniu: + # 文件大小 /M + max-size: 15 + +#邮箱验证码有效时间/分钟 +code: + expiration: 5 + +#登录图形验证码有效时间/分钟 +loginCode: + expiration: 2 + +#密码加密传输,前端公钥加密,后端私钥解密 +rsa: + private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A== + +# sm.ms 图床的 token +smms: + token: 1oOP3ykFDI0K6ifmtvU7c8Y1eTWZSlyl + +yshop: + # 配置 + version: 3.2 + apiUrl: http://127.0.0.1:8009/api + +logging: + level: + co.yixiang: DEBUG + org.springframework.web: DEBUG + com.github.binarywang.demo.wx.mp: DEBUG + me.chanjar.weixin: DEBUG + +mybatis-plus: + check-config-location: true + configuration: + map-underscore-to-camel-case: true + global-config: + db-config: + id-type: auto + logic-delete-value: 1 + logic-not-delete-value: 0 + mapper-locations: classpath*:mapper/**/*Mapper.xml +# PageHelper分页插件 +pagehelper: + helperDialect: mysql + reasonable: true + supportMethodsArguments: true + params: count=countSql diff --git a/yshop-admin/src/main/resources/generator.properties b/yshop-admin/src/main/resources/generator.properties new file mode 100644 index 0000000..16ee01d --- /dev/null +++ b/yshop-admin/src/main/resources/generator.properties @@ -0,0 +1,27 @@ +#\u6570\u636E\u5E93\u7C7B\u578B\u8F6CJava\u7C7B\u578B +tinyint=Integer +smallint=Integer +mediumint=Integer +int=Integer +integer=Integer + +bigint=Long + +float=Float + +double=Double + +decimal=BigDecimal + +bit=Boolean + +char=String +varchar=String +tinytext=String +text=String +mediumtext=String +longtext=String + +date=Date +datetime=Date +timestamp=Date \ No newline at end of file diff --git a/yshop-admin/src/main/resources/log4jdbc.log4j2.properties b/yshop-admin/src/main/resources/log4jdbc.log4j2.properties new file mode 100644 index 0000000..302525f --- /dev/null +++ b/yshop-admin/src/main/resources/log4jdbc.log4j2.properties @@ -0,0 +1,4 @@ +# If you use SLF4J. First, you need to tell log4jdbc-log4j2 that you want to use the SLF4J logger +log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator +log4jdbc.auto.load.popular.drivers=false +log4jdbc.drivers=com.mysql.cj.jdbc.Driver \ No newline at end of file diff --git a/yshop-admin/src/main/resources/logback.xml b/yshop-admin/src/main/resources/logback.xml new file mode 100644 index 0000000..d75c193 --- /dev/null +++ b/yshop-admin/src/main/resources/logback.xml @@ -0,0 +1,61 @@ + + + + + + + + yshop + + + + + + + ${log.pattern} + ${log.charset} + + + + + + ${log.path}/error.log + + ${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz + 50MB + 30 + + + %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n + UTF-8 + + + ERROR + + + + + + ${log.path}/info.log + + ${log.path}/%d{yyyy-MM}/info.%d{yyyy-MM-dd}.%i.log.gz + 50MB + 30 + + + %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n + UTF-8 + + + INFO + + + + + + + + + + + diff --git a/yshop-admin/src/main/resources/template/email/email.ftl b/yshop-admin/src/main/resources/template/email/email.ftl new file mode 100644 index 0000000..8f7e13a --- /dev/null +++ b/yshop-admin/src/main/resources/template/email/email.ftl @@ -0,0 +1,45 @@ + + + + + + + +
+
+

尊敬的用户,您好:

+

您正在申请邮箱验证,您的验证码为:

+

${code}

+ + +
+
+ + +
+
+ + diff --git a/yshop-admin/src/main/resources/template/generator/admin/Controller.ftl b/yshop-admin/src/main/resources/template/generator/admin/Controller.ftl new file mode 100644 index 0000000..5a2172f --- /dev/null +++ b/yshop-admin/src/main/resources/template/generator/admin/Controller.ftl @@ -0,0 +1,81 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package ${package}.rest; + +import co.yixiang.aop.log.Log; +import ${package}.domain.${className}; +import ${package}.service.${className}Service; +import ${package}.service.dto.${className}QueryCriteria; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @author ${author} +* @date ${date} +*/ +@Api(tags = "${apiAlias}管理") +@RestController +@RequestMapping("/api/${changeClassName}") +public class ${className}Controller { + + private final ${className}Service ${changeClassName}Service; + + public ${className}Controller(${className}Service ${changeClassName}Service) { + this.${changeClassName}Service = ${changeClassName}Service; + } + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('${changeClassName}:list')") + public void download(HttpServletResponse response, ${className}QueryCriteria criteria) throws IOException { + ${changeClassName}Service.download(${changeClassName}Service.queryAll(criteria), response); + } + + @GetMapping + @Log("查询${apiAlias}") + @ApiOperation("查询${apiAlias}") + @PreAuthorize("@el.check('${changeClassName}:list')") + public ResponseEntity get${className}s(${className}QueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(${changeClassName}Service.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增${apiAlias}") + @ApiOperation("新增${apiAlias}") + @PreAuthorize("@el.check('${changeClassName}:add')") + public ResponseEntity create(@Validated @RequestBody ${className} resources){ + return new ResponseEntity<>(${changeClassName}Service.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改${apiAlias}") + @ApiOperation("修改${apiAlias}") + @PreAuthorize("@el.check('${changeClassName}:edit')") + public ResponseEntity update(@Validated @RequestBody ${className} resources){ + ${changeClassName}Service.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除${apiAlias}") + @ApiOperation("删除${apiAlias}") + @PreAuthorize("@el.check('${changeClassName}:del')") + @DeleteMapping + public ResponseEntity deleteAll(@RequestBody ${pkColumnType}[] ids) { + ${changeClassName}Service.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-admin/src/main/resources/template/generator/admin/ControllerP.ftl b/yshop-admin/src/main/resources/template/generator/admin/ControllerP.ftl new file mode 100644 index 0000000..18c09b5 --- /dev/null +++ b/yshop-admin/src/main/resources/template/generator/admin/ControllerP.ftl @@ -0,0 +1,85 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package ${package}.rest; +import java.util.Arrays; +import co.yixiang.dozer.service.IGenerator; +import lombok.AllArgsConstructor; +import co.yixiang.logging.aop.log.Log; +import ${package}.domain.${className}; +import ${package}.service.${className}Service; +import ${package}.service.dto.${className}QueryCriteria; +import ${package}.service.dto.${className}Dto; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import co.yixiang.domain.PageResult; +/** +* @author ${author} +* @date ${date} +*/ +@AllArgsConstructor +@Api(tags = "${apiAlias}管理") +@RestController +@RequestMapping("/api/${changeClassName}") +public class ${className}Controller { + + private final ${className}Service ${changeClassName}Service; + private final IGenerator generator; + + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('admin','${changeClassName}:list')") + public void download(HttpServletResponse response, ${className}QueryCriteria criteria) throws IOException { + ${changeClassName}Service.download(generator.convert(${changeClassName}Service.queryAll(criteria), ${className}Dto.class), response); + } + + @GetMapping + @Log("查询${apiAlias}") + @ApiOperation("查询${apiAlias}") + @PreAuthorize("@el.check('admin','${changeClassName}:list')") + public ResponseEntity> get${className}s(${className}QueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(${changeClassName}Service.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增${apiAlias}") + @ApiOperation("新增${apiAlias}") + @PreAuthorize("@el.check('admin','${changeClassName}:add')") + public ResponseEntity create(@Validated @RequestBody ${className} resources){ + return new ResponseEntity<>(${changeClassName}Service.save(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改${apiAlias}") + @ApiOperation("修改${apiAlias}") + @PreAuthorize("@el.check('admin','${changeClassName}:edit')") + public ResponseEntity update(@Validated @RequestBody ${className} resources){ + ${changeClassName}Service.updateById(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除${apiAlias}") + @ApiOperation("删除${apiAlias}") + @PreAuthorize("@el.check('admin','${changeClassName}:del')") + @DeleteMapping + public ResponseEntity deleteAll(@RequestBody ${pkColumnType}[] ids) { + Arrays.asList(ids).forEach(id->{ + ${changeClassName}Service.removeById(id); + }); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-admin/src/main/resources/template/generator/admin/Dto.ftl b/yshop-admin/src/main/resources/template/generator/admin/Dto.ftl new file mode 100644 index 0000000..6eb9219 --- /dev/null +++ b/yshop-admin/src/main/resources/template/generator/admin/Dto.ftl @@ -0,0 +1,45 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package ${package}.service.dto; + +import lombok.Data; +<#if hasDateTime> +import java.util.Date; + +<#if hasBigDecimal> +import java.math.BigDecimal; + +import java.io.Serializable; +<#if !auto && pkColumnType = 'Long'> +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; + + +/** +* @author ${author} +* @date ${date} +*/ +@Data +public class ${className}Dto implements Serializable { +<#if columns??> + <#list columns as column> + + <#if column.remark != ''> + /** ${column.remark} */ + + <#if column.columnKey = 'PRI'> + <#if !auto && pkColumnType = 'Long'> + /** 防止精度丢失 */ + @JsonSerialize(using= ToStringSerializer.class) + + + private ${column.columnType} ${column.changeColumnName}; + + +} diff --git a/yshop-admin/src/main/resources/template/generator/admin/DtoP.ftl b/yshop-admin/src/main/resources/template/generator/admin/DtoP.ftl new file mode 100644 index 0000000..fb4a67c --- /dev/null +++ b/yshop-admin/src/main/resources/template/generator/admin/DtoP.ftl @@ -0,0 +1,47 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package ${package}.service.dto; + +import lombok.Data; +<#if hasDateTime> +import java.util.Date; + +<#if hasBigDecimal> +import java.math.BigDecimal; + +import java.io.Serializable; +<#if !auto && pkColumnType == 'Long'> +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; + + +/** +* @author ${author} +* @date ${date} +*/ +@Data +public class ${className}Dto implements Serializable { +<#if columns??> + <#list columns as column> + + <#if column.remark != ''> + /** ${column.remark} */ + + <#if column.columnKey = 'PRI'> + <#if !auto && pkColumnType = 'Long'> + /** 防止精度丢失 */ + @JsonSerialize(using= ToStringSerializer.class) + + + <#if column.changeColumnName != 'delFlag'> + private ${column.columnType} ${column.changeColumnName}; + + + +} diff --git a/yshop-admin/src/main/resources/template/generator/admin/Entity.ftl b/yshop-admin/src/main/resources/template/generator/admin/Entity.ftl new file mode 100644 index 0000000..304e642 --- /dev/null +++ b/yshop-admin/src/main/resources/template/generator/admin/Entity.ftl @@ -0,0 +1,73 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package ${package}.domain; + +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; + +<#if isNotNullColumns??> +import javax.validation.constraints.*; + +<#if hasDateAnnotation> +import javax.persistence.Entity; +import javax.persistence.Table; +import org.hibernate.annotations.*; + +<#if hasDateTime> +import java.util.Date; + +<#if hasBigDecimal> +import java.math.BigDecimal; + +import java.io.Serializable; + +/** +* @author ${author} +* @date ${date} +*/ +@Entity +@Data +@Table(name="${tableName}") +public class ${className} implements Serializable { +<#if columns??> + <#list columns as column> + + <#if column.remark != ''> + /** ${column.remark} */ + + <#if column.columnKey = 'PRI'> + @Id + <#if auto> + @GeneratedValue(strategy = GenerationType.IDENTITY) + + + @Column(name = "${column.columnName}"<#if column.columnKey = 'UNI'>,unique = true<#if column.istNotNull && column.columnKey != 'PRI'>,nullable = false) + <#if column.istNotNull && column.columnKey != 'PRI'> + <#if column.columnType = 'String'> + @NotBlank + <#else> + @NotNull + + + <#if column.dateAnnotation??> + <#if column.dateAnnotation = 'CreationTimestamp'> + @CreationTimestamp + <#else> + @UpdateTimestamp + + + private ${column.columnType} ${column.changeColumnName}; + + + + public void copy(${className} source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-admin/src/main/resources/template/generator/admin/EntityP.ftl b/yshop-admin/src/main/resources/template/generator/admin/EntityP.ftl new file mode 100644 index 0000000..955f5ad --- /dev/null +++ b/yshop-admin/src/main/resources/template/generator/admin/EntityP.ftl @@ -0,0 +1,60 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package ${package}.domain; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import com.baomidou.mybatisplus.annotation.TableName; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +<#if isNotNullColumns??> +import javax.validation.constraints.*; + +<#if hasDateAnnotation> + +<#if hasDateTime> +import java.util.Date; + +<#if hasBigDecimal> +import java.math.BigDecimal; + +import co.yixiang.domain.BaseDomain; + +/** +* @author ${author} +* @date ${date} +*/ +@Data +@TableName("${tableName}") +public class ${className} extends BaseDomain { +<#if columns??> + <#list columns as column> + <#if column.changeColumnName != 'isDel' && column.changeColumnName != 'createTime' && column.changeColumnName != 'updateTime' > + <#if column.remark != ''> + /** ${column.remark} */ + + <#if column.columnKey = 'PRI'> + @TableId + + <#if column.istNotNull && column.columnKey != 'PRI'> + <#if column.columnType = 'String'> + @NotBlank + <#else> + @NotNull + + + private ${column.columnType} ${column.changeColumnName}; + + + + + + public void copy(${className} source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-admin/src/main/resources/template/generator/admin/Mapper.ftl b/yshop-admin/src/main/resources/template/generator/admin/Mapper.ftl new file mode 100644 index 0000000..6d377b2 --- /dev/null +++ b/yshop-admin/src/main/resources/template/generator/admin/Mapper.ftl @@ -0,0 +1,24 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package ${package}.service.mapper; + +import co.yixiang.base.BaseMapper; +import ${package}.domain.${className}; +import ${package}.service.dto.${className}Dto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author ${author} +* @date ${date} +*/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface ${className}Mapper extends BaseMapper<${className}Dto, ${className}> { + +} diff --git a/yshop-admin/src/main/resources/template/generator/admin/MapperP.ftl b/yshop-admin/src/main/resources/template/generator/admin/MapperP.ftl new file mode 100644 index 0000000..2493ec6 --- /dev/null +++ b/yshop-admin/src/main/resources/template/generator/admin/MapperP.ftl @@ -0,0 +1,23 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package ${package}.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import ${package}.domain.${className}; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** +* @author ${author} +* @date ${date} +*/ +@Repository +public interface ${className}Mapper extends CoreMapper<${className}> { + +} diff --git a/yshop-admin/src/main/resources/template/generator/admin/QueryCriteria.ftl b/yshop-admin/src/main/resources/template/generator/admin/QueryCriteria.ftl new file mode 100644 index 0000000..691b088 --- /dev/null +++ b/yshop-admin/src/main/resources/template/generator/admin/QueryCriteria.ftl @@ -0,0 +1,73 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package ${package}.service.dto; + +import lombok.Data; +<#if queryHasDateTime> +import java.util.Date; + +<#if queryHasBigDecimal> +import java.math.BigDecimal; + +<#if betweens??> +import java.util.List; + +<#if queryColumns??> +import co.yixiang.annotation.Query; + + +/** +* @author ${author} +* @date ${date} +*/ +@Data +public class ${className}QueryCriteria{ +<#if queryColumns??> + <#list queryColumns as column> + +<#if column.queryType = '='> + /** 精确 */ + @Query + private ${column.columnType} ${column.changeColumnName}; + +<#if column.queryType = 'Like'> + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private ${column.columnType} ${column.changeColumnName}; + +<#if column.queryType = '!='> + /** 不等于 */ + @Query(type = Query.Type.NOT_EQUAL) + private ${column.columnType} ${column.changeColumnName}; + +<#if column.queryType = 'NotNull'> + /** 不为空 */ + @Query(type = Query.Type.NOT_NULL) + private ${column.columnType} ${column.changeColumnName}; + +<#if column.queryType = '>='> + /** 大于等于 */ + @Query(type = Query.Type.GREATER_THAN) + private ${column.columnType} ${column.changeColumnName}; + +<#if column.queryType = '<='> + /** 小于等于 */ + @Query(type = Query.Type.LESS_THAN) + private ${column.columnType} ${column.changeColumnName}; + + + +<#if betweens??> + <#list betweens as column> + /** BETWEEN */ + @Query(type = Query.Type.BETWEEN) + private List<${column.columnType}> createTime; + + +} diff --git a/yshop-admin/src/main/resources/template/generator/admin/QueryCriteriaP.ftl b/yshop-admin/src/main/resources/template/generator/admin/QueryCriteriaP.ftl new file mode 100644 index 0000000..691b088 --- /dev/null +++ b/yshop-admin/src/main/resources/template/generator/admin/QueryCriteriaP.ftl @@ -0,0 +1,73 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package ${package}.service.dto; + +import lombok.Data; +<#if queryHasDateTime> +import java.util.Date; + +<#if queryHasBigDecimal> +import java.math.BigDecimal; + +<#if betweens??> +import java.util.List; + +<#if queryColumns??> +import co.yixiang.annotation.Query; + + +/** +* @author ${author} +* @date ${date} +*/ +@Data +public class ${className}QueryCriteria{ +<#if queryColumns??> + <#list queryColumns as column> + +<#if column.queryType = '='> + /** 精确 */ + @Query + private ${column.columnType} ${column.changeColumnName}; + +<#if column.queryType = 'Like'> + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private ${column.columnType} ${column.changeColumnName}; + +<#if column.queryType = '!='> + /** 不等于 */ + @Query(type = Query.Type.NOT_EQUAL) + private ${column.columnType} ${column.changeColumnName}; + +<#if column.queryType = 'NotNull'> + /** 不为空 */ + @Query(type = Query.Type.NOT_NULL) + private ${column.columnType} ${column.changeColumnName}; + +<#if column.queryType = '>='> + /** 大于等于 */ + @Query(type = Query.Type.GREATER_THAN) + private ${column.columnType} ${column.changeColumnName}; + +<#if column.queryType = '<='> + /** 小于等于 */ + @Query(type = Query.Type.LESS_THAN) + private ${column.columnType} ${column.changeColumnName}; + + + +<#if betweens??> + <#list betweens as column> + /** BETWEEN */ + @Query(type = Query.Type.BETWEEN) + private List<${column.columnType}> createTime; + + +} diff --git a/yshop-admin/src/main/resources/template/generator/admin/Repository.ftl b/yshop-admin/src/main/resources/template/generator/admin/Repository.ftl new file mode 100644 index 0000000..03c39f7 --- /dev/null +++ b/yshop-admin/src/main/resources/template/generator/admin/Repository.ftl @@ -0,0 +1,32 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package ${package}.repository; + +import ${package}.domain.${className}; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @author ${author} +* @date ${date} +*/ +public interface ${className}Repository extends JpaRepository<${className}, ${pkColumnType}>, JpaSpecificationExecutor<${className}> { +<#if columns??> + <#list columns as column> + <#if column.columnKey = 'UNI'> + /** + * 根据 ${column.capitalColumnName} 查询 + * @param ${column.columnName} / + * @return / + */ + ${className} findBy${column.capitalColumnName}(${column.columnType} ${column.columnName}); + + + +} diff --git a/yshop-admin/src/main/resources/template/generator/admin/Service.ftl b/yshop-admin/src/main/resources/template/generator/admin/Service.ftl new file mode 100644 index 0000000..1ae32c5 --- /dev/null +++ b/yshop-admin/src/main/resources/template/generator/admin/Service.ftl @@ -0,0 +1,74 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package ${package}.service; + +import ${package}.domain.${className}; +import ${package}.service.dto.${className}Dto; +import ${package}.service.dto.${className}QueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @author ${author} +* @date ${date} +*/ +public interface ${className}Service { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(${className}QueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List<${className}Dto> + */ + List<${className}Dto> queryAll(${className}QueryCriteria criteria); + + /** + * 根据ID查询 + * @param ${pkChangeColName} ID + * @return ${className}Dto + */ + ${className}Dto findById(${pkColumnType} ${pkChangeColName}); + + /** + * 创建 + * @param resources / + * @return ${className}Dto + */ + ${className}Dto create(${className} resources); + + /** + * 编辑 + * @param resources / + */ + void update(${className} resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(${pkColumnType}[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List<${className}Dto> all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-admin/src/main/resources/template/generator/admin/ServiceImpl.ftl b/yshop-admin/src/main/resources/template/generator/admin/ServiceImpl.ftl new file mode 100644 index 0000000..9c1009a --- /dev/null +++ b/yshop-admin/src/main/resources/template/generator/admin/ServiceImpl.ftl @@ -0,0 +1,162 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package ${package}.service.impl; + +import ${package}.domain.${className}; +<#if columns??> + <#list columns as column> + <#if column.columnKey = 'UNI'> + <#if column_index = 1> +import co.yixiang.exception.EntityExistException; + + + + +import co.yixiang.utils.ValidationUtil; +import co.yixiang.utils.FileUtil; +import ${package}.repository.${className}Repository; +import ${package}.service.${className}Service; +import ${package}.service.dto.${className}Dto; +import ${package}.service.dto.${className}QueryCriteria; +import ${package}.service.mapper.${className}Mapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +<#if !auto && pkColumnType = 'Long'> +import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.util.IdUtil; + +<#if !auto && pkColumnType = 'String'> +import cn.hutool.core.util.IdUtil; + +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @author ${author} +* @date ${date} +*/ +@Service +//@CacheConfig(cacheNames = "${changeClassName}") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class ${className}ServiceImpl implements ${className}Service { + + private final ${className}Repository ${changeClassName}Repository; + + private final ${className}Mapper ${changeClassName}Mapper; + + public ${className}ServiceImpl(${className}Repository ${changeClassName}Repository, ${className}Mapper ${changeClassName}Mapper) { + this.${changeClassName}Repository = ${changeClassName}Repository; + this.${changeClassName}Mapper = ${changeClassName}Mapper; + } + + @Override + //@Cacheable + public Map queryAll(${className}QueryCriteria criteria, Pageable pageable){ + Page<${className}> page = ${changeClassName}Repository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(${changeClassName}Mapper::toDto)); + } + + @Override + //@Cacheable + public List<${className}Dto> queryAll(${className}QueryCriteria criteria){ + return ${changeClassName}Mapper.toDto(${changeClassName}Repository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + //@Cacheable(key = "#p0") + public ${className}Dto findById(${pkColumnType} ${pkChangeColName}) { + ${className} ${changeClassName} = ${changeClassName}Repository.findById(${pkChangeColName}).orElseGet(${className}::new); + ValidationUtil.isNull(${changeClassName}.get${pkCapitalColName}(),"${className}","${pkChangeColName}",${pkChangeColName}); + return ${changeClassName}Mapper.toDto(${changeClassName}); + } + + @Override + //@CacheEvict(allEntries = true) + @Transactional(rollbackFor = Exception.class) + public ${className}Dto create(${className} resources) { +<#if !auto && pkColumnType = 'Long'> + Snowflake snowflake = IdUtil.createSnowflake(1, 1); + resources.set${pkCapitalColName}(snowflake.nextId()); + +<#if !auto && pkColumnType = 'String'> + resources.set${pkCapitalColName}(IdUtil.simpleUUID()); + +<#if columns??> + <#list columns as column> + <#if column.columnKey = 'UNI'> + if(${changeClassName}Repository.findBy${column.capitalColumnName}(resources.get${column.capitalColumnName}()) != null){ + throw new EntityExistException(${className}.class,"${column.columnName}",resources.get${column.capitalColumnName}()); + } + + + + return ${changeClassName}Mapper.toDto(${changeClassName}Repository.save(resources)); + } + + @Override + //@CacheEvict(allEntries = true) + @Transactional(rollbackFor = Exception.class) + public void update(${className} resources) { + ${className} ${changeClassName} = ${changeClassName}Repository.findById(resources.get${pkCapitalColName}()).orElseGet(${className}::new); + ValidationUtil.isNull( ${changeClassName}.get${pkCapitalColName}(),"${className}","id",resources.get${pkCapitalColName}()); +<#if columns??> + <#list columns as column> + <#if column.columnKey = 'UNI'> + <#if column_index = 1> + ${className} ${changeClassName}1 = null; + + ${changeClassName}1 = ${changeClassName}Repository.findBy${column.capitalColumnName}(resources.get${column.capitalColumnName}()); + if(${changeClassName}1 != null && !${changeClassName}1.get${pkCapitalColName}().equals(${changeClassName}.get${pkCapitalColName}())){ + throw new EntityExistException(${className}.class,"${column.columnName}",resources.get${column.capitalColumnName}()); + } + + + + ${changeClassName}.copy(resources); + ${changeClassName}Repository.save(${changeClassName}); + } + + @Override + //@CacheEvict(allEntries = true) + public void deleteAll(${pkColumnType}[] ids) { + for (${pkColumnType} id : ids) { + ${changeClassName}Repository.deleteById(${pkChangeColName}); + } + } + + @Override + public void download(List<${className}Dto> all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (${className}Dto ${changeClassName} : all) { + Map map = new LinkedHashMap<>(); + <#list columns as column> + <#if column.columnKey != 'PRI'> + <#if column.remark != ''> + map.put("${column.remark}", ${changeClassName}.get${column.capitalColumnName}()); + <#else> + map.put(" ${column.changeColumnName}", ${changeClassName}.get${column.capitalColumnName}()); + + + + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-admin/src/main/resources/template/generator/admin/ServiceImplP.ftl b/yshop-admin/src/main/resources/template/generator/admin/ServiceImplP.ftl new file mode 100644 index 0000000..0de0880 --- /dev/null +++ b/yshop-admin/src/main/resources/template/generator/admin/ServiceImplP.ftl @@ -0,0 +1,102 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package ${package}.service.impl; + +import ${package}.domain.${className}; +<#if columns??> + <#list columns as column> + <#if column.columnKey = 'UNI'> + <#if column_index = 1> +import co.yixiang.exception.EntityExistException; + + + + +import co.yixiang.common.service.impl.BaseServiceImpl; +import lombok.AllArgsConstructor; +import co.yixiang.dozer.service.IGenerator; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.utils.ValidationUtil; +import co.yixiang.utils.FileUtil; +import ${package}.service.${className}Service; +import ${package}.service.dto.${className}Dto; +import ${package}.service.dto.${className}QueryCriteria; +import ${package}.service.mapper.${className}Mapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +<#if !auto && pkColumnType = 'Long'> +import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.util.IdUtil; + +<#if !auto && pkColumnType = 'String'> +import cn.hutool.core.util.IdUtil; + +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import co.yixiang.domain.PageResult; +/** +* @author ${author} +* @date ${date} +*/ +@Service +@AllArgsConstructor +//@CacheConfig(cacheNames = "${changeClassName}") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class ${className}ServiceImpl extends BaseServiceImpl<${className}Mapper, ${className}> implements ${className}Service { + + private final IGenerator generator; + + @Override + //@Cacheable + public PageResult<${className}Dto> queryAll(${className}QueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo<${className}> page = new PageInfo<>(queryAll(criteria)); + return generator.convertPageInfo(page,${className}Dto.class); + } + + + @Override + //@Cacheable + public List<${className}> queryAll(${className}QueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(${className}.class, criteria)); + } + + + @Override + public void download(List<${className}Dto> all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (${className}Dto ${changeClassName} : all) { + Map map = new LinkedHashMap<>(); + <#list columns as column> + <#if column.columnKey != 'PRI'> + <#if column.remark != ''> + map.put("${column.remark}", ${changeClassName}.get${column.capitalColumnName}()); + <#else> + map.put(" ${column.changeColumnName}", ${changeClassName}.get${column.capitalColumnName}()); + + + + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-admin/src/main/resources/template/generator/admin/ServiceP.ftl b/yshop-admin/src/main/resources/template/generator/admin/ServiceP.ftl new file mode 100644 index 0000000..1d5a907 --- /dev/null +++ b/yshop-admin/src/main/resources/template/generator/admin/ServiceP.ftl @@ -0,0 +1,48 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package ${package}.service; +import co.yixiang.common.service.BaseService; +import ${package}.domain.${className}; +import ${package}.service.dto.${className}Dto; +import ${package}.service.dto.${className}QueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import co.yixiang.domain.PageResult; +/** +* @author ${author} +* @date ${date} +*/ +public interface ${className}Service extends BaseService<${className}>{ + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + PageResult<${className}Dto> queryAll(${className}QueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List<${className}Dto> + */ + List<${className}> queryAll(${className}QueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List<${className}Dto> all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-admin/src/main/resources/template/generator/front/api.ftl b/yshop-admin/src/main/resources/template/generator/front/api.ftl new file mode 100644 index 0000000..9587d0d --- /dev/null +++ b/yshop-admin/src/main/resources/template/generator/front/api.ftl @@ -0,0 +1,27 @@ +import request from '@/utils/request' + +export function add(data) { + return request({ + url: 'api/${changeClassName}', + method: 'post', + data + }) +} + +export function del(ids) { + return request({ + url: 'api/${changeClassName}/', + method: 'delete', + data: ids + }) +} + +export function edit(data) { + return request({ + url: 'api/${changeClassName}', + method: 'put', + data + }) +} + +export default { add, edit, del } diff --git a/yshop-admin/src/main/resources/template/generator/front/eForm.ftl b/yshop-admin/src/main/resources/template/generator/front/eForm.ftl new file mode 100644 index 0000000..1e8fbcd --- /dev/null +++ b/yshop-admin/src/main/resources/template/generator/front/eForm.ftl @@ -0,0 +1,108 @@ + + + + + diff --git a/yshop-admin/src/main/resources/template/generator/front/index.ftl b/yshop-admin/src/main/resources/template/generator/front/index.ftl new file mode 100644 index 0000000..9e9af38 --- /dev/null +++ b/yshop-admin/src/main/resources/template/generator/front/index.ftl @@ -0,0 +1,253 @@ +<#--noinspection ALL--> + + + + + diff --git a/yshop-admin/src/test/java/co/yixiang/Api_java_demo.java b/yshop-admin/src/test/java/co/yixiang/Api_java_demo.java new file mode 100644 index 0000000..e251dc9 --- /dev/null +++ b/yshop-admin/src/test/java/co/yixiang/Api_java_demo.java @@ -0,0 +1,545 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang; + +import org.apache.commons.codec.digest.DigestUtils; +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * @author :LionCity + * @date :Created in 2020-04-01 10:47 + * @description:飞鹅打印机 + * @modified By: + * @version: V1.0 + */ +public class Api_java_demo { + public static final String URL = "http://api.feieyun.cn/Api/Open/";//不需要修改 + + public static final String USER = "18948217680@163.com";//*必填*:账号名 + public static final String UKEY = "Fg4Nb6sykhK6wJDj";//*必填*: 飞鹅云后台注册账号后生成的UKEY 【备注:这不是填打印机的KEY】 + public static final String SN = "918502791";//*必填*:打印机编号,必须要在管理后台里添加打印机或调用API接口添加之后,才能调用API + + + //**********测试时,打开下面注释掉方法的即可,更多接口文档信息,请访问官网开放平台查看********** + public static void main(String[] args) throws Exception{ + //==================添加打印机接口(支持批量)================== + //***返回值JSON字符串*** + //正确例子:{"msg":"ok","ret":0,"data":{"ok":["sn#key#remark#carnum","316500011#abcdefgh#快餐前台"],"no":["316500012#abcdefgh#快餐前台#13688889999 (错误:识别码不正确)"]},"serverExecutedTime":3} + //错误:{"msg":"参数错误 : 该帐号未注册.","ret":-2,"data":null,"serverExecutedTime":37} + + //提示:打印机编号(必填) # 打印机识别码(必填) # 备注名称(选填) # 流量卡号码(选填),多台打印机请换行(\n)添加新打印机信息,每次最多100行(台)。 +// String snlist = "sn1#key1#remark1#carnum1\nsn2#key2#remark2#carnum2"; +// String method = addprinter(snlist); +// System.out.println(method); + + + + //==================方法1.小票机打印订单接口================== + //***返回值JSON字符串*** + //成功:{"msg":"ok","ret":0,"data":"xxxxxxx_xxxxxxxx_xxxxxxxx","serverExecutedTime":5} + //失败:{"msg":"错误描述","ret":非0,"data":"null","serverExecutedTime":5} + + String method1 = print(SN);//该接口只能是小票机使用,如购买的是标签机请使用下面方法2,调用打印 + System.out.println(method1); + + + + //==================方法2.标签机专用打印订单接口================== + //***返回值JSON字符串*** + //成功:{"msg":"ok","ret":0,"data":"xxxxxxx_xxxxxxxx_xxxxxxxx","serverExecutedTime":5} + //失败:{"msg":"错误描述","ret":非0,"data":"null","serverExecutedTime":5} + +// String method2 = printLabelMsg(SN);//打开注释调用标签机打印接口进行打印,该接口只能是标签机使用,其它型号打印机请勿使用该接口 +// System.out.println(method2); + + + + //===========方法3.查询某订单是否打印成功============= + //***返回值JSON字符串*** + //成功:{"msg":"ok","ret":0,"data":true,"serverExecutedTime":2}//data:true为已打印,false为未打印 + //失败:{"msg":"错误描述","ret":非0, "data":null,"serverExecutedTime":7} + +// String orderid = "xxxxxxx_xxxxxxxx_xxxxxxxx";//订单ID,从方法1返回值data获取 +// String method3 = queryOrderState(orderid); +// System.out.println(method3); + + + + //===========方法4.查询指定打印机某天的订单详情============ + //***返回值JSON字符串*** + //成功:{"msg":"ok","ret":0,"data":{"print":6,"waiting":1},"serverExecutedTime":9}//print已打印,waiting为打印 + //失败:{"msg":"错误描述","ret":非0,"data":"null","serverExecutedTime":5} + +// String strdate = "2016-11-12";//注意时间格式为"yyyy-MM-dd" +// String method4 = queryOrderInfoByDate(SN,strdate); +// System.out.println(method4); + + + + //===========方法5.查询打印机的状态========================== + //***返回值JSON字符串*** + //成功:{"msg":"ok","ret":0,"data":"状态","serverExecutedTime":4} + //失败:{"msg":"错误描述","ret":非0,"data":"null","serverExecutedTime":5} + +// String method5 = queryPrinterStatus(SN); +// System.out.println(method5); + + } + + + + + + //=====================以下是函数实现部分================================================ + + private static String addprinter(String snlist){ + + //通过POST请求,发送打印信息到服务器 + RequestConfig requestConfig = RequestConfig.custom() + .setSocketTimeout(30000)//读取超时 + .setConnectTimeout(30000)//连接超时 + .build(); + + CloseableHttpClient httpClient = HttpClients.custom() + .setDefaultRequestConfig(requestConfig) + .build(); + + HttpPost post = new HttpPost(URL); + List nvps = new ArrayList(); + nvps.add(new BasicNameValuePair("user",USER)); + String STIME = String.valueOf(System.currentTimeMillis()/1000); + nvps.add(new BasicNameValuePair("stime",STIME)); + nvps.add(new BasicNameValuePair("sig",signature(USER,UKEY,STIME))); + nvps.add(new BasicNameValuePair("apiname","Open_printerAddlist"));//固定值,不需要修改 + nvps.add(new BasicNameValuePair("printerContent",snlist)); + + CloseableHttpResponse response = null; + String result = null; + try + { + post.setEntity(new UrlEncodedFormEntity(nvps,"utf-8")); + response = httpClient.execute(post); + int statecode = response.getStatusLine().getStatusCode(); + if(statecode == 200){ + HttpEntity httpentity = response.getEntity(); + if (httpentity != null){ + result = EntityUtils.toString(httpentity); + } + } + } + catch (Exception e) + { + e.printStackTrace(); + } + finally{ + try { + if(response!=null){ + response.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + try { + post.abort(); + } catch (Exception e) { + e.printStackTrace(); + } + try { + httpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return result; + + } + + + //方法1 + private static String print(String sn){ + //标签说明: + //单标签: + //"
"为换行,""为切刀指令(主动切纸,仅限切刀打印机使用才有效果) + //""为打印LOGO指令(前提是预先在机器内置LOGO图片),""为钱箱或者外置音响指令 + //成对标签: + //""为居中放大一倍,""为放大一倍,""为居中,字体变高一倍 + //字体变宽一倍,""为二维码,""为字体加粗,""为右对齐 + //拼凑订单内容时可参考如下格式 + //根据打印纸张的宽度,自行调整内容的格式,可参考下面的样例格式 + + String content; + content = "测试打印
"; + content += "名称      单价 数量 金额
"; + content += "--------------------------------
"; + content += "饭       1.0 1 1.0
"; + content += "炒饭      10.0 10 10.0
"; + content += "蛋炒饭     10.0 10 100.0
"; + content += "鸡蛋炒饭    100.0 1 100.0
"; + content += "番茄蛋炒饭   1000.0 1 100.0
"; + content += "西红柿蛋炒饭  1000.0 1 100.0
"; + content += "西红柿鸡蛋炒饭 100.0 10 100.0
"; + content += "西红柿鸡蛋炒饭饭饭饭饭饭饭饭饭饭饭饭饭饭饭饭饭饭饭饭饭饭饭饭饭饭饭饭饭 100.0 10 100.0
"; + content += "备注:加辣
"; + content += "--------------------------------
"; + content += "合计:xx.0元
"; + content += "送货地点:广州市南沙区xx路xx号
"; + content += "联系电话:13888888888888
"; + content += "订餐时间:2016-08-08 08:08:08
"; + content += "https://admin.jidanguo10.com/weixin?id=2"; + + //通过POST请求,发送打印信息到服务器 + RequestConfig requestConfig = RequestConfig.custom() + .setSocketTimeout(30000)//读取超时 + .setConnectTimeout(30000)//连接超时 + .build(); + + CloseableHttpClient httpClient = HttpClients.custom() + .setDefaultRequestConfig(requestConfig) + .build(); + + HttpPost post = new HttpPost(URL); + List nvps = new ArrayList(); + nvps.add(new BasicNameValuePair("user",USER)); + String STIME = String.valueOf(System.currentTimeMillis()/1000); + nvps.add(new BasicNameValuePair("stime",STIME)); + nvps.add(new BasicNameValuePair("sig",signature(USER,UKEY,STIME))); + nvps.add(new BasicNameValuePair("apiname","Open_printMsg"));//固定值,不需要修改 + nvps.add(new BasicNameValuePair("sn",sn)); + nvps.add(new BasicNameValuePair("content",content)); + nvps.add(new BasicNameValuePair("times","1"));//打印联数 + + CloseableHttpResponse response = null; + String result = null; + try + { + post.setEntity(new UrlEncodedFormEntity(nvps,"utf-8")); + response = httpClient.execute(post); + int statecode = response.getStatusLine().getStatusCode(); + if(statecode == 200){ + HttpEntity httpentity = response.getEntity(); + if (httpentity != null){ + //服务器返回的JSON字符串,建议要当做日志记录起来 + result = EntityUtils.toString(httpentity); + } + } + } + catch (Exception e) + { + e.printStackTrace(); + } + finally{ + try { + if(response!=null){ + response.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + try { + post.abort(); + } catch (Exception e) { + e.printStackTrace(); + } + try { + httpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return result; + + } + + + + //方法2 + private static String printLabelMsg(String sn){ + + String content; + content = "1";//设定打印时出纸和打印字体的方向,n 0 或 1,每次设备重启后都会初始化为 0 值设置,1:正向出纸,0:反向出纸, + content += "#001 五号桌 1/3可乐鸡翅张三先生 13800138000";//40mm宽度标签纸打印例子,打开注释调用标签打印接口打印 + + //通过POST请求,发送打印信息到服务器 + RequestConfig requestConfig = RequestConfig.custom() + .setSocketTimeout(30000)//读取超时 + .setConnectTimeout(30000)//连接超时 + .build(); + + CloseableHttpClient httpClient = HttpClients.custom() + .setDefaultRequestConfig(requestConfig) + .build(); + + HttpPost post = new HttpPost(URL); + List nvps = new ArrayList(); + nvps.add(new BasicNameValuePair("user",USER)); + String STIME = String.valueOf(System.currentTimeMillis()/1000); + nvps.add(new BasicNameValuePair("stime",STIME)); + nvps.add(new BasicNameValuePair("sig",signature(USER,UKEY,STIME))); + nvps.add(new BasicNameValuePair("apiname","Open_printLabelMsg"));//固定值,不需要修改 + nvps.add(new BasicNameValuePair("sn",sn)); + nvps.add(new BasicNameValuePair("content",content)); + nvps.add(new BasicNameValuePair("times","1"));//打印联数 + + CloseableHttpResponse response = null; + String result = null; + try + { + post.setEntity(new UrlEncodedFormEntity(nvps,"utf-8")); + response = httpClient.execute(post); + int statecode = response.getStatusLine().getStatusCode(); + if(statecode == 200){ + HttpEntity httpentity = response.getEntity(); + if (httpentity != null){ + //服务器返回的JSON字符串,建议要当做日志记录起来 + result = EntityUtils.toString(httpentity); + } + } + } + catch (Exception e) + { + e.printStackTrace(); + } + finally{ + try { + if(response!=null){ + response.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + try { + post.abort(); + } catch (Exception e) { + e.printStackTrace(); + } + try { + httpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return result; + + } + + + //方法3 + private static String queryOrderState(String orderid){ + + //通过POST请求,发送打印信息到服务器 + RequestConfig requestConfig = RequestConfig.custom() + .setSocketTimeout(30000)//读取超时 + .setConnectTimeout(30000)//连接超时 + .build(); + + CloseableHttpClient httpClient = HttpClients.custom() + .setDefaultRequestConfig(requestConfig) + .build(); + + HttpPost post = new HttpPost(URL); + List nvps = new ArrayList(); + nvps.add(new BasicNameValuePair("user",USER)); + String STIME = String.valueOf(System.currentTimeMillis()/1000); + nvps.add(new BasicNameValuePair("stime",STIME)); + nvps.add(new BasicNameValuePair("sig",signature(USER,UKEY,STIME))); + nvps.add(new BasicNameValuePair("apiname","Open_queryOrderState"));//固定值,不需要修改 + nvps.add(new BasicNameValuePair("orderid",orderid)); + + CloseableHttpResponse response = null; + String result = null; + try + { + post.setEntity(new UrlEncodedFormEntity(nvps,"utf-8")); + response = httpClient.execute(post); + int statecode = response.getStatusLine().getStatusCode(); + if(statecode == 200){ + HttpEntity httpentity = response.getEntity(); + if (httpentity != null){ + //服务器返回 + result = EntityUtils.toString(httpentity); + } + } + } + catch (Exception e) + { + e.printStackTrace(); + } + finally{ + try { + if(response!=null){ + response.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + try { + post.abort(); + } catch (Exception e) { + e.printStackTrace(); + } + try { + httpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return result; + + } + + + + //方法4 + private static String queryOrderInfoByDate(String sn,String strdate){ + + //通过POST请求,发送打印信息到服务器 + RequestConfig requestConfig = RequestConfig.custom() + .setSocketTimeout(30000)//读取超时 + .setConnectTimeout(30000)//连接超时 + .build(); + + CloseableHttpClient httpClient = HttpClients.custom() + .setDefaultRequestConfig(requestConfig) + .build(); + + HttpPost post = new HttpPost(URL); + List nvps = new ArrayList(); + nvps.add(new BasicNameValuePair("user",USER)); + String STIME = String.valueOf(System.currentTimeMillis()/1000); + nvps.add(new BasicNameValuePair("stime",STIME)); + nvps.add(new BasicNameValuePair("sig",signature(USER,UKEY,STIME))); + nvps.add(new BasicNameValuePair("apiname","Open_queryOrderInfoByDate"));//固定值,不需要修改 + nvps.add(new BasicNameValuePair("sn",sn)); + nvps.add(new BasicNameValuePair("date",strdate));//yyyy-MM-dd格式 + + CloseableHttpResponse response = null; + String result = null; + try + { + post.setEntity(new UrlEncodedFormEntity(nvps,"utf-8")); + response = httpClient.execute(post); + int statecode = response.getStatusLine().getStatusCode(); + if(statecode == 200){ + HttpEntity httpentity = response.getEntity(); + if (httpentity != null){ + //服务器返回 + result = EntityUtils.toString(httpentity); + } + } + } + catch (Exception e) + { + e.printStackTrace(); + } + finally{ + try { + if(response!=null){ + response.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + try { + post.abort(); + } catch (Exception e) { + e.printStackTrace(); + } + try { + httpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return result; + + } + + + + //方法5 + private static String queryPrinterStatus(String sn){ + + //通过POST请求,发送打印信息到服务器 + RequestConfig requestConfig = RequestConfig.custom() + .setSocketTimeout(30000)//读取超时 + .setConnectTimeout(30000)//连接超时 + .build(); + + CloseableHttpClient httpClient = HttpClients.custom() + .setDefaultRequestConfig(requestConfig) + .build(); + + HttpPost post = new HttpPost(URL); + List nvps = new ArrayList(); + nvps.add(new BasicNameValuePair("user",USER)); + String STIME = String.valueOf(System.currentTimeMillis()/1000); + nvps.add(new BasicNameValuePair("stime",STIME)); + nvps.add(new BasicNameValuePair("sig",signature(USER,UKEY,STIME))); + nvps.add(new BasicNameValuePair("apiname","Open_queryPrinterStatus"));//固定值,不需要修改 + nvps.add(new BasicNameValuePair("sn",sn)); + + CloseableHttpResponse response = null; + String result = null; + try + { + post.setEntity(new UrlEncodedFormEntity(nvps,"utf-8")); + response = httpClient.execute(post); + int statecode = response.getStatusLine().getStatusCode(); + if(statecode == 200){ + HttpEntity httpentity = response.getEntity(); + if (httpentity != null){ + //服务器返回 + result = EntityUtils.toString(httpentity); + } + } + } + catch (Exception e) + { + e.printStackTrace(); + } + finally{ + try { + if(response!=null){ + response.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + try { + post.abort(); + } catch (Exception e) { + e.printStackTrace(); + } + try { + httpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return result; + + } + + + //生成签名字符串 + private static String signature(String USER,String UKEY,String STIME){ + String s = DigestUtils.sha1Hex(USER+UKEY+STIME); + return s; + } +} diff --git a/yshop-admin/src/test/java/co/yixiang/FileTest.java b/yshop-admin/src/test/java/co/yixiang/FileTest.java new file mode 100644 index 0000000..8a22696 --- /dev/null +++ b/yshop-admin/src/test/java/co/yixiang/FileTest.java @@ -0,0 +1,104 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang; + +import cn.hutool.core.img.ImgUtil; +import org.springframework.web.multipart.MultipartFile; + +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; + +/** + * @author :LionCity + * @date :Created in 2020-03-24 16:45 + * @description: + * @modified By: + * @version: + */ +public class FileTest { + public static void main(String[] args) throws IOException { + readfile("D:/upload"); + } + public static void readfile(String filepath) throws FileNotFoundException, IOException { + try { + + File file = new File(filepath); + if (!file.isDirectory()) { + System.out.println("文件"); + System.out.println("path=" + file.getPath()); + System.out.println("absolutepath=" + file.getAbsolutePath()); + System.out.println("name=" + file.getName()); + + File targetFile = new File(file.getPath().replace("upload","uploadZip")); + if (!targetFile.getParentFile().exists()) { + targetFile.getParentFile().mkdirs(); + } + ImgUtil.scale(file,targetFile,getAccuracy(file.length()/ 1024)); + } else if (file.isDirectory()) { + System.out.println("文件夹"); + String[] filelist = file.list(); + for (int i = 0; i < filelist.length; i++) { + File readfile = new File(filepath + "\\" + filelist[i]); + if (!readfile.isDirectory()) { + System.out.println("path=" + readfile.getPath()); + System.out.println("absolutepath=" + + readfile.getAbsolutePath()); + System.out.println("name=" + readfile.getName()); + File targetFile = new File(readfile.getPath().replace("upload","uploadZip")); + System.out.println("path2=" + targetFile.getPath()); + System.out.println("fileSize=" + targetFile.length()); + if (!targetFile.getParentFile().exists()) { + targetFile.getParentFile().mkdirs(); + } + ImgUtil.scale(readfile,targetFile,getAccuracy(file.length()/ 1024)); + } else if (readfile.isDirectory()) { + readfile(filepath + "\\" + filelist[i]); + } + } + + } + + } catch (FileNotFoundException e) { + System.out.println("readfile() Exception:" + e.getMessage()); + } + } + + public static BufferedImage inputImage(MultipartFile file) { + BufferedImage srcImage = null; + try { + FileInputStream in = (FileInputStream) file.getInputStream(); + srcImage = javax.imageio.ImageIO.read(in); + } catch (IOException e) { + System.out.println("读取图片文件出错!" + e.getMessage()); + } + return srcImage; + } + + /** + * 自动调节精度(经验数值) + * + * @param size 源图片大小 + * @return 图片压缩质量比 + */ + public static float getAccuracy(long size) { + float accuracy; + if (size < 400) { + accuracy = 0.85f; + } else if (size < 900) { + accuracy = 0.75f; + } else if (size < 2047) { + accuracy = 0.6f; + } else if (size < 3275) { + accuracy = 0.44f; + } else { + accuracy = 0.4f; + } + return accuracy; + } +} diff --git a/yshop-admin/src/test/java/co/yixiang/Order.java b/yshop-admin/src/test/java/co/yixiang/Order.java new file mode 100644 index 0000000..0fe95b3 --- /dev/null +++ b/yshop-admin/src/test/java/co/yixiang/Order.java @@ -0,0 +1,42 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang; + +public class Order { + private String title; + private String price; + private String num; + + public Order() { + } + public Order(String title, String price, String num) { + this.title = title; + this.price = price; + this.num = num; + } + @Override + public String toString() { + return "Order [title=" + title + ", price=" + price + ", num=" + num + "]"; + } + public String getTitle() { + return title; + } + public void setTitle(String title) { + this.title = title; + } + public String getPrice() { + return price; + } + public void setPrice(String price) { + this.price = price; + } + public String getNum() { + return num; + } + public void setNum(String num) { + this.num = num; + } +} diff --git a/yshop-admin/src/test/java/co/yixiang/PrintUtil4.java b/yshop-admin/src/test/java/co/yixiang/PrintUtil4.java new file mode 100644 index 0000000..1b7304b --- /dev/null +++ b/yshop-admin/src/test/java/co/yixiang/PrintUtil4.java @@ -0,0 +1,351 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang; + +import org.apache.commons.codec.digest.DigestUtils; +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@SuppressWarnings("static-access") +public class PrintUtil4 { + static PrintUtil4 p = new PrintUtil4(); + public static final String URL = "http://api.feieyun.cn/Api/Open/";//不需要修改 + + public static final String USER = "18948217680@163.com";//*必填*:账号名 + public static final String UKEY = "Fg4Nb6sykhK6wJDj";//*必填*: 飞鹅云后台注册账号后生成的UKEY 【备注:这不是填打印机的KEY】 + public static final String SN = "918502791";//*必填*:打印机编号,必须要在管理后台里添加打印机或调用API接口添加之后,才能调用API + + public static void main(String[] args) { +// ======================1.多个打印机同时打印====================================== +// List list = new ArrayList<>(); +// list.add(SN); +// list.add(SN2); +// for (String sn : list) { +// String method1 = p.print(sn); +// System.out.println(method1); +// } + +// ======================2单个打印机打印====================================== + String result = p.print(SN); + System.out.println(result); + +// p.writeFile("E:/retlog.txt", result); +// System.out.println("返回json数据已保存至 E:/retlog.txt 文件,有需要请查看"); + + } + + // =====================打印订单排版Demo========================== + private static String print(String sn) { +// =====================1.字体大小效果测试===================================== +// String s1 = "放大两倍
"; +// String s2 = "放大一倍
"; +// String s3 = "变高一倍
"; +// String s4 = "变宽一倍
"; +// String s5 = "字体加粗
"; +// String s6 = "默认不加标签最小效果
"; +// String s7 = "变高一倍加粗
"; +// String s8 = "变宽一倍加粗
"; +// +// String content = s1+s2+s3+s4+s5+s6+s7+s8; +// =====================1.end=================================== + +// =====================2.字体行间距测试====================================== +// String content = "飞鹅云测试
"; +// content += "名称 单价 数量 金额
"; +// content += "--------------------------------
"; +// content += "鸡蛋炒饭1   100.0 1 100.0
"; +// content += "鸡蛋炒饭2   100.0 2 200.0
"; +// content += "鸡蛋炒饭3   100.0 3 300.0
"; +// byte[] spaces = new byte[3]; +// spaces[0] = 0x1b; +// spaces[1] = 0x33; +// spaces[2] = 0x30;//7f => 50 行距距离设置最小值为\x50 最大值为\x7f +// String ls = new String(spaces);//行距开始 +// byte[] spacee = new byte[2]; +// spacee[0] = 0x1b; +// spacee[1] = 0x32; +// String le = new String(spacee);//行距结束 +// content += ls+content+le; +// =====================2.end====================================== + +// =====================3.字体大小测试=========================================== +// String content = "鸡蛋炒饭 数量:1 单价:100.0 总额:100.0
"; +// byte[] start = new byte[3]; +// start[0] = 0x1d; +// start[1] = 0x21; +// start[2] = 0x11;//7f => 50 行距距离设置最小值为\x50 最大值为\x7f +// String ls = new String(start);//行距开始 +// byte[] end = new byte[4]; +// end[0] = 0x0d; +// end[1] = 0x0a; +// end[2] = 0x1b; +// end[3] = 0x40; +// String le = new String(end);//行距结束 +// content += ls+content+le; +// =====================3.end======================================= + + +// *********************4.排版测试******************************************************************* + Order order1 = new Order("青头鸭", "100.4", "10"); +/* Order order2 = new Order("小蘑菇音乐铃 JSN-3022 -文创 UP+", "10.3", "10"); + Order order3 = new Order("功夫小子 手机座 JSN-1002-文创 UP+", "10.5", "10"); + Order order4 = new Order("zsfhjksgh菜名四dk", "10.0", "8"); + Order order5 = new Order("zsfhjksghd菜名五hjk", "100.2", "8");*/ + + List orderList = new ArrayList<>(); + orderList.add(order1); + /*orderList.add(order2); + orderList.add(order3); + orderList.add(order4); + orderList.add(order5);*/ + String content = p.getOrder(orderList, 14, 6, 3, 6);//orderList为数组 b1代表名称列占用(14个字节) b2单价列(6个字节) b3数量列(3个字节) b4金额列(6个字节)-->这里的字节数可按自己需求自由改写,14+6+3+6再加上代码写的3个空格就是32了,58mm打印机一行总占32字节 + + // 通过POST请求,发送打印信息到服务器 + RequestConfig requestConfig = RequestConfig.custom() + .setSocketTimeout(30000)// 读取超时 + .setConnectTimeout(30000)// 连接超时 + .build(); + + CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build(); + HttpPost post = new HttpPost(URL); + List nvps = new ArrayList(); + nvps.add(new BasicNameValuePair("user", USER)); + String STIME = String.valueOf(System.currentTimeMillis() / 1000); + nvps.add(new BasicNameValuePair("stime", STIME)); + nvps.add(new BasicNameValuePair("sig", p.signature(USER, UKEY, STIME))); + nvps.add(new BasicNameValuePair("apiname", "Open_printMsg"));// 固定值,不需要修改 + nvps.add(new BasicNameValuePair("sn", sn)); + nvps.add(new BasicNameValuePair("content", content)); + nvps.add(new BasicNameValuePair("times", "1"));// 打印联数 + + CloseableHttpResponse response = null; + String result = null; + try { + post.setEntity(new UrlEncodedFormEntity(nvps, "utf-8")); + response = httpClient.execute(post); + int statecode = response.getStatusLine().getStatusCode(); + if (statecode == 200) { + HttpEntity httpentity = response.getEntity(); + if (httpentity != null) { + // 服务器返回的JSON字符串,建议要当做日志记录起来 + result = EntityUtils.toString(httpentity); + } + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + p.close(response, post, httpClient); + } + return result; + } + + public void writeFile(String path, String content) { + content = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒").format(new Date()) + ",保存的订单日志信息为: " + content; + FileOutputStream fos = null; + try { + fos = new FileOutputStream(path, true); + fos.write(content.getBytes()); + fos.write("\r
".getBytes()); + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (fos != null) { + try { + fos.flush(); + fos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + private static String signature(String USER, String UKEY, String STIME) { + return DigestUtils.sha1Hex(USER + UKEY + STIME); + } + + + //飞鹅技术支持 + //######################################################################################################### + + //进行订单的多列排版demo,实现商品超出字数的自动换下一行对齐处理,同时保持各列进行对齐 + + //排版原理是统计字符串字节数,补空格换行处理 + + //58mm的机器,一行打印16个汉字,32个字母;80mm的机器,一行打印24个汉字,48个字母 + + //######################################################################################################### + + //orderList为数组 b1代表名称列占用字节 b2单价列 b3数量列 b4金额列-->这里的字节数可按自己需求自由改写,详细往上看112行调用实际例子运用 + public static String getOrder(List orderList, int b1, int b2, int b3, int b4) { + String orderInfo = "预养订单测试
"; + orderInfo += "名称 单价 数量 金额
"; + orderInfo += "--------------------------------
"; + double totals = 0.0; + for (int i = 0; i < orderList.size(); i++) { + String title = orderList.get(i).getTitle(); + String price = orderList.get(i).getPrice(); + String num = orderList.get(i).getNum(); + String total = "" + Double.valueOf(price) * Integer.parseInt(num); + totals += Double.parseDouble(total); + price = p.addSpace(price, b2); + num = p.addSpace(num, b3); + total = p.addSpace(total, b4); + String otherStr = " " + price + num + " " + total; + + int tl = 0; + try { + tl = title.getBytes("GBK").length; + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + int spaceNum = (tl / b1 + 1) * b1 - tl; + if (tl < b1) { + for (int k = 0; k < spaceNum; k++) { + title += " "; + } + title += otherStr; + } else if (tl == b1) { + title += otherStr; + } else { + List list = null; + if (p.isEn(title)) { + list = p.getStrList(title, b1); + } else { + list = p.getStrList(title, b1 / 2); + } + String s0 = p.titleAddSpace(list.get(0)); + title = s0 + otherStr + "
";// 添加 单价 数量 总额 + String s = ""; + for (int k = 1; k < list.size(); k++) { + s += list.get(k); + } + try { + s = p.getStringByEnter(b1, s); + } catch (Exception e) { + e.printStackTrace(); + } + title += s; + } + orderInfo += title + "
"; + } + orderInfo += "--------------------------------
"; + orderInfo += "合计:" + totals + "元
"; + orderInfo += "送货地点:广州市南沙区xx路xx号
"; + orderInfo += "联系电话:020-39004606
"; + orderInfo += "订餐时间:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "
"; + orderInfo += "备注:加辣
"; + orderInfo += "https://admin.jidanguo10.com/weixin?id=2"; + return orderInfo; + } + + public String titleAddSpace(String str) { + int k = 0; + int b = 14; + try { + k = str.getBytes("GBK").length; + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + for (int i = 0; i < b - k; i++) { + str += " "; + } + return str; + } + + public static String getStringByEnter(int length, String string) throws Exception { + for (int i = 1; i <= string.length(); i++) { + if (string.substring(0, i).getBytes("GBK").length > length) { + return string.substring(0, i - 1) + "
" + getStringByEnter(length, string.substring(i - 1)); + } + } + return string; + } + + public static String addSpace(String str, int size) { + int len = str.length(); + if (len < size) { + for (int i = 0; i < size - len; i++) { + str += " "; + } + } + return str; + } + + public static Boolean isEn(String str) { + Boolean b = false; + try { + b = str.getBytes("GBK").length == str.length(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return b; + } + + public static List getStrList(String inputString, int length) { + int size = inputString.length() / length; + if (inputString.length() % length != 0) { + size += 1; + } + return getStrList(inputString, length, size); + } + + public static List getStrList(String inputString, int length, int size) { + List list = new ArrayList(); + for (int index = 0; index < size; index++) { + String childStr = substring(inputString, index * length, (index + 1) * length); + list.add(childStr); + } + return list; + } + + public static String substring(String str, int f, int t) { + if (f > str.length()) + return null; + if (t > str.length()) { + return str.substring(f, str.length()); + } else { + return str.substring(f, t); + } + } + + public static void close(CloseableHttpResponse response, HttpPost post, CloseableHttpClient httpClient) { + try { + if (response != null) { + response.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + try { + post.abort(); + } catch (Exception e) { + e.printStackTrace(); + } + try { + httpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + +} diff --git a/yshop-app/Dockerfile b/yshop-app/Dockerfile new file mode 100644 index 0000000..08bcb7f --- /dev/null +++ b/yshop-app/Dockerfile @@ -0,0 +1,18 @@ +FROM moxm/java:1.8-full as builder + +MAINTAINER wangiegie@gmail.com + +ENV TZ=Asia/Shanghai +ENV JAVA_OPTS="-Xms128m -Xmx256m -Djava.security.egd=file:/dev/./urandom" + +RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +RUN mkdir -p /yshop-app + +WORKDIR /yshop-app + +EXPOSE 8008 + +ADD ./target/yshop-app-3.2.jar ./ + +CMD java $JAVA_OPTS -jar yshop-app-3.2.jar --spring.profiles.active=docker diff --git a/yshop-app/pom.xml b/yshop-app/pom.xml new file mode 100644 index 0000000..46d040d --- /dev/null +++ b/yshop-app/pom.xml @@ -0,0 +1,98 @@ + + + + yshop + co.yixiang + 3.2 + + 4.0.0 + + yshop-app + 移动端模块 + + + 0.10.6 + 3.4.2 + + + + + co.yixiang + yshop-weixin + 3.2 + + + org.springframework.boot + spring-boot-starter-security + + + + + + co.yixiang + yshop-message + 3.2 + + + co.yixiang + yshop-mall + + + + + + + com.auth0 + java-jwt + 3.8.1 + + + + org.apache.velocity + velocity-engine-core + 2.0 + + + com.google.zxing + core + 3.3.3 + + + com.aliyun + aliyun-java-sdk-core + 4.0.3 + + + com.github.qcloudsms + qcloudsms + 1.0.5 + + + com.vdurmont + emoji-java + 4.0.0 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + + + + diff --git a/yshop-app/src/main/java/co/yixiang/ApiRun.java b/yshop-app/src/main/java/co/yixiang/ApiRun.java new file mode 100644 index 0000000..36cb94d --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/ApiRun.java @@ -0,0 +1,42 @@ +package co.yixiang; + +import co.yixiang.utils.SpringContextHolder; +import com.binarywang.spring.starter.wxjava.miniapp.config.WxMaAutoConfiguration; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.context.annotation.Bean; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +/** + * @author hupeng + * @date 2019/10/1 9:20:19 + */ +@EnableAsync +@EnableTransactionManagement +@EnableCaching +@MapperScan(basePackages ={"co.yixiang.modules.*.service.mapper", "co.yixiang.config"}) +@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class , WxMaAutoConfiguration.class}) +public class ApiRun { + + public static void main(String[] args) { + SpringApplication.run(ApiRun.class, args); + + System.out.println( + " __ \n" + + " __ __ ___ / / ___ ___ \n" + + " / // /(_-< / _ \\/ _ \\ / _ \\ \n" + + " \\_, //___//_//_/\\___// .__/ \n" + + "/___/ /_/ \n "+ + + "\n意象yshop电商系统移动端API启动成功 \n官网:https://www.yixiang.co 提供技术支持゙ \n"); + } + + @Bean + public SpringContextHolder springContextHolder() { + return new SpringContextHolder(); + } +} diff --git a/yshop-app/src/main/java/co/yixiang/common/aop/NoRepeatSubmit.java b/yshop-app/src/main/java/co/yixiang/common/aop/NoRepeatSubmit.java new file mode 100644 index 0000000..056bdb2 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/aop/NoRepeatSubmit.java @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.common.aop; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface NoRepeatSubmit { + + /** + * 设置请求锁定时间 + * + * @return + */ + int lockTime() default 10; + +} diff --git a/yshop-app/src/main/java/co/yixiang/common/aspect/AppLogAspect.java b/yshop-app/src/main/java/co/yixiang/common/aspect/AppLogAspect.java new file mode 100644 index 0000000..0eb10da --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/aspect/AppLogAspect.java @@ -0,0 +1,101 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.common.aspect; + +import co.yixiang.common.bean.LocalUser; +import co.yixiang.logging.domain.Log; +import co.yixiang.logging.service.LogService; +import co.yixiang.utils.RequestHolder; +import co.yixiang.utils.StringUtils; +import co.yixiang.utils.ThrowableUtil; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.AfterThrowing; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; + +/** + * @author hupeng + * @date 2018-11-24 + */ +@Component +@Aspect +@Slf4j +public class AppLogAspect { + + private final LogService logService; + + ThreadLocal currentTime = new ThreadLocal<>(); + + public AppLogAspect(LogService logService) { + this.logService = logService; + } + + /** + * 配置切入点 + */ + @Pointcut("@annotation(co.yixiang.logging.aop.log.AppLog)") + public void logPointcut() { + // 该方法无方法体,主要为了让同类中其他方法使用此切入点 + } + + /** + * 配置环绕通知,使用在方法logPointcut()上注册的切入点 + * + * @param joinPoint join point for advice + */ + @Around("logPointcut()") + public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable { + Object result; + currentTime.set(System.currentTimeMillis()); + result = joinPoint.proceed(); + Log log = new Log("INFO",System.currentTimeMillis() - currentTime.get()); + currentTime.remove(); + HttpServletRequest request = RequestHolder.getHttpServletRequest(); + logService.saveApp(getUsername(), + StringUtils.getIp(RequestHolder.getHttpServletRequest()),joinPoint, + log,getUid()); + return result; + } + + /** + * 配置异常通知 + * + * @param joinPoint join point for advice + * @param e exception + */ + @AfterThrowing(pointcut = "logPointcut()", throwing = "e") + public void logAfterThrowing(JoinPoint joinPoint, Throwable e) { + Log log = new Log("ERROR",System.currentTimeMillis() - currentTime.get()); + currentTime.remove(); + log.setExceptionDetail(ThrowableUtil.getStackTrace(e).getBytes()); + HttpServletRequest request = RequestHolder.getHttpServletRequest(); + logService.save(getUsername(), + StringUtils.getIp(RequestHolder.getHttpServletRequest()), + (ProceedingJoinPoint)joinPoint, log,getUid()); + } + + public String getUsername() { + try { + return LocalUser.getUser().getUsername(); + }catch (Exception e){ + return ""; + } + } + + public Long getUid(){ + try { + return LocalUser.getUser().getUid(); + }catch (Exception e){ + return 0L; + } + } +} diff --git a/yshop-app/src/main/java/co/yixiang/common/aspect/RepeatSubmitAspect.java b/yshop-app/src/main/java/co/yixiang/common/aspect/RepeatSubmitAspect.java new file mode 100644 index 0000000..7bda088 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/aspect/RepeatSubmitAspect.java @@ -0,0 +1,95 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.common.aspect; + + +import co.yixiang.api.ApiResult; +import co.yixiang.common.aop.NoRepeatSubmit; +import co.yixiang.common.util.RedisLock; +import co.yixiang.common.util.RequestUtils; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.Assert; + +import javax.servlet.http.HttpServletRequest; +import java.util.UUID; + +/** + * 重复提交aop + * @author hupeng + * @since 2020-06-02 + */ +@Aspect +@Component +@Slf4j +public class RepeatSubmitAspect { + + + @Autowired + private RedisLock redisLock; + + @Pointcut("@annotation(noRepeatSubmit)") + public void pointCut(NoRepeatSubmit noRepeatSubmit) { + } + + @Around("pointCut(noRepeatSubmit)") + public Object around(ProceedingJoinPoint pjp, NoRepeatSubmit noRepeatSubmit) throws Throwable { + int lockSeconds = noRepeatSubmit.lockTime(); + + HttpServletRequest request = RequestUtils.getRequest(); + Assert.notNull(request, "request can not null"); + + String bearerToken = request.getHeader("Authorization"); + String[] tokens = bearerToken.split(" "); + String token = tokens[1]; + String path = request.getServletPath(); + String key = getKey(token, path); + String clientId = getClientId(); + + boolean isSuccess = redisLock.tryLock(key, clientId, lockSeconds); + log.info("tryLock key = [{}], clientId = [{}]", key, clientId); + + if (isSuccess) { + log.info("tryLock success, key = [{}], clientId = [{}]", key, clientId); + // 获取锁成功 + Object result; + + try { + // 执行进程 + result = pjp.proceed(); + } finally { + // 解锁 + redisLock.releaseLock(key, clientId); + log.info("releaseLock success, key = [{}], clientId = [{}]", key, clientId); + } + + return result; + + } else { + // 获取锁失败,认为是重复提交的请求 + log.info("tryLock fail, key = [{}]", key); + return ApiResult.fail("重复请求,请稍后再试"); + } + + } + + private String getKey(String token, String path) { + return token + path; + } + + private String getClientId() { + return UUID.randomUUID().toString(); + } + +} diff --git a/yshop-app/src/main/java/co/yixiang/common/bean/LocalUser.java b/yshop-app/src/main/java/co/yixiang/common/bean/LocalUser.java new file mode 100644 index 0000000..7c666fa --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/bean/LocalUser.java @@ -0,0 +1,76 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.common.bean; + + +import co.yixiang.api.ApiCode; +import co.yixiang.api.UnAuthenticatedException; +import co.yixiang.common.util.JwtToken; +import co.yixiang.common.util.RequestUtils; +import co.yixiang.modules.user.domain.YxUser; +import com.auth0.jwt.interfaces.Claim; +import org.apache.commons.lang3.StringUtils; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; + +/** + * 全局user + * @author hupeng + * @date 2020-04-30 + */ +public class LocalUser { + private static ThreadLocal> threadLocal = new ThreadLocal<>(); + + public static void set(YxUser user, Integer scope) { + Map map = new HashMap<>(); + map.put("user", user); + map.put("scope", scope); + LocalUser.threadLocal.set(map); + } + + public static void clear() { + LocalUser.threadLocal.remove(); + } + + public static YxUser getUser() { + Map map = LocalUser.threadLocal.get(); + YxUser user = (YxUser)map.get("user"); + return user; + } + + public static Integer getScope() { + Map map = LocalUser.threadLocal.get(); + Integer scope = (Integer)map.get("scope"); + return scope; + } + + public static Long getUidByToken(){ + String bearerToken = RequestUtils.getRequest().getHeader("Authorization"); + if (StringUtils.isEmpty(bearerToken)) { + return 0L; + } + + if (!bearerToken.startsWith("Bearer")) { + return 0L; + } + String[] tokens = bearerToken.split(" "); + if (!(tokens.length == 2)) { + return 0L; + } + String token = tokens[1]; + + Optional> optionalMap = JwtToken.getClaims(token); + Map map = optionalMap + .orElseThrow(() -> new UnAuthenticatedException(ApiCode.UNAUTHORIZED)); + + return map.get("uid").asLong(); + } +} diff --git a/yshop-app/src/main/java/co/yixiang/common/bean/RequestDetail.java b/yshop-app/src/main/java/co/yixiang/common/bean/RequestDetail.java new file mode 100644 index 0000000..716d732 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/bean/RequestDetail.java @@ -0,0 +1,37 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.common.bean; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + + +/** + * 请求详情信息 + * @author hupeng + * @date 2020-04-30 + */ +@Data +@Accessors(chain = true) +public class RequestDetail implements Serializable { + private static final long serialVersionUID = 2543641512850125440L; + + /** + * 请求ip地址 + */ + private String ip; + + /** + * 请求路径 + */ + private String path; + +} diff --git a/yshop-app/src/main/java/co/yixiang/common/config/CorsFilter.java b/yshop-app/src/main/java/co/yixiang/common/config/CorsFilter.java new file mode 100644 index 0000000..f9ca45a --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/config/CorsFilter.java @@ -0,0 +1,47 @@ +package co.yixiang.common.config; + +/** + * @author :LionCity + * @date :Created in 2020-12-21 13:38 + * @description: + * @modified By: + * @version: + */ + +import co.yixiang.utils.StringUtils; +import org.springframework.core.annotation.Order; +import org.springframework.http.HttpHeaders; +import org.springframework.stereotype.Component; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpFilter; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +@Component +@Order(-9999) +public class CorsFilter extends HttpFilter { + + /** + * + */ + private static final long serialVersionUID = -8387103310559517243L; + + @Override + protected void doFilter(HttpServletRequest req, HttpServletResponse res, FilterChain chain) throws IOException, ServletException { + + String origin = req.getHeader(HttpHeaders.ORIGIN); + + if (!StringUtils.isEmpty(origin)){ + res.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, origin); + res.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, "Origin, x-requested-with, Content-Type, Accept, Authorization"); + res.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true"); + res.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET, POST, PUT, OPTIONS, DELETE"); + res.addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "Cache-Control, Content-Language, Content-Type, Expires, Last-Modified, Pragma"); + res.addHeader(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "60"); + } + super.doFilter(req, res, chain); + } +} diff --git a/yshop-app/src/main/java/co/yixiang/common/config/DruidConfig.java b/yshop-app/src/main/java/co/yixiang/common/config/DruidConfig.java new file mode 100644 index 0000000..85e2b57 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/config/DruidConfig.java @@ -0,0 +1,52 @@ +package co.yixiang.common.config; + +import co.yixiang.common.config.datasource.DynamicDataSource; +import co.yixiang.enums.DataSourceType; +import com.alibaba.druid.pool.DruidDataSource; +import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; + +import javax.sql.DataSource; +import java.util.HashMap; +import java.util.Map; + + +/** + * @ClassName druid 配置多数据源 + * @Author hupeng <610796224@qq.com> + * @Date 2020/4/30 + **/ +@Configuration(proxyBeanMethods = false) +public class DruidConfig +{ + @Bean + @ConfigurationProperties("spring.datasource.druid.master") + public DataSource masterDataSource(DruidProperties druidProperties) + { + DruidDataSource dataSource = DruidDataSourceBuilder.create().build(); + return druidProperties.dataSource(dataSource); + } + + @Bean + @ConfigurationProperties("spring.datasource.druid.slave") + @ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true") + public DataSource slaveDataSource(DruidProperties druidProperties) + { + DruidDataSource dataSource = DruidDataSourceBuilder.create().build(); + return druidProperties.dataSource(dataSource); + } + + @Bean(name = "dynamicDataSource") + @Primary + public DynamicDataSource dataSource(DataSource masterDataSource, DataSource slaveDataSource) + { + Map targetDataSources = new HashMap<>(); + targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource); + targetDataSources.put(DataSourceType.SLAVE.name(), slaveDataSource); + return new DynamicDataSource(masterDataSource, targetDataSources); + } +} diff --git a/yshop-app/src/main/java/co/yixiang/common/config/DruidProperties.java b/yshop-app/src/main/java/co/yixiang/common/config/DruidProperties.java new file mode 100644 index 0000000..85b6398 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/config/DruidProperties.java @@ -0,0 +1,77 @@ +package co.yixiang.common.config; + +import com.alibaba.druid.pool.DruidDataSource; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +/** + * @ClassName druid 配置属性 + * @Author hupeng <610796224@qq.com> + * @Date 2020/4/30 + **/ +@Configuration(proxyBeanMethods = false) +public class DruidProperties +{ + @Value("${spring.datasource.druid.initialSize}") + private int initialSize; + + @Value("${spring.datasource.druid.minIdle}") + private int minIdle; + + @Value("${spring.datasource.druid.maxActive}") + private int maxActive; + + @Value("${spring.datasource.druid.maxWait}") + private int maxWait; + + @Value("${spring.datasource.druid.timeBetweenEvictionRunsMillis}") + private int timeBetweenEvictionRunsMillis; + + @Value("${spring.datasource.druid.minEvictableIdleTimeMillis}") + private int minEvictableIdleTimeMillis; + + @Value("${spring.datasource.druid.maxEvictableIdleTimeMillis}") + private int maxEvictableIdleTimeMillis; + + @Value("${spring.datasource.druid.validationQuery}") + private String validationQuery; + + @Value("${spring.datasource.druid.testWhileIdle}") + private boolean testWhileIdle; + + @Value("${spring.datasource.druid.testOnBorrow}") + private boolean testOnBorrow; + + @Value("${spring.datasource.druid.testOnReturn}") + private boolean testOnReturn; + + public DruidDataSource dataSource(DruidDataSource datasource) + { + /** 配置初始化大小、最小、最大 */ + datasource.setInitialSize(initialSize); + datasource.setMaxActive(maxActive); + datasource.setMinIdle(minIdle); + + /** 配置获取连接等待超时的时间 */ + datasource.setMaxWait(maxWait); + + /** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */ + datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); + + /** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */ + datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); + datasource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis); + + /** + * 用来检测连接是否有效的sql,要求是一个查询语句,常用select 'x'。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会起作用。 + */ + datasource.setValidationQuery(validationQuery); + /** 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。 */ + datasource.setTestWhileIdle(testWhileIdle); + /** 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */ + datasource.setTestOnBorrow(testOnBorrow); + /** 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */ + datasource.setTestOnReturn(testOnReturn); + return datasource; + } +} diff --git a/yshop-app/src/main/java/co/yixiang/common/config/FilterConfig.java b/yshop-app/src/main/java/co/yixiang/common/config/FilterConfig.java new file mode 100644 index 0000000..c00433a --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/config/FilterConfig.java @@ -0,0 +1,48 @@ +package co.yixiang.common.config; + +import cn.hutool.core.util.StrUtil; +import co.yixiang.xss.XssFilter; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import javax.servlet.DispatcherType; +import java.util.HashMap; +import java.util.Map; + + +/** + * @ClassName Filter配置 + * @Author hupeng <610796224@qq.com> + * @Date 2020/4/30 + **/ +@Configuration(proxyBeanMethods = false) +public class FilterConfig +{ + @Value("${xss.enabled}") + private String enabled; + + @Value("${xss.excludes}") + private String excludes; + + @Value("${xss.urlPatterns}") + private String urlPatterns; + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Bean + public FilterRegistrationBean xssFilterRegistration() + { + FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setDispatcherTypes(DispatcherType.REQUEST); + registration.setFilter(new XssFilter()); + registration.addUrlPatterns(StrUtil.split(urlPatterns, ",")); + registration.setName("xssFilter"); + registration.setOrder(Integer.MAX_VALUE); + Map initParameters = new HashMap(); + initParameters.put("excludes", excludes); + initParameters.put("enabled", enabled); + registration.setInitParameters(initParameters); + return registration; + } +} diff --git a/yshop-app/src/main/java/co/yixiang/common/config/InterceptorConfig.java b/yshop-app/src/main/java/co/yixiang/common/config/InterceptorConfig.java new file mode 100644 index 0000000..6213714 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/config/InterceptorConfig.java @@ -0,0 +1,71 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.common.config; + + + +import co.yixiang.common.interceptor.PermissionInterceptor; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; +import org.springframework.web.servlet.HandlerInterceptor; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * @ClassName 拦截器配置 + * @Author hupeng <610796224@qq.com> + * @Date 2020/4/30 + **/ +@Configuration +public class InterceptorConfig implements WebMvcConfigurer { + + @Value("${file.path}") + private String path; + + @Value("${file.avatar}") + private String avatar; + + @Bean + public HandlerInterceptor getPermissionInterceptor() { + return new PermissionInterceptor(); + } + + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(this.getPermissionInterceptor()); + } + +// @Bean +// public CorsFilter corsFilter() { +// UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); +// CorsConfiguration config = new CorsConfiguration(); +// config.setAllowCredentials(true); +// config.addAllowedOrigin("*"); +// config.addAllowedHeader("*"); +// config.addAllowedMethod("*"); +// source.registerCorsConfiguration("/**", config); +// return new CorsFilter(source); +// +// } + + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + String avatarUtl = "file:" + avatar.replace("\\","/"); + String pathUtl = "file:" + path.replace("\\","/"); + registry.addResourceHandler("/avatar/**").addResourceLocations(avatarUtl).setCachePeriod(0); + registry.addResourceHandler("/file/**").addResourceLocations(pathUtl).setCachePeriod(0); + registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/").setCachePeriod(0); + } +} diff --git a/yshop-app/src/main/java/co/yixiang/common/config/JacksonConfig.java b/yshop-app/src/main/java/co/yixiang/common/config/JacksonConfig.java new file mode 100644 index 0000000..e72a008 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/config/JacksonConfig.java @@ -0,0 +1,54 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.common.config; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Primary; +import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; + + +/** + * @ClassName 返回json空值去掉null和"" + * @Author hupeng <610796224@qq.com> + * @Date 2020/4/30 + **/ +//@Configuration +public class JacksonConfig +{ + @Bean + @Primary + @ConditionalOnMissingBean(ObjectMapper.class) + public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder) + { + ObjectMapper objectMapper = builder.createXmlMapper(false).build(); + // 通过该方法对mapper对象进行设置,所有序列化的对象都将按改规则进行系列化 + // Include.Include.ALWAYS 默认 + // Include.NON_DEFAULT 属性为默认值不序列化 + // Include.NON_EMPTY 属性为 空("") 或者为 NULL + // 都不序列化,则返回的json是没有这个字段的。这样对移动端会更省流量 + // Include.NON_NULL 属性为NULL 不序列化,就是为null的字段不参加序列化 + // objectMapper.setSerializationInclusion(Include.NON_EMPTY); + // 字段保留,将null值转为"" + //objectMapper.setSerializationInclusion(Include.NON_EMPTY); + // objectMapper.getSerializerProvider().setNullValueSerializer(new + // JsonSerializer() + // { + // @Override + // public void serialize(Object o, JsonGenerator jsonGenerator, + // SerializerProvider serializerProvider) + // throws IOException, JsonProcessingException + // { + // jsonGenerator.writeString(""); + // } + // }); + return objectMapper; + } +} diff --git a/yshop-app/src/main/java/co/yixiang/common/config/MybatisPlusConfig.java b/yshop-app/src/main/java/co/yixiang/common/config/MybatisPlusConfig.java new file mode 100644 index 0000000..6a2dee9 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/config/MybatisPlusConfig.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.common.config; + + +import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * MybatisPlus配置 + * + */ +@Configuration(proxyBeanMethods = false) +public class MybatisPlusConfig { + + /** + * mybatis-plus分页插件 + */ + @Bean + public PaginationInterceptor paginationInterceptor() { + return new PaginationInterceptor(); + } +} diff --git a/yshop-app/src/main/java/co/yixiang/common/config/datasource/DynamicDataSource.java b/yshop-app/src/main/java/co/yixiang/common/config/datasource/DynamicDataSource.java new file mode 100644 index 0000000..161f32a --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/config/datasource/DynamicDataSource.java @@ -0,0 +1,29 @@ +package co.yixiang.common.config.datasource; + +import co.yixiang.config.datasource.DynamicDataSourceContextHolder; +import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; + +import javax.sql.DataSource; +import java.util.Map; + + +/** + * @ClassName 动态数据源 + * @Author hupeng <610796224@qq.com> + * @Date 2020/4/30 + **/ +public class DynamicDataSource extends AbstractRoutingDataSource +{ + public DynamicDataSource(DataSource defaultTargetDataSource, Map targetDataSources) + { + super.setDefaultTargetDataSource(defaultTargetDataSource); + super.setTargetDataSources(targetDataSources); + super.afterPropertiesSet(); + } + + @Override + protected Object determineCurrentLookupKey() + { + return DynamicDataSourceContextHolder.getDataSourceType(); + } +} \ No newline at end of file diff --git a/yshop-app/src/main/java/co/yixiang/common/constant/CommonConstant.java b/yshop-app/src/main/java/co/yixiang/common/constant/CommonConstant.java new file mode 100644 index 0000000..718fd6f --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/constant/CommonConstant.java @@ -0,0 +1,46 @@ +package co.yixiang.common.constant; + + +public interface CommonConstant { + + /** + * 默认页码为1 + */ + Integer DEFAULT_PAGE_INDEX = 1; + + /** + * 默认页大小为10 + */ + Integer DEFAULT_PAGE_SIZE = 10; + + /** + * 登录用户 + */ + String LOGIN_SYS_USER = "loginSysUser"; + + /** + * 登陆token + */ + String TOKEN = "token"; + /** + * 刷新token + */ + String REFRESH_TOKEN = "refresh_token"; + + /** + * 初始密码 + */ + String INIT_PWD = "123456"; + + /** + * 默认头像 + */ + String DEFAULT_HEAD_URL = ""; + + /** + * 管理员角色名称 + */ + String ADMIN_ROLE_NAME = "管理员"; + + String ADMIN_LOGIN = "adminLogin"; +} diff --git a/yshop-app/src/main/java/co/yixiang/common/enums/SmsTypeEnum.java b/yshop-app/src/main/java/co/yixiang/common/enums/SmsTypeEnum.java new file mode 100644 index 0000000..84cab89 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/enums/SmsTypeEnum.java @@ -0,0 +1,36 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.common.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.stream.Stream; + +/** + * @author hupeng + * 短信类型枚举 + */ +@Getter +@AllArgsConstructor +public enum SmsTypeEnum { + BIND("bind","绑定手机短信"), + LOGIN("login","登陆短信"), + REGISTER("register","注册短信"); + + private String value; + private String desc; + + public static SmsTypeEnum toType(String value) { + return Stream.of(SmsTypeEnum.values()) + .filter(c -> c.value == value) + .findAny() + .orElse(null); + } +} diff --git a/yshop-app/src/main/java/co/yixiang/common/exception/BusinessException.java b/yshop-app/src/main/java/co/yixiang/common/exception/BusinessException.java new file mode 100644 index 0000000..74f10e1 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/exception/BusinessException.java @@ -0,0 +1,35 @@ +///** +// * Copyright (C) 2018-2021 +// * All rights reserved, Designed By www.yixiang.co +// * 注意: +// * 本软件为www.yixiang.co开发研制,未经购买不得使用 +// * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +// * 一经发现盗用、分享等行为,将追究法律责任,后果自负 +// */ +//package co.yixiang.common.exception; +// +// +// +// +// +///** +// * 业务异常 +// * @author hupeng +// * @date 2020-04-30 +// */ +//public class BusinessException extends YshopException { +// private static final long serialVersionUID = -2303357122330162359L; +// +// public BusinessException(String message) { +// super(message); +// } +// +// public BusinessException(Integer errorCode, String message) { +// super(errorCode, message); +// } +// +// public BusinessException(ApiCode apiCode) { +// super(apiCode); +// } +// +//} diff --git a/yshop-app/src/main/java/co/yixiang/common/exception/DaoException.java b/yshop-app/src/main/java/co/yixiang/common/exception/DaoException.java new file mode 100644 index 0000000..c98ee6f --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/exception/DaoException.java @@ -0,0 +1,34 @@ +///** +// * Copyright (C) 2018-2021 +// * All rights reserved, Designed By www.yixiang.co +// * 注意: +// * 本软件为www.yixiang.co开发研制,未经购买不得使用 +// * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +// * 一经发现盗用、分享等行为,将追究法律责任,后果自负 +// */ +//package co.yixiang.common.exception; +// +// +//import co.yixiang.common.api.ApiCode; +// +// +///** +// * DAO异常 +// * @author hupeng +// * @date 2020-04-30 +// */ +//public class DaoException extends YshopException { +// private static final long serialVersionUID = -6912618737345878854L; +// +// public DaoException(String message) { +// super(message); +// } +// +// public DaoException(Integer errorCode, String message) { +// super(errorCode, message); +// } +// +// public DaoException(ApiCode apiCode) { +// super(apiCode); +// } +//} diff --git a/yshop-app/src/main/java/co/yixiang/common/exception/UnAuthenticatedException.java b/yshop-app/src/main/java/co/yixiang/common/exception/UnAuthenticatedException.java new file mode 100644 index 0000000..d24be2a --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/exception/UnAuthenticatedException.java @@ -0,0 +1,30 @@ +///** +// * Copyright (C) 2018-2021 +// * All rights reserved, Designed By www.yixiang.co +// * 注意: +// * 本软件为www.yixiang.co开发研制,未经购买不得使用 +// * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +// * 一经发现盗用、分享等行为,将追究法律责任,后果自负 +// */ +//package co.yixiang.common.exception; +// +//import co.yixiang.common.api.ApiCode; +// +///** +// * 认证异常 +// * @author hupeng +// * @date 2020-04-30 +// */ +//public class UnAuthenticatedException extends YshopException { +// public UnAuthenticatedException(String message) { +// super(message); +// } +// +// public UnAuthenticatedException(Integer errorCode, String message) { +// super(errorCode, message); +// } +// +// public UnAuthenticatedException(ApiCode apiCode) { +// super(apiCode); +// } +//} diff --git a/yshop-app/src/main/java/co/yixiang/common/exception/YshopException.java b/yshop-app/src/main/java/co/yixiang/common/exception/YshopException.java new file mode 100644 index 0000000..0f454d2 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/exception/YshopException.java @@ -0,0 +1,60 @@ +///** +// * Copyright (C) 2018-2021 +// * All rights reserved, Designed By www.yixiang.co +// * 注意: +// * 本软件为www.yixiang.co开发研制,未经购买不得使用 +// * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +// * 一经发现盗用、分享等行为,将追究法律责任,后果自负 +// */ +//package co.yixiang.common.exception; +// +// +// +//import co.yixiang.common.api.ApiCode; +//import lombok.Data; +//import lombok.EqualsAndHashCode; +// +///** +// * 自定义异常 +// * @author hupeng +// * @date 2020-04-30 +// */ +//@Data +//@EqualsAndHashCode(callSuper = true) +//public class YshopException extends RuntimeException{ +// +// private static final long serialVersionUID = -2470461654663264392L; +// +// private Integer errorCode; +// private String message; +// +// public YshopException() { +// super(); +// } +// +// public YshopException(String message) { +// super(message); +// this.message = message; +// } +// +// public YshopException(Integer errorCode, String message) { +// super(message); +// this.errorCode = errorCode; +// this.message = message; +// } +// +// public YshopException(ApiCode apiCode) { +// super(apiCode.getMessage()); +// this.errorCode = apiCode.getCode(); +// this.message = apiCode.getMessage(); +// } +// +// public YshopException(String message, Throwable cause) { +// super(message, cause); +// } +// +// public YshopException(Throwable cause) { +// super(cause); +// } +// +//} diff --git a/yshop-app/src/main/java/co/yixiang/common/handler/GlobalExceptionHandler.java b/yshop-app/src/main/java/co/yixiang/common/handler/GlobalExceptionHandler.java new file mode 100644 index 0000000..43b1662 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/handler/GlobalExceptionHandler.java @@ -0,0 +1,186 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.common.handler; + + +import co.yixiang.api.ApiCode; +import co.yixiang.api.ApiResult; +import co.yixiang.api.BusinessException; +import co.yixiang.api.DaoException; +import co.yixiang.api.UnAuthenticatedException; +import co.yixiang.api.YshopException; +import co.yixiang.common.bean.RequestDetail; +import co.yixiang.common.util.RequestDetailThreadLocal; +import co.yixiang.exception.BadLimitRequestException; +import com.alibaba.fastjson.JSON; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.validation.BindingResult; +import org.springframework.validation.FieldError; +import org.springframework.web.HttpRequestMethodNotSupportedException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * 全局异常 + * @author hupeng + * @date 2020-04-30 + */ +@ControllerAdvice +@RestController +@Slf4j +public class GlobalExceptionHandler { + + /** + * 非法参数验证异常 + * + * @param ex + * @return + */ + @ExceptionHandler(MethodArgumentNotValidException.class) + @ResponseStatus(value = HttpStatus.OK) + public ApiResult handleMethodArgumentNotValidExceptionHandler(MethodArgumentNotValidException ex) { + printRequestDetail(); + BindingResult bindingResult = ex.getBindingResult(); + List list = new ArrayList<>(); + List fieldErrors = bindingResult.getFieldErrors(); + for (FieldError fieldError : fieldErrors) { + list.add(fieldError.getDefaultMessage()); + } + + Collections.sort(list); + String msg = "不能为空"; + if(!list.isEmpty()) { + msg = list.get(0); + } + log.error(getApiCodeString(ApiCode.PARAMETER_EXCEPTION) + ":" + JSON.toJSONString(list)); + return ApiResult.fail(ApiCode.PARAMETER_EXCEPTION.getCode(), msg); + } + + + + + @ExceptionHandler(value = BadLimitRequestException.class) + @ResponseStatus(HttpStatus.BAD_REQUEST) + public ApiResult badLimitRequestException(BadLimitRequestException exception) { + printRequestDetail(); + printApiCodeException(ApiCode.SYSTEM_EXCEPTION, exception); + return new ApiResult() + .setStatus(ApiCode.BAD_LIMIT_EXCEPTION.getCode()) + .setMsg(exception.getMessage()); + } + + + + /** + * 自定义业务/数据异常处理 + * + * @param exception + * @return + */ + @ExceptionHandler(value = {YshopException.class}) + @ResponseStatus(HttpStatus.OK) + public ApiResult YshopException(YshopException exception) { + printRequestDetail(); + log.error("YshopException:", exception); + int errorCode; + if (exception instanceof BusinessException) { + errorCode = ApiCode.BUSINESS_EXCEPTION.getCode(); + } else if (exception instanceof DaoException) { + errorCode = ApiCode.DAO_EXCEPTION.getCode(); + } else if (exception instanceof UnAuthenticatedException) { + errorCode = ApiCode.UNAUTHORIZED.getCode(); + + } else { + errorCode = ApiCode.BUSINESS_EXCEPTION.getCode(); + } + System.out.println("======="); + return new ApiResult() + .setStatus(errorCode) + .setMsg(exception.getMessage()); + } + + + + + + /** + * 默认的异常处理 + * + * @param exception + * @return + */ + @ExceptionHandler(value = HttpRequestMethodNotSupportedException.class) + @ResponseStatus(HttpStatus.OK) + public ApiResult httpRequestMethodNotSupportedExceptionHandler(Exception exception) { + printRequestDetail(); + printApiCodeException(ApiCode.HTTP_REQUEST_METHOD_NOT_SUPPORTED_EXCEPTION, exception); + return ApiResult.fail(ApiCode.HTTP_REQUEST_METHOD_NOT_SUPPORTED_EXCEPTION.getCode(), exception.getMessage()); + } + + /** + * 默认的异常处理 + * + * @param exception + * @return + */ + @ExceptionHandler(value = Exception.class) + @ResponseStatus(HttpStatus.OK) + public ApiResult exceptionHandler(Exception exception) { + printRequestDetail(); + printApiCodeException(ApiCode.SYSTEM_EXCEPTION, exception); + // return ApiResult.fail(ApiCode.SYSTEM_EXCEPTION); + + return new ApiResult() + .setStatus(ApiCode.FAIL.getCode()) + .setMsg(exception.getMessage()); + } + + + /** + * 打印请求详情 + */ + private void printRequestDetail() { + RequestDetail requestDetail = RequestDetailThreadLocal.getRequestDetail(); + if (requestDetail != null) { + log.error("异常来源:ip: {}, path: {}", requestDetail.getIp(), requestDetail.getPath()); + } + } + + /** + * 获取ApiCode格式化字符串 + * + * @param apiCode + * @return + */ + private String getApiCodeString(ApiCode apiCode) { + if (apiCode != null) { + return String.format("errorCode: %s, errorMessage: %s", apiCode.getCode(), apiCode.getMessage()); + } + return null; + } + + /** + * 打印错误码及异常 + * + * @param apiCode + * @param exception + */ + private void printApiCodeException(ApiCode apiCode, Exception exception) { + log.error(getApiCodeString(apiCode), exception); + } + +} diff --git a/yshop-app/src/main/java/co/yixiang/common/interceptor/AuthCheck.java b/yshop-app/src/main/java/co/yixiang/common/interceptor/AuthCheck.java new file mode 100644 index 0000000..75d0695 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/interceptor/AuthCheck.java @@ -0,0 +1,26 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.common.interceptor; + + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @ClassName 自定义权限注解 + * @Author hupeng <610796224@qq.com> + * @Date 2020/4/30 + **/ +@Target({ElementType.METHOD, ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface AuthCheck { + int value() default 4; +} diff --git a/yshop-app/src/main/java/co/yixiang/common/interceptor/PermissionInterceptor.java b/yshop-app/src/main/java/co/yixiang/common/interceptor/PermissionInterceptor.java new file mode 100644 index 0000000..5ce77ef --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/interceptor/PermissionInterceptor.java @@ -0,0 +1,129 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.common.interceptor; + + +import co.yixiang.api.ApiCode; +import co.yixiang.api.UnAuthenticatedException; +import co.yixiang.common.bean.LocalUser; +import co.yixiang.common.util.JwtToken; +import co.yixiang.constant.ShopConstants; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.service.YxUserService; +import co.yixiang.utils.RedisUtils; +import com.auth0.jwt.interfaces.Claim; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.StringUtils; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Map; +import java.util.Optional; + +/** + * 权限拦截器 + * @author hupeng + * @date 2020-04-30 + */ +public class PermissionInterceptor extends HandlerInterceptorAdapter { + + @Autowired + private YxUserService userService; + + @Autowired + private RedisUtils redisUtils; + + public PermissionInterceptor() { + super(); + } + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + Optional authCheck = this.getAuthCheck(handler); + if (!authCheck.isPresent()) { + return true; + } + + String bearerToken = request.getHeader("Authorization"); + if (StringUtils.isEmpty(bearerToken)) { + throw new UnAuthenticatedException(ApiCode.UNAUTHORIZED); + } + + if (!bearerToken.startsWith("Bearer")) { + throw new UnAuthenticatedException(ApiCode.UNAUTHORIZED); + } + String[] tokens = bearerToken.split(" "); + if (!(tokens.length == 2)) { + throw new UnAuthenticatedException(ApiCode.UNAUTHORIZED); + } + String token = tokens[1]; + + Optional> optionalMap = JwtToken.getClaims(token); + Map map = optionalMap + .orElseThrow(() -> new UnAuthenticatedException(ApiCode.UNAUTHORIZED)); + + String uName = map.get("uName").asString(); + + //检测用户是否被踢出 + if (redisUtils.get(ShopConstants.YSHOP_APP_LOGIN_USER + uName + ":" + token) == null) { + throw new UnAuthenticatedException(ApiCode.UNAUTHORIZED); + } + boolean valid = this.hasPermission(authCheck.get(), map); + if(valid){ + this.setToThreadLocal(map); + } + return valid; + } + + private void setToThreadLocal(Map map) { + Integer uid = map.get("uid").asInt(); + Integer scope = map.get("scope").asInt(); + YxUser user = userService.getById(uid); + if(user == null) { + throw new UnAuthenticatedException(ApiCode.NOT_PERMISSION); + } + LocalUser.set(user, scope); + } + + private boolean hasPermission(AuthCheck authCheck, Map map) { + Integer level = authCheck.value(); + Integer scope = map.get("scope").asInt(); + if (level > scope) { + throw new UnAuthenticatedException(ApiCode.NOT_PERMISSION); + } + return true; + } + + @Override + public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { + super.postHandle(request, response, handler, modelAndView); + } + + @Override + public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { + LocalUser.clear(); + super.afterCompletion(request, response, handler, ex); + } + + private Optional getAuthCheck(Object handler) { + if (handler instanceof HandlerMethod) { + HandlerMethod handlerMethod = (HandlerMethod) handler; + AuthCheck authCheck = handlerMethod.getMethod().getAnnotation(AuthCheck.class); + if (authCheck == null) { + return Optional.empty(); + } + return Optional.of(authCheck); + } + return Optional.empty(); + } + +} diff --git a/yshop-app/src/main/java/co/yixiang/common/param/QueryParam.java b/yshop-app/src/main/java/co/yixiang/common/param/QueryParam.java new file mode 100644 index 0000000..6f2073f --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/param/QueryParam.java @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.common.param; + + +import co.yixiang.common.constant.CommonConstant; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + + +@Data +@ApiModel("查询参数对象") +public abstract class QueryParam implements Serializable{ + private static final long serialVersionUID = -3263921252635611410L; + + @ApiModelProperty(value = "页码,默认为1") + private Integer page = CommonConstant.DEFAULT_PAGE_INDEX; + @ApiModelProperty(value = "页大小,默认为10") + private Integer limit = CommonConstant.DEFAULT_PAGE_SIZE; + @ApiModelProperty(value = "搜索字符串") + private String keyword; + + public void setPage(Integer page) { + if (page == null || page <= 0){ + this.page = CommonConstant.DEFAULT_PAGE_INDEX; + }else{ + this.page = page; + } + } + + public void setLimit(Integer limit) { + if (limit == null || limit <= 0){ + this.limit = CommonConstant.DEFAULT_PAGE_SIZE; + }else{ + this.limit = limit; + } + } + +} diff --git a/yshop-app/src/main/java/co/yixiang/common/util/BrowserUtil.java b/yshop-app/src/main/java/co/yixiang/common/util/BrowserUtil.java new file mode 100644 index 0000000..c574828 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/util/BrowserUtil.java @@ -0,0 +1,69 @@ +package co.yixiang.common.util; + +import javax.servlet.http.HttpServletRequest; + + +/** + * 浏览器工具类 + * @author hupeng + * @date 2020-04-30 + */ +public final class BrowserUtil { + public static final String IE = "msie"; + public static final String FIREFOX = "firefox"; + public static final String CHROME = "chrome"; + + private BrowserUtil() { + throw new AssertionError(); + } + + /** + * 获取当前浏览器名称 + * + * @param request + * @return 返回浏览器名称 + */ + public static String getCurrent(HttpServletRequest request) { + String userAgent = request.getHeader("USER-AGENT").toLowerCase(); + if (userAgent != null && !("".equals(userAgent.trim()))) { + if (userAgent.indexOf(CHROME) >= 0) { + return CHROME; + } else if (userAgent.indexOf(FIREFOX) >= 0) { + return FIREFOX; + } else if (userAgent.indexOf(IE) >= 0) { + return IE; + } + } + return null; + } + + /** + * 是否是IE浏览器 + * + * @param request + * @return + */ + public static boolean isIe(HttpServletRequest request) { + return IE.equals(getCurrent(request)); + } + + /** + * 是否是Firefox浏览器 + * + * @param request + * @return + */ + public static boolean isFirefox(HttpServletRequest request) { + return FIREFOX.equals(getCurrent(request)); + } + + /** + * 是否是Chrome浏览器 + * + * @param request + * @return + */ + public static boolean isChrome(HttpServletRequest request) { + return CHROME.equals(getCurrent(request)); + } +} diff --git a/yshop-app/src/main/java/co/yixiang/common/util/CityTreeUtil.java b/yshop-app/src/main/java/co/yixiang/common/util/CityTreeUtil.java new file mode 100644 index 0000000..9262188 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/util/CityTreeUtil.java @@ -0,0 +1,90 @@ +package co.yixiang.common.util; + + + +import co.yixiang.modules.user.vo.CityVo; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * @ClassName 树形工具类 + * @Author hupeng <610796224@qq.com> + * @Date 2019/10/22 + **/ +public class CityTreeUtil { + /** + * 获得指定节点下所有归档 + * + * @param list + * @param parentId + * @return + */ + public static List list2TreeConverter(List list, int parentId) { + List returnList = new ArrayList<>(); + + for (CityVo res : list) { + //判断对象是否为根节点 + + if (res.getPid() == parentId) { + //该节点为根节点,开始递归 + + //通过递归为节点设置childList + recursionFn(list, res); + + returnList.add(res); + } + } + + return returnList; + } + + /** + * 递归列表 + * 通过递归,给指定t节点设置childList + * + * @param list + * @param t + */ + public static void recursionFn(List list, CityVo t) { + //只能获取当前t节点的子节点集,并不是所有子节点集 + List childsList = getChildList(list, t); + + //设置他的子集对象集 + t.setC(childsList); + + //迭代子集对象集 + + //遍历完,则退出递归 + for (CityVo nextChild : childsList) { + + //判断子集对象是否还有子节点 + if (!CollectionUtils.isEmpty(childsList)) { + //有下一个子节点,继续递归 + recursionFn(list, nextChild); + } + } + } + + /** + * 获得指定节点下的所有子节点 + * + * @param list + * @param t + * @return + */ + public static List getChildList(List list, CityVo t) { + List childsList = new ArrayList<>(); + //遍历集合元素,如果元素的Parentid==指定元素的id,则说明是该元素的子节点 + for (CityVo t1 : list) { + if (t1.getPid().equals(t.getV())) { + childsList.add(t1); + } + } + + return childsList; + } + + +} diff --git a/yshop-app/src/main/java/co/yixiang/common/util/IpUtil.java b/yshop-app/src/main/java/co/yixiang/common/util/IpUtil.java new file mode 100644 index 0000000..b5d5d16 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/util/IpUtil.java @@ -0,0 +1,66 @@ +package co.yixiang.common.util; + +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import java.net.InetAddress; +import java.net.UnknownHostException; + + +/** + * 获取IP地址工具类 + * @author hupeng + * @date 2020-04-30 + */ +public final class IpUtil { + + private static final String UNKNOWN = "unknown"; + private static final String IPV6_LOCAL = "0:0:0:0:0:0:0:1"; + + private IpUtil(){ + throw new AssertionError(); + } + + /** + * 获取请求用户的IP地址 + * @return + */ + public static String getRequestIp() { + ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + HttpServletRequest request = attributes.getRequest(); + return getRequestIp(request); + } + + /** + * 获取请求用户的IP地址 + * @param request + * @return + */ + public static String getRequestIp(HttpServletRequest request) { + String ip = request.getHeader("x-forwarded-for"); + if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getRemoteAddr(); + } + + if (IPV6_LOCAL.equals(ip)){ + ip = getLocalhostIp(); + } + return ip; + } + + public static String getLocalhostIp(){ + try { + return InetAddress.getLocalHost().getHostAddress(); + } catch (UnknownHostException e) { + } + return null; + } + +} diff --git a/yshop-app/src/main/java/co/yixiang/common/util/JacksonUtil.java b/yshop-app/src/main/java/co/yixiang/common/util/JacksonUtil.java new file mode 100644 index 0000000..ebfc324 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/util/JacksonUtil.java @@ -0,0 +1,184 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.common.util; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + +public class JacksonUtil { + + private static final Log logger = LogFactory.getLog(JacksonUtil.class); + + public static String parseString(String body, String field) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode node; + try { + node = mapper.readTree(body); + JsonNode leaf = node.get(field); + if (leaf != null) { + return leaf.asText(); + } + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + return null; + } + + + public static List parseStringList(String body, String field) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode node; + try { + node = mapper.readTree(body); + JsonNode leaf = node.get(field); + + if (leaf != null) { + return mapper.convertValue(leaf, new TypeReference>() { + }); + } + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + return null; + } + + public static Integer parseInteger(String body, String field) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode node; + try { + node = mapper.readTree(body); + JsonNode leaf = node.get(field); + if (leaf != null) { + return leaf.asInt(); + } + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + return null; + } + + public static List parseIntegerList(String body, String field) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode node; + try { + node = mapper.readTree(body); + JsonNode leaf = node.get(field); + + if (leaf != null) { + return mapper.convertValue(leaf, new TypeReference>() { + }); + } + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + return null; + } + + + public static Boolean parseBoolean(String body, String field) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode node; + try { + node = mapper.readTree(body); + JsonNode leaf = node.get(field); + if (leaf != null) { + return leaf.asBoolean(); + } + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + return null; + } + + public static Short parseShort(String body, String field) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode node; + try { + node = mapper.readTree(body); + JsonNode leaf = node.get(field); + if (leaf != null) { + Integer value = leaf.asInt(); + return value.shortValue(); + } + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + return null; + } + + public static Byte parseByte(String body, String field) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode node; + try { + node = mapper.readTree(body); + JsonNode leaf = node.get(field); + if (leaf != null) { + Integer value = leaf.asInt(); + return value.byteValue(); + } + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + return null; + } + + public static T parseObject(String body, String field, Class clazz) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode node; + try { + node = mapper.readTree(body); + node = node.get(field); + return mapper.treeToValue(node, clazz); + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + return null; + } + + public static Object toNode(String json) { + if (json == null) { + return null; + } + ObjectMapper mapper = new ObjectMapper(); + try { + + return mapper.readTree(json); + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + + return null; + } + + public static Map toMap(String data) { + ObjectMapper objectMapper = new ObjectMapper(); + try { + return objectMapper.readValue(data, new TypeReference>() { + }); + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + return null; + } + + public static String toJson(Object data) { + ObjectMapper objectMapper = new ObjectMapper(); + try { + return objectMapper.writeValueAsString(data); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/yshop-app/src/main/java/co/yixiang/common/util/JwtToken.java b/yshop-app/src/main/java/co/yixiang/common/util/JwtToken.java new file mode 100644 index 0000000..2598c85 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/util/JwtToken.java @@ -0,0 +1,107 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.common.util; + +import cn.hutool.core.date.DateUtil; +import com.auth0.jwt.JWT; +import com.auth0.jwt.JWTVerifier; +import com.auth0.jwt.algorithms.Algorithm; +import com.auth0.jwt.exceptions.JWTVerificationException; +import com.auth0.jwt.interfaces.Claim; +import com.auth0.jwt.interfaces.DecodedJWT; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; + +/** + * @ClassName JwtToken + * @Author hupeng <610796224@qq.com> + * @Date 2020/4/30 + **/ +@Component +public class JwtToken { + + private static String jwtKey; + private static Integer expiredTimeIn; + private static Integer defaultScope = 8; + + @Value("${yshop.security.jwt-key}") + public void setJwtKey(String jwtKey) { + JwtToken.jwtKey = jwtKey; + } + + @Value("${yshop.security.token-expired-in}") + public void setExpiredTimeIn(Integer expiredTimeIn) { + JwtToken.expiredTimeIn = expiredTimeIn; + } + + public static Optional> getClaims(String token) { + DecodedJWT decodedJWT; + Algorithm algorithm = Algorithm.HMAC256(JwtToken.jwtKey); + JWTVerifier jwtVerifier = JWT.require(algorithm).build(); + try { + decodedJWT = jwtVerifier.verify(token); + } catch (JWTVerificationException e) { + return Optional.empty(); + } + return Optional.of(decodedJWT.getClaims()); + } + + public static Boolean verifyToken(String token) { + try { + Algorithm algorithm = Algorithm.HMAC256(JwtToken.jwtKey); + JWTVerifier verifier = JWT.require(algorithm).build(); + verifier.verify(token); + } catch (JWTVerificationException e) { + return false; + } + return true; + } + + public static String getExpireTime(String token){ + return DateUtil.formatDateTime(JWT.decode(token).getExpiresAt()); + } + + + public static String makeToken(Long uid,String uName, Integer scope) { + return JwtToken.getToken(uid,uName, scope); + } + + public static String makeToken(Long uid,String uName) { + return JwtToken.getToken(uid,uName, JwtToken.defaultScope); + } + + private static String getToken(Long uid,String uName, Integer scope) { + Algorithm algorithm = Algorithm.HMAC256(JwtToken.jwtKey); + Map map = JwtToken.calculateExpiredIssues(); + + return JWT.create() + .withClaim("uid", uid) + .withClaim("scope", scope) + .withClaim("uName", uName) + .withExpiresAt(map.get("expiredTime")) + .withIssuedAt(map.get("now")) + .sign(algorithm); + } + + private static Map calculateExpiredIssues() { + Map map = new HashMap<>(); + Calendar calendar = Calendar.getInstance(); + Date now = calendar.getTime(); + calendar.add(Calendar.SECOND, JwtToken.expiredTimeIn); + map.put("now", now); + map.put("expiredTime", calendar.getTime()); + return map; + } +} diff --git a/yshop-app/src/main/java/co/yixiang/common/util/PhoneUtil.java b/yshop-app/src/main/java/co/yixiang/common/util/PhoneUtil.java new file mode 100644 index 0000000..934197b --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/util/PhoneUtil.java @@ -0,0 +1,60 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.common.util; + + +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; + +/** + * 手机号码工具类 + * @author hupeng + * @date 2020-04-30 + */ +@Slf4j +public class PhoneUtil { + + /** + * 手机号码长度 + */ + private static final int PHONE_LENGTH = 11; + + /** + * 脱敏*号 + */ + private static final String ASTERISK = "****"; + + /** + * 手机号码脱敏 + * 截取手机号码前三位,后4为,中间4位使用*号代替 + * 18812345678 + * 188****5678 + * + * @param phone + * @return + */ + public static String desensitize(String phone) { + // 校验手机号码 + if (StringUtils.isBlank(phone)) { + return null; + } + if (phone.length() != PHONE_LENGTH) { + log.error("手机号码不合法:" + phone); + return phone; + } + + String before = phone.substring(0,3); + String after = phone.substring(7,11); + String desensitizePhone = before + "****" + after; + return desensitizePhone; + } + + + +} diff --git a/yshop-app/src/main/java/co/yixiang/common/util/RedisLock.java b/yshop-app/src/main/java/co/yixiang/common/util/RedisLock.java new file mode 100644 index 0000000..72634c6 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/util/RedisLock.java @@ -0,0 +1,78 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.common.util; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisCallback; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Service; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.params.SetParams; + +import java.util.Collections; + +/** + * Redis 分布式锁实现 + */ +@Service +public class RedisLock { + + private static final Long RELEASE_SUCCESS = 1L; + private static final String LOCK_SUCCESS = "OK"; + private static final String SET_IF_NOT_EXIST = "NX"; + // 当前设置 过期时间单位, EX = seconds; PX = milliseconds + private static final String SET_WITH_EXPIRE_TIME = "EX"; + // if get(key) == value return del(key) + private static final String RELEASE_LOCK_SCRIPT = "if redis.call('get', KEYS[1]) == ARGV[1] then return redis.call('del', KEYS[1]) else return 0 end"; + + @Autowired + private StringRedisTemplate redisTemplate; + + /** + * 该加锁方法仅针对单实例 Redis 可实现分布式加锁 + * 对于 Redis 集群则无法使用 + * + * 支持重复,线程安全 + * + * @param lockKey 加锁键 + * @param clientId 加锁客户端唯一标识(采用UUID) + * @param seconds 锁过期时间 + * @return + */ + public boolean tryLock(String lockKey, String clientId, long seconds) { + return redisTemplate.execute((RedisCallback) redisConnection -> { + Jedis jedis = (Jedis) redisConnection.getNativeConnection(); + SetParams setParams = new SetParams(); + String result = jedis.set(lockKey, clientId, setParams.nx().px(seconds)); + if (LOCK_SUCCESS.equals(result)) { + return true; + } + return false; + }); + } + + /** + * 与 tryLock 相对应,用作释放锁 + * + * @param lockKey + * @param clientId + * @return + */ + public boolean releaseLock(String lockKey, String clientId) { + return redisTemplate.execute((RedisCallback) redisConnection -> { + Jedis jedis = (Jedis) redisConnection.getNativeConnection(); + Object result = jedis.eval(RELEASE_LOCK_SCRIPT, Collections.singletonList(lockKey), + Collections.singletonList(clientId)); + if (RELEASE_SUCCESS.equals(result)) { + return true; + } + return false; + }); + } +} diff --git a/yshop-app/src/main/java/co/yixiang/common/util/RequestDetailThreadLocal.java b/yshop-app/src/main/java/co/yixiang/common/util/RequestDetailThreadLocal.java new file mode 100644 index 0000000..cc47fb3 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/util/RequestDetailThreadLocal.java @@ -0,0 +1,38 @@ +package co.yixiang.common.util; + +import co.yixiang.common.bean.RequestDetail; + + +/** + * 记录请求详情信息到当前线程中 + * @author hupeng + * @date 2020-04-30 + */ +public class RequestDetailThreadLocal { + + private static ThreadLocal threadLocal = new ThreadLocal<>(); + + /** + * 设置请求信息到当前线程中 + * + * @param requestDetail + */ + public static void setRequestDetail(RequestDetail requestDetail) { + threadLocal.set(requestDetail); + } + + /** + * 从当前线程中获取请求信息 + */ + public static RequestDetail getRequestDetail() { + return threadLocal.get(); + } + + /** + * 销毁 + */ + public static void remove() { + threadLocal.remove(); + } + +} diff --git a/yshop-app/src/main/java/co/yixiang/common/util/RequestUtils.java b/yshop-app/src/main/java/co/yixiang/common/util/RequestUtils.java new file mode 100644 index 0000000..031657d --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/util/RequestUtils.java @@ -0,0 +1,20 @@ +package co.yixiang.common.util; + +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; + +/** + * @ClassName 获取Request工具类 + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/26 + **/ +public class RequestUtils { + + public static HttpServletRequest getRequest() { + ServletRequestAttributes ra= (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + return ra.getRequest(); + } + +} diff --git a/yshop-app/src/main/java/co/yixiang/common/util/SmsUtils.java b/yshop-app/src/main/java/co/yixiang/common/util/SmsUtils.java new file mode 100644 index 0000000..10c7e3a --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/util/SmsUtils.java @@ -0,0 +1,70 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.common.util; + + +import co.yixiang.utils.RedisUtils; +import com.aliyuncs.CommonRequest; +import com.aliyuncs.CommonResponse; +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.IAcsClient; +import com.aliyuncs.exceptions.ClientException; +import com.aliyuncs.http.MethodType; +import com.aliyuncs.profile.DefaultProfile; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; + +/** + * @ClassName 阿里云短信 + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/26 + **/ +@Slf4j +@Configuration(proxyBeanMethods = false) +public class SmsUtils { + + private static RedisUtils redisUtils; + + @Autowired + public SmsUtils(RedisUtils redisUtils){ + SmsUtils.redisUtils = redisUtils; + } + /** + * 发送短信 + * @param phoneNumbers 手机号 + * @param templateParam 短信模板变量对应的实际值,JSON格式 + */ + public static void sendSms(String phoneNumbers, String templateParam) throws ClientException { + String regionId = redisUtils.getY("sms_region"); + String accessKeyId = redisUtils.getY("sms_access_key"); + String accessKeySecret = redisUtils.getY("sms_access_secret"); + String sign = redisUtils.getY("sms_sign"); + String templateId = redisUtils.getY("sms_templateId"); + DefaultProfile profile = DefaultProfile.getProfile( + regionId, + accessKeyId, + accessKeySecret); + IAcsClient client = new DefaultAcsClient(profile); + + CommonRequest request = new CommonRequest(); + + request.setMethod(MethodType.POST); + request.setDomain("dysmsapi.aliyuncs.com"); + request.setVersion("2017-05-25"); + request.setAction("SendSms"); + request.putQueryParameter("RegionId", regionId); + request.putQueryParameter("PhoneNumbers", phoneNumbers); + request.putQueryParameter("SignName", sign); + request.putQueryParameter("TemplateCode", templateId); + request.putQueryParameter("TemplateParam", templateParam); + CommonResponse response = client.getCommonResponse(request); + System.out.println(response.getData()); + } +} diff --git a/yshop-app/src/main/java/co/yixiang/common/util/SpringContextUtil.java b/yshop-app/src/main/java/co/yixiang/common/util/SpringContextUtil.java new file mode 100644 index 0000000..47e3b05 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/util/SpringContextUtil.java @@ -0,0 +1,41 @@ +package co.yixiang.common.util; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + + +/** + * Spring工具类,获取Spring上下文对象等 + * @author hupeng + * @date 2020-04-30 + */ +@Component +public class SpringContextUtil implements ApplicationContextAware { + + private static ApplicationContext applicationContext = null; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + if(SpringContextUtil.applicationContext == null){ + SpringContextUtil.applicationContext = applicationContext; + } + } + + public static ApplicationContext getApplicationContext() { + return applicationContext; + } + + public static Object getBean(String name){ + return getApplicationContext().getBean(name); + } + + public static T getBean(Class clazz){ + return getApplicationContext().getBean(clazz); + } + + public static T getBean(String name,Class clazz){ + return getApplicationContext().getBean(name, clazz); + } +} \ No newline at end of file diff --git a/yshop-app/src/main/java/co/yixiang/common/web/param/IdParam.java b/yshop-app/src/main/java/co/yixiang/common/web/param/IdParam.java new file mode 100644 index 0000000..7b57a6a --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/web/param/IdParam.java @@ -0,0 +1,19 @@ +package co.yixiang.common.web.param; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +@Data +@ApiModel("ID参数") +public class IdParam implements Serializable { + private static final long serialVersionUID = -5353973980674510450L; + + @NotBlank(message="ID不能为空") + @ApiModelProperty(value = "地址ID") + private String id; +} diff --git a/yshop-app/src/main/java/co/yixiang/common/web/param/IdStatusParam.java b/yshop-app/src/main/java/co/yixiang/common/web/param/IdStatusParam.java new file mode 100644 index 0000000..3f05d33 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/web/param/IdStatusParam.java @@ -0,0 +1,41 @@ +package co.yixiang.common.web.param; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.io.Serializable; + +@ApiModel("主键状态VO") +public class IdStatusParam implements Serializable { + private static final long serialVersionUID = -7581307955242965701L; + + @ApiModelProperty("主键ID") + private String id; + + @ApiModelProperty("状态,1:启用 0:禁用") + private Integer status; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + @Override + public String toString() { + return "IdStatusVo{" + + "id='" + id + '\'' + + ", status=" + status + + '}'; + } +} diff --git a/yshop-app/src/main/java/co/yixiang/common/web/param/NameParam.java b/yshop-app/src/main/java/co/yixiang/common/web/param/NameParam.java new file mode 100644 index 0000000..db3b963 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/web/param/NameParam.java @@ -0,0 +1,30 @@ +package co.yixiang.common.web.param; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.io.Serializable; + + +@ApiModel("名称参数") +public class NameParam implements Serializable { + private static final long serialVersionUID = -3710501706034574149L; + + @ApiModelProperty("名称") + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public String toString() { + return "NameParam{" + + "name='" + name + '\'' + + '}'; + } +} diff --git a/yshop-app/src/main/java/co/yixiang/common/web/param/OrderQueryParam.java b/yshop-app/src/main/java/co/yixiang/common/web/param/OrderQueryParam.java new file mode 100644 index 0000000..b3a2626 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/web/param/OrderQueryParam.java @@ -0,0 +1,34 @@ +package co.yixiang.common.web.param; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Arrays; +import java.util.List; + + +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel("可排序查询参数对象") +public abstract class OrderQueryParam extends QueryParam{ + private static final long serialVersionUID = 57714391204790143L; + + @ApiModelProperty(value = "排序") + private List orders; + + public void defaultOrder(OrderItem orderItem){ + this.defaultOrders(Arrays.asList(orderItem)); + } + + public void defaultOrders(List orderItems){ + if (CollectionUtil.isEmpty(orderItems)){ + return; + } + this.orders = orderItems; + } + +} diff --git a/yshop-app/src/main/java/co/yixiang/common/web/vo/CommonIdName.java b/yshop-app/src/main/java/co/yixiang/common/web/vo/CommonIdName.java new file mode 100644 index 0000000..abd0aa4 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/web/vo/CommonIdName.java @@ -0,0 +1,58 @@ +package co.yixiang.common.web.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + + +@ApiModel("ID-NAME-VO") +public class CommonIdName { + + @ApiModelProperty("id") + private String id; + + @ApiModelProperty("名称") + private String name; + + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public CommonIdName(String id, String name) { + super(); + this.id = id; + this.name = name; + + } + + + public CommonIdName() { + super(); + } + + + @Override + public String toString() { + return "CommonIdName [id=" + id + ", name=" + name + "]"; + } + + + + +} diff --git a/yshop-app/src/main/java/co/yixiang/common/web/vo/Paging.java b/yshop-app/src/main/java/co/yixiang/common/web/vo/Paging.java new file mode 100644 index 0000000..169caa0 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/common/web/vo/Paging.java @@ -0,0 +1,60 @@ +package co.yixiang.common.web.vo; + +import com.alibaba.fastjson.annotation.JSONField; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.io.Serializable; +import java.util.Collections; +import java.util.List; + + +@ApiModel("分页") +@SuppressWarnings("unchecked") +public class Paging implements Serializable { + private static final long serialVersionUID = -1683800405530086022L; + + @ApiModelProperty("总行数") + @JSONField(name = "total") + @JsonProperty("total") + private long total = 0; + + @ApiModelProperty("数据列表") + @JSONField(name = "records") + @JsonProperty("records") + private List records = Collections.emptyList(); + + public Paging() { + } + + public Paging(IPage page) { + this.total = page.getTotal(); + this.records = page.getRecords(); + } + + public long getTotal() { + return total; + } + + public void setTotal(long total) { + this.total = total; + } + + public List getRecords() { + return records; + } + + public void setRecords(List records) { + this.records = records; + } + + @Override + public String toString() { + return "Paging{" + + "total=" + total + + ", records=" + records + + '}'; + } +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/activity/param/BargainShareParam.java b/yshop-app/src/main/java/co/yixiang/modules/activity/param/BargainShareParam.java new file mode 100644 index 0000000..cb75297 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/activity/param/BargainShareParam.java @@ -0,0 +1,24 @@ +package co.yixiang.modules.activity.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; + +/** + * @ClassName BargainShareParam + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/20 + **/ +@Getter +@Setter +public class BargainShareParam { + + @NotBlank(message = "参数有误") + @ApiModelProperty(value = "砍价产品ID") + private String bargainId; + + @ApiModelProperty(value = "来源") + private String from; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/activity/param/PinkCancelParam.java b/yshop-app/src/main/java/co/yixiang/modules/activity/param/PinkCancelParam.java new file mode 100644 index 0000000..5ee8a1f --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/activity/param/PinkCancelParam.java @@ -0,0 +1,25 @@ +package co.yixiang.modules.activity.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; + +/** + * @ClassName PinkCancelParam + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/23 + **/ +@Getter +@Setter +public class PinkCancelParam { + + @NotBlank(message = "参数错误") + @ApiModelProperty(value = "拼团产品ID") + private String id; + + @NotBlank(message = "参数错误") + @ApiModelProperty(value = "团购产品id") + private String cid; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/activity/param/PinkShareParam.java b/yshop-app/src/main/java/co/yixiang/modules/activity/param/PinkShareParam.java new file mode 100644 index 0000000..0a53e54 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/activity/param/PinkShareParam.java @@ -0,0 +1,22 @@ +package co.yixiang.modules.activity.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; + +/** + * @ClassName BargainShareParam + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/20 + **/ +@Getter +@Setter +public class PinkShareParam { + @NotBlank(message = "参数有误") + private String id; + + @ApiModelProperty(value = "来源") + private String from; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/activity/param/YxStoreBargainQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/activity/param/YxStoreBargainQueryParam.java new file mode 100644 index 0000000..e3ee611 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/activity/param/YxStoreBargainQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.activity.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 砍价表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-12-21 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="砍价表查询参数", description="砍价表查询参数") +public class YxStoreBargainQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/activity/param/YxStoreBargainUserHelpQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/activity/param/YxStoreBargainUserHelpQueryParam.java new file mode 100644 index 0000000..d397bd2 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/activity/param/YxStoreBargainUserHelpQueryParam.java @@ -0,0 +1,32 @@ +package co.yixiang.modules.activity.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; + +/** + *

+ * 砍价用户帮助表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-12-21 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="砍价用户帮助表查询参数", description="砍价用户帮助表查询参数") +public class YxStoreBargainUserHelpQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; + + @NotBlank(message = "参数有误") + @ApiModelProperty(value = "砍价产品ID") + private String bargainId; + + @NotBlank(message = "参数有误") + @ApiModelProperty(value = "砍价用户id") + private String bargainUserUid; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/activity/param/YxStoreBargainUserQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/activity/param/YxStoreBargainUserQueryParam.java new file mode 100644 index 0000000..2cc513d --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/activity/param/YxStoreBargainUserQueryParam.java @@ -0,0 +1,32 @@ +package co.yixiang.modules.activity.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; + +/** + *

+ * 用户参与砍价表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-12-21 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="用户参与砍价表查询参数", description="用户参与砍价表查询参数") +public class YxStoreBargainUserQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; + + @NotBlank(message = "参数错误") + @ApiModelProperty(value = "砍价用户ID") + private String bargainUserUid; + + @ApiModelProperty(value = "砍价产品ID") + private String bargainId; + +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/activity/param/YxStoreCombinationQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/activity/param/YxStoreCombinationQueryParam.java new file mode 100644 index 0000000..a16a35a --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/activity/param/YxStoreCombinationQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.activity.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 拼团产品表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-11-19 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="拼团产品表查询参数", description="拼团产品表查询参数") +public class YxStoreCombinationQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/activity/param/YxStorePinkQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/activity/param/YxStorePinkQueryParam.java new file mode 100644 index 0000000..7e6863a --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/activity/param/YxStorePinkQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.activity.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 拼团表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-11-19 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="拼团表查询参数", description="拼团表查询参数") +public class YxStorePinkQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/activity/param/YxStoreSeckillQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/activity/param/YxStoreSeckillQueryParam.java new file mode 100644 index 0000000..d41728c --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/activity/param/YxStoreSeckillQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.activity.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 商品秒杀产品表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-12-14 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="商品秒杀产品表查询参数", description="商品秒杀产品表查询参数") +public class YxStoreSeckillQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/activity/rest/StoreBargainController.java b/yshop-app/src/main/java/co/yixiang/modules/activity/rest/StoreBargainController.java new file mode 100644 index 0000000..e2aa2e1 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/activity/rest/StoreBargainController.java @@ -0,0 +1,313 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.rest; + +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.ApiResult; +import co.yixiang.api.YshopException; +import co.yixiang.logging.aop.log.AppLog; +import co.yixiang.common.aop.NoRepeatSubmit; +import co.yixiang.common.bean.LocalUser; +import co.yixiang.common.interceptor.AuthCheck; +import co.yixiang.constant.SystemConfigConstants; +import co.yixiang.modules.activity.domain.YxStoreBargainUser; +import co.yixiang.modules.activity.domain.YxStoreBargainUserHelp; +import co.yixiang.modules.activity.param.BargainShareParam; +import co.yixiang.modules.activity.param.YxStoreBargainUserHelpQueryParam; +import co.yixiang.modules.activity.param.YxStoreBargainUserQueryParam; +import co.yixiang.modules.activity.service.YxStoreBargainService; +import co.yixiang.modules.activity.service.YxStoreBargainUserHelpService; +import co.yixiang.modules.activity.service.YxStoreBargainUserService; +import co.yixiang.modules.activity.vo.BargainCountVo; +import co.yixiang.modules.activity.vo.BargainVo; +import co.yixiang.modules.activity.vo.TopCountVo; +import co.yixiang.modules.activity.vo.YxStoreBargainQueryVo; +import co.yixiang.modules.activity.vo.YxStoreBargainUserHelpQueryVo; +import co.yixiang.modules.activity.vo.YxStoreBargainUserQueryVo; +import co.yixiang.modules.services.CreatShareProductService; +import co.yixiang.modules.shop.service.YxSystemConfigService; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.service.YxUserService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.google.common.collect.Maps; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** + *

+ * 砍价 前端控制器 + *

+ * + * @author hupeng + * @since 2019-12-21 + */ + +@RestController +@RequestMapping +@Api(value = "砍价商品", tags = "营销:砍价商品") +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +@SuppressWarnings("unchecked") +public class StoreBargainController { + + private final YxStoreBargainService storeBargainService; + private final YxStoreBargainUserService storeBargainUserService; + private final YxStoreBargainUserHelpService storeBargainUserHelpService; + private final YxUserService userService; + private final YxSystemConfigService systemConfigService; + private final CreatShareProductService creatShareProductService; + + @Value("${file.path}") + private String path; + + + + + /** + * 砍价产品列表 + */ + @GetMapping("/bargain/list") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int") + }) + @ApiOperation(value = "砍价产品列表",notes = "砍价产品列表") + public ApiResult getYxStoreBargainPageList(@RequestParam(value = "page",defaultValue = "1") int page, + @RequestParam(value = "limit",defaultValue = "10") int limit){ + + return ApiResult.resultPage(storeBargainService.getList(page, limit),limit); + } + + /** + * 砍价详情 + */ + @AppLog(value = "查看砍价产品", type = 1) + @AuthCheck + @GetMapping("/bargain/detail/{id}") + @ApiOperation(value = "砍价详情",notes = "砍价详情",response = YxStoreBargainQueryVo.class) + public ApiResult getYxStoreBargain(@PathVariable Long id){ + if(ObjectUtil.isNull(id)) { + throw new YshopException("参数错误"); + } + YxUser yxUser = LocalUser.getUser(); + return ApiResult.ok(storeBargainService.getDetail(id,yxUser)); + } + + /** + * 砍价详情统计 + */ + @AppLog(value = "砍价详情统计", type = 1) + @AuthCheck + @PostMapping("/bargain/help/count") + @ApiOperation(value = "砍价详情统计",notes = "砍价详情统计") + public ApiResult helpCount(@Validated @RequestBody YxStoreBargainUserHelpQueryParam param){ + Long bargainId = Long.valueOf(param.getBargainId()); + Long bargainUserUid = Long.valueOf(param.getBargainUserUid()); + Long uid = LocalUser.getUser().getUid(); + return ApiResult.ok(storeBargainService.helpCount(bargainId,bargainUserUid,uid)); + } + + /** + * 砍价顶部统计 + */ + @PostMapping("/bargain/share") + @ApiOperation(value = "砍价顶部统计",notes = "砍价顶部统计") + public ApiResult topCount(@Validated @RequestBody BargainShareParam param){ + Long bargainId = null; + if(NumberUtil.isNumber(param.getBargainId())) { + bargainId = Long.valueOf(param.getBargainId()); + } + return ApiResult.ok(storeBargainService.topCount(bargainId)); + } + + /** + * 参与砍价 + */ + @AppLog(value = "参与砍价", type = 1) + @NoRepeatSubmit + @AuthCheck + @PostMapping("/bargain/start") + @ApiOperation(value = "参与砍价",notes = "参与砍价") + public ApiResult start(@Validated @RequestBody BargainShareParam param){ + Long bargainId = null; + if(NumberUtil.isNumber(param.getBargainId())) { + bargainId = Long.valueOf(param.getBargainId()); + } + Long uid = LocalUser.getUser().getUid(); + storeBargainUserService.setBargain(bargainId,uid); + return ApiResult.ok(); + } + + /** + * 帮助好友砍价 + */ + @AppLog(value = "帮助好友砍价", type = 1) + @NoRepeatSubmit + @AuthCheck + @PostMapping("/bargain/help") + @ApiOperation(value = "帮助好友砍价",notes = "帮助好友砍价") + public ApiResult> help(@Validated @RequestBody YxStoreBargainUserHelpQueryParam param){ + Long bargainId = Long.valueOf(param.getBargainId()); + Long bargainUserUid = Long.valueOf(param.getBargainUserUid()); + Long uid = LocalUser.getUser().getUid(); + Map map = Maps.newHashMap(); + boolean isBargainUserHelp = storeBargainUserService + .isBargainUserHelp(bargainId,bargainUserUid,uid); + if(!isBargainUserHelp){ + map.put("status","SUCCESSFUL"); + return ApiResult.ok(map); + } + + storeBargainService.doHelp(bargainId,bargainUserUid,uid); + map.put("status","SUCCESS"); + return ApiResult.ok(map); + } + + /** + * 获取砍掉金额 + */ + @AuthCheck + @PostMapping("/bargain/help/price") + @ApiOperation(value = "获取砍掉金额",notes = "获取砍掉金额") + public ApiResult> price(@Validated @RequestBody YxStoreBargainUserHelpQueryParam param){ + Long bargainId = Long.valueOf(param.getBargainId()); + Long bargainUserUid = Long.valueOf(param.getBargainUserUid()); + Long uid = LocalUser.getUser().getUid(); + Map map = Maps.newHashMap(); + YxStoreBargainUser storeBargainUser = storeBargainUserService + .getBargainUserInfo(bargainId,bargainUserUid); + if(ObjectUtil.isNull(storeBargainUser)){ + map.put("price",0); + return ApiResult.ok(map); + } + YxStoreBargainUserHelp storeBargainUserHelp = storeBargainUserHelpService + .getOne(new LambdaQueryWrapper() + .eq(YxStoreBargainUserHelp::getBargainId,bargainId) + .eq(YxStoreBargainUserHelp::getBargainUserId,storeBargainUser.getId()) + .eq(YxStoreBargainUserHelp::getUid,uid).last("limit 1")); + if(ObjectUtil.isNull(storeBargainUserHelp)){ + map.put("price",0); + }else{ + map.put("price",storeBargainUserHelp.getPrice()); + } + return ApiResult.ok(map); + } + + /** + * 好友帮 + */ + @PostMapping("/bargain/help/list") + @ApiOperation(value = "好友帮",notes = "好友帮") + public ApiResult> helpList(@Validated @RequestBody YxStoreBargainUserHelpQueryParam param){ + Long bargainId = Long.valueOf(param.getBargainId()); + Long bargainUserUid = Long.valueOf(param.getBargainUserUid()); + return ApiResult.ok(storeBargainUserHelpService.getList(bargainId,bargainUserUid + ,param.getPage(),param.getLimit())); + } + + /** + * 获取开启砍价用户信息 + */ + @PostMapping("/bargain/start/user") + @ApiOperation(value = "获取开启砍价用户信息",notes = "获取开启砍价用户信息") + public ApiResult startUser(@Validated @RequestBody YxStoreBargainUserQueryParam param){ + Long bargainUserUid = Long.valueOf(param.getBargainUserUid()); + return ApiResult.ok(userService.getYxUserById(bargainUserUid)); + } + + /** + * 砍价海报 + */ + @AuthCheck + @PostMapping("/bargain/poster") + @ApiOperation(value = "砍价海报",notes = "砍价海报") + public ApiResult> poster(@Validated @RequestBody BargainShareParam param){ + Long bargainId = Long.valueOf(param.getBargainId()); + String siteUrl = systemConfigService.getData(SystemConfigConstants.SITE_URL); + if(StrUtil.isBlank(siteUrl)){ + throw new YshopException("未配置h5地址"); + } + String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL); + if(StrUtil.isBlank(apiUrl)){ + throw new YshopException("未配置api地址"); + } + YxUser userInfo = LocalUser.getUser(); + Map map = Maps.newHashMap(); + String url = creatShareProductService.getBargainPosterUrl(bargainId,userInfo,siteUrl,apiUrl,path,param.getFrom()); + map.put("url",url); + return ApiResult.ok(map); + } + + + /** + * 砍价列表(已参与) + */ + @AuthCheck + @GetMapping("/bargain/user/list") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int") + }) + @ApiOperation(value = "砍价列表(已参与)",notes = "砍价列表(已参与)") + public ApiResult> bargainUserList( + @RequestParam(value = "page",defaultValue = "1") int page, + @RequestParam(value = "limit",defaultValue = "10") int limit){ + Long uid = LocalUser.getUser().getUid(); + List yxStoreBargainUserQueryVos = storeBargainUserService + .bargainUserList(uid,page,limit); + if(yxStoreBargainUserQueryVos.isEmpty()) { + throw new YshopException("暂无参与砍价"); + } + return ApiResult.ok(yxStoreBargainUserQueryVos); + } + + /** + * 砍价取消 + */ + @AppLog(value = "取消砍价", type = 1) + @AuthCheck + @PostMapping("/bargain/user/cancel") + @ApiOperation(value = "砍价取消",notes = "砍价取消") + public ApiResult bargainCancel(@Validated @RequestBody BargainShareParam param){ + Long bargainId = Long.valueOf(param.getBargainId()); + Long uid = LocalUser.getUser().getUid(); + storeBargainUserService.bargainCancel(bargainId,uid); + return ApiResult.ok(); + } + + + + + + + + + + + +} + diff --git a/yshop-app/src/main/java/co/yixiang/modules/activity/rest/StoreCombinationController.java b/yshop-app/src/main/java/co/yixiang/modules/activity/rest/StoreCombinationController.java new file mode 100644 index 0000000..e526db3 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/activity/rest/StoreCombinationController.java @@ -0,0 +1,166 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.rest; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.ApiResult; +import co.yixiang.api.YshopException; +import co.yixiang.logging.aop.log.AppLog; +import co.yixiang.common.bean.LocalUser; +import co.yixiang.common.interceptor.AuthCheck; +import co.yixiang.constant.SystemConfigConstants; +import co.yixiang.modules.activity.param.PinkCancelParam; +import co.yixiang.modules.activity.param.PinkShareParam; +import co.yixiang.modules.activity.service.YxStoreCombinationService; +import co.yixiang.modules.activity.service.YxStorePinkService; +import co.yixiang.modules.activity.vo.CombinationQueryVo; +import co.yixiang.modules.activity.vo.PinkInfoVo; +import co.yixiang.modules.activity.vo.StoreCombinationVo; +import co.yixiang.modules.activity.vo.YxStoreCombinationQueryVo; +import co.yixiang.modules.product.service.YxStoreProductRelationService; +import co.yixiang.modules.services.CreatShareProductService; +import co.yixiang.modules.shop.service.YxSystemConfigService; +import co.yixiang.modules.user.domain.YxUser; +import com.google.common.collect.Maps; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** + *

+ * 拼团前端控制器 + *

+ * + * @author hupeng + * @since 2019-11-19 + */ +@Slf4j +@RestController +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +@Api(value = "拼团", tags = "营销:拼团") +public class StoreCombinationController { + + private final YxStoreCombinationService storeCombinationService; + private final YxStorePinkService storePinkService; + private final YxSystemConfigService systemConfigService; + private final YxStoreProductRelationService relationService; + private final CreatShareProductService creatShareProductService; + + @Value("${file.path}") + private String path; + + + /** + * 拼团产品列表 + */ + @GetMapping("/combination/list") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int") + }) + @ApiOperation(value = "拼团产品列表",notes = "拼团产品列表") + public ApiResult getList(@RequestParam(value = "page",defaultValue = "1") int page, + @RequestParam(value = "limit",defaultValue = "10") int limit){ + return ApiResult.ok(storeCombinationService.getList(page, limit)); + } + + /** + * 拼团产品详情 + */ + @AppLog(value = "查看拼团产品详情", type = 1) + @AuthCheck + @GetMapping("/combination/detail/{id}") + @ApiOperation(value = "拼团产品详情",notes = "拼团产品详情") + public ApiResult detail(@PathVariable Long id){ + if(ObjectUtil.isNull(id)) { + throw new YshopException("参数错误"); + } + Long uid = LocalUser.getUser().getUid(); + StoreCombinationVo storeCombinationVo = storeCombinationService.getDetail(id,uid); + storeCombinationVo.setUserCollect(relationService + .isProductRelation(storeCombinationVo.getStoreInfo().getProductId(),uid)); + return ApiResult.ok(storeCombinationVo); + } + + /** + * 拼团明细 + */ + @AppLog(value = "查看拼团明细", type = 1) + @AuthCheck + @GetMapping("/combination/pink/{id}") + @ApiOperation(value = "拼团明细",notes = "拼团明细") + public ApiResult pink(@PathVariable Long id){ + if(ObjectUtil.isNull(id)) { + throw new YshopException("参数错误"); + } + Long uid = LocalUser.getUser().getUid(); + return ApiResult.ok(storePinkService.pinkInfo(id,uid)); + } + + /** + * 拼团海报 + */ + @AppLog(value = "生成拼团海报", type = 1) + @AuthCheck + @PostMapping("/combination/poster") + @ApiOperation(value = "拼团海报",notes = "拼团海报") + public ApiResult poster(@Validated @RequestBody PinkShareParam param){ + String siteUrl = systemConfigService.getData(SystemConfigConstants.SITE_URL); + if(StrUtil.isEmpty(siteUrl)){ + throw new YshopException("未配置h5地址"); + } + String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL); + if(StrUtil.isEmpty(apiUrl)){ + throw new YshopException("未配置api地址"); + } + YxUser userInfo = LocalUser.getUser(); + Map map = Maps.newHashMap(); + String spreadUrl = creatShareProductService.getPinkPosterUrl(Long.valueOf(param.getId()),userInfo, + siteUrl,apiUrl,path,param.getFrom()); + map.put("url",spreadUrl); + return ApiResult.ok(map); + } + + /** + * 取消开团 + */ + @AppLog(value = "取消开团", type = 1) + @AuthCheck + @PostMapping("/combination/remove") + @ApiOperation(value = "取消开团",notes = "取消开团") + public ApiResult remove(@Validated @RequestBody PinkCancelParam param){ + Long pinkId = Long.valueOf(param.getId()); + Long cId = Long.valueOf(param.getCid()); + Long uid = LocalUser.getUser().getUid(); + storePinkService.removePink(uid,cId,pinkId); + return ApiResult.ok(); + } + + + + +} + diff --git a/yshop-app/src/main/java/co/yixiang/modules/activity/rest/StoreIntegralController.java b/yshop-app/src/main/java/co/yixiang/modules/activity/rest/StoreIntegralController.java new file mode 100644 index 0000000..505967a --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/activity/rest/StoreIntegralController.java @@ -0,0 +1,39 @@ +package co.yixiang.modules.activity.rest; + +import co.yixiang.api.ApiResult; +import co.yixiang.modules.product.param.YxStoreProductQueryParam; +import co.yixiang.modules.product.service.YxStoreProductService; +import co.yixiang.modules.product.vo.YxStoreProductQueryVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 积分兑换前端控制器 + * @author yshop + */ +@Slf4j +@RestController +@RequestMapping +@Api(value = "积分兑换", tags = "营销:积分兑换") +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +public class StoreIntegralController { + + private final YxStoreProductService storeProductService; + + /** + * 获取积分产品列表 + */ + @GetMapping("/products/integral") + @ApiOperation(value = "获取积分产品列表",notes = "获取积分产品列表") + public ApiResult> goodsList(YxStoreProductQueryParam productQueryParam){ + return ApiResult.ok(storeProductService.getGoodsList(productQueryParam)); + } +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/activity/rest/StoreSeckillController.java b/yshop-app/src/main/java/co/yixiang/modules/activity/rest/StoreSeckillController.java new file mode 100644 index 0000000..1eea802 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/activity/rest/StoreSeckillController.java @@ -0,0 +1,162 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.rest; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.ApiResult; +import co.yixiang.api.YshopException; +import co.yixiang.logging.aop.log.AppLog; +import co.yixiang.common.bean.LocalUser; +import co.yixiang.common.interceptor.AuthCheck; +import co.yixiang.constant.ShopConstants; +import co.yixiang.modules.activity.service.YxStoreSeckillService; +import co.yixiang.modules.activity.service.dto.SeckillTimeDto; +import co.yixiang.modules.activity.vo.SeckillConfigVo; +import co.yixiang.modules.activity.vo.StoreSeckillVo; +import co.yixiang.modules.activity.vo.YxStoreSeckillQueryVo; +import co.yixiang.modules.product.service.YxStoreProductRelationService; +import co.yixiang.modules.shop.domain.YxSystemGroupData; +import co.yixiang.modules.shop.service.YxSystemGroupDataService; +import co.yixiang.modules.shop.service.dto.YxSystemGroupDataQueryCriteria; +import co.yixiang.utils.OrderUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; + +/** + *

+ * 商品秒杀产品前端控制器 + *

+ * + * @author hupeng + * @since 2019-12-14 + */ +@Slf4j +@RestController +@RequestMapping +@Api(value = "商品秒杀", tags = "营销:商品秒杀") +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +public class StoreSeckillController { + + private final YxStoreSeckillService yxStoreSeckillService; + private final YxSystemGroupDataService yxSystemGroupDataService; + private final YxStoreProductRelationService relationService; + + /** + * 秒杀产品列表 + */ + @GetMapping("/seckill/list/{time}") + @ApiOperation(value = "秒杀产品列表", notes = "秒杀产品列表") + public ApiResult> getYxStoreSeckillPageList(@PathVariable String time, + @RequestParam(value = "page",defaultValue = "1") int page, + @RequestParam(value = "limit",defaultValue = "10") int limit){ + if (StrUtil.isBlank(time) || !NumberUtil.isNumber(time)){ + throw new YshopException("参数错误"); + } + return ApiResult.resultPage(yxStoreSeckillService.getList(page, limit, Integer.valueOf(time)),limit); + + } + + + /** + * 根据id获取商品秒杀产品详情 + */ + @AppLog(value = "根据id获取商品秒杀产品详情", type = 1) + @AuthCheck + @GetMapping("/seckill/detail/{id}") + @ApiOperation(value = "秒杀产品详情", notes = "秒杀产品详情") + public ApiResult getYxStoreSeckill(@PathVariable Long id){ + Long uid = LocalUser.getUser().getUid(); + StoreSeckillVo storeSeckillVo = yxStoreSeckillService.getDetail(id); + storeSeckillVo.setUserCollect(relationService + .isProductRelation(storeSeckillVo.getStoreInfo().getProductId(),uid)); + return ApiResult.ok(storeSeckillVo); + } + + + /** + * 秒杀产品时间区间 + */ + @GetMapping("/seckill/index") + @ApiOperation(value = "秒杀产品时间区间", notes = "秒杀产品时间区间") + public ApiResult getYxStoreSeckillIndex() { + //获取秒杀配置 + AtomicInteger seckillTimeIndex = new AtomicInteger(); + SeckillConfigVo seckillConfigVo = new SeckillConfigVo(); + + YxSystemGroupDataQueryCriteria queryCriteria = new YxSystemGroupDataQueryCriteria(); + queryCriteria.setGroupName(ShopConstants.YSHOP_SECKILL_TIME); + queryCriteria.setStatus(1); + List yxSystemGroupDataList = yxSystemGroupDataService.queryAll(queryCriteria); + + List list = new ArrayList<>(); + int today = OrderUtil.dateToTimestampT(DateUtil.beginOfDay(new Date())); + yxSystemGroupDataList.forEach(i -> { + String jsonStr = i.getValue(); + JSONObject jsonObject = JSON.parseObject(jsonStr); + int time = Integer.valueOf(jsonObject.get("time").toString());//时间 5 + int continued = Integer.valueOf(jsonObject.get("continued").toString());//活动持续事件 3 + SimpleDateFormat sdf = new SimpleDateFormat("HH"); + String nowTime = sdf.format(new Date()); + String index = nowTime.substring(0, 1); + int currentHour = "0".equals(index) ? Integer.valueOf(nowTime.substring(1, 2)) : Integer.valueOf(nowTime); + SeckillTimeDto seckillTimeDto = new SeckillTimeDto(); + seckillTimeDto.setId(i.getId()); + //活动结束时间 + int activityEndHour = time + continued; + if (activityEndHour > 24) { + seckillTimeDto.setState("即将开始"); + seckillTimeDto.setTime(jsonObject.get("time").toString().length() > 1 ? jsonObject.get("time").toString() + ":00" : "0" + jsonObject.get("time").toString() + ":00"); + seckillTimeDto.setStatus(2); + seckillTimeDto.setStop(today + activityEndHour * 3600); + } else { + if (currentHour >= time && currentHour < activityEndHour) { + seckillTimeDto.setState("抢购中"); + seckillTimeDto.setTime(jsonObject.get("time").toString().length() > 1 ? jsonObject.get("time").toString() + ":00" : "0" + jsonObject.get("time").toString() + ":00"); + seckillTimeDto.setStatus(1); + seckillTimeDto.setStop(today + activityEndHour * 3600); + seckillTimeIndex.set(yxSystemGroupDataList.indexOf(i)); + } else if (currentHour < time) { + seckillTimeDto.setState("即将开始"); + seckillTimeDto.setTime(jsonObject.get("time").toString().length() > 1 ? jsonObject.get("time").toString() + ":00" : "0" + jsonObject.get("time").toString() + ":00"); + seckillTimeDto.setStatus(2); + seckillTimeDto.setStop(OrderUtil.dateToTimestamp(new Date()) + activityEndHour * 3600); + } else if (currentHour >= activityEndHour) { + seckillTimeDto.setState("已结束"); + seckillTimeDto.setTime(jsonObject.get("time").toString().length() > 1 ? jsonObject.get("time").toString() + ":00" : "0" + jsonObject.get("time").toString() + ":00"); + seckillTimeDto.setStatus(0); + seckillTimeDto.setStop(today + activityEndHour * 3600); + } + } + list.add(seckillTimeDto); + }); + seckillConfigVo.setSeckillTimeIndex(seckillTimeIndex.get()); + seckillConfigVo.setSeckillTime(list); + return ApiResult.ok(seckillConfigVo); + } +} + diff --git a/yshop-app/src/main/java/co/yixiang/modules/auth/param/HLoginParam.java b/yshop-app/src/main/java/co/yixiang/modules/auth/param/HLoginParam.java new file mode 100644 index 0000000..2d3cb70 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/auth/param/HLoginParam.java @@ -0,0 +1,31 @@ +package co.yixiang.modules.auth.param; + + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; + +/** + * @ClassName 登陆LoginDTO + * @Author hupeng <610796224@qq.com> + * @Date 2020/05/02 + **/ +@Getter +@Setter +public class HLoginParam { + + @NotBlank(message = "用户名必填") + @ApiModelProperty(value = "用户名") + private String username; + + @NotBlank(message = "密码必填") + @ApiModelProperty(value = "密码") + private String password; + + @ApiModelProperty(value = "分销绑定关系的ID") + private String spread; + + +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/auth/param/LoginParam.java b/yshop-app/src/main/java/co/yixiang/modules/auth/param/LoginParam.java new file mode 100644 index 0000000..d104787 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/auth/param/LoginParam.java @@ -0,0 +1,28 @@ +package co.yixiang.modules.auth.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @ClassName LoginParam + * @Author hupeng <610796224@qq.com> + * @Date 2020/01/15 + **/ +@Data +public class LoginParam { + + @NotBlank(message = "code参数缺失") + @ApiModelProperty(value = "小程序登陆code") + private String code; + + @ApiModelProperty(value = "分销绑定关系的ID") + private String spread; + + @ApiModelProperty(value = "小程序完整用户信息的加密数据") + private String encryptedData; + + @ApiModelProperty(value = "小程序加密算法的初始向量") + private String iv; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/auth/param/LoginVerifyParam.java b/yshop-app/src/main/java/co/yixiang/modules/auth/param/LoginVerifyParam.java new file mode 100644 index 0000000..02769ae --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/auth/param/LoginVerifyParam.java @@ -0,0 +1,24 @@ +package co.yixiang.modules.auth.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author : gzlv 2021/7/20 15:09 + */ +@Data +public class LoginVerifyParam { + + @NotBlank(message = "手机号必填") + @ApiModelProperty(value = "手机号码") + private String account; + + @NotBlank(message = "验证码必填") + @ApiModelProperty(value = "验证码") + private String captcha; + + @ApiModelProperty(value = "分销绑定关系的ID") + private String spread; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/auth/param/RegParam.java b/yshop-app/src/main/java/co/yixiang/modules/auth/param/RegParam.java new file mode 100644 index 0000000..4cf2b6e --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/auth/param/RegParam.java @@ -0,0 +1,33 @@ +package co.yixiang.modules.auth.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @ClassName RegParam + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/25 + **/ +@Data +public class RegParam { + + @NotBlank(message = "手机号必填") + @ApiModelProperty(value = "手机号码") + private String account; + + @NotBlank(message = "验证码必填") + @ApiModelProperty(value = "验证码") + private String captcha; + + @NotBlank(message = "密码必填") + @ApiModelProperty(value = "密码") + private String password; + + @ApiModelProperty(value = "分销绑定关系的ID") + private String spread; + + @ApiModelProperty(value = "邀请码") + private String inviteCode; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/auth/param/UpdatePasswordParam.java b/yshop-app/src/main/java/co/yixiang/modules/auth/param/UpdatePasswordParam.java new file mode 100644 index 0000000..14b236b --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/auth/param/UpdatePasswordParam.java @@ -0,0 +1,25 @@ +package co.yixiang.modules.auth.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author : gzlv 2021/7/20 17:27 + */ +@Data +public class UpdatePasswordParam { + + @NotBlank(message = "手机号必填") + @ApiModelProperty(value = "手机号码") + private String account; + + @NotBlank(message = "验证码必填") + @ApiModelProperty(value = "验证码") + private String captcha; + + @NotBlank(message = "密码必填") + @ApiModelProperty(value = "密码") + private String password; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/auth/param/VerityParam.java b/yshop-app/src/main/java/co/yixiang/modules/auth/param/VerityParam.java new file mode 100644 index 0000000..9404b36 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/auth/param/VerityParam.java @@ -0,0 +1,22 @@ +package co.yixiang.modules.auth.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @ClassName VerityParam + * @Author hupeng <610796224@qq.com> + * @Date 2019/10/25 + **/ +@Data +public class VerityParam { + + @NotBlank(message = "手机号必填") + @ApiModelProperty(value = "手机号码") + private String phone; + + @ApiModelProperty(value = "短信类型 bind绑定手机短信 login登陆短信 register注册短信") + private String type; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/auth/rest/AuthController.java b/yshop-app/src/main/java/co/yixiang/modules/auth/rest/AuthController.java new file mode 100644 index 0000000..9013e0e --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/auth/rest/AuthController.java @@ -0,0 +1,326 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.auth.rest; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.RandomUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.SecureUtil; +import co.yixiang.api.ApiResult; +import co.yixiang.api.YshopException; +import co.yixiang.common.bean.LocalUser; +import co.yixiang.common.enums.SmsTypeEnum; +import co.yixiang.common.interceptor.AuthCheck; +import co.yixiang.common.util.JwtToken; +import co.yixiang.common.util.SmsUtils; +import co.yixiang.constant.ShopConstants; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.modules.auth.param.*; +import co.yixiang.modules.services.AuthService; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.service.YxUserService; +import co.yixiang.utils.RedisUtils; +import com.alibaba.fastjson.JSONObject; +import com.aliyuncs.exceptions.ClientException; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * @ClassName 认证服务 + * @Author hupeng <610796224@qq.com> + * @Date 2020/4/30 + **/ +@Slf4j +@RestController +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +@Api(value = "认证模块", tags = "商城:认证") +public class AuthController { + + private final YxUserService userService; + private final RedisUtils redisUtil; + private final AuthService authService; + + @Value("${single.login}") + private Boolean singleLogin; + + + + /** + * 小程序登陆接口 + */ + @PostMapping("/wxapp/auth") + @ApiOperation(value = "小程序登陆", notes = "小程序登陆") + public ApiResult> login(@Validated @RequestBody LoginParam loginParam, + HttpServletRequest request) { + + YxUser yxUser = authService.wxappLogin(loginParam); + String token = JwtToken.makeToken(yxUser.getUid(),yxUser.getUsername()); + String expiresTimeStr = JwtToken.getExpireTime(token); + + // 返回 token + Map map = new LinkedHashMap<>(2); + + map.put("token", token); + map.put("expires_time", expiresTimeStr); + + // 保存在线信息 + authService.save(yxUser, token, request); + if(singleLogin){ + authService.checkLoginOnUser(yxUser.getUsername(),token); + } + + + return ApiResult.ok(map).setMsg("登陆成功"); + + } + + /** + * 根据手机号查询用户状态 + */ + @GetMapping("/wxapp/authPhone/{phone}") + @ApiOperation(value = "根据手机号查询用户状态", notes = "根据手机号查询用户状态") + public ApiResult authPhone(@PathVariable String phone) { + return ApiResult.ok(authService.authPhone(phone)).setMsg("获取成功"); + } + + @AuthCheck + @PostMapping("/wxapp/loginAuth") + @ApiOperation(value = "小程序获取用户信息", notes = "小程序获取用户信息") + public ApiResult loginAuth(@Validated @RequestBody LoginParam loginParam, + HttpServletRequest request) { + YxUser yxUser = authService.loginAuth(loginParam); + return ApiResult.ok(yxUser).setMsg("获取成功"); + + } + /** + * 微信公众号授权 + */ + @GetMapping("/wechat/auth") + @ApiImplicitParams({ + @ApiImplicitParam(name = "code", value = "微信授权code", paramType = "query", dataType = "string"), + @ApiImplicitParam(name = "spread", value = "分销绑定关系的ID", paramType = "query", dataType = "string") + }) + @ApiOperation(value = "微信公众号授权", notes = "微信公众号授权") + public ApiResult> authLogin(@RequestParam(value = "code") String code, + @RequestParam(value = "spread") String spread, + HttpServletRequest request) { + + YxUser yxUser = authService.wechatLogin(code,spread); + String token = JwtToken.makeToken(yxUser.getUid(),yxUser.getUsername()); + String expiresTimeStr = JwtToken.getExpireTime(token); + + // 返回 token + Map map = new HashMap(2) {{ + put("token", token); + put("expires_time", expiresTimeStr); + }}; + + // 保存在线信息 + authService.save(yxUser, token, request); + if(singleLogin){ + authService.checkLoginOnUser(yxUser.getUsername(),token); + } + + return ApiResult.ok(map).setMsg("登陆成功"); + + + } + + + @ApiOperation("H5登录授权") + @PostMapping(value = "/login") + public ApiResult> login(@Validated @RequestBody HLoginParam loginDTO,HttpServletRequest request) { + YxUser yxUser = userService.getOne(Wrappers.lambdaQuery() + .eq(YxUser::getUsername,loginDTO.getUsername()) + .eq(YxUser::getPassword,SecureUtil.md5(loginDTO.getPassword())),false); + + if(yxUser == null) { + throw new YshopException("账号或者密码不正确"); + } + + String token = JwtToken.makeToken(yxUser.getUid(),yxUser.getUsername()); + String expiresTimeStr = JwtToken.getExpireTime(token); + + // 保存在线信息 + authService.save(yxUser, token, request); + // 返回 token + Map map = new HashMap(2) {{ + put("token", token); + put("expires_time", expiresTimeStr); + }}; + + userService.setSpread(loginDTO.getSpread(),yxUser.getUid()); + + if(singleLogin){ + //踢掉之前已经登录的token + authService.checkLoginOnUser(yxUser.getUsername(),token); + } + + return ApiResult.ok(map).setMsg("登陆成功"); + } + + @ApiOperation("H5验证码登录授权") + @PostMapping(value = "/login/mobile") + public ApiResult> loginVerify(@Validated @RequestBody LoginVerifyParam loginVerifyParam,HttpServletRequest request) { + Object codeObj = redisUtil.get("code_" + loginVerifyParam.getAccount()); + if(codeObj == null){ + throw new YshopException("请先获取验证码"); + } + String code = codeObj.toString(); + if (!StrUtil.equals(code, loginVerifyParam.getCaptcha())) { + throw new YshopException("验证码错误"); + } + YxUser yxUser = userService.getOne(Wrappers.lambdaQuery() + .eq(YxUser::getUsername,loginVerifyParam.getAccount())); + + if(yxUser == null) { + throw new YshopException("账号不存在"); + } + + String token = JwtToken.makeToken(yxUser.getUid(),yxUser.getUsername()); + String expiresTimeStr = JwtToken.getExpireTime(token); + + // 保存在线信息 + authService.save(yxUser, token, request); + // 返回 token + Map map = new HashMap(2) {{ + put("token", token); + put("expires_time", expiresTimeStr); + }}; + + userService.setSpread(loginVerifyParam.getSpread(),yxUser.getUid()); + + if(singleLogin){ + //踢掉之前已经登录的token + authService.checkLoginOnUser(yxUser.getUsername(),token); + } + + return ApiResult.ok(map).setMsg("登陆成功"); + } + + @AuthCheck + @ApiOperation("修改密码") + @PostMapping(value = "/register/reset") + public ApiResult updatePassword(@Validated @RequestBody UpdatePasswordParam updatePasswordParam,HttpServletRequest request) { + Object codeObj = redisUtil.get("code_" + updatePasswordParam.getAccount()); + if(codeObj == null){ + throw new YshopException("请先获取验证码"); + } + String code = codeObj.toString(); + if (!StrUtil.equals(code, updatePasswordParam.getCaptcha())) { + throw new YshopException("验证码错误"); + } + YxUser yxUser = userService.getOne(Wrappers.lambdaQuery() + .eq(YxUser::getUsername,updatePasswordParam.getAccount())); + + if(yxUser == null) { + throw new YshopException("账号不存在,数据错误"); + } + yxUser.setPassword(SecureUtil.md5(updatePasswordParam.getPassword())); + boolean b = userService.updateById(yxUser); + if (!b) { + throw new YshopException("修改失败"); + } + String bearerToken = request.getHeader("Authorization"); + String[] tokens = bearerToken.split(" "); + String token = tokens[1]; + authService.logout(LocalUser.getUser().getUsername(), token); + + return ApiResult.ok(true).setMsg("修改成功"); + } + + + @PostMapping("/register") + @ApiOperation(value = "H5/APP注册新用户", notes = "H5/APP注册新用户") + public ApiResult register(@Validated @RequestBody RegParam param) { + Object codeObj = redisUtil.get("code_" + param.getAccount()); + if(codeObj == null){ + return ApiResult.fail("请先获取验证码"); + } + String code = codeObj.toString(); + if (!StrUtil.equals(code, param.getCaptcha())) { + return ApiResult.fail("验证码错误"); + } + YxUser yxUser = userService.getOne(Wrappers.lambdaQuery() + .eq(YxUser::getPhone,param.getAccount()),false); + if (ObjectUtil.isNotNull(yxUser)) { + return ApiResult.fail("用户已存在"); + } + + authService.register(param); + return ApiResult.ok("","注册成功"); + } + + + @PostMapping("/register/verify") + @ApiOperation(value = "短信验证码发送", notes = "短信验证码发送") + public ApiResult verify(@Validated @RequestBody VerityParam param) { + YxUser yxUser = userService.getOne(Wrappers.lambdaQuery() + .eq(YxUser::getPhone,param.getPhone()),false); + if (SmsTypeEnum.REGISTER.getValue().equals(param.getType()) && ObjectUtil.isNotNull(yxUser)) { + return ApiResult.fail("手机号已注册"); + } + if (SmsTypeEnum.LOGIN.getValue().equals(param.getType()) && ObjectUtil.isNull(yxUser)) { + return ApiResult.fail("账号不存在"); + } + String codeKey = "code_" + param.getPhone(); + if (ObjectUtil.isNotNull(redisUtil.get(codeKey))) { + return ApiResult.fail("10分钟内有效:" + redisUtil.get(codeKey).toString()); + } + String code = RandomUtil.randomNumbers(ShopConstants.YSHOP_SMS_SIZE); + + //redis存储 + redisUtil.set(codeKey, code, ShopConstants.YSHOP_SMS_REDIS_TIME); + + String enable = redisUtil.getY("sms_enable"); + if (ShopCommonEnum.ENABLE_2.getValue().toString().equals(enable)) { + return ApiResult.fail("测试阶段验证码:" + code); + } + + //发送阿里云短信 + JSONObject json = new JSONObject(); + json.put("code",code); + try { + SmsUtils.sendSms(param.getPhone(),json.toJSONString()); + } catch (ClientException e) { + redisUtil.del(codeKey); + e.printStackTrace(); + return ApiResult.ok("发送失败:"+e.getErrMsg()); + } + return ApiResult.ok("发送成功,请注意查收"); + + + } + + @AuthCheck + @ApiOperation(value = "退出登录", notes = "退出登录") + @PostMapping(value = "/auth/logout") + public ApiResult logout(HttpServletRequest request) { + String bearerToken = request.getHeader("Authorization"); + String[] tokens = bearerToken.split(" "); + String token = tokens[1]; + authService.logout(LocalUser.getUser().getUsername(), token); + return ApiResult.ok("退出成功"); + } + +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/cart/param/CartIdsParm.java b/yshop-app/src/main/java/co/yixiang/modules/cart/param/CartIdsParm.java new file mode 100644 index 0000000..eb47c3c --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/cart/param/CartIdsParm.java @@ -0,0 +1,20 @@ +package co.yixiang.modules.cart.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @ClassName CartIds + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/15 + **/ +@Data +public class CartIdsParm { + + @NotNull(message = "参数有误") + @ApiModelProperty(value = "购物车ID,多个用,分隔开") + List ids; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/cart/param/CartNumParam.java b/yshop-app/src/main/java/co/yixiang/modules/cart/param/CartNumParam.java new file mode 100644 index 0000000..8fc6d17 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/cart/param/CartNumParam.java @@ -0,0 +1,29 @@ +package co.yixiang.modules.cart.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; + +/** + * @ClassName 购物车数量CartNumParam + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/19 + **/ +@Getter +@Setter +public class CartNumParam { + + @Min(value = 1,message = "数量不在合法范围内") + @Max(value = 9999,message = "数量不在合法范围内") + @ApiModelProperty(value = "购物车数量") + private Integer number; + + @NotNull(message = "参数有误") + @ApiModelProperty(value = "购物车ID") + private Long id; + +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/cart/param/CartParam.java b/yshop-app/src/main/java/co/yixiang/modules/cart/param/CartParam.java new file mode 100644 index 0000000..7005cb5 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/cart/param/CartParam.java @@ -0,0 +1,46 @@ +package co.yixiang.modules.cart.param; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; + +/** + * @ClassName 添加购物车CartParam + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/19 + **/ +@Getter +@Setter +public class CartParam { + + @Min(value = 1,message = "数量不在合法范围内") + @Max(value = 9999,message = "数量不在合法范围内") + @ApiModelProperty(value = "购物车数量") + private Integer cartNum; + + @JsonProperty(value = "new") + @ApiModelProperty(value = "是否新购买") + private Integer isNew = 0; + + @NotNull(message = "参数有误") + @ApiModelProperty(value = "产品ID") + private Long productId; + + //@NotBlank(message = "参数有误") + @ApiModelProperty(value = "唯一的ID") + private String uniqueId; + + @ApiModelProperty(value = "产品拼团ID") + private Long combinationId = 0L; + + @ApiModelProperty(value = "产品秒杀ID") + private Long secKillId = 0L; + + @ApiModelProperty(value = "产品砍价ID") + private Long bargainId = 0L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/cart/param/YxStoreCartQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/cart/param/YxStoreCartQueryParam.java new file mode 100644 index 0000000..dcd3153 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/cart/param/YxStoreCartQueryParam.java @@ -0,0 +1,20 @@ +package co.yixiang.modules.cart.param; + +import io.swagger.annotations.ApiModel; +import lombok.Data; + +/** + *

+ * 购物车表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-25 + */ +@Data +@ApiModel(value="YxStoreCartQueryParam对象", description="购物车表查询参数") +public class YxStoreCartQueryParam { + private static final long serialVersionUID = 1L; + + private Integer numType = 0; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/cart/rest/StoreCartController.java b/yshop-app/src/main/java/co/yixiang/modules/cart/rest/StoreCartController.java new file mode 100644 index 0000000..f02b89d --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/cart/rest/StoreCartController.java @@ -0,0 +1,127 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.cart.rest; + +import co.yixiang.annotation.Limit; +import co.yixiang.api.ApiResult; +import co.yixiang.logging.aop.log.AppLog; +import co.yixiang.common.aop.NoRepeatSubmit; +import co.yixiang.common.bean.LocalUser; +import co.yixiang.common.interceptor.AuthCheck; +import co.yixiang.modules.cart.param.CartIdsParm; +import co.yixiang.modules.cart.param.CartNumParam; +import co.yixiang.modules.cart.param.CartParam; +import co.yixiang.modules.cart.service.YxStoreCartService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import java.util.LinkedHashMap; +import java.util.Map; + +/** + *

+ * 购物车控制器 + *

+ * + * @author hupeng + * @since 2019-10-25 + */ +@Slf4j +@RestController +@Api(value = "购物车", tags = "商城:购物车") +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +public class StoreCartController { + + private final YxStoreCartService storeCartService; + + /** + * 购物车 获取数量 + */ + @AuthCheck + @GetMapping("/cart/count") + @ApiOperation(value = "获取数量",notes = "获取数量") + public ApiResult> count(){ + Map map = new LinkedHashMap<>(); + Long uid = LocalUser.getUser().getUid(); + map.put("count",storeCartService.getUserCartNum(uid)); + return ApiResult.ok(map); + } + + /** + * 购物车 添加 + */ + @AppLog(value = "购物车 添加", type = 1) + @NoRepeatSubmit + @AuthCheck + @PostMapping("/cart/add") + @ApiOperation(value = "添加购物车",notes = "添加购物车") + @Limit(key = "cart_limit", period = 60, count = 30, name = "cartLimit", prefix = "yshop") + public ApiResult> add(@Validated @RequestBody CartParam cartParam){ + Map map = new LinkedHashMap<>(); + Long uid = LocalUser.getUser().getUid(); + map.put("cartId",storeCartService.addCart(uid,cartParam.getProductId(),cartParam.getCartNum(), + cartParam.getUniqueId(),cartParam.getIsNew(),cartParam.getCombinationId(), + cartParam.getSecKillId(),cartParam.getBargainId())); + return ApiResult.ok(map); + } + + + /** + * 购物车列表 + */ + @AppLog(value = "查看购物车列表", type = 1) + @AuthCheck + @GetMapping("/cart/list") + @ApiOperation(value = "购物车列表",notes = "购物车列表") + public ApiResult> getList(){ + Long uid = LocalUser.getUser().getUid(); + return ApiResult.ok(storeCartService.getUserProductCartList(uid,"",null)); + } + + /** + * 修改产品数量 + */ + @AppLog(value = "修改购物车产品数量", type = 1) + @AuthCheck + @PostMapping("/cart/num") + @ApiOperation(value = "修改产品数量",notes = "修改产品数量") + public ApiResult cartNum(@Validated @RequestBody CartNumParam param){ + Long uid = LocalUser.getUser().getUid(); + storeCartService.changeUserCartNum(param.getId(), param.getNumber(),uid); + return ApiResult.ok(); + } + + /** + * 购物车删除产品 + */ + @AppLog(value = "购物车删除产品", type = 1) + @NoRepeatSubmit + @AuthCheck + @PostMapping("/cart/del") + @ApiOperation(value = "购物车删除产品",notes = "购物车删除产品") + public ApiResult cartDel(@Validated @RequestBody CartIdsParm parm){ + Long uid = LocalUser.getUser().getUid(); + storeCartService.removeUserCart(uid, parm.getIds()); + return ApiResult.ok(); + } + + + + + +} + diff --git a/yshop-app/src/main/java/co/yixiang/modules/coupon/param/YxStoreCouponIssueQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/coupon/param/YxStoreCouponIssueQueryParam.java new file mode 100644 index 0000000..eb4d84a --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/coupon/param/YxStoreCouponIssueQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.coupon.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 优惠券前台领取表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-27 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxStoreCouponIssueQueryParam对象", description="优惠券前台领取表查询参数") +public class YxStoreCouponIssueQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/coupon/param/YxStoreCouponIssueUserQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/coupon/param/YxStoreCouponIssueUserQueryParam.java new file mode 100644 index 0000000..8876513 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/coupon/param/YxStoreCouponIssueUserQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.coupon.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 优惠券前台用户领取记录表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-27 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxStoreCouponIssueUserQueryParam对象", description="优惠券前台用户领取记录表查询参数") +public class YxStoreCouponIssueUserQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/coupon/param/YxStoreCouponQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/coupon/param/YxStoreCouponQueryParam.java new file mode 100644 index 0000000..613ddbf --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/coupon/param/YxStoreCouponQueryParam.java @@ -0,0 +1,28 @@ +package co.yixiang.modules.coupon.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; + +/** + *

+ * 优惠券表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-27 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxStoreCouponQueryParam对象", description="优惠券表查询参数") +public class YxStoreCouponQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; + + @NotBlank(message = "参数有误") + @ApiModelProperty(value = "优惠券ID") + private String couponId; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/coupon/param/YxStoreCouponUserQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/coupon/param/YxStoreCouponUserQueryParam.java new file mode 100644 index 0000000..dd3f41e --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/coupon/param/YxStoreCouponUserQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.coupon.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 优惠券发放记录表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-27 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxStoreCouponUserQueryParam对象", description="优惠券发放记录表查询参数") +public class YxStoreCouponUserQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/coupon/rest/CouponController.java b/yshop-app/src/main/java/co/yixiang/modules/coupon/rest/CouponController.java new file mode 100644 index 0000000..bc01332 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/coupon/rest/CouponController.java @@ -0,0 +1,143 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.coupon.rest; + +import cn.hutool.core.util.NumberUtil; +import co.yixiang.api.ApiResult; +import co.yixiang.api.YshopException; +import co.yixiang.logging.aop.log.AppLog; +import co.yixiang.common.aop.NoRepeatSubmit; +import co.yixiang.common.bean.LocalUser; +import co.yixiang.common.interceptor.AuthCheck; +import co.yixiang.modules.activity.service.YxStoreCouponIssueService; +import co.yixiang.modules.activity.service.YxStoreCouponUserService; +import co.yixiang.modules.activity.vo.StoreCouponUserVo; +import co.yixiang.modules.activity.vo.YxStoreCouponIssueQueryVo; +import co.yixiang.modules.activity.vo.YxStoreCouponUserQueryVo; +import co.yixiang.modules.coupon.param.YxStoreCouponQueryParam; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 优惠券 todo + *

+ * + * @author hupeng + * @since 2019-10-02 + */ +@Slf4j +@RestController +@Api(value = "优惠券", tags = "营销:优惠券") +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +public class CouponController { + + private final YxStoreCouponIssueService couponIssueService; + private final YxStoreCouponUserService storeCouponUserService; + + /** + * 可领取优惠券列表 + */ + @AuthCheck + @GetMapping("/coupons") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "productId", value = "产品ID", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "type", value = "优惠券类型 0通用券 1商品券 2内部券", paramType = "query", dataType = "int") + }) + @ApiOperation(value = "可领取优惠券列表",notes = "可领取优惠券列表") + public ApiResult> getList(@RequestParam(value = "page",defaultValue = "1") int page, + @RequestParam(value = "limit",defaultValue = "10") int limit, + @RequestParam(value = "productId",required = false) Long productId, + @RequestParam(value = "type",required = false) Integer type){ + Long uid = LocalUser.getUser().getUid(); + return ApiResult.ok(couponIssueService.getCouponList(page, limit,uid,productId,type)); + } + + /** + * 领取优惠券 + */ + @AppLog(value = "领取优惠券", type = 1) + @NoRepeatSubmit + @AuthCheck + @PostMapping("/coupon/receive") + @ApiOperation(value = "领取优惠券",notes = "领取优惠券") + public ApiResult receive(@Validated @RequestBody YxStoreCouponQueryParam param){ + Long uid = LocalUser.getUser().getUid(); + if(!NumberUtil.isNumber(param.getCouponId())){ + throw new YshopException("参数非法"); + } + Integer couponId = Integer.valueOf(param.getCouponId()); + couponIssueService.issueUserCoupon(couponId,uid); + return ApiResult.ok(); + } + + /** + * 用户已领取优惠券 + */ + @AppLog(value = "查看已领取优惠券", type = 1) + @AuthCheck + @GetMapping("/coupons/user/{type}") + @ApiOperation(value = "用户已领取优惠券",notes = "用户已领取优惠券") + public ApiResult> getUserList(){ + Long uid = LocalUser.getUser().getUid(); + List list = storeCouponUserService.getUserCoupon(uid); + return ApiResult.ok(list); + } + + /** + * 用户已领取优惠券pc + */ + @AppLog(value = "用户已领取优惠券pc", type = 1) + @AuthCheck + @GetMapping("/coupons/user/pc/{type}") + @ApiOperation(value = "用户已领取优惠券pc",notes = "用户已领取优惠券pc") + public ApiResult getUserPCList( + @RequestParam(value = "page", defaultValue = "1") int page, + @RequestParam(value = "limit", defaultValue = "10") int limit, @PathVariable(value = "type") Integer type){ + Long uid = LocalUser.getUser().getUid(); + Map map = storeCouponUserService.getUserPCCoupon(uid,page,limit,type); + Long total = (Long) map.get("total"); + Long totalPage = (Long) map.get("totalPage"); + return ApiResult.resultPage(total.intValue(), totalPage.intValue(), map.get("list")); + } + + /** + * 优惠券 订单获取 + */ + @AuthCheck + @GetMapping("/coupons/order/{cartIds}") + @ApiImplicitParams({ + @ApiImplicitParam(name = "cartIds", value = "购物车ID,多个用,分割", paramType = "query", dataType = "int") + }) + @ApiOperation(value = "优惠券订单获取",notes = "优惠券订单获取") + public ApiResult> orderCoupon(@PathVariable String cartIds){ + Long uid = LocalUser.getUser().getUid(); + return ApiResult.ok(storeCouponUserService.beUsableCouponList(uid,cartIds)); + } + + +} + diff --git a/yshop-app/src/main/java/co/yixiang/modules/manage/dto/ChartDataDto.java b/yshop-app/src/main/java/co/yixiang/modules/manage/dto/ChartDataDto.java new file mode 100644 index 0000000..b9708f0 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/manage/dto/ChartDataDto.java @@ -0,0 +1,16 @@ +package co.yixiang.modules.manage.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName ChartDataDto + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/25 + **/ +@Data +public class ChartDataDto implements Serializable { + private Double num; + private String time; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/manage/param/OrderPriceParam.java b/yshop-app/src/main/java/co/yixiang/modules/manage/param/OrderPriceParam.java new file mode 100644 index 0000000..39edb2e --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/manage/param/OrderPriceParam.java @@ -0,0 +1,24 @@ +package co.yixiang.modules.manage.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @ClassName OrderPriceParam + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/26 + **/ +@Data +public class OrderPriceParam implements Serializable { + + @NotBlank(message = "订单编号错误") + @ApiModelProperty(value = "订单ID") + private String orderId; + + @NotBlank(message = "修改价格必填") + @ApiModelProperty(value = "商品价格") + private String price; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/manage/param/OrderRemarkParam.java b/yshop-app/src/main/java/co/yixiang/modules/manage/param/OrderRemarkParam.java new file mode 100644 index 0000000..1959ebc --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/manage/param/OrderRemarkParam.java @@ -0,0 +1,24 @@ +package co.yixiang.modules.manage.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @ClassName OrderPriceParam + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/26 + **/ +@Data +public class OrderRemarkParam implements Serializable { + + @NotBlank(message = "订单编号错误") + @ApiModelProperty(value = "订单ID") + private String orderId; + + @NotBlank(message = "备注必填") + @ApiModelProperty(value = "备注") + private String remark; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/manage/param/ShoperQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/manage/param/ShoperQueryParam.java new file mode 100644 index 0000000..b2b2064 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/manage/param/ShoperQueryParam.java @@ -0,0 +1,26 @@ +package co.yixiang.modules.manage.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author hupeng + * @date 2019-02-27 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="商户查询参数", description="商户查询参数") +public class ShoperQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "商品状态,默认为0未支付 1待发货 2待收货 3待评价 4已完成 5退款中 6已退款 7退款") + private Integer status = 0; + + @ApiModelProperty(value = "分类") + private Integer cate = 1; + + private Integer type = 1; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/manage/param/YxExpressQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/manage/param/YxExpressQueryParam.java new file mode 100644 index 0000000..c7b44f0 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/manage/param/YxExpressQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.manage.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 快递公司表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-12-13 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxExpressQueryParam对象", description="快递公司表查询参数") +public class YxExpressQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/manage/rest/ShoperController.java b/yshop-app/src/main/java/co/yixiang/modules/manage/rest/ShoperController.java new file mode 100644 index 0000000..86e4fa0 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/manage/rest/ShoperController.java @@ -0,0 +1,189 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.manage.rest; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.ApiResult; +import co.yixiang.api.YshopException; +import co.yixiang.logging.aop.log.AppLog; +import co.yixiang.common.interceptor.AuthCheck; +import co.yixiang.modules.manage.param.OrderPriceParam; +import co.yixiang.modules.manage.param.ShoperQueryParam; +import co.yixiang.modules.order.param.OrderDeliveryParam; +import co.yixiang.modules.order.param.OrderRefundParam; +import co.yixiang.modules.order.service.YxExpressService; +import co.yixiang.modules.order.service.YxStoreOrderService; +import co.yixiang.modules.order.vo.OrderDataVo; +import co.yixiang.modules.order.vo.ShoperOrderTimeDataVo; +import co.yixiang.modules.order.vo.UserOrderCountVo; +import co.yixiang.modules.order.vo.YxStoreOrderQueryVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.math.BigDecimal; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * @ClassName ShoperController + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/25 + **/ +@Slf4j +@RestController +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +@Api(value = "商家管理", tags = "商城:商家管理") +public class ShoperController { + + private final YxStoreOrderService storeOrderService; + private final YxExpressService expressService; + + /** + * 订单数据统计 + */ + @AuthCheck + @GetMapping("/admin/order/statistics") + @ApiOperation(value = "订单数据统计",notes = "订单数据统计") + public ApiResult> statistics(){ + UserOrderCountVo userOrderCountVo = storeOrderService.orderData(null); + ShoperOrderTimeDataVo orderTimeDataVo = storeOrderService.getShoperOrderTimeData(); + + Map map = new LinkedHashMap<>(); + map.put("orderCount",userOrderCountVo); + map.put("orderTimeCount",orderTimeDataVo); + return ApiResult.ok(map); + } + + /** + * 订单每月统计数据 + */ + @AuthCheck + @GetMapping("/admin/order/data") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int") + }) + @ApiOperation(value = "订单每月统计数据",notes = "订单每月统计数据") + public ApiResult> data(@RequestParam(value = "page",defaultValue = "1") int page, + @RequestParam(value = "limit",defaultValue = "10") int limit){ + return ApiResult.ok(storeOrderService.getOrderDataPriceCount(page,limit)); + } + + + /** + * 订单列表 + */ + @AppLog(value = "查看订单列表", type = 1) + @AuthCheck + @GetMapping("/admin/order/list") + @ApiOperation(value = "订单列表",notes = "订单列表") + public ApiResult orderList(ShoperQueryParam queryParam) { + Map map = storeOrderService.orderList(null, queryParam.getStatus(), + queryParam.getPage(), queryParam.getLimit()); + return ApiResult.ok(map.get("list")); + } + + /** + * 订单详情 + */ + @AppLog(value = "查看订单详情", type = 1) + @AuthCheck + @GetMapping("/admin/order/detail/{key}") + @ApiOperation(value = "订单详情",notes = "订单详情") + public ApiResult orderDetail(@PathVariable String key){ + if(StrUtil.isEmpty(key)) { + throw new YshopException("参数错误"); + } + YxStoreOrderQueryVo storeOrder = storeOrderService.getOrderInfo(key,null); + if(ObjectUtil.isNull(storeOrder)){ + throw new YshopException("订单不存在"); + } + return ApiResult.ok(storeOrderService.handleOrder(storeOrder)); + } + + /** + * 订单改价 + */ + @AppLog(value = "订单改价", type = 1) + @AuthCheck + @PostMapping("/admin/order/price") + @ApiOperation(value = "订单改价",notes = "订单改价") + public ApiResult orderPrice(@Validated @RequestBody OrderPriceParam param){ + storeOrderService.editOrderPrice(param.getOrderId(),param.getPrice()); + return ApiResult.ok(); + } + + /** + * 快递公司 + */ + @GetMapping("/logistics") + @ApiOperation(value = "快递公司",notes = "快递公司") + public ApiResult express(){ + return ApiResult.ok(expressService.list()); + } + + + /** + * 订单发货 + */ + @AppLog(value = "订单发货", type = 1) + @AuthCheck + @PostMapping("/admin/order/delivery/keep") + @ApiOperation(value = "订单发货",notes = "订单发货") + public ApiResult orderDelivery(@Validated @RequestBody OrderDeliveryParam param){ + storeOrderService.orderDelivery(param.getOrderId(),param.getDeliveryId(), + param.getDeliveryName(),param.getDeliveryType()); + return ApiResult.ok(); + } + + /** + * 订单退款 + */ + @AppLog(value = "订单退款", type = 1) + @AuthCheck + @PostMapping("/admin/order/refund") + @ApiOperation(value = "订单退款",notes = "订单退款") + public ApiResult orderRefund(@Validated @RequestBody OrderRefundParam param){ + storeOrderService.orderRefund(param.getOrderId(),new BigDecimal(param.getPrice()),param.getType()); + return ApiResult.ok(); + } + + + /** + * 订单交易额/订单数量时间chart统计 + */ + @Deprecated + @GetMapping("/admin/order/time") + @ApiOperation(value = "chart统计",notes = "chart统计") + public ApiResult chartCount(ShoperQueryParam queryParam){ +// return ApiResult.ok(storeOrderService.chartCount(queryParam.getCate().intValue(), +// queryParam.getType().intValue())); + return null; + } + + + + + + +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/manage/vo/YxExpressQueryVo.java b/yshop-app/src/main/java/co/yixiang/modules/manage/vo/YxExpressQueryVo.java new file mode 100644 index 0000000..0cb2fc7 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/manage/vo/YxExpressQueryVo.java @@ -0,0 +1,37 @@ +package co.yixiang.modules.manage.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 快递公司表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-12-13 + */ +@Data +@ApiModel(value="YxExpressQueryVo对象", description="快递公司表查询参数") +public class YxExpressQueryVo implements Serializable{ + private static final long serialVersionUID = 1L; + +@ApiModelProperty(value = "快递公司id") +private Integer id; + +@ApiModelProperty(value = "快递公司简称") +private String code; + +@ApiModelProperty(value = "快递公司全称") +private String name; + +@ApiModelProperty(value = "排序") +private Integer sort; + +@ApiModelProperty(value = "是否显示") +private Boolean isShow; + +} \ No newline at end of file diff --git a/yshop-app/src/main/java/co/yixiang/modules/order/dto/OrderExtendDto.java b/yshop-app/src/main/java/co/yixiang/modules/order/dto/OrderExtendDto.java new file mode 100644 index 0000000..3d12860 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/order/dto/OrderExtendDto.java @@ -0,0 +1,31 @@ +package co.yixiang.modules.order.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Map; + +/** + * @ClassName OrderExtendDto + * @Author hupeng <610796224@qq.com> + * @Date 2019/10/28 + **/ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class OrderExtendDto implements Serializable { + + @ApiModelProperty(value = "唯一的key") + private String key; + + @ApiModelProperty(value = "订单ID") + private String orderId; + + @ApiModelProperty(value = "微信相关配置") + private Map jsConfig; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/order/dto/PayDto.java b/yshop-app/src/main/java/co/yixiang/modules/order/dto/PayDto.java new file mode 100644 index 0000000..5219014 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/order/dto/PayDto.java @@ -0,0 +1,17 @@ +package co.yixiang.modules.order.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName PayDto + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/7 + **/ +@Data +public class PayDto implements Serializable { + private String from; + private String paytype; + private String uni; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/order/param/ComputeOrderParam.java b/yshop-app/src/main/java/co/yixiang/modules/order/param/ComputeOrderParam.java new file mode 100644 index 0000000..63afd5a --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/order/param/ComputeOrderParam.java @@ -0,0 +1,44 @@ +package co.yixiang.modules.order.param; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * @ClassName ComputeOrderParam + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/22 + **/ +@Getter +@Setter +@ToString +public class ComputeOrderParam { + //@NotBlank(message = "请选择地址") + @ApiModelProperty(value = "地址ID") + private String addressId; + + @ApiModelProperty(value = "优惠券ID") + private String couponId; + + //@NotBlank(message = "请选择支付方式") + @ApiModelProperty(value = "支付方式") + private String payType; + + @ApiModelProperty(value = "使用积分 1-表示使用") + private String useIntegral; + + @JsonProperty(value = "shipping_type") + @ApiModelProperty(value = "配送方式 1=快递 ,2=门店自提") + private String shippingType; + + @ApiModelProperty(value = "砍价ID") + private String bargainId; + + @ApiModelProperty(value = "拼团ID") + private String pinkId; + + @ApiModelProperty(value = "拼团ID") + private String combinationId; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/order/param/ConfirmOrderParam.java b/yshop-app/src/main/java/co/yixiang/modules/order/param/ConfirmOrderParam.java new file mode 100644 index 0000000..afca6f8 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/order/param/ConfirmOrderParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.order.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; + +/** + * @ClassName 确认订单ConfirmOrderDTO + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/21 + **/ +@Getter +@Setter +public class ConfirmOrderParam { + + @NotBlank(message = "请提交购买的商品") + @ApiModelProperty(value = "购物车ID") + private String cartId; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/order/param/DoOrderParam.java b/yshop-app/src/main/java/co/yixiang/modules/order/param/DoOrderParam.java new file mode 100644 index 0000000..8841589 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/order/param/DoOrderParam.java @@ -0,0 +1,20 @@ +package co.yixiang.modules.order.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; + +/** + * @ClassName HandleOrderParam + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/23 + **/ +@Getter +@Setter +public class DoOrderParam { + @NotBlank(message = "参数有误") + @ApiModelProperty(value = "订单ID") + private String uni; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/order/param/ExpressParam.java b/yshop-app/src/main/java/co/yixiang/modules/order/param/ExpressParam.java new file mode 100644 index 0000000..a61641e --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/order/param/ExpressParam.java @@ -0,0 +1,24 @@ +package co.yixiang.modules.order.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName ExpressParam + * @Author hupeng <610796224@qq.com> + * @Date 2019/12/9 + **/ +@Data +public class ExpressParam implements Serializable { + + @ApiModelProperty(value = "订单编号") + private String orderCode; + + @ApiModelProperty(value = "快递公司编码") + private String shipperCode; + + @ApiModelProperty(value = "物流单号") + private String logisticCode; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/order/param/HandleOrderParam.java b/yshop-app/src/main/java/co/yixiang/modules/order/param/HandleOrderParam.java new file mode 100644 index 0000000..db303b3 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/order/param/HandleOrderParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.order.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; + +/** + * @ClassName HandleOrderParam + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/23 + **/ +@Getter +@Setter +public class HandleOrderParam { + + @NotBlank(message = "参数有误") + @ApiModelProperty(value = "订单ID") + private String id; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/order/param/OrderDeliveryParam.java b/yshop-app/src/main/java/co/yixiang/modules/order/param/OrderDeliveryParam.java new file mode 100644 index 0000000..180b080 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/order/param/OrderDeliveryParam.java @@ -0,0 +1,32 @@ +package co.yixiang.modules.order.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @ClassName OrderPriceParam + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/26 + **/ +@Data +public class OrderDeliveryParam implements Serializable { + + @NotBlank(message = "订单编号错误") + @ApiModelProperty(value = "订单ID") + private String orderId; + + @NotBlank(message = "快递单号必填") + @ApiModelProperty(value = "快递单号") + private String deliveryId; + + @NotBlank(message = "快递公司必填") + @ApiModelProperty(value = "快递公司") + private String deliveryName; + + @NotBlank(message = "快递方式必填") + @ApiModelProperty(value = "快递方式") + private String deliveryType; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/order/param/OrderRefundParam.java b/yshop-app/src/main/java/co/yixiang/modules/order/param/OrderRefundParam.java new file mode 100644 index 0000000..d28f2ed --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/order/param/OrderRefundParam.java @@ -0,0 +1,29 @@ +package co.yixiang.modules.order.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @ClassName OrderRefundParam + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/26 + **/ +@Data +public class OrderRefundParam implements Serializable { + + @NotBlank(message = "订单编号错误") + @ApiModelProperty(value = "订单ID") + private String orderId; + + @NotNull(message = "退款金额必填") + @ApiModelProperty(value = "退款金额") + private String price; + + @NotNull(message = "参数错误") + @ApiModelProperty(value = "类型:1同意 2拒绝") + private Integer type; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/order/param/OrderVerifyParam.java b/yshop-app/src/main/java/co/yixiang/modules/order/param/OrderVerifyParam.java new file mode 100644 index 0000000..32c1891 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/order/param/OrderVerifyParam.java @@ -0,0 +1,24 @@ +package co.yixiang.modules.order.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @ClassName OrderVerifyParam + * @Author hupeng <610796224@qq.com> + * @Date 2020/03/05 + **/ +@Data +public class OrderVerifyParam implements Serializable { + + @ApiModelProperty(value = "订单核销状态:1确认0正常") + private Integer isConfirm; + + @NotBlank(message = "缺少核销码") + @ApiModelProperty(value = "核销码") + private String verifyCode; + +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/order/param/PayParam.java b/yshop-app/src/main/java/co/yixiang/modules/order/param/PayParam.java new file mode 100644 index 0000000..056e8fe --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/order/param/PayParam.java @@ -0,0 +1,27 @@ +package co.yixiang.modules.order.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @ClassName PayDto + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/7 + **/ +@Data +public class PayParam implements Serializable { + + @ApiModelProperty(value = "来源") + private String from; + + @NotBlank(message = "选择支付类型") + @ApiModelProperty(value = "支付类型") + private String paytype; + + @NotBlank(message = "参数错误") + @ApiModelProperty(value = "订单ID") + private String uni; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/order/param/ProductOrderParam.java b/yshop-app/src/main/java/co/yixiang/modules/order/param/ProductOrderParam.java new file mode 100644 index 0000000..5e24276 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/order/param/ProductOrderParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.order.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; + +/** + * @ClassName ProductOrderParam + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/23 + **/ +@Getter +@Setter +public class ProductOrderParam { + + @NotBlank(message = "参数有误") + @ApiModelProperty(value = "订单唯一值") + private String unique; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/order/param/ProductReplyParam.java b/yshop-app/src/main/java/co/yixiang/modules/order/param/ProductReplyParam.java new file mode 100644 index 0000000..43c8cfe --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/order/param/ProductReplyParam.java @@ -0,0 +1,38 @@ +package co.yixiang.modules.order.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; + +/** + * @ClassName ProductReplyParam + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/23 + **/ +@Getter +@Setter +public class ProductReplyParam { + + @NotBlank(message = "评论不能为空") + @Size(min = 1, max = 200,message = "长度超过了限制") + @ApiModelProperty(value = "商品评论内容") + private String comment; + + @ApiModelProperty(value = "商品评论图片地址") + private String pics; + + @NotBlank(message = "请为商品评分") + @ApiModelProperty(value = "商品评分") + private String productScore; + + @NotBlank(message = "请为商品评分") + @ApiModelProperty(value = "服务评分") + private String serviceScore; + + @NotBlank(message = "参数有误") + @ApiModelProperty(value = "订单唯一值") + private String unique; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/order/param/RefundParam.java b/yshop-app/src/main/java/co/yixiang/modules/order/param/RefundParam.java new file mode 100644 index 0000000..6ef322e --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/order/param/RefundParam.java @@ -0,0 +1,33 @@ +package co.yixiang.modules.order.param; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @ClassName RefundParam + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/6 + **/ +@Data +public class RefundParam implements Serializable { + + @JsonProperty(value = "refund_reason_wap_explain") + @ApiModelProperty(value = "退款备注") + private String refundReasonWapExplain; + + @JsonProperty(value = "refund_reason_wap_img") + @ApiModelProperty(value = "退款图片") + private String refundReasonWapImg; + + @NotBlank(message = "请填写退款原因") + @ApiModelProperty(value = "退款原因") + private String text; + + @NotBlank(message = "参数错误") + @ApiModelProperty(value = "订单唯一值") + private String uni; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/order/param/YxStoreOrderCartInfoQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/order/param/YxStoreOrderCartInfoQueryParam.java new file mode 100644 index 0000000..94f02c3 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/order/param/YxStoreOrderCartInfoQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.order.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 订单购物详情表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-27 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxStoreOrderCartInfoQueryParam对象", description="订单购物详情表查询参数") +public class YxStoreOrderCartInfoQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/order/param/YxStoreOrderQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/order/param/YxStoreOrderQueryParam.java new file mode 100644 index 0000000..831aed7 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/order/param/YxStoreOrderQueryParam.java @@ -0,0 +1,23 @@ +package co.yixiang.modules.order.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 订单表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-27 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxStoreOrderQueryParam对象", description="订单表查询参数") +public class YxStoreOrderQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; + + private Integer type = 1; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/order/param/YxStoreOrderStatusQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/order/param/YxStoreOrderStatusQueryParam.java new file mode 100644 index 0000000..af8a3be --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/order/param/YxStoreOrderStatusQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.order.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 订单操作记录表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-27 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxStoreOrderStatusQueryParam对象", description="订单操作记录表查询参数") +public class YxStoreOrderStatusQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/order/rest/StoreOrderController.java b/yshop-app/src/main/java/co/yixiang/modules/order/rest/StoreOrderController.java new file mode 100644 index 0000000..6412890 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/order/rest/StoreOrderController.java @@ -0,0 +1,487 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.order.rest; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.ApiResult; +import co.yixiang.api.YshopException; +import co.yixiang.common.aop.NoRepeatSubmit; +import co.yixiang.common.bean.LocalUser; +import co.yixiang.common.interceptor.AuthCheck; +import co.yixiang.enums.*; +import co.yixiang.logging.aop.log.AppLog; +import co.yixiang.modules.mp.domain.YxWechatTemplate; +import co.yixiang.modules.mp.service.WeixinPayService; +import co.yixiang.modules.mp.service.YxWechatTemplateService; +import co.yixiang.modules.order.domain.YxStoreOrder; +import co.yixiang.modules.order.domain.YxStoreOrderCartInfo; +import co.yixiang.modules.order.dto.OrderExtendDto; +import co.yixiang.modules.order.param.*; +import co.yixiang.modules.order.service.YxStoreOrderCartInfoService; +import co.yixiang.modules.order.service.YxStoreOrderService; +import co.yixiang.modules.order.service.YxStoreOrderStatusService; +import co.yixiang.modules.order.service.dto.YxStoreOrderDto; +import co.yixiang.modules.order.vo.ComputeVo; +import co.yixiang.modules.order.vo.ConfirmOrderVo; +import co.yixiang.modules.order.vo.OrderCartInfoVo; +import co.yixiang.modules.order.vo.YxStoreOrderQueryVo; +import co.yixiang.modules.services.CreatShareProductService; +import co.yixiang.modules.services.OrderSupplyService; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.tools.express.ExpressService; +import co.yixiang.tools.express.config.ExpressAutoConfiguration; +import co.yixiang.tools.express.dao.ExpressInfo; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.vdurmont.emoji.EmojiParser; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * 订单控制器 + *

+ * + * @author hupeng + * @since 2019-10-27 + */ +@Slf4j +@RestController +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +@Api(value = "订单模块", tags = "商城:订单模块") +public class StoreOrderController { + + private final YxStoreOrderService storeOrderService; + private final OrderSupplyService orderSupplyService; + private final CreatShareProductService creatShareProductService; + private final YxWechatTemplateService yxWechatTemplateService; + private final YxStoreOrderStatusService orderStatusService; + + private final YxStoreOrderCartInfoService storeOrderCartInfoService; + private final WeixinPayService weixinPayService; + + @Value("${file.path}") + private String path; + + + /** + * 订单确认 + */ + @AppLog(value = "订单确认", type = 1) + @AuthCheck + @PostMapping("/order/confirm") + @ApiOperation(value = "订单确认", notes = "订单确认") + public ApiResult confirm(@Validated @RequestBody ConfirmOrderParam param) { + YxUser yxUser = LocalUser.getUser(); + return ApiResult.ok(storeOrderService.confirmOrder(yxUser, param.getCartId())); + + } + + /** + * 计算订单金额 + */ + @AuthCheck + @PostMapping("/order/computed/{key}") + @ApiImplicitParams({ + @ApiImplicitParam(name = "key", value = "唯一的key", paramType = "query", dataType = "string") + }) + @ApiOperation(value = "计算订单金额", notes = "计算订单金额") + public ApiResult> computedOrder(@Validated @RequestBody ComputeOrderParam param, + @PathVariable String key) { + YxUser yxUser = LocalUser.getUser(); + Map map = orderSupplyService.check(yxUser.getUid(), key, param); + if (OrderLogEnum.EXTEND_ORDER.getValue().equals(map.get("status")) + || OrderLogEnum.PINK_ORDER_FAIL_1.getValue().equals(map.get("status")) + || OrderLogEnum.PINK_ORDER_FAIL_2.getValue().equals(map.get("status"))) { + return ApiResult.ok(map, map.get("msg").toString()); + } + + ComputeVo computeVo = storeOrderService.computedOrder(yxUser, key, + param.getCouponId(), + param.getUseIntegral(), + param.getShippingType(), + param.getAddressId()); + + map.put("result", computeVo); + map.put("status", OrderLogEnum.NONE_ORDER.getValue()); + return ApiResult.ok(map); + } + + /** + * 订单创建 + */ + @AppLog(value = "订单创建", type = 1) + @AuthCheck + @NoRepeatSubmit + @PostMapping("/order/create/{key}") + @ApiOperation(value = "订单创建", notes = "订单创建") + public ApiResult> create(@Valid @RequestBody OrderParam param, + @PathVariable String key) { + YxUser yxUser = LocalUser.getUser(); + ComputeOrderParam computeOrderParam = new ComputeOrderParam(); + BeanUtil.copyProperties(param, computeOrderParam); + Map map = orderSupplyService.check(yxUser.getUid(), key, computeOrderParam); + if (OrderLogEnum.EXTEND_ORDER.getValue().equals(map.get("status")) + || OrderLogEnum.PINK_ORDER_FAIL_2.getValue().equals(map.get("status")) + || OrderLogEnum.PINK_ORDER_FAIL_1.getValue().equals(map.get("status"))) { + return ApiResult.ok(map, map.get("msg").toString()); + } + + + //创建订单 + YxStoreOrder order = storeOrderService.createOrder(yxUser, key, param); + + if (ObjectUtil.isNull(order)) { + throw new YshopException("订单生成失败"); + } + + String orderId = order.getOrderId(); + + OrderExtendDto orderDTO = new OrderExtendDto(); + orderDTO.setKey(key); + orderDTO.setOrderId(orderId); + map.put("status", OrderLogEnum.CREATE_ORDER_SUCCESS.getValue()); + map.put("result", orderDTO); + map.put("createTime", order.getCreateTime()); + + //开始处理支付 + //处理金额为0的情况 + if(order.getPayPrice().compareTo(BigDecimal.ZERO) <= 0&&!param.getPayType().equals(PayTypeEnum.INTEGRAL.getValue())){ + storeOrderService.yuePay(orderId,yxUser.getUid()); + map.put("payMsg","支付成功"); + return ApiResult.ok(map,"支付成功"); + } + + orderSupplyService.goPay(map,orderId,yxUser.getUid(), + param.getPayType(),param.getFrom(),orderDTO); + return ApiResult.ok(map, map.get("payMsg").toString()); + } + + + /** + * 订单支付 + */ + @AppLog(value = "订单支付", type = 1) + @AuthCheck + @PostMapping("/order/pay") + @ApiOperation(value = "订单支付", notes = "订单支付") + public ApiResult> pay(@Valid @RequestBody PayParam param) { + Map map = new LinkedHashMap<>(); + Long uid = LocalUser.getUser().getUid(); + YxStoreOrderQueryVo storeOrder = storeOrderService + .getOrderInfo(param.getUni(), uid); + if (ObjectUtil.isNull(storeOrder)) { + throw new YshopException("订单不存在"); + } + + if (OrderInfoEnum.REFUND_STATUS_1.getValue().equals(storeOrder.getPaid())) { + throw new YshopException("该订单已支付"); + } + + String orderId = storeOrder.getOrderId(); + + OrderExtendDto orderDTO = new OrderExtendDto(); + orderDTO.setOrderId(orderId); + map.put("status", "SUCCESS"); + map.put("result", orderDTO); + + + if (storeOrder.getPayPrice().compareTo(BigDecimal.ZERO) <= 0 && !param.getPaytype().equals(PayTypeEnum.INTEGRAL.getValue())) { + storeOrderService.yuePay(orderId, uid); + return ApiResult.ok(map, "支付成功"); + } + + //处理是否已经修改过订单价格,如果修改用新的单号去拉起支付 + if (StrUtil.isNotBlank(storeOrder.getExtendOrderId())) { + orderId = storeOrder.getExtendOrderId(); + } + + + orderSupplyService.goPay(map, orderId, uid, param.getPaytype(), param.getFrom(), orderDTO); + + return ApiResult.ok(map); + } + + + /** + * 订单列表 + */ + @AppLog(value = "查看订单列表", type = 1) + @AuthCheck + @GetMapping("/order/list") + @ApiImplicitParams({ + @ApiImplicitParam(name = "type", value = "商品状态,-1全部 默认为0未支付 1待发货 2待收货 3待评价 4已完成 5退款中 6已退款 7退款", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int") + }) + @ApiOperation(value = "订单列表", notes = "订单列表") + public ApiResult orderList(@RequestParam(value = "type", defaultValue = "0") int type, + @RequestParam(value = "page", defaultValue = "1") int page, + @RequestParam(value = "limit", defaultValue = "10") int limit) { + Long uid = LocalUser.getUser().getUid(); + Map map = storeOrderService.orderList(uid, type, page, limit); + Long total = (Long) map.get("total"); + Long totalPage = (Long) map.get("totalPage"); + return ApiResult.resultPage(total.intValue(), totalPage.intValue(), map.get("list")); + } + + + /** + * 订单详情 + */ + @AppLog(value = "查看订单详情", type = 1) + @AuthCheck + @GetMapping("/order/detail/{key}") + @ApiImplicitParams({ + @ApiImplicitParam(name = "key", value = "唯一的key", paramType = "query", dataType = "string") + }) + @ApiOperation(value = "订单详情", notes = "订单详情") + public ApiResult detail(@PathVariable String key) { + Long uid = LocalUser.getUser().getUid(); + if (StrUtil.isEmpty(key)) { + throw new YshopException("参数错误"); + } + YxStoreOrderQueryVo storeOrder = storeOrderService.getOrderInfo(key, uid); + if (ObjectUtil.isNull(storeOrder)) { + throw new YshopException("订单不存在"); + } + storeOrder = creatShareProductService.handleQrcode(storeOrder, path); + + return ApiResult.ok(storeOrderService.handleOrder(storeOrder)); + } + + + /** + * 订单收货 + */ + @AppLog(value = "订单收货", type = 1) + @AuthCheck + @PostMapping("/order/take") + @ApiOperation(value = "订单收货", notes = "订单收货") + public ApiResult orderTake(@Validated @RequestBody DoOrderParam param) { + Long uid = LocalUser.getUser().getUid(); + storeOrderService.takeOrder(param.getUni(), uid); + return ApiResult.ok(); + } + + /** + * 订单产品信息 + */ + @PostMapping("/order/product") + @ApiOperation(value = "订单产品信息", notes = "订单产品信息") + public ApiResult product(@Validated @RequestBody ProductOrderParam param) { + return ApiResult.ok(orderSupplyService.getProductOrder(param.getUnique())); + } + + /** + * 订单评价 + */ + @AppLog(value = "订单评价", type = 1) + @AuthCheck + @NoRepeatSubmit + @PostMapping("/order/comment") + @ApiOperation(value = "订单评价", notes = "订单评价") + public ApiResult comment(@Valid @RequestBody ProductReplyParam param) { + YxUser user = LocalUser.getUser(); + YxStoreOrderCartInfo orderCartInfo = storeOrderCartInfoService + .getOne(Wrappers.lambdaQuery() + .eq(YxStoreOrderCartInfo::getUnique,param.getUnique())); + storeOrderService.orderComment(orderCartInfo, user, param.getUnique(), + param.getComment(), + param.getPics(), param.getProductScore(), param.getServiceScore()); + + //增加状态 + orderStatusService.create(orderCartInfo.getOid(), + OrderLogEnum.EVAL_ORDER.getValue(), + OrderLogEnum.EVAL_ORDER.getDesc()); + return ApiResult.ok(); + } + + /** + * 订单评价 + */ + @AppLog(value = "订单评价", type = 1) + @AuthCheck + @NoRepeatSubmit + @PostMapping("/order/comments") + @ApiOperation(value = "订单评价", notes = "订单评价") + public ApiResult comments(@Valid @RequestBody List param) { + YxUser user = LocalUser.getUser(); + if (param.size() > 0) { + YxStoreOrderCartInfo orderCartInfo = storeOrderCartInfoService + .getOne(Wrappers.lambdaQuery() + .eq(YxStoreOrderCartInfo::getUnique,param.get(0).getUnique())); + + for (ProductReplyParam productReplyParam : param) { + storeOrderService.orderComment(orderCartInfo , user, productReplyParam.getUnique(), + productReplyParam.getComment(), + productReplyParam.getPics(), productReplyParam.getProductScore(), productReplyParam.getServiceScore()); + } + + //增加状态 + orderStatusService.create(orderCartInfo.getOid(), + OrderLogEnum.EVAL_ORDER.getValue(), + OrderLogEnum.EVAL_ORDER.getDesc()); + } + return ApiResult.ok(); + } + + + /** + * 订单删除 + */ + @AppLog(value = "订单删除", type = 1) + @AuthCheck + @PostMapping("/order/del") + @ApiOperation(value = "订单删除", notes = "订单删除") + public ApiResult orderDel(@Validated @RequestBody DoOrderParam param) { + Long uid = LocalUser.getUser().getUid(); + storeOrderService.removeOrder(param.getUni(), uid); + return ApiResult.ok(); + } + + /** + * 订单退款理由 + */ + @GetMapping("/order/refund/reason") + @ApiOperation(value = "订单退款理由", notes = "订单退款理由") + public ApiResult refundReason() { + ArrayList list = new ArrayList<>(); + list.add("收货地址填错了"); + list.add("与描述不符"); + list.add("信息填错了,重新拍"); + list.add("收到商品损坏了"); + list.add("未按预定时间发货"); + list.add("其它原因"); + + return ApiResult.ok(list); + } + + /** + * 订单退款审核 + */ + @AppLog(value = "订单退款审核", type = 1) + @NoRepeatSubmit + @AuthCheck + @PostMapping("/order/refund/verify") + @ApiOperation(value = "订单退款审核", notes = "订单退款审核") + public ApiResult refundVerify(@RequestBody RefundParam param) { + Long uid = LocalUser.getUser().getUid(); + storeOrderService.orderApplyRefund(param.getRefundReasonWapExplain(), + param.getRefundReasonWapImg(), + EmojiParser.removeAllEmojis(param.getText()), + param.getUni(), uid); + return ApiResult.ok(); + } + + /** + * 订单取消 未支付的订单回退积分,回退优惠券,回退库存 + */ + @AppLog(value = "订单取消", type = 1) + @NoRepeatSubmit + @AuthCheck + @PostMapping("/order/cancel") + @ApiOperation(value = "订单取消", notes = "订单取消") + public ApiResult cancelOrder(@Validated @RequestBody HandleOrderParam param) { + Long uid = LocalUser.getUser().getUid(); + YxStoreOrderQueryVo orderInfo = storeOrderService.getOrderInfo(param.getId(), uid); + if (ObjectUtil.isNull(orderInfo)) { + throw new YshopException("订单不存在"); + } + if (orderInfo.getStatus() != 0) { + throw new YshopException("订单不能取消"); + } + if (orderInfo.getPaid() == 1) { + BigDecimal bigDecimal = new BigDecimal("100"); + int payPrice = bigDecimal.multiply(orderInfo.getPayPrice()).intValue(); + weixinPayService.refundOrder(param.getId(),payPrice); + } + storeOrderService.cancelOrder(param.getId(), uid); + return ApiResult.ok(); + } + + + /** + * 获取物流信息 + */ + @AuthCheck + @PostMapping("/order/express") + @ApiOperation(value = "获取物流信息", notes = "获取物流信息") + public ApiResult express(@RequestBody ExpressParam expressInfoDo) { + + //顺丰轨迹查询处理 + String lastFourNumber = ""; + if (expressInfoDo.getShipperCode().equals(ShipperCodeEnum.SF.getValue())) { + YxStoreOrderDto yxStoreOrderDto; + yxStoreOrderDto = storeOrderService.getOrderDetail(Long.valueOf(expressInfoDo.getOrderCode())); + lastFourNumber = yxStoreOrderDto.getUserPhone(); + if (lastFourNumber.length() == 11) { + lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4); + } + } + + ExpressService expressService = ExpressAutoConfiguration.expressService(); + ExpressInfo expressInfo = expressService.getExpressInfo(expressInfoDo.getOrderCode(), + expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode(), lastFourNumber); + if (!expressInfo.isSuccess()) { + throw new YshopException(expressInfo.getReason()); + } + return ApiResult.ok(expressInfo); + } + + /** + * 订单核销 + */ + @AppLog(value = "订单核销", type = 1) + @NoRepeatSubmit + @AuthCheck + @PostMapping("/order/order_verific") + @ApiOperation(value = "订单核销", notes = "订单核销") + public ApiResult orderVerify(@RequestBody OrderVerifyParam param) { + Long uid = LocalUser.getUser().getUid(); + YxStoreOrderQueryVo orderQueryVo = storeOrderService.verifyOrder(param.getVerifyCode(), + param.getIsConfirm(), uid); + if (orderQueryVo != null) { + return ApiResult.ok(orderQueryVo); + } + + return ApiResult.ok("核销成功"); + } + + + @AuthCheck + @GetMapping("/order/getSubscribeTemplate") + @ApiOperation(value = "获取订阅消息模板ID", notes = "获取订阅消息模板ID") + public ApiResult> getSubscribeTemplate() { + List yxWechatTemplate = yxWechatTemplateService.lambdaQuery() + .eq(YxWechatTemplate::getType, "subscribe") + .eq(YxWechatTemplate::getStatus, ShopCommonEnum.IS_STATUS_1.getValue()).list(); + List temId = yxWechatTemplate.stream().map(tem -> tem.getTempid()).collect(Collectors.toList()); + return ApiResult.ok(temId); + } + +} + diff --git a/yshop-app/src/main/java/co/yixiang/modules/product/param/CollectDelFootParam.java b/yshop-app/src/main/java/co/yixiang/modules/product/param/CollectDelFootParam.java new file mode 100644 index 0000000..f24fdff --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/product/param/CollectDelFootParam.java @@ -0,0 +1,20 @@ +package co.yixiang.modules.product.param; + +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +/** + * @author : gzlv 2021/6/26 19:17 + */ +@Getter +@Setter +@ApiModel("查询参数对象") +public class CollectDelFootParam { + + private List ids; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/product/param/YxArticleQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/product/param/YxArticleQueryParam.java new file mode 100644 index 0000000..26b4909 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/product/param/YxArticleQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.product.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 文章管理表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-02 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxArticleQueryParam对象", description="文章管理表查询参数") +public class YxArticleQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/product/param/YxStoreCategoryQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/product/param/YxStoreCategoryQueryParam.java new file mode 100644 index 0000000..642eb94 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/product/param/YxStoreCategoryQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.product.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 商品分类表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-22 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxStoreCategoryQueryParam对象", description="商品分类表查询参数") +public class YxStoreCategoryQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/product/param/YxStoreProductAttrQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/product/param/YxStoreProductAttrQueryParam.java new file mode 100644 index 0000000..c01a01d --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/product/param/YxStoreProductAttrQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.product.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 商品属性表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxStoreProductAttrQueryParam对象", description="商品属性表查询参数") +public class YxStoreProductAttrQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/product/param/YxStoreProductAttrResultQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/product/param/YxStoreProductAttrResultQueryParam.java new file mode 100644 index 0000000..4c0bde8 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/product/param/YxStoreProductAttrResultQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.product.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 商品属性详情表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxStoreProductAttrResultQueryParam对象", description="商品属性详情表查询参数") +public class YxStoreProductAttrResultQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/product/param/YxStoreProductAttrValueQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/product/param/YxStoreProductAttrValueQueryParam.java new file mode 100644 index 0000000..200231b --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/product/param/YxStoreProductAttrValueQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.product.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 商品属性值表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxStoreProductAttrValueQueryParam对象", description="商品属性值表查询参数") +public class YxStoreProductAttrValueQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/product/param/YxStoreProductRelationQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/product/param/YxStoreProductRelationQueryParam.java new file mode 100644 index 0000000..77f9202 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/product/param/YxStoreProductRelationQueryParam.java @@ -0,0 +1,29 @@ +package co.yixiang.modules.product.param; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; + +/** + *

+ * 商品点赞和收藏表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-23 + */ +@Getter +@Setter +@ApiModel("查询参数对象") +public class YxStoreProductRelationQueryParam { + + @NotBlank(message = "参数有误") + @ApiModelProperty(value = "商品id",required=true) + private String id; + + @ApiModelProperty(value = "某种类型的商品(普通商品、秒杀商品)") + private String category = "root"; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/product/param/YxStoreProductReplyQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/product/param/YxStoreProductReplyQueryParam.java new file mode 100644 index 0000000..506a526 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/product/param/YxStoreProductReplyQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.product.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 评论表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxStoreProductReplyQueryParam对象", description="评论表查询参数") +public class YxStoreProductReplyQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/product/rest/StoreCategoryController.java b/yshop-app/src/main/java/co/yixiang/modules/product/rest/StoreCategoryController.java new file mode 100644 index 0000000..adcffc3 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/product/rest/StoreCategoryController.java @@ -0,0 +1,53 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.rest; + +import co.yixiang.annotation.AnonymousAccess; +import co.yixiang.api.ApiResult; +import co.yixiang.modules.category.service.YxStoreCategoryService; +import co.yixiang.utils.CateDTO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + *

+ * 商品分类前端控制器 + *

+ * + * @author hupeng + * @since 2019-10-22 + */ +@Slf4j +@RestController +@Api(value = "商品分类", tags = "商城:商品分类") +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +public class StoreCategoryController { + + private final YxStoreCategoryService yxStoreCategoryService; + + + /** + * 商品分类列表 + */ + @AnonymousAccess + @GetMapping("/category") + @ApiOperation(value = "商品分类列表",notes = "商品分类列表") + public ApiResult> getYxStoreCategoryPageList(){ + return ApiResult.ok(yxStoreCategoryService.getList()); + } + +} + diff --git a/yshop-app/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java b/yshop-app/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java new file mode 100644 index 0000000..bd94830 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java @@ -0,0 +1,312 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.rest; + + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.qrcode.QrCodeUtil; +import co.yixiang.api.ApiResult; +import co.yixiang.api.YshopException; +import co.yixiang.constant.ShopConstants; +import co.yixiang.logging.aop.log.AppLog; +import co.yixiang.common.aop.NoRepeatSubmit; +import co.yixiang.common.bean.LocalUser; +import co.yixiang.common.interceptor.AuthCheck; +import co.yixiang.constant.SystemConfigConstants; +import co.yixiang.enums.AppFromEnum; +import co.yixiang.enums.ProductEnum; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.modules.product.domain.YxStoreProduct; +import co.yixiang.modules.product.param.CollectDelFootParam; +import co.yixiang.modules.product.param.YxStoreProductQueryParam; +import co.yixiang.modules.product.param.YxStoreProductRelationQueryParam; +import co.yixiang.modules.product.service.YxStoreProductRelationService; +import co.yixiang.modules.product.service.YxStoreProductReplyService; +import co.yixiang.modules.product.service.YxStoreProductService; +import co.yixiang.modules.product.vo.ProductVo; +import co.yixiang.modules.product.vo.ReplyCountVo; +import co.yixiang.modules.product.vo.YxStoreProductQueryVo; +import co.yixiang.modules.product.vo.YxStoreProductReplyQueryVo; +import co.yixiang.modules.services.CreatShareProductService; +import co.yixiang.modules.shop.domain.YxSystemAttachment; +import co.yixiang.modules.shop.service.YxSystemAttachmentService; +import co.yixiang.modules.shop.service.YxSystemConfigService; +import co.yixiang.modules.user.domain.YxUser; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.awt.FontFormatException; +import java.io.File; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + *

+ * 商品控制器 + *

+ * + * @author hupeng + * @since 2019-10-19 + */ +@Slf4j +@RestController +@Api(value = "产品模块", tags = "商城:产品模块") +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +public class StoreProductController { + + private final YxStoreProductService storeProductService; + private final YxStoreProductRelationService productRelationService; + private final YxStoreProductReplyService replyService; + private final YxSystemConfigService systemConfigService; + private final YxSystemAttachmentService systemAttachmentService; + private final CreatShareProductService creatShareProductService; + @Value("${file.path}") + private String path; + + + /** + * 获取首页更多产品 + */ + @GetMapping("/groom/list/{type}") + @ApiImplicitParams({ + @ApiImplicitParam(name = "type", value = "类型:1精品推荐,2热门榜单,3首发新品,4促销单品", paramType = "query", dataType = "int") + }) + @ApiOperation(value = "获取首页更多产品",notes = "获取首页更多产品") + public ApiResult> moreGoodsList(@PathVariable Integer type){ + Map map = new LinkedHashMap<>(); + // 精品推荐 + if(ProductEnum.TYPE_1.getValue().equals(type)){ + map.put("list",storeProductService.getList(1,20,ProductEnum.TYPE_1.getValue())); + // 热门榜单 + }else if(type.equals(ProductEnum.TYPE_2.getValue())){ + map.put("list",storeProductService.getList(1,20,ProductEnum.TYPE_2.getValue())); + // 首发新品 + }else if(type.equals(ProductEnum.TYPE_3.getValue())){ + map.put("list",storeProductService.getList(1,20,ProductEnum.TYPE_3.getValue())); + // 促销单品 + }else if(type.equals(ProductEnum.TYPE_4.getValue())){ + map.put("list",storeProductService.getList(1,20,ProductEnum.TYPE_4.getValue())); + } + + return ApiResult.ok(map); + } + + /** + * 获取产品列表 + */ + @GetMapping("/products") + @ApiOperation(value = "商品列表",notes = "商品列表") + public ApiResult> goodsList(YxStoreProductQueryParam productQueryParam){ + return ApiResult.ok(storeProductService.getGoodsList(productQueryParam)); + } + + /** + * 为你推荐 + */ + @GetMapping("/product/hot") + @ApiOperation(value = "为你推荐",notes = "为你推荐") + public ApiResult> productRecommend(YxStoreProductQueryParam queryParam){ + return ApiResult.ok(storeProductService.getList(queryParam.getPage(), queryParam.getLimit(), + ShopCommonEnum.IS_STATUS_1.getValue())); + } + + /** + * 商品详情海报 + */ + @AppLog(value = "商品详情海报", type = 1) + @AuthCheck + @GetMapping("/product/poster/{id}") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "商品ID", paramType = "query", dataType = "int") + }) + @ApiOperation(value = "商品详情海报",notes = "商品详情海报") + public ApiResult prodoctPoster(@PathVariable Integer id,@RequestParam(value = "from",defaultValue = "h5") String from) throws IOException, FontFormatException { + YxUser userInfo = LocalUser.getUser(); + + long uid = userInfo.getUid(); + + YxStoreProduct storeProduct = storeProductService.getById(id); + // 海报 + String siteUrl = systemConfigService.getData(SystemConfigConstants.SITE_URL); + if(StrUtil.isEmpty(siteUrl)){ + return ApiResult.fail("未配置h5地址"); + } + String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL); + if(StrUtil.isEmpty(apiUrl)){ + return ApiResult.fail("未配置api地址"); + } + String name = id+"_"+uid + "_"+from+"_product_detail_wap.jpg"; + YxSystemAttachment attachment = systemAttachmentService.getInfo(name); + String sepa = File.separator; + String fileDir = path+"qrcode"+ sepa; + String qrcodeUrl = ""; + if(ObjectUtil.isNull(attachment)){ + File file = FileUtil.mkdir(new File(fileDir)); + //如果类型是小程序 + if(AppFromEnum.ROUNTINE.getValue().equals(from)){ + siteUrl = siteUrl+"/product/"; + //生成二维码 + QrCodeUtil.generate(siteUrl+"?id="+id+"&spread="+uid+"&pageType=good&codeType="+AppFromEnum.ROUNTINE.getValue(), 180, 180, + FileUtil.file(fileDir+name)); + } + else if(AppFromEnum.APP.getValue().equals(from)){ + siteUrl = siteUrl+"/product/"; + //生成二维码 + QrCodeUtil.generate(siteUrl+"?id="+id+"&spread="+uid+"&pageType=good&codeType="+AppFromEnum.APP.getValue(), 180, 180, + FileUtil.file(fileDir+name)); + //如果类型是h5 + }else if(AppFromEnum.H5.getValue().equals(from)){ + //生成二维码 + QrCodeUtil.generate(siteUrl+"/detail/"+id+"?spread="+uid, 180, 180, + FileUtil.file(fileDir+name)); + }else { + //生成二维码 + String uniUrl = systemConfigService.getData(SystemConfigConstants.UNI_SITE_URL); + siteUrl = StrUtil.isNotBlank(uniUrl) ? uniUrl : ShopConstants.DEFAULT_UNI_H5_URL; + QrCodeUtil.generate(siteUrl+"/pages/shop/GoodsCon/index?id="+id+"&spread="+uid, 180, 180, + FileUtil.file(fileDir+name)); + } + systemAttachmentService.attachmentAdd(name,String.valueOf(FileUtil.size(file)), + fileDir+name,"qrcode/"+name); + + qrcodeUrl = apiUrl + "/api/file/qrcode/"+name; + }else{ + qrcodeUrl = apiUrl + "/api/file/" + attachment.getSattDir(); + } + String spreadPicName = id+"_"+uid + "_"+from+"_product_user_spread.jpg"; + String spreadPicPath = fileDir+spreadPicName; + String rr = creatShareProductService.creatProductPic(storeProduct,qrcodeUrl, + spreadPicName,spreadPicPath,apiUrl); + return ApiResult.ok(rr); + } + + + + /** + * 普通商品详情 + */ + //@AppLog(value = "普通商品详情", type = 1) + //@AuthCheck + @GetMapping("/product/detail/{id}") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "商品ID", paramType = "query", dataType = "long",required = true), + @ApiImplicitParam(name = "latitude", value = "纬度", paramType = "query", dataType = "string"), + @ApiImplicitParam(name = "longitude", value = "经度", paramType = "query", dataType = "string"), + @ApiImplicitParam(name = "from", value = "来自:", paramType = "query", dataType = "string") + }) + @ApiOperation(value = "普通商品详情",notes = "普通商品详情") + public ApiResult detail(@PathVariable long id, + @RequestParam(value = "",required=false) String latitude, + @RequestParam(value = "",required=false) String longitude, + @RequestParam(value = "",required=false) String from) { + long uid = LocalUser.getUidByToken(); + storeProductService.incBrowseNum(id); + ProductVo productDTO = storeProductService.goodsDetail(id,uid,latitude,longitude); + return ApiResult.ok(productDTO); + } + + /** + * 添加收藏 + */ + @AppLog(value = "添加收藏", type = 1) + @NoRepeatSubmit + @AuthCheck + @PostMapping("/collect/add") + @ApiOperation(value = "添加收藏",notes = "添加收藏") + public ApiResult collectAdd(@Validated @RequestBody YxStoreProductRelationQueryParam param){ + long uid = LocalUser.getUser().getUid(); + if(!NumberUtil.isNumber(param.getId())) { + throw new YshopException("参数非法"); + } + productRelationService.addRroductRelation(Long.valueOf(param.getId()),uid,param.getCategory()); + return ApiResult.ok(); + } + + /** + * 取消收藏 + */ + @AppLog(value = "取消收藏", type = 1) + @NoRepeatSubmit + @AuthCheck + @PostMapping("/collect/del") + @ApiOperation(value = "取消收藏",notes = "取消收藏") + public ApiResult collectDel(@Validated @RequestBody YxStoreProductRelationQueryParam param){ + long uid = LocalUser.getUser().getUid(); + if(!NumberUtil.isNumber(param.getId())) { + throw new YshopException("参数非法"); + } + productRelationService.delRroductRelation(Long.valueOf(param.getId()), + uid,param.getCategory()); + return ApiResult.ok(); + } + + /** + * 取消收藏/足跡 + */ + @AppLog(value = "删除足跡", type = 1) + @NoRepeatSubmit + @AuthCheck + @DeleteMapping("/collect/delFoot") + @ApiOperation(value = "删除足跡",notes = "删除足跡") + public ApiResult collectDelFoot(@Validated @RequestBody CollectDelFootParam param){ + if (CollectionUtil.isEmpty(param.getIds())){ + throw new YshopException("参数非法"); + } + productRelationService.collectDelFoot(param.getIds()); + return ApiResult.ok(); + } + + /** + * 获取产品评论 + */ + @GetMapping("/reply/list/{id}") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "商品ID", paramType = "query", dataType = "long",required = true), + @ApiImplicitParam(name = "type", value = "评论分数类型", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int") + }) + @ApiOperation(value = "获取产品评论",notes = "获取产品评论") + public ApiResult> replyList(@PathVariable Long id, + @RequestParam(value = "type",defaultValue = "0") int type, + @RequestParam(value = "page",defaultValue = "1") int page, + @RequestParam(value = "limit",defaultValue = "10") int limit){ + return ApiResult.ok(replyService.getReplyList(id,type, page,limit)); + } + + /** + * 获取产品评论数据 + */ + @GetMapping("/reply/config/{id}") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "商品ID", paramType = "query", dataType = "int") + }) + @ApiOperation(value = "获取产品评论数据",notes = "获取产品评论数据") + public ApiResult replyCount(@PathVariable Integer id){ + return ApiResult.ok(replyService.getReplyCount(id)); + } + + + +} + diff --git a/yshop-app/src/main/java/co/yixiang/modules/services/AuthService.java b/yshop-app/src/main/java/co/yixiang/modules/services/AuthService.java new file mode 100644 index 0000000..70c8451 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/services/AuthService.java @@ -0,0 +1,440 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.services; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.api.WxMaUserService; +import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; +import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; +import cn.binarywang.wx.miniapp.bean.WxMaUserInfo; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.SecureUtil; +import co.yixiang.api.YshopException; +import co.yixiang.common.bean.LocalUser; +import co.yixiang.common.util.IpUtil; +import co.yixiang.constant.ShopConstants; +import co.yixiang.enums.AppFromEnum; +import co.yixiang.modules.auth.param.LoginParam; +import co.yixiang.modules.auth.param.RegParam; +import co.yixiang.modules.mp.config.WxMaConfiguration; +import co.yixiang.modules.mp.config.WxMpConfiguration; +import co.yixiang.modules.shop.domain.YxSystemAttachment; +import co.yixiang.modules.shop.service.YxSystemAttachmentService; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.service.YxUserService; +import co.yixiang.modules.user.service.dto.WechatUserDto; +import co.yixiang.modules.user.vo.OnlineUser; +import co.yixiang.utils.*; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.bean.WxOAuth2UserInfo; +import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.mp.bean.result.WxMpUser; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +/** + * @ClassName 登陆认证服务类 + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/14 + **/ +@Slf4j +@Service +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +public class AuthService { + + private final YxUserService userService; + private final RedisUtils redisUtils; + private static Integer expiredTimeIn; + private final YxSystemAttachmentService systemAttachmentService; + + @Value("${yshop.security.token-expired-in}") + public void setExpiredTimeIn(Integer expiredTimeIn) { + AuthService.expiredTimeIn = expiredTimeIn; + } + + + /** + * 小程序登陆 + * + * @param loginParam loginParam + * @return long + */ + @Transactional(rollbackFor = Exception.class) + public YxUser loginAuth(LoginParam loginParam) { + String code = loginParam.getCode(); + String encryptedData = loginParam.getEncryptedData(); + String iv = loginParam.getIv(); + String spread = loginParam.getSpread(); + try { + //读取redis配置 + String appId = redisUtils.getY(ShopKeyUtils.getWxAppAppId()); + String secret = redisUtils.getY(ShopKeyUtils.getWxAppSecret()); + if (StrUtil.isBlank(appId) || StrUtil.isBlank(secret)) { + throw new YshopException("请先配置小程序"); + } + WxMaService wxMaService = WxMaConfiguration.getWxMaService(); + WxMaJscode2SessionResult session = wxMaService.getUserService().getSessionInfo(code); + + WxMaUserInfo wxMpUser = wxMaService.getUserService().getUserInfo(session.getSessionKey(), encryptedData, iv); + + YxUser yxUser = this.userService.getOne(Wrappers.lambdaQuery() + .eq(YxUser::getUid, LocalUser.getUser().getUid()), false); + + if (ObjectUtil.isNotEmpty(yxUser)) { + + + //过滤掉表情 + String ip = IpUtil.getRequestIp(); + yxUser = YxUser.builder() + .nickname(wxMpUser.getNickName()) + .avatar(wxMpUser.getAvatarUrl()) + .addIp(ip) + .lastIp(ip) + .build(); + + //构建微信用户 + WechatUserDto wechatUserDTO = WechatUserDto.builder() + .nickname(wxMpUser.getNickName()) + .routineOpenid(session.getOpenid()) + .unionId(session.getUnionid()) + .sex(Integer.valueOf(wxMpUser.getGender())) + .language(wxMpUser.getLanguage()) + .city(wxMpUser.getCity()) + .province(wxMpUser.getProvince()) + .country(wxMpUser.getCountry()) + .headimgurl(wxMpUser.getAvatarUrl()) + .build(); + + yxUser.setWxProfile(wechatUserDTO); + + this.userService.update(yxUser,Wrappers.lambdaQuery() + .eq(YxUser::getUid, LocalUser.getUser().getUid())); + + } + return yxUser; + } catch (WxErrorException e) { + e.printStackTrace(); + log.error(e.getMessage()); + throw new YshopException(e.toString()); + } + } + + + /** + * 小程序登陆 + * + * @param loginParam loginParam + * @return long + */ + @Transactional(rollbackFor = Exception.class) + public YxUser wxappLogin(LoginParam loginParam) { + String code = loginParam.getCode(); + String encryptedData = loginParam.getEncryptedData(); + String iv = loginParam.getIv(); + String spread = loginParam.getSpread(); + try { + //读取redis配置 + String appId = redisUtils.getY(ShopKeyUtils.getWxAppAppId()); + String secret = redisUtils.getY(ShopKeyUtils.getWxAppSecret()); + if (StrUtil.isBlank(appId) || StrUtil.isBlank(secret)) { + throw new YshopException("请先配置小程序"); + } + WxMaService wxMaService = WxMaConfiguration.getWxMaService(); + WxMaJscode2SessionResult session = wxMaService.getUserService().getSessionInfo(code); + + WxMaPhoneNumberInfo phoneNoInfo = wxMaService.getUserService() + .getPhoneNoInfo(session.getSessionKey(), encryptedData, iv); + + YxUser yxUser = this.userService.getOne(Wrappers.lambdaQuery() + .eq(YxUser::getPhone, phoneNoInfo.getPhoneNumber()), false); + + if (ObjectUtil.isNull(yxUser)) { + + //兼容旧系统 + yxUser = this.userService.getOne(Wrappers.lambdaQuery() + .eq(YxUser::getUsername, session.getOpenid()), false); + + if (ObjectUtil.isNull(yxUser)) { + //过滤掉表情 + String ip = IpUtil.getRequestIp(); + yxUser = YxUser.builder() + .username(phoneNoInfo.getPhoneNumber()) + .phone(phoneNoInfo.getPhoneNumber()) + .addIp(ip) + .lastIp(ip) + .userType(AppFromEnum.ROUNTINE.getValue()) + .build(); + + //构建微信用户 + WechatUserDto wechatUserDTO = WechatUserDto.builder() + .routineOpenid(session.getOpenid()) + .unionId(session.getUnionid()) + .build(); + + yxUser.setWxProfile(wechatUserDTO); + + this.userService.save(yxUser); + }else { + yxUser.setUsername(phoneNoInfo.getPhoneNumber()); + yxUser.setPhone(phoneNoInfo.getPhoneNumber()); + this.userService.updateById(yxUser); + } + + } else { + WechatUserDto wechatUser = yxUser.getWxProfile(); + if (null != wechatUser &&(StrUtil.isBlank(wechatUser.getRoutineOpenid()) && StrUtil.isNotBlank(session.getOpenid()))) { + wechatUser.setRoutineOpenid(session.getOpenid()); + yxUser.setWxProfile(wechatUser); + } + yxUser.setUserType(AppFromEnum.ROUNTINE.getValue()); + this.userService.updateById(yxUser); + } + this.userService.setSpread(spread, yxUser.getUid()); + redisUtils.set(ShopConstants.YSHOP_MINI_SESSION_KET + yxUser.getUid(), session.getSessionKey()); + return yxUser; + } catch (WxErrorException e) { + e.printStackTrace(); + log.error(e.getMessage()); + throw new YshopException(e.toString()); + } + } + + /** + * 公众号登陆 + * + * @param code code码 + * @param spread 上级用户 + * @return uid + */ + @Transactional(rollbackFor = Exception.class) + public YxUser wechatLogin(String code, String spread) { + try { + WxMpService wxService = WxMpConfiguration.getWxMpService(); + WxOAuth2AccessToken wxOAuth2AccessToken = wxService.getOAuth2Service().getAccessToken(code); + WxOAuth2UserInfo wxOAuth2UserInfo = wxService.getOAuth2Service().getUserInfo(wxOAuth2AccessToken, null); + WxMpUser wxMpUser = wxService.getUserService().userInfo(wxOAuth2UserInfo.getOpenid()); + String openid = wxMpUser.getOpenId(); + + //如果开启了UnionId + if (StrUtil.isNotBlank(wxMpUser.getUnionId())) { + openid = wxMpUser.getUnionId(); + } + + YxUser yxUser = userService.getOne(Wrappers.lambdaQuery() + .eq(YxUser::getUsername, openid), false); + + //long uid = 0; + YxUser returnUser = null; + if (yxUser == null) { + //过滤掉表情 + String nickname = wxMpUser.getNickname(); + log.info("昵称:{}", nickname); + //用户保存 + String ip = IpUtil.getRequestIp(); + YxUser user = YxUser.builder() + .username(openid) + .nickname(nickname) + .avatar(wxMpUser.getHeadImgUrl()) + .addIp(ip) + .lastIp(ip) + .userType(AppFromEnum.WECHAT.getValue()) + .build(); + + //构建微信用户 + WechatUserDto wechatUserDTO = WechatUserDto.builder() + .nickname(nickname) + .openid(wxMpUser.getOpenId()) + .unionId(wxMpUser.getUnionId()) + .sex(wxMpUser.getSex()) + .language(wxMpUser.getLanguage()) + .city(wxMpUser.getCity()) + .province(wxMpUser.getProvince()) + .country(wxMpUser.getCountry()) + .headimgurl(wxMpUser.getHeadImgUrl()) + .subscribe(wxMpUser.getSubscribe()) + .subscribeTime(wxMpUser.getSubscribeTime()) + .build(); + + user.setWxProfile(wechatUserDTO); + userService.save(user); + + returnUser = user; + } else { + returnUser = yxUser; + WechatUserDto wechatUser = yxUser.getWxProfile(); + if ((StrUtil.isBlank(wechatUser.getOpenid()) && StrUtil.isNotBlank(wxMpUser.getOpenId())) + || (StrUtil.isBlank(wechatUser.getUnionId()) && StrUtil.isNotBlank(wxMpUser.getUnionId()))) { + wechatUser.setOpenid(wxMpUser.getOpenId()); + wechatUser.setUnionId(wxMpUser.getUnionId()); + + yxUser.setWxProfile(wechatUser); + } + + yxUser.setUserType(AppFromEnum.WECHAT.getValue()); + userService.updateById(yxUser); + + } + + userService.setSpread(spread, returnUser.getUid()); + + log.error("spread:{}", spread); + + return returnUser; + + } catch (WxErrorException e) { + e.printStackTrace(); + log.error(e.getMessage()); + throw new YshopException(e.toString()); + } + } + + + /** + * 注册 + * + * @param param RegDTO + */ + @Transactional(rollbackFor = Exception.class) + public void register(RegParam param) { + + String account = param.getAccount(); + String ip = IpUtil.getRequestIp(); + YxUser user = YxUser.builder() + .username(account) + .nickname(account) + .password(SecureUtil.md5(param.getPassword())) + .phone(account) + .avatar(ShopConstants.YSHOP_DEFAULT_AVATAR) + .addIp(ip) + .lastIp(ip) + .userType(AppFromEnum.H5.getValue()) + .build(); + + userService.save(user); + + //设置推广关系 + if (StrUtil.isNotBlank(param.getInviteCode())) { + YxSystemAttachment systemAttachment = systemAttachmentService.getByCode(param.getInviteCode()); + if (systemAttachment != null) { + userService.setSpread(String.valueOf(systemAttachment.getUid()), + user.getUid()); + } + } + + } + + + /** + * 保存在线用户信息 + * + * @param yxUser / + * @param token / + * @param request / + */ + public void save(YxUser yxUser, String token, HttpServletRequest request) { + String job = "yshop开发工程师"; + String ip = StringUtils.getIp(request); + String browser = StringUtils.getBrowser(request); + String address = StringUtils.getCityInfo(ip); + OnlineUser onlineUser = null; + try { + onlineUser = new OnlineUser(yxUser.getUsername(), yxUser.getNickname(), job, browser, + ip, address, EncryptUtils.desEncrypt(token), new Date()); + } catch (Exception e) { + e.printStackTrace(); + } + redisUtils.set(ShopConstants.YSHOP_APP_LOGIN_USER +onlineUser.getUserName() + ":" + token, onlineUser, AuthService.expiredTimeIn); + } + + /** + * 检测用户是否在之前已经登录,已经登录踢下线 + * + * @param userName 用户名 + */ + public void checkLoginOnUser(String userName, String igoreToken) { + List onlineUsers = this.getAll(userName); + if (onlineUsers == null || onlineUsers.isEmpty()) { + return; + } + for (OnlineUser onlineUser : onlineUsers) { + try { + String token = EncryptUtils.desDecrypt(onlineUser.getKey()); + if (StringUtils.isNotBlank(igoreToken) && !igoreToken.equals(token)) { + this.kickOut(userName, onlineUser.getKey()); + } else if (StringUtils.isBlank(igoreToken)) { + this.kickOut(userName, onlineUser.getKey()); + } + } catch (Exception e) { + log.error("checkUser is error", e); + } + } + } + + /** + * 踢出用户 + * + * @param key / + */ + public void kickOut(String userName, String key) throws Exception { + key = ShopConstants.YSHOP_APP_LOGIN_USER + userName + ":" + EncryptUtils.desDecrypt(key); + redisUtils.del(key); + } + + /** + * 退出登录 + * + * @param token / + */ + public void logout(String userName, String token) { + String key = ShopConstants.YSHOP_APP_LOGIN_USER + userName + ":" + token; + redisUtils.del(key); + } + + /** + * 查询全部数据,不分页 + * + * @param uName / + * @return / + */ + private List getAll(String uName) { + List keys = null; + keys = redisUtils.scan(ShopConstants.YSHOP_APP_LOGIN_USER + uName + ":" + "*"); + + Collections.reverse(keys); + List onlineUsers = new ArrayList<>(); + for (String key : keys) { + OnlineUser onlineUser = (OnlineUser) redisUtils.get(key); + onlineUsers.add(onlineUser); + } + onlineUsers.sort((o1, o2) -> o2.getLoginTime().compareTo(o1.getLoginTime())); + return onlineUsers; + } + + /** + * 根据手机号查询用户注册状态 + * @param phone 手机号 + * @return / + */ + public YxUser authPhone(String phone) { + return userService.getOne(Wrappers.lambdaQuery().eq(YxUser::getPhone, phone)); + } +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/services/CreatShareProductService.java b/yshop-app/src/main/java/co/yixiang/modules/services/CreatShareProductService.java new file mode 100644 index 0000000..cc8fbe0 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/services/CreatShareProductService.java @@ -0,0 +1,872 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.services; + +import cn.hutool.core.img.ImgUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.qrcode.QrCodeUtil; +import cn.hutool.http.HttpUtil; +import co.yixiang.api.YshopException; +import co.yixiang.constant.ShopConstants; +import co.yixiang.constant.SystemConfigConstants; +import co.yixiang.enums.AppFromEnum; +import co.yixiang.enums.OrderInfoEnum; +import co.yixiang.modules.activity.domain.YxStoreBargain; +import co.yixiang.modules.activity.domain.YxStoreBargainUser; +import co.yixiang.modules.activity.domain.YxStoreCombination; +import co.yixiang.modules.activity.domain.YxStorePink; +import co.yixiang.modules.activity.service.YxStoreBargainService; +import co.yixiang.modules.activity.service.YxStoreBargainUserService; +import co.yixiang.modules.activity.service.YxStoreCombinationService; +import co.yixiang.modules.activity.service.YxStorePinkService; +import co.yixiang.modules.order.vo.YxStoreOrderQueryVo; +import co.yixiang.modules.product.domain.YxStoreProduct; +import co.yixiang.modules.shop.domain.YxSystemAttachment; +import co.yixiang.modules.shop.service.YxSystemAttachmentService; +import co.yixiang.modules.shop.service.YxSystemConfigService; +import co.yixiang.modules.shop.service.YxSystemStoreService; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.utils.OrderUtil; +import co.yixiang.utils.RedisUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FileUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.imageio.ImageIO; +import javax.imageio.stream.ImageInputStream; +import java.awt.Color; +import java.awt.Font; +import java.awt.FontFormatException; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +import static co.yixiang.utils.FileUtil.transformStyle; + +/** + * @ClassName 二维码相关服务 + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/22 + **/ +@Slf4j +@Service +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +public class CreatShareProductService { + + private final YxSystemAttachmentService systemAttachmentService; + private final YxStoreBargainService storeBargainService; + private final YxStoreBargainUserService storeBargainUserService; + private final YxStorePinkService storePinkService; + private final YxStoreCombinationService storeCombinationService; + private final YxSystemStoreService systemStoreService; + private final YxSystemConfigService systemConfigService; + + /** + * 返回门店信息与二维码 + * @param storeOrder 订单 + * @return YxStoreOrderQueryVo + */ + public YxStoreOrderQueryVo handleQrcode(YxStoreOrderQueryVo storeOrder,String path){ + //门店 + if(OrderInfoEnum.SHIPPIING_TYPE_2.getValue().equals(storeOrder.getShippingType())){ + String mapKey = RedisUtil.get(SystemConfigConstants.TENGXUN_MAP_KEY); + if(StrUtil.isBlank(mapKey)) { + throw new YshopException("请配置腾讯地图key"); + } + String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL); + if(StrUtil.isEmpty(apiUrl)){ + throw new YshopException("未配置api地址"); + } + //生成二维码 + String name = storeOrder.getVerifyCode()+"_yshop.jpg"; + YxSystemAttachment attachment = systemAttachmentService.getInfo(name); + String fileDir = path+"qrcode"+ File.separator; + String qrcodeUrl = ""; + if(ObjectUtil.isNull(attachment)){ + //生成二维码 + File file = FileUtil.mkdir(new File(fileDir)); + QrCodeUtil.generate(storeOrder.getVerifyCode(), 180, 180, + FileUtil.file(fileDir+name)); + systemAttachmentService.attachmentAdd(name,String.valueOf(FileUtil.size(file)), + fileDir+name,"qrcode/"+name); + qrcodeUrl = apiUrl + "/api/file/qrcode/"+name; + }else{ + qrcodeUrl = apiUrl + "/api/file/" + attachment.getSattDir(); + } + storeOrder.setCode(qrcodeUrl); + storeOrder.setMapKey(mapKey); + storeOrder.setSystemStore(systemStoreService.getYxSystemStoreById(storeOrder.getStoreId())); + } + + return storeOrder; + } + + /** + * 获取分销二维码url + * @param from 来源 + * @param userInfo 用户 + * @param siteUrl h5地址 + * @param apiUrl api地址 + * @param path 本地图片路径 + * @return url + */ + public String getSpreadUrl(String from,YxUser userInfo,String siteUrl, + String apiUrl,String path){ + String spreadUrl = ""; + Long uid = userInfo.getUid(); + + File newFile = new File("fx.jpg"); + File newFileT = new File("simsunb.ttf"); + try { + if(!newFile.exists()){ + InputStream stream = getClass().getClassLoader().getResourceAsStream("fx.jpg"); + FileUtils.copyInputStreamToFile(stream, newFile); + } + if(!newFileT.exists()){ + InputStream streamT = getClass().getClassLoader() + .getResourceAsStream("simsunb.ttf"); + FileUtils.copyInputStreamToFile(streamT, newFileT); + } + } catch (IOException e) { + log.error(e.getMessage()); + throw new YshopException(e.getMessage()); + } + + if(StrUtil.isNotBlank(from) && AppFromEnum.APP.getValue().equals(from)){ + String spreadPicName = uid + "_"+from+"_user_spread.jpg"; + String fileDir = path+"qrcode"+File.separator; + String spreadPicPath = fileDir+spreadPicName; + + YxSystemAttachment attachmentT = systemAttachmentService.getInfo(spreadPicName); + if(ObjectUtil.isNull(attachmentT)){ + try { + Font font = Font.createFont(Font.TRUETYPE_FONT, newFileT); + Font f= font.deriveFont(Font.PLAIN,20); + ImgUtil.pressText(// + newFile, + FileUtil.file(spreadPicPath), + userInfo.getNickname()+"邀您加入", + Color.BLACK, + f, //字体 + 0, //x坐标修正值。 默认在中间,偏移量相对于中间偏移 + 300, //y坐标修正值。 默认在中间,偏移量相对于中间偏移 + 0.8f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字 + ); + + String inviteCode = OrderUtil.createShareCode(); + ImgUtil.pressText( + FileUtil.file(spreadPicPath), + FileUtil.file(spreadPicPath), + "邀您码:"+ inviteCode, + Color.RED, + f, //字体 + 0, //x坐标修正值。 默认在中间,偏移量相对于中间偏移 + 340, //y坐标修正值。 默认在中间,偏移量相对于中间偏移 + 0.8f + ); + + systemAttachmentService.newAttachmentAdd(spreadPicName, + String.valueOf(FileUtil.size(new File(spreadPicPath))), + spreadPicPath,"qrcode/"+spreadPicName,uid,inviteCode); + + spreadUrl = apiUrl + "/api/file/qrcode/"+spreadPicName; + } catch (Exception e) { + e.printStackTrace(); + } + }else{ + spreadUrl = apiUrl + "/api/file/" + attachmentT.getSattDir(); + } + } + else{//其他 + if(StrUtil.isBlank(from)) { + from = AppFromEnum.H5.getValue(); + } + + String name = uid + "_"+from+"_user_wap.jpg"; + + YxSystemAttachment attachment = systemAttachmentService.getInfo(name); + String fileDir = path+"qrcode"+File.separator; + String qrcodeUrl = ""; + if(ObjectUtil.isNull(attachment)){ + //生成二维码 + //判断用户是否小程序,注意小程序二维码生成路径要与H5不一样 不然会导致都跳转到小程序问题 + if(from.equals(AppFromEnum.ROUNTINE.getValue())){ + siteUrl = siteUrl+"/distribution/"; + }else if(AppFromEnum.UNIAPPH5.getValue().equals(from)){ + String uniUrl = systemConfigService.getData(SystemConfigConstants.UNI_SITE_URL); + siteUrl = StrUtil.isNotBlank(uniUrl) ? uniUrl : ShopConstants.DEFAULT_UNI_H5_URL; + siteUrl = siteUrl+"/pages/Loading/index"; + } + File file = FileUtil.mkdir(new File(fileDir)); + QrCodeUtil.generate(siteUrl+"?spread="+uid, 180, 180, + FileUtil.file(fileDir+name)); + + systemAttachmentService.attachmentAdd(name,String.valueOf(FileUtil.size(file)), + fileDir+name,"qrcode/"+name); + + qrcodeUrl = fileDir+name; + }else{ + qrcodeUrl = attachment.getAttDir(); + } + + String spreadPicName = uid + "_"+from+"_user_spread.jpg"; + String spreadPicPath = fileDir+spreadPicName; + + YxSystemAttachment attachmentT = systemAttachmentService.getInfo(spreadPicName); + if(ObjectUtil.isNull(attachmentT)){ + try { + + Font font = Font.createFont(Font.TRUETYPE_FONT, newFileT); + Font f= font.deriveFont(Font.PLAIN,20); + //font. + ImgUtil.pressText(// + newFile, + FileUtil.file(spreadPicPath), + userInfo.getNickname()+"邀您加入", + Color.BLACK, + f, //字体 + 50, //x坐标修正值。 默认在中间,偏移量相对于中间偏移 + 300, //y坐标修正值。 默认在中间,偏移量相对于中间偏移 + 0.8f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字 + ); + + ImgUtil.pressImage( + FileUtil.file(spreadPicPath), + FileUtil.file(spreadPicPath), + ImgUtil.read(FileUtil.file(qrcodeUrl)), //水印图片 + -150, //x坐标修正值。 默认在中间,偏移量相对于中间偏移 + 340, //y坐标修正值。 默认在中间,偏移量相对于中间偏移 + 0.8f + ); + + systemAttachmentService.attachmentAdd(spreadPicName, + String.valueOf(FileUtil.size(new File(spreadPicPath))), + spreadPicPath,"qrcode/"+spreadPicName); + + spreadUrl = apiUrl + "/api/file/qrcode/"+spreadPicName; + + } catch (Exception e) { + e.printStackTrace(); + } + }else{ + spreadUrl = apiUrl + "/api/file/" + attachmentT.getSattDir(); + } + + } + + return spreadUrl; + } + + + /** + * 获取砍价海报 + * @param bargainId 砍价商品id + * @param userInfo 用户 + * @param siteUrl h5地址 + * @param apiUrl api地址 + * @param path 本地图片路径 + * @return url + */ + public String getBargainPosterUrl(Long bargainId, YxUser userInfo,String siteUrl, + String apiUrl,String path,String from){ + Long uid = userInfo.getUid(); + YxStoreBargain storeBargainQueryVo = storeBargainService + .getById(bargainId); + YxStoreBargainUser storeBargainUser = storeBargainUserService + .getBargainUserInfo(bargainId,uid); + + if(ObjectUtil.isNull(storeBargainQueryVo) || ObjectUtil.isNull(storeBargainUser)) { + throw new YshopException("数据不存在"); + } + //用户可以砍掉的金额 好友砍价之前获取可以砍价金额 + double coverPrice = NumberUtil.sub(storeBargainUser.getBargainPrice() + ,storeBargainUser.getBargainPriceMin()).doubleValue(); + //用户剩余要砍掉的价格 + double surplusPrice = NumberUtil.sub(coverPrice, + storeBargainUser.getPrice()).doubleValue(); + + + String name = bargainId+"_"+uid + "_"+from+"_bargain_share_wap.jpg"; + YxSystemAttachment attachment = systemAttachmentService.getInfo(name); + //删除已经存在的砍价海报图片 + if (ObjectUtil.isNotNull(attachment)) { + storeBargainService.deleteBargainImg(name); + } + String fileDir = path+"qrcode"+ File.separator; + String qrcodeUrl = ""; + if(ObjectUtil.isNull(attachment)){ + //生成二维码 + //判断用户是否小程序,注意小程序二维码生成路径要与H5不一样 不然会导致都跳转到小程序问题 + File file = FileUtil.mkdir(new File(fileDir)); + if(AppFromEnum.ROUNTINE.getValue().equals(from)){ + siteUrl = siteUrl+"/bargain/"; + QrCodeUtil.generate(siteUrl+"?bargainId="+bargainId+"&uid="+uid+"&partake="+uid+"&pageType=dargain&codeType="+AppFromEnum.ROUNTINE.getValue(), 180, 180, + FileUtil.file(fileDir+name)); + } + else if(AppFromEnum.APP.getValue().equals(from)){ + siteUrl = siteUrl+"/bargain/"; + QrCodeUtil.generate(siteUrl+"?bargainId="+bargainId+"&uid="+uid+"&partake="+uid+"&pageType=dargain&codeType="+AppFromEnum.APP.getValue(), 180, 180, + FileUtil.file(fileDir+name)); + }else if(AppFromEnum.H5.getValue().equals(from)){ + QrCodeUtil.generate(siteUrl+"/activity/dargain_detail/"+bargainId+"/"+uid+"?spread="+uid, 180, 180, + FileUtil.file(fileDir+name)); + }else { + String uniUrl = systemConfigService.getData(SystemConfigConstants.UNI_SITE_URL); + siteUrl = StrUtil.isNotBlank(uniUrl) ? uniUrl : ShopConstants.DEFAULT_UNI_H5_URL; + QrCodeUtil.generate(siteUrl+"/pages/activity/DargainDetails/index?id="+bargainId+"&uid="+uid+"&partake="+uid, 180, 180, + FileUtil.file(fileDir+name)); + } + systemAttachmentService.attachmentAdd(name,String.valueOf(FileUtil.size(file)), + fileDir+name,"qrcode/"+name); + qrcodeUrl = fileDir+name; + }else{ + qrcodeUrl = attachment.getAttDir(); + } + + String spreadPicName = bargainId+"_"+uid + "_"+from+"_bargain_user_spread.jpg"; + String spreadPicPath = fileDir+spreadPicName; + + YxSystemAttachment attachmentT = systemAttachmentService.getInfo(spreadPicName); + //删除已经存在的砍价海报图片 + if (ObjectUtil.isNotNull(attachmentT)) { + storeBargainService.deleteBargainImg(spreadPicName); + } + String spreadUrl = ""; + File newFile = new File("poster.jpg"); + File newFileT = new File("simsunb.ttf"); + try { + if(!newFile.exists()){ + InputStream stream = getClass().getClassLoader().getResourceAsStream("poster.jpg"); + FileUtils.copyInputStreamToFile(stream, newFile); + } + if(!newFileT.exists()){ + InputStream streamT = getClass().getClassLoader() + .getResourceAsStream("simsunb.ttf"); + FileUtils.copyInputStreamToFile(streamT, newFileT); + } + } catch (IOException e) { + log.error(e.getMessage()); + throw new YshopException(e.getMessage()); + } + if(ObjectUtil.isNull(attachmentT)){ + try { + + //第一步标题 + Font font = Font.createFont(Font.TRUETYPE_FONT, newFileT); + Font f= font.deriveFont(Font.PLAIN,30); + //font. + ImgUtil.pressText(// + newFile, + FileUtil.file(spreadPicPath), + storeBargainQueryVo.getTitle(), + Color.BLACK, + f, //字体 + 0, //x坐标修正值。 默认在中间,偏移量相对于中间偏移 + -480, //y坐标修正值。 默认在中间,偏移量相对于中间偏移 + 0.8f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字 + ); + Font f2= font.deriveFont(Font.PLAIN,45); + //第2步价格 + ImgUtil.pressText(// + FileUtil.file(spreadPicPath), + FileUtil.file(spreadPicPath), + NumberUtil.sub(storeBargainQueryVo.getPrice(), + storeBargainUser.getPrice()).toString(), + Color.RED, + f2, //字体 + -160, //x坐标修正值。 默认在中间,偏移量相对于中间偏移 + -380, //y坐标修正值。 默认在中间,偏移量相对于中间偏移 + 0.8f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字 + ); + + Font f3= font.deriveFont(Font.PLAIN,30); + + ImgUtil.pressText(// + FileUtil.file(spreadPicPath), + FileUtil.file(spreadPicPath), + "已砍至", + Color.WHITE, + f3, //字体 + 90, //x坐标修正值。 默认在中间,偏移量相对于中间偏移 + -385, //y坐标修正值。 默认在中间,偏移量相对于中间偏移 + 0.8f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字 + ); + + //第4步介绍 + String pro = "还差还差" + surplusPrice + "即可砍价成功"; + ImgUtil.pressText(// + FileUtil.file(spreadPicPath), + FileUtil.file(spreadPicPath), + pro, + Color.BLACK, + f3, //字体 + -50, //x坐标修正值。 默认在中间,偏移量相对于中间偏移 + -300, //y坐标修正值。 默认在中间,偏移量相对于中间偏移 + 0.8f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字 + ); + + //第5步商品图片 + //下载图片 + String image = storeBargainQueryVo.getImage(); + String ext = image.substring(image.lastIndexOf(".")); + String picImage = fileDir + "bargain_product_" + bargainId + ext; + if(!new File(picImage).exists()){ + //下载商品图 + HttpUtil.downloadFile(image, FileUtil.file(picImage)); + //只缩放一次防止图片持续缩放导致图片没了 + ImgUtil.scale( + FileUtil.file(picImage), + FileUtil.file(picImage), + 0.4f//缩放比例 + ); + } + + ImgUtil.pressImage( + FileUtil.file(spreadPicPath), + FileUtil.file(spreadPicPath), + ImgUtil.read(FileUtil.file(picImage)), //水印图片 + 0, //x坐标修正值。 默认在中间,偏移量相对于中间偏移 + -80, //y坐标修正值。 默认在中间,偏移量相对于中间偏移 + 0.7f + ); + + ImgUtil.pressImage( + FileUtil.file(spreadPicPath), + FileUtil.file(spreadPicPath), + ImgUtil.read(FileUtil.file(qrcodeUrl)), //水印图片 + 0, //x坐标修正值。 默认在中间,偏移量相对于中间偏移 + 390, //y坐标修正值。 默认在中间,偏移量相对于中间偏移 + 0.8f + ); + + systemAttachmentService.attachmentAdd(spreadPicName, + String.valueOf(FileUtil.size(new File(spreadPicPath))), + spreadPicPath,"qrcode/"+spreadPicName); + + spreadUrl = apiUrl + "/api/file/qrcode/"+spreadPicName; + } catch (Exception e) { + e.printStackTrace(); + log.error(e.getMessage()); + throw new YshopException("生成失败"); + } + }else{ + spreadUrl = apiUrl + "/api/file/" + attachmentT.getSattDir(); + } + + return spreadUrl; + } + + + /** + * 获取拼团海报 + * @param pinkId 拼团id + * @param userInfo 用户 + * @param siteUrl h5地址 + * @param apiUrl api地址 + * @param path 本地图片路径 + * @return url + */ + public String getPinkPosterUrl(Long pinkId, YxUser userInfo,String siteUrl, + String apiUrl,String path,String from){ + Long uid = userInfo.getUid(); + YxStorePink storePink = storePinkService.getById(pinkId); + if(ObjectUtil.isNull(storePink)) { + throw new YshopException("拼团不存在"); + } + YxStoreCombination storeCombination = storeCombinationService.getById(storePink.getCid()); + if(ObjectUtil.isNull(storeCombination)) { + throw new YshopException("拼团产品不存在"); + } + + + String name = pinkId+"_"+uid + "_"+from+"_pink_share_wap.jpg"; + YxSystemAttachment attachment = systemAttachmentService.getInfo(name); + String fileDir = path+"qrcode"+ File.separator; + String qrcodeUrl = ""; + if(ObjectUtil.isNull(attachment)){ + //生成二维码 + File file = FileUtil.mkdir(new File(fileDir)); + if(AppFromEnum.ROUNTINE.getValue().equals(from)){ + siteUrl = siteUrl+"/pink/"; + QrCodeUtil.generate(siteUrl+"?pinkId="+pinkId+"&spread="+uid+"&pageType=group&codeType="+AppFromEnum.ROUNTINE.getValue(), 180, 180, + FileUtil.file(fileDir+name)); + } + else if(AppFromEnum.APP.getValue().equals(from)){ + siteUrl = siteUrl+"/pink/"; + QrCodeUtil.generate(siteUrl+"?pinkId="+pinkId+"&spread="+uid+"&pageType=group&codeType="+AppFromEnum.ROUNTINE.getValue(), 180, 180, + FileUtil.file(fileDir+name)); + } + else if(AppFromEnum.H5.getValue().equals(from)){ + QrCodeUtil.generate(siteUrl+"/activity/group_rule/"+pinkId+"?spread="+uid, 180, 180, + FileUtil.file(fileDir+name)); + }else { + String uniUrl = systemConfigService.getData(SystemConfigConstants.UNI_SITE_URL); + siteUrl = StrUtil.isNotBlank(uniUrl) ? uniUrl : ShopConstants.DEFAULT_UNI_H5_URL; + QrCodeUtil.generate(siteUrl+"/pages/activity/GroupRule/index?id="+pinkId+"&spread="+uid, 180, 180, + FileUtil.file(fileDir+name)); + } + + + systemAttachmentService.attachmentAdd(name,String.valueOf(FileUtil.size(file)), + fileDir+name,"qrcode/"+name); + + qrcodeUrl = fileDir+name; + }else{ + qrcodeUrl = attachment.getAttDir(); + } + + String spreadPicName = pinkId+"_"+uid + "_"+from+"_pink_user_spread.jpg"; + String spreadPicPath = fileDir+spreadPicName; + + YxSystemAttachment attachmentT = systemAttachmentService.getInfo(spreadPicName); + String spreadUrl = ""; +// InputStream stream = getClass().getClassLoader().getResourceAsStream("poster.jpg"); +// InputStream streamT = getClass().getClassLoader() +// .getResourceAsStream("simsunb.ttf"); + File newFile = new File("poster.jpg"); + File newFileT = new File("simsunb.ttf"); + try { + if(!newFileT.exists()){ + InputStream streamT = getClass().getClassLoader() + .getResourceAsStream("simsunb.ttf"); + FileUtils.copyInputStreamToFile(streamT, newFileT); + } + if(!newFile.exists()){ + InputStream stream = getClass().getClassLoader().getResourceAsStream("poster.jpg"); + FileUtils.copyInputStreamToFile(stream, newFile); + } + + } catch (IOException e) { + log.error(e.getMessage()); + throw new YshopException(e.getMessage()); + } + if(ObjectUtil.isNull(attachmentT)){ + try { + + //第一步标题 + Font font = Font.createFont(Font.TRUETYPE_FONT, newFileT); + Font f= font.deriveFont(Font.PLAIN,40); + //font. + ImgUtil.pressText(// + newFile, + FileUtil.file(spreadPicPath), + storeCombination.getTitle(), + Color.BLACK, + f, //字体 + 0, //x坐标修正值。 默认在中间,偏移量相对于中间偏移 + -480, //y坐标修正值。 默认在中间,偏移量相对于中间偏移 + 0.8f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字 + ); + + Font f2= font.deriveFont(Font.PLAIN,45); + //第2步价格 + ImgUtil.pressText(// + FileUtil.file(spreadPicPath), + FileUtil.file(spreadPicPath), + storePink.getTotalPrice().toString(), + Color.RED, + f2, //字体 + -160, //x坐标修正值。 默认在中间,偏移量相对于中间偏移 + -350, //y坐标修正值。 默认在中间,偏移量相对于中间偏移 + 0.8f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字 + ); + + Font f3= font.deriveFont(Font.PLAIN,30); + //第3步几人团 + ImgUtil.pressText(// + FileUtil.file(spreadPicPath), + FileUtil.file(spreadPicPath), + storePink.getPeople()+"人团", + Color.WHITE, + f3, //字体 + 90, //x坐标修正值。 默认在中间,偏移量相对于中间偏移 + -370, //y坐标修正值。 默认在中间,偏移量相对于中间偏移 + 0.8f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字 + ); + + //第4步介绍 + String pro = "原价¥"+storeCombination.getProductPrice()+" 还差" + +storePinkService.surplusPeople(storePink)+"人拼团成功"; + ImgUtil.pressText(// + FileUtil.file(spreadPicPath), + FileUtil.file(spreadPicPath), + pro, + Color.BLACK, + f3, //字体 + -50, //x坐标修正值。 默认在中间,偏移量相对于中间偏移 + -300, //y坐标修正值。 默认在中间,偏移量相对于中间偏移 + 0.7f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字 + ); + + //第5步商品图片 + //下载图片 +// String picImage = fileDir+pinkId+"_pink_image.jpg"; +// HttpUtil.downloadFile(storeCombination.getImage(), +// FileUtil.file(picImage)); + + String image = storeCombination.getImage(); + String ext = image.substring(image.lastIndexOf(".")); + String picImage = fileDir + "pink_product_" + pinkId + ext; + if(!new File(picImage).exists()){ + //下载商品图 + HttpUtil.downloadFile(image, FileUtil.file(picImage)); + //只缩放一次防止图片持续缩放导致图片没了 + ImgUtil.scale( + FileUtil.file(picImage), + FileUtil.file(picImage), + 0.5f//缩放比例 + ); + } + + + ImgUtil.pressImage( + FileUtil.file(spreadPicPath), + FileUtil.file(spreadPicPath), + ImgUtil.read(FileUtil.file(picImage)), //水印图片 + 0, //x坐标修正值。 默认在中间,偏移量相对于中间偏移 + 0, //y坐标修正值。 默认在中间,偏移量相对于中间偏移 + 0.8f + ); + + ImgUtil.pressImage( + FileUtil.file(spreadPicPath), + FileUtil.file(spreadPicPath), + ImgUtil.read(FileUtil.file(qrcodeUrl)), //水印图片 + 0, //x坐标修正值。 默认在中间,偏移量相对于中间偏移 + 390, //y坐标修正值。 默认在中间,偏移量相对于中间偏移 + 0.8f + ); + + systemAttachmentService.attachmentAdd(spreadPicName, + String.valueOf(FileUtil.size(new File(spreadPicPath))), + spreadPicPath,"qrcode/"+spreadPicName); + + spreadUrl = apiUrl + "/api/file/qrcode/"+spreadPicName; + + } catch (Exception e) { + log.error(e.getMessage()); + throw new YshopException(e.getMessage()); + } + }else{ + spreadUrl = apiUrl + "/api/file/" + attachmentT.getSattDir(); + } + + return spreadUrl; + } + + + /** + * 普通组合海报 + * @param productDTO 商品 + * @param shareCode 二维码 + * @param spreadPicName 海报图片名称 + * @param spreadPicPath 路径 + * @param apiUrl api地址 + * @return String + * @throws IOException + * @throws FontFormatException + */ + public String creatProductPic(YxStoreProduct productDTO, String shareCode, String spreadPicName, String spreadPicPath, String apiUrl) throws IOException, FontFormatException { + YxSystemAttachment attachmentT = systemAttachmentService.getInfo(spreadPicName); + String spreadUrl = ""; + if(ObjectUtil.isNull(attachmentT)){ + //创建图片 + BufferedImage img = new BufferedImage(750, 1334, BufferedImage.TYPE_INT_RGB); + //开启画图 + Graphics g = img.getGraphics(); + //背景 -- 读取互联网图片 + InputStream stream = getClass().getClassLoader().getResourceAsStream("background.png"); + ImageInputStream background = ImageIO.createImageInputStream(stream); + BufferedImage back = ImageIO.read(background); + + g.drawImage(back.getScaledInstance(750, 1334, Image.SCALE_DEFAULT), 0, 0, null); // 绘制缩小后的图 + //商品 banner图 + //读取互联网图片 + BufferedImage priductUrl = null; + try { + priductUrl = ImageIO.read(new URL(transformStyle(productDTO.getImage()))); + } catch (IOException e) { + e.printStackTrace(); + } + g.drawImage(priductUrl.getScaledInstance(750,590,Image.SCALE_DEFAULT),0,0,null); + + File newFileT = new File("simsunb.ttf"); + if(!newFileT.exists()){ + InputStream streamT = getClass().getClassLoader() + .getResourceAsStream("simsunb.ttf"); + FileUtils.copyInputStreamToFile(streamT, newFileT); + } + Font font = Font.createFont(Font.TRUETYPE_FONT, newFileT); + //文案标题 + g.setFont(font.deriveFont(Font.BOLD,34)); + g.setColor(new Color(29,29,29)); + int fontlenb = getWatermarkLength(productDTO.getStoreName(), g); + //文字长度相对于图片宽度应该有多少行 + int lineb = fontlenb / (back.getWidth() +200); + //高度 + int yb = back.getHeight() - (lineb + 1) * 30 + 100; + //文字叠加,自动换行叠加 + int tempXb = 32; + int tempYb = yb; + //单字符长度 + int tempCharLenb = 0; + //单行字符总长度临时计算 + int tempLineLenb = 0; + StringBuffer sbb =new StringBuffer(); + for(int i=0; i < productDTO.getStoreName().length(); i++) { + char tempChar = productDTO.getStoreName().charAt(i); + tempCharLenb = getCharLen(tempChar, g); + tempLineLenb += tempCharLenb; + if(tempLineLenb >= (back.getWidth()+220)) { + //长度已经满一行,进行文字叠加 + g.drawString(sbb.toString(), tempXb, tempYb + 50); + //清空内容,重新追加 + sbb.delete(0, sbb.length()); + //每行文字间距50 + tempYb += 50; + tempLineLenb =0; + } + //追加字符 + sbb.append(tempChar); + } + g.drawString(sbb.toString(), tempXb, tempYb + 50); + + //------------------------------------------------文案----------------------- + //文案 + g.setFont(font.deriveFont(Font.PLAIN,30)); + g.setColor(new Color(47,47,47)); + int fontlen = getWatermarkLength(productDTO.getStoreInfo(), g); + //文字长度相对于图片宽度应该有多少行 + int line = fontlen / (back.getWidth() - 90); + //高度 + int y = tempYb + 50 - (line + 1) * 30 + 100; + //文字叠加,自动换行叠加 + int tempX = 32; + int tempY = y; + //单字符长度 + int tempCharLen = 0; + //单行字符总长度临时计算 + int tempLineLen = 0; + StringBuffer sb =new StringBuffer(); + + for(int i=0; i < productDTO.getStoreInfo().length(); i++) { + char tempChar = productDTO.getStoreInfo().charAt(i); + tempCharLen = getCharLen(tempChar, g); + tempLineLen += tempCharLen; + if(tempLineLen >= (back.getWidth()-90)) { + //长度已经满一行,进行文字叠加 + g.drawString(sb.toString(), tempX, tempY + 50); + //清空内容,重新追加 + sb.delete(0, sb.length()); + //每行文字间距50 + tempY += 50; + tempLineLen =0; + } + //追加字符 + sb.append(tempChar); + } + //最后叠加余下的文字 + g.drawString(sb.toString(), tempX, tempY + 50); + + //价格背景 + //读取互联网图片 + BufferedImage bground = null; + InputStream redStream = getClass().getClassLoader().getResourceAsStream("red.jpg"); + try { + ImageInputStream red = ImageIO.createImageInputStream(redStream); + bground = ImageIO.read(red); + } catch (IOException e) { + e.printStackTrace(); + } + // 绘制缩小后的图 + g.drawImage(bground.getScaledInstance(160, 40, Image.SCALE_DEFAULT), 30, 1053, null); + + //限时促销价 + g.setFont(font.deriveFont(Font.PLAIN,24)); + g.setColor(new Color(255,255,255)); + g.drawString("限时促销价", 50, 1080); + + //价格 + g.setFont(font.deriveFont(Font.PLAIN,50)); + g.setColor(new Color(249,64,64)); + g.drawString("¥" +productDTO.getPrice(), 29, 1162); + + //原价 + g.setFont(font.deriveFont(Font.PLAIN,36)); + g.setColor(new Color(171,171,171)); + String price = "¥" + productDTO.getOtPrice(); + g.drawString(price, 260, 1160); + g.drawLine(250,1148,260+150,1148); + +// //商品名称 +// g.setFont(font.deriveFont(Font.PLAIN,32)); +// g.setColor(new Color(29,29,29)); +// g.drawString(productDTO.getStoreName(), 30, 1229); + + //生成二维码返回链接 + String url = shareCode; + //读取互联网图片 + BufferedImage qrCode = null; + try { + qrCode = ImageIO.read(new URL(url)); + } catch (IOException e) { + e.printStackTrace(); + } + // 绘制缩小后的图 + g.drawImage(qrCode.getScaledInstance(174, 174, Image.SCALE_DEFAULT), 536, 1057, null); + + //二维码字体 + g.setFont(font.deriveFont(Font.PLAIN,25)); + g.setColor(new Color(171,171,171)); + //绘制文字 + g.drawString("扫描或长按小程序码", 515, 1260); + + g.dispose(); + //先将画好的海报写到本地 + File file = new File(spreadPicPath); + try { + ImageIO.write(img, "jpg",file); + } catch (IOException e) { + e.printStackTrace(); + } + systemAttachmentService.attachmentAdd(spreadPicName, + String.valueOf(FileUtil.size(new File(spreadPicPath))), + spreadPicPath,"qrcode/"+spreadPicName); + spreadUrl = apiUrl + "/api/file/qrcode/"+spreadPicName; + //保存到本地 生成文件名字 + }else { + spreadUrl = apiUrl + "/api/file/" + attachmentT.getSattDir(); + } + + return spreadUrl; + } + + + /** + * 获取水印文字总长度 + *@paramwaterMarkContent水印的文字 + *@paramg + *@return水印文字总长度 + */ + public static int getWatermarkLength(String waterMarkContent, Graphics g) { + return g.getFontMetrics(g.getFont()).charsWidth(waterMarkContent.toCharArray(),0, waterMarkContent.length()); + } + public static int getCharLen(char c, Graphics g) { + return g.getFontMetrics(g.getFont()).charWidth(c); + } +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/services/OrderSupplyService.java b/yshop-app/src/main/java/co/yixiang/modules/services/OrderSupplyService.java new file mode 100644 index 0000000..c07381d --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/services/OrderSupplyService.java @@ -0,0 +1,268 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.services; + +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.YshopException; +import co.yixiang.enums.AppFromEnum; +import co.yixiang.enums.BillDetailEnum; +import co.yixiang.enums.OrderInfoEnum; +import co.yixiang.enums.OrderLogEnum; +import co.yixiang.enums.PayTypeEnum; +import co.yixiang.modules.activity.domain.YxStoreBargainUser; +import co.yixiang.modules.activity.service.YxStoreBargainUserService; +import co.yixiang.modules.activity.service.YxStorePinkService; +import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; +import co.yixiang.modules.order.domain.YxStoreOrder; +import co.yixiang.modules.order.domain.YxStoreOrderCartInfo; +import co.yixiang.modules.order.dto.OrderExtendDto; +import co.yixiang.modules.order.param.ComputeOrderParam; +import co.yixiang.modules.order.service.YxStoreOrderCartInfoService; +import co.yixiang.modules.order.service.YxStoreOrderService; +import co.yixiang.modules.order.service.dto.ProductAttrDto; +import co.yixiang.modules.order.service.dto.ProductDto; +import co.yixiang.modules.order.vo.OrderCartInfoVo; +import co.yixiang.modules.order.vo.YxStoreOrderQueryVo; +import co.yixiang.modules.mp.service.WeixinPayService; +import com.alibaba.fastjson.JSONObject; +import com.github.binarywang.wxpay.bean.order.WxPayAppOrderResult; +import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult; +import com.github.binarywang.wxpay.bean.order.WxPayMwebOrderResult; +import com.github.binarywang.wxpay.bean.order.WxPayNativeOrderResult; +import com.google.common.collect.Maps; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.Map; + +/** + * @ClassName 订单提供者服务 + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/22 + **/ +@Slf4j +@Service +@AllArgsConstructor +public class OrderSupplyService { + + private final YxStoreOrderService storeOrderService; + private final YxStoreBargainUserService storeBargainUserService; + private final YxStorePinkService storePinkService; + private final YxStoreOrderCartInfoService orderCartInfoService; + private final WeixinPayService weixinPayService; + + + /** + * 返回订单产品信息 + * @param unique 订单唯一值 + * @return OrderCartInfoVo + */ + public OrderCartInfoVo getProductOrder(String unique){ + YxStoreOrderCartInfo orderCartInfo = orderCartInfoService.findByUni(unique); + + YxStoreCartQueryVo cartInfo = JSONObject.parseObject(orderCartInfo.getCartInfo(), + YxStoreCartQueryVo.class); + + ProductDto productDTO = new ProductDto(); + productDTO.setImage(cartInfo.getProductInfo().getImage()); + productDTO.setPrice(cartInfo.getProductInfo().getPrice().doubleValue()); + productDTO.setStoreName(cartInfo.getProductInfo().getStoreName()); + if(ObjectUtil.isNotEmpty(cartInfo.getProductInfo().getAttrInfo())){ + ProductAttrDto productAttrDTO = new ProductAttrDto(); + productAttrDTO.setImage(cartInfo.getProductInfo().getAttrInfo().getImage()); + productAttrDTO.setPrice(cartInfo.getProductInfo().getAttrInfo().getPrice().doubleValue()); + productAttrDTO.setProductId(cartInfo.getProductInfo().getAttrInfo().getProductId()); + productAttrDTO.setSku(cartInfo.getProductInfo().getAttrInfo().getSku()); + productDTO.setAttrInfo(productAttrDTO); + } + + + return OrderCartInfoVo.builder() + .bargainId(cartInfo.getBargainId()) + .cartNum(cartInfo.getCartNum()) + .combinationId(cartInfo.getCombinationId()) + .orderId(storeOrderService.getById(orderCartInfo.getOid()).getOrderId()) + .seckillId(cartInfo.getSeckillId()) + .productInfo(productDTO) + .build(); + } + + /** + * 订单检测 + * @param uid uid + * @param key 缓存值 + * @param param ComputeOrderParam + * @return map + */ + public Map check(Long uid,String key, ComputeOrderParam param){ + Map map = Maps.newHashMap(); + if(StrUtil.isBlank(key)) { + throw new YshopException("参数错误"); + } + YxStoreOrderQueryVo storeOrder = storeOrderService.getOrderInfo(key,uid); + if(ObjectUtil.isNotNull(storeOrder)){ + + OrderExtendDto orderExtendDTO = OrderExtendDto.builder() + .key(key) + .orderId(storeOrder.getOrderId()) + .build(); + map.put("status", OrderLogEnum.EXTEND_ORDER.getValue()); + map.put("result", orderExtendDTO); + map.put("msg",OrderLogEnum.EXTEND_ORDER.getDesc()); + } + + // 砍价 + if(StrUtil.isNotBlank(param.getBargainId()) && NumberUtil.isNumber(param.getBargainId())){ + Long bargainId = Long.valueOf(param.getBargainId()); + if(bargainId > 0){ + YxStoreBargainUser storeBargainUser = storeBargainUserService + .getBargainUserInfo(bargainId,uid); + if(storeBargainUser == null) { + throw new YshopException("砍价失败"); + } + if(OrderInfoEnum.BARGAIN_STATUS_3.getValue().equals(storeBargainUser.getStatus())) { + throw new YshopException("砍价已支付"); + } + } + + } + // 拼团 + if(StrUtil.isNotBlank(param.getPinkId()) && NumberUtil.isNumber(param.getPinkId())){ + Long pinkId = Long.valueOf(param.getPinkId()); + if(pinkId > 0){ + YxStoreOrder yxStoreOrder = storeOrderService.getOrderPink(pinkId,uid); + if(yxStoreOrder != null){ + map.put("status",OrderLogEnum.PINK_ORDER_FAIL_1.getValue()); + OrderExtendDto orderExtendDTO = new OrderExtendDto(); + orderExtendDTO.setOrderId(yxStoreOrder.getOrderId()); + map.put("result",orderExtendDTO); + map.put("msg",OrderLogEnum.PINK_ORDER_FAIL_1.getDesc()); + } + if(yxStoreOrder != null && storePinkService.getIsPinkUid(pinkId,uid)){ + map.put("status",OrderLogEnum.PINK_ORDER_FAIL_2.getValue()); + OrderExtendDto orderExtendDTO = new OrderExtendDto(); + orderExtendDTO.setOrderId(yxStoreOrder.getOrderId()); + map.put("result",orderExtendDTO); + map.put("msg",OrderLogEnum.PINK_ORDER_FAIL_2.getDesc()); + } + } + + } + + + return map; + } + + /** + * 支付 + * @param map map + * @param orderId 订单号 + * @param uid uid + * @param payType 支付方式 + * @param from 来源 + * @param orderDTO orderDTO + * @return map + */ + public Map goPay(Map map, String orderId, Long uid, String payType, + String from, OrderExtendDto orderDTO){ + switch (PayTypeEnum.toType(payType)){ + case WEIXIN: + Map jsConfig = new HashMap<>(); + if(AppFromEnum.WEIXIN_H5.getValue().equals(from)){ + WxPayMwebOrderResult wxPayMwebOrderResult = (WxPayMwebOrderResult)weixinPayService + .unifyPay(orderId,from, BillDetailEnum.TYPE_3.getValue(),"H5商品购买"); + + log.info("wxPayMwebOrderResult:{}",wxPayMwebOrderResult); + jsConfig.put("mweb_url",wxPayMwebOrderResult.getMwebUrl()); + orderDTO.setJsConfig(jsConfig); + map.put("result",orderDTO); + map.put("status","WECHAT_H5_PAY"); + map.put("payMsg","订单创建成功"); + return map; + } else if(AppFromEnum.ROUNTINE.getValue().equals(from)){ + map.put("status","WECHAT_PAY"); + WxPayMpOrderResult wxPayMpOrderResult = (WxPayMpOrderResult)weixinPayService + .unifyPay(orderId,from, BillDetailEnum.TYPE_3.getValue(),"小程序商品购买"); + jsConfig.put("appId",wxPayMpOrderResult.getAppId()); + jsConfig.put("timeStamp",wxPayMpOrderResult.getTimeStamp()); + jsConfig.put("paySign",wxPayMpOrderResult.getPaySign()); + jsConfig.put("nonceStr",wxPayMpOrderResult.getNonceStr()); + jsConfig.put("package",wxPayMpOrderResult.getPackageValue()); + jsConfig.put("signType",wxPayMpOrderResult.getSignType()); + orderDTO.setJsConfig(jsConfig); + map.put("payMsg","订单创建成功"); + map.put("result",orderDTO); + return map; + }else if(AppFromEnum.APP.getValue().equals(from)){//app支付 + map.put("status","WECHAT_APP_PAY"); + WxPayAppOrderResult wxPayAppOrderResult = (WxPayAppOrderResult)weixinPayService + .unifyPay(orderId,from, BillDetailEnum.TYPE_3.getValue(),"APP商品购买"); + jsConfig.put("appid",wxPayAppOrderResult.getAppId()); + jsConfig.put("partnerid",wxPayAppOrderResult.getPartnerId()); + jsConfig.put("prepayid",wxPayAppOrderResult.getPrepayId()); + jsConfig.put("package",wxPayAppOrderResult.getPackageValue()); + jsConfig.put("noncestr",wxPayAppOrderResult.getNonceStr()); + jsConfig.put("timestamp",wxPayAppOrderResult.getTimeStamp()); + jsConfig.put("sign",wxPayAppOrderResult.getSign()); + orderDTO.setJsConfig(jsConfig); + map.put("result",orderDTO); + map.put("payMsg","订单创建成功"); + return map; + }else if(AppFromEnum.PC.getValue().equals(from)){ //扫码支付 + map.put("status","WECHAT_PC_PAY"); + WxPayNativeOrderResult wxPayNativeOrderResult = (WxPayNativeOrderResult)weixinPayService + .unifyPay(orderId,from, BillDetailEnum.TYPE_3.getValue(),"pc商品购买"); + jsConfig.put("codeUrl",wxPayNativeOrderResult.getCodeUrl()); + orderDTO.setJsConfig(jsConfig); + map.put("result",orderDTO); + map.put("payMsg","订单创建成功"); + return map; + } + else{//公众号 + map.put("status","WECHAT_PAY"); + WxPayMpOrderResult wxPayMpOrderResult = (WxPayMpOrderResult)weixinPayService + .unifyPay(orderId,from, BillDetailEnum.TYPE_3.getValue(),"公众号商品购买"); + + log.info("WxPayMpOrderResult:{}",wxPayMpOrderResult); + + jsConfig.put("appId",wxPayMpOrderResult.getAppId()); + jsConfig.put("timestamp",wxPayMpOrderResult.getTimeStamp()); + jsConfig.put("nonceStr",wxPayMpOrderResult.getNonceStr()); + jsConfig.put("package",wxPayMpOrderResult.getPackageValue()); + jsConfig.put("signType",wxPayMpOrderResult.getSignType()); + jsConfig.put("paySign",wxPayMpOrderResult.getPaySign()); + orderDTO.setJsConfig(jsConfig); + map.put("result",orderDTO); + map.put("payMsg","订单创建成功"); + + return map; + } + case YUE: + storeOrderService.yuePay(orderId,uid); + map.put("payMsg","余额支付成功"); + return map; + case INTEGRAL: + storeOrderService.integralPay(orderId,uid); + map.put("payMsg","积分兑换成功"); + return map; + default: + } + + map.put("payMsg","订单生成失败"); + return map; + } + + + + +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/shop/param/YxArticleQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/shop/param/YxArticleQueryParam.java new file mode 100644 index 0000000..45b2d05 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/shop/param/YxArticleQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.shop.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 文章管理表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-02 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxArticleQueryParam对象", description="文章管理表查询参数") +public class YxArticleQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/shop/param/YxSystemConfigQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/shop/param/YxSystemConfigQueryParam.java new file mode 100644 index 0000000..0977b55 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/shop/param/YxSystemConfigQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.shop.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 配置表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-19 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxSystemConfigQueryParam对象", description="配置表查询参数") +public class YxSystemConfigQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/shop/param/YxSystemGroupDataQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/shop/param/YxSystemGroupDataQueryParam.java new file mode 100644 index 0000000..5dfb829 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/shop/param/YxSystemGroupDataQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.shop.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 组合数据详情表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-19 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxSystemGroupDataQueryParam对象", description="组合数据详情表查询参数") +public class YxSystemGroupDataQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/shop/param/YxSystemStoreQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/shop/param/YxSystemStoreQueryParam.java new file mode 100644 index 0000000..a981167 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/shop/param/YxSystemStoreQueryParam.java @@ -0,0 +1,28 @@ +package co.yixiang.modules.shop.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +/** + *

+ * 门店自提 查询参数对象 + *

+ * + * @author hupeng + * @date 2020-03-04 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="门店自提", description="门店自提查询参数") +public class YxSystemStoreQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "纬度") + private String latitude; + + @ApiModelProperty(value = "经度") + private String longitude; + +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/shop/param/YxSystemStoreStaffQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/shop/param/YxSystemStoreStaffQueryParam.java new file mode 100644 index 0000000..98b645d --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/shop/param/YxSystemStoreStaffQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.shop.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 门店店员表 查询参数对象 + *

+ * + * @author hupeng + * @date 2020-03-23 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxSystemStoreStaffQueryParam对象", description="门店店员表查询参数") +public class YxSystemStoreStaffQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/shop/rest/ArticleController.java b/yshop-app/src/main/java/co/yixiang/modules/shop/rest/ArticleController.java new file mode 100644 index 0000000..27d67f3 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/shop/rest/ArticleController.java @@ -0,0 +1,68 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.rest; + +import co.yixiang.api.ApiResult; +import co.yixiang.modules.mp.service.YxArticleService; +import co.yixiang.modules.mp.vo.YxArticleQueryVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Collections; +import java.util.List; + +/** + *

+ * 文章 前端控制器 + *

+ * + * @author hupeng + * @since 2019-10-02 + */ +@Slf4j +@RestController +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +@RequestMapping("/article") +@Api(value = "文章模块", tags = "商城:文章模块") +public class ArticleController { + + private final YxArticleService articleService; + + + /** + * 获取文章文章详情 + */ + @GetMapping("/details/{id}") + @ApiOperation(value = "文章详情",notes = "文章详情") + public ApiResult getYxArticle(@PathVariable Integer id){ + YxArticleQueryVo yxArticleQueryVo = articleService.getDetail(id); + articleService.incVisitNum(id); + return ApiResult.ok(yxArticleQueryVo); + } + + /** + * 文章列表 + */ + @GetMapping("/list") + @ApiOperation(value = "文章列表",notes = "文章列表") + public ApiResult> getYxArticlePageList(@RequestParam(value = "page",defaultValue = "1") int page, + @RequestParam(value = "limit",defaultValue = "10") int limit){ + return ApiResult.resultPage(articleService.getList(page,limit),limit); + } + +} + diff --git a/yshop-app/src/main/java/co/yixiang/modules/shop/rest/IndexController.java b/yshop-app/src/main/java/co/yixiang/modules/shop/rest/IndexController.java new file mode 100644 index 0000000..d2d732e --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/shop/rest/IndexController.java @@ -0,0 +1,173 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.rest; + +import cn.hutool.core.io.file.FileReader; +import cn.hutool.core.io.resource.ClassPathResource; +import co.yixiang.api.ApiResult; +import co.yixiang.api.YshopException; +import co.yixiang.constant.ShopConstants; +import co.yixiang.enums.ProductEnum; +import co.yixiang.modules.activity.service.YxStoreCombinationService; +import co.yixiang.modules.activity.service.YxStoreSeckillService; +import co.yixiang.modules.canvas.domain.StoreCanvas; +import co.yixiang.modules.canvas.service.StoreCanvasService; +import co.yixiang.modules.mp.service.YxWechatLiveService; +import co.yixiang.modules.product.service.YxStoreProductService; +import co.yixiang.modules.product.vo.YxSystemStoreQueryVo; +import co.yixiang.modules.shop.domain.YxAppVersion; +import co.yixiang.modules.shop.param.YxSystemStoreQueryParam; +import co.yixiang.modules.shop.service.YxAppVersionService; +import co.yixiang.modules.shop.service.YxSystemGroupDataService; +import co.yixiang.modules.shop.service.YxSystemStoreService; +import co.yixiang.modules.shop.vo.AppCheckVersion; +import co.yixiang.modules.shop.vo.IndexVo; +import co.yixiang.modules.shop.vo.YxAppVersionVo; +import co.yixiang.utils.FileUtil; +import co.yixiang.utils.RedisUtil; +import co.yixiang.utils.ShopKeyUtils; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.io.File; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * @ClassName IndexController + * @Author hupeng <610796224@qq.com> + * @Date 2019/10/19 + **/ +@Slf4j +@RestController +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +@Api(value = "首页模块", tags = "商城:首页模块") +public class IndexController { + private final YxAppVersionService appVersionService; + private final YxSystemGroupDataService systemGroupDataService; + private final YxStoreProductService storeProductService; + private final YxSystemStoreService systemStoreService; + private final YxStoreCombinationService storeCombinationService; + private final YxStoreSeckillService storeSeckillService; + private final YxWechatLiveService wechatLiveService; + + private final StoreCanvasService storeCanvasService; + + @GetMapping("/getCanvas") + @ApiOperation(value = "读取画布数据") + public ResponseEntity getCanvas(StoreCanvas storeCanvas){ + StoreCanvas canvas = storeCanvasService.getOne(new LambdaQueryWrapper() + .eq(StoreCanvas::getTerminal, storeCanvas.getTerminal()) + .orderByDesc(StoreCanvas::getCanvasId).last("limit 1")); + return new ResponseEntity<>(canvas, HttpStatus.OK); + } + + @Cacheable(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY) + @GetMapping("/index") + @ApiOperation(value = "首页数据",notes = "首页数据") + public ApiResult index(){ + IndexVo indexVo = IndexVo.builder() + .banner(systemGroupDataService.getDatas(ShopConstants.YSHOP_HOME_BANNER)) + .bastList(storeProductService.getList(1,6, ProductEnum.TYPE_1.getValue())) + .benefit(storeProductService.getList(1,10,ProductEnum.TYPE_4.getValue())) + .combinationList(storeCombinationService.getList(1,8).getStoreCombinationQueryVos()) + .firstList(storeProductService.getList(1,6,ProductEnum.TYPE_3.getValue())) + .likeInfo(storeProductService.getList(1,8,ProductEnum.TYPE_2.getValue())) + .mapKey(RedisUtil.get(ShopKeyUtils.getTengXunMapKey())) + .menus(systemGroupDataService.getDatas(ShopConstants.YSHOP_HOME_MENUS)) + .roll(systemGroupDataService.getDatas(ShopConstants.YSHOP_HOME_ROLL_NEWS)) + .seckillList(storeSeckillService.getList(1, 4)) + .liveList(wechatLiveService.getList(1,4,0)) + .build(); + return ApiResult.ok(indexVo); + } + + @GetMapping("/search/keyword") + @ApiOperation(value = "热门搜索关键字获取",notes = "热门搜索关键字获取") + public ApiResult> search(){ + List list = systemGroupDataService.getDatas(ShopConstants.YSHOP_HOT_SEARCH); + List stringList = new ArrayList<>(); + for (JSONObject object : list) { + stringList.add(object.getString("title")); + } + return ApiResult.ok(stringList); + } + + + @PostMapping("/image_base64") + @ApiOperation(value = "获取图片base64",notes = "获取图片base64") + @Deprecated + public ApiResult> imageBase64(){ + return ApiResult.ok(null); + } + + + @GetMapping("/citys") + @ApiOperation(value = "获取城市json",notes = "获取城市json") + public ApiResult cityJson(){ + String path = "city.json"; + String name = "city.json"; + try { + File file = FileUtil.inputStreamToFile(new ClassPathResource(path).getStream(), name); + FileReader fileReader = new FileReader(file,"UTF-8"); + String string = fileReader.readString(); + JSONObject jsonObject = JSON.parseObject(string); + return ApiResult.ok(jsonObject); + } catch (Exception e) { + log.error(e.getMessage()); + throw new YshopException("无数据"); + } + + } + + + @GetMapping("/store_list") + @ApiOperation(value = "获取门店列表",notes = "获取门店列表") + public ApiResult> storeList( YxSystemStoreQueryParam param){ + Map map = new LinkedHashMap<>(); + List lists = systemStoreService.getStoreList( + param.getLatitude(), + param.getLongitude(), + param.getPage(),param.getLimit()); + map.put("list",lists); + return ApiResult.ok(map); + } + + + @GetMapping("/version") + @ApiOperation(value = "获取app版本信息",notes = "获取app版本信息") + public ApiResult storeList(AppCheckVersion param){ + YxAppVersion appVersion= appVersionService.lambdaQuery().orderByDesc(YxAppVersion::getCreateTime).one(); + YxAppVersionVo appVersionVo=new YxAppVersionVo(); + appVersionVo.setVersionCode(appVersion.getVersionCode()); + appVersionVo.setVersionInfo(appVersion.getVersionInfo()); + appVersionVo.setVersionName(appVersion.getVersionName()); + appVersionVo.setDownloadUrl("1101".equals(param.getType())?appVersion.getAndroidUrl():appVersion.getIosUrl()); + appVersionVo.setForceUpdate(appVersion.getForceUpdate()==0); + if (!param.getVersionName().equals(appVersion.getVersionName())){ + return ApiResult.ok(appVersionVo); + } + return ApiResult.ok(new YxAppVersionVo()); + } + +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/shop/vo/IndexVo.java b/yshop-app/src/main/java/co/yixiang/modules/shop/vo/IndexVo.java new file mode 100644 index 0000000..fabad30 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/shop/vo/IndexVo.java @@ -0,0 +1,57 @@ +package co.yixiang.modules.shop.vo; + +import co.yixiang.modules.activity.vo.YxStoreCombinationQueryVo; +import co.yixiang.modules.activity.vo.YxStoreSeckillQueryVo; +import co.yixiang.modules.mp.service.dto.YxWechatLiveDto; +import co.yixiang.modules.product.vo.YxStoreProductQueryVo; +import com.alibaba.fastjson.JSONObject; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@ApiModel("首页数据") +public class IndexVo { + + @ApiModelProperty("banner") + private List banner; + //首页按钮 + @ApiModelProperty("首页按钮") + private List menus; + //精品推荐->拼团 + @ApiModelProperty("精品推荐") + private List bastList; + //首发新品->秒杀 + @ApiModelProperty("首发新品") + private List firstList; + //猜你喜欢 + @ApiModelProperty("猜你喜欢") + private List benefit; + //热门榜单 + @ApiModelProperty("热门榜单") + private List likeInfo; + //滚动 + @ApiModelProperty("滚动") + private List roll; + //地图key + @ApiModelProperty("地图key") + private String mapKey; + //精品推荐->拼团 + @ApiModelProperty("精品推荐->拼团") + private List combinationList; + //首发新品->秒杀 + @ApiModelProperty("首发新品->秒杀") + private List seckillList; + //直播间信息 + @ApiModelProperty("直播间") + private List liveList; + +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/test/LimitController.java b/yshop-app/src/main/java/co/yixiang/modules/test/LimitController.java new file mode 100644 index 0000000..c9023ec --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/test/LimitController.java @@ -0,0 +1,34 @@ +package co.yixiang.modules.test; + +import co.yixiang.annotation.AnonymousAccess; +import co.yixiang.annotation.Limit; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.concurrent.atomic.AtomicInteger; + +/** + * @author / + * 接口限流测试类 + */ +@RestController +@RequestMapping("/test") +@Api(tags = "系统:限流测试管理") +public class LimitController { + + private static final AtomicInteger ATOMIC_INTEGER = new AtomicInteger(); + + /** + * 测试限流注解,下面配置说明该接口 60秒内最多只能访问 10次,保存到redis的键名为 limit_test, + */ + @GetMapping("/limit") + @AnonymousAccess + @ApiOperation("测试") + @Limit(key = "test", period = 60, count = 10, name = "testLimit", prefix = "limit") + public int testLimit() { + return ATOMIC_INTEGER.incrementAndGet(); + } +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/dto/TaskFinishDTO.java b/yshop-app/src/main/java/co/yixiang/modules/user/dto/TaskFinishDTO.java new file mode 100644 index 0000000..596230e --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/dto/TaskFinishDTO.java @@ -0,0 +1,19 @@ +package co.yixiang.modules.user.dto; + + +import lombok.Data; + +import java.io.Serializable; + + +/** + * @ClassName TaskFinishDTO + * @Author hupeng <610796224@qq.com> + * @Date 2019/12/6 + **/ +@Data +public class TaskFinishDTO implements Serializable { + private String addTime; + private String title; + private Integer number; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/dto/UserBillDTO.java b/yshop-app/src/main/java/co/yixiang/modules/user/dto/UserBillDTO.java new file mode 100644 index 0000000..fc5554a --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/dto/UserBillDTO.java @@ -0,0 +1,16 @@ +package co.yixiang.modules.user.dto; + +import lombok.Data; + +/** + * @ClassName UserBillDTO + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/12 + **/ +@Data +public class UserBillDTO { + private String addTime; + private String title; + private Double number; + private Integer pm; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/dto/UserRankDTO.java b/yshop-app/src/main/java/co/yixiang/modules/user/dto/UserRankDTO.java new file mode 100644 index 0000000..609e357 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/dto/UserRankDTO.java @@ -0,0 +1,16 @@ +package co.yixiang.modules.user.dto; + +import lombok.Data; + +/** + * @ClassName UserRankDTO + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/13 + **/ +@Data +public class UserRankDTO { + private Integer uid; + private Integer count; + private String nickname; + private String avatar; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/param/PromParam.java b/yshop-app/src/main/java/co/yixiang/modules/user/param/PromParam.java new file mode 100644 index 0000000..89dc239 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/param/PromParam.java @@ -0,0 +1,30 @@ +package co.yixiang.modules.user.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName PromParam + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/12 + **/ +@Data +public class PromParam implements Serializable { + + @ApiModelProperty(value = "推荐人级别 0一级推荐人 1二级推荐人") + private Integer grade; + + @ApiModelProperty(value = "关键字搜索") + private String keyword; + + @ApiModelProperty(value = "页码") + private Integer limit; + + @ApiModelProperty(value = "页大小") + private Integer page; + + @ApiModelProperty(value = "排序") + private String sort; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/param/RechargeParam.java b/yshop-app/src/main/java/co/yixiang/modules/user/param/RechargeParam.java new file mode 100644 index 0000000..896a779 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/param/RechargeParam.java @@ -0,0 +1,37 @@ +package co.yixiang.modules.user.param; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @ClassName RechargeParam + * @Author hupeng <610796224@qq.com> + * @Date 2019/12/8 + **/ +@Data +public class RechargeParam implements Serializable { + + @NotBlank(message = "充值参数有误") + @JsonProperty(value = "rechar_id") + @ApiModelProperty(value = "用户充值ID") + private String recharId; + + @ApiModelProperty(value = "来源") + private String from; + + //@NotNull(message = "金额必填") + // @Min(value = 1,message = "充值金额不能低于1") + @ApiModelProperty(value = "充值金额") + private Double price; + + @JsonProperty(value = "paid_price") + @ApiModelProperty(value = "赠送金额") + private Double paidPrice; + + @ApiModelProperty(value = "充值单号") + private String orderSn; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/param/UserEditParam.java b/yshop-app/src/main/java/co/yixiang/modules/user/param/UserEditParam.java new file mode 100644 index 0000000..ffb7d3c --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/param/UserEditParam.java @@ -0,0 +1,28 @@ +package co.yixiang.modules.user.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import java.io.Serializable; + +/** + * @ClassName UserEditParam + * @Author hupeng <610796224@qq.com> + * @Date 2020/02/07 + **/ +@Data +public class UserEditParam implements Serializable { + + @NotBlank(message = "请上传头像") + @ApiModelProperty(value = "用户头像") + private String avatar; + + @NotBlank(message = "请填写昵称") + @Size(min = 1, max = 60,message = "长度超过了限制") + @ApiModelProperty(value = "用户昵称") + private String nickname; + + +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/param/YxSystemAttachmentQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxSystemAttachmentQueryParam.java new file mode 100644 index 0000000..fbadfae --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxSystemAttachmentQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.user.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 附件管理表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-11-11 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxSystemAttachmentQueryParam对象", description="附件管理表查询参数") +public class YxSystemAttachmentQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/param/YxSystemUserLevelQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxSystemUserLevelQueryParam.java new file mode 100644 index 0000000..ec27699 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxSystemUserLevelQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.user.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 设置用户等级表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-12-06 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxSystemUserLevelQueryParam对象", description="设置用户等级表查询参数") +public class YxSystemUserLevelQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/param/YxSystemUserTaskQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxSystemUserTaskQueryParam.java new file mode 100644 index 0000000..80282db --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxSystemUserTaskQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.user.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 等级任务设置 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-12-06 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxSystemUserTaskQueryParam对象", description="等级任务设置查询参数") +public class YxSystemUserTaskQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserAddressQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserAddressQueryParam.java new file mode 100644 index 0000000..3ca24b1 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserAddressQueryParam.java @@ -0,0 +1,23 @@ +package co.yixiang.modules.user.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 用户地址表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-28 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxUserAddressQueryParam对象", description="用户地址表查询参数") +public class YxUserAddressQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; + private Integer uid; + private Integer isDel; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserBillQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserBillQueryParam.java new file mode 100644 index 0000000..03d0760 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserBillQueryParam.java @@ -0,0 +1,22 @@ +package co.yixiang.modules.user.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 用户账单表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-27 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxUserBillQueryParam对象", description="用户账单表查询参数") +public class YxUserBillQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; + +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserExtractQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserExtractQueryParam.java new file mode 100644 index 0000000..2f21405 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserExtractQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.user.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 用户提现表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-11-11 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxUserExtractQueryParam对象", description="用户提现表查询参数") +public class YxUserExtractQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserLevelQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserLevelQueryParam.java new file mode 100644 index 0000000..dcba851 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserLevelQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.user.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 用户等级记录表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-12-06 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxUserLevelQueryParam对象", description="用户等级记录表查询参数") +public class YxUserLevelQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserQueryParam.java new file mode 100644 index 0000000..3440650 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.user.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 用户表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-16 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxUserQueryParam对象", description="用户表查询参数") +public class YxUserQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserRechargeQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserRechargeQueryParam.java new file mode 100644 index 0000000..a6cdad3 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserRechargeQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.user.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 用户充值表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-12-08 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxUserRechargeQueryParam对象", description="用户充值表查询参数") +public class YxUserRechargeQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserSignQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserSignQueryParam.java new file mode 100644 index 0000000..0377413 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserSignQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.user.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 签到记录表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-12-05 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxUserSignQueryParam对象", description="签到记录表查询参数") +public class YxUserSignQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserTaskFinishQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserTaskFinishQueryParam.java new file mode 100644 index 0000000..1a5d0d5 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxUserTaskFinishQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.user.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 用户任务完成记录表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-12-07 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxUserTaskFinishQueryParam对象", description="用户任务完成记录表查询参数") +public class YxUserTaskFinishQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/param/YxWechatUserQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxWechatUserQueryParam.java new file mode 100644 index 0000000..8ff25a9 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/param/YxWechatUserQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.user.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 微信用户表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-27 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxWechatUserQueryParam对象", description="微信用户表查询参数") +public class YxWechatUserQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/rest/UserAddressController.java b/yshop-app/src/main/java/co/yixiang/modules/user/rest/UserAddressController.java new file mode 100644 index 0000000..a5cb31b --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/rest/UserAddressController.java @@ -0,0 +1,156 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.rest; + +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.ApiResult; +import co.yixiang.api.YshopException; +import co.yixiang.logging.aop.log.AppLog; +import co.yixiang.common.bean.LocalUser; +import co.yixiang.common.interceptor.AuthCheck; +import co.yixiang.common.util.CityTreeUtil; +import co.yixiang.common.web.param.IdParam; +import co.yixiang.constant.ShopConstants; +import co.yixiang.modules.template.domain.YxSystemCity; +import co.yixiang.modules.template.service.YxSystemCityService; +import co.yixiang.modules.user.param.AddressParam; +import co.yixiang.modules.user.service.YxUserAddressService; +import co.yixiang.modules.user.vo.CityVo; +import co.yixiang.modules.user.vo.YxUserAddressQueryVo; +import com.google.common.collect.Lists; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + *

+ * 用户地前端控制器 + *

+ * + * @author hupeng + * @since 2019-10-28 + */ +@Slf4j +@RestController +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +@Api(value = "用户地址", tags = "用户:用户地址") +public class UserAddressController { + + private final YxUserAddressService userAddressService; + private final YxSystemCityService systemCityService; + + + @Cacheable(cacheNames = ShopConstants.YSHOP_REDIS_CITY_KEY) + @GetMapping("/city_list") + @ApiOperation(value = "城市列表",notes = "城市列表") + public ApiResult> getTest() { + List yxSystemCities = systemCityService.list(); + + List cityVOS = Lists.newArrayList(); + + for (YxSystemCity systemCity : yxSystemCities){ + CityVo cityVO = new CityVo(); + + cityVO.setV(systemCity.getCityId()); + cityVO.setN(systemCity.getName()); + cityVO.setPid(systemCity.getParentId()); + + cityVOS.add(cityVO); + } + + + return ApiResult.ok(CityTreeUtil.list2TreeConverter(cityVOS, 0)); + + } + + /** + * 添加或修改地址 + */ + @AppLog(value = "添加或修改地址", type = 1) + @AuthCheck + @PostMapping("/address/edit") + @ApiOperation(value = "添加或修改地址",notes = "添加或修改地址") + public ApiResult> addYxUserAddress(@Valid @RequestBody AddressParam param){ + Long uid = LocalUser.getUser().getUid(); + Long id = userAddressService.addAndEdit(uid,param); + Map map = new LinkedHashMap<>(); + map.put("id",id); + return ApiResult.ok(map); + } + + /** + * 设置默认地址 + */ + @AppLog(value = "设置默认地址", type = 1) + @AuthCheck + @PostMapping("/address/default/set") + @ApiOperation(value = "设置默认地址",notes = "设置默认地址") + public ApiResult setDefault(@Valid @RequestBody IdParam idParam){ + Long uid = LocalUser.getUser().getUid(); + userAddressService.setDefault(uid,Long.valueOf(idParam.getId())); + return ApiResult.ok(); + } + + + + /** + * 删除用户地址 + */ + @AuthCheck + @PostMapping("/address/del") + @ApiOperation(value = "删除用户地址",notes = "删除用户地址") + public ApiResult deleteYxUserAddress(@Valid @RequestBody IdParam idParam){ + userAddressService.removeById(idParam.getId()); + return ApiResult.ok(); + } + + + /** + * 用户地址列表 + */ + @AuthCheck + @GetMapping("/address/list") + @ApiOperation(value = "用户地址列表",notes = "用户地址列表") + public ApiResult> getYxUserAddressPageList(@RequestParam(value = "page",defaultValue = "1") int page, + @RequestParam(value = "limit",defaultValue = "10") int limit){ + Long uid = LocalUser.getUser().getUid(); + List addressQueryVos = userAddressService.getList(uid,page,limit); + return ApiResult.ok(addressQueryVos); + } + + /** + * 地址详情 + */ + @AuthCheck + @GetMapping("/address/detail/{id}") + @ApiOperation(value = "地址详情",notes = "地址详情") + public ApiResult addressDetail(@PathVariable String id){ + if(StrUtil.isBlank(id) || !NumberUtil.isNumber(id)){ + throw new YshopException("参数非法"); + } + return ApiResult.ok(userAddressService.getDetail(Long.valueOf(id))); + } + +} + diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/rest/UserBillController.java b/yshop-app/src/main/java/co/yixiang/modules/user/rest/UserBillController.java new file mode 100644 index 0000000..a340466 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/rest/UserBillController.java @@ -0,0 +1,209 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.rest; + +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.ApiResult; +import co.yixiang.api.YshopException; +import co.yixiang.logging.aop.log.AppLog; +import co.yixiang.common.bean.LocalUser; +import co.yixiang.common.interceptor.AuthCheck; +import co.yixiang.constant.SystemConfigConstants; +import co.yixiang.enums.BillDetailEnum; +import co.yixiang.modules.activity.service.YxUserExtractService; +import co.yixiang.modules.services.CreatShareProductService; +import co.yixiang.modules.shop.service.YxSystemConfigService; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.param.PromParam; +import co.yixiang.modules.user.param.YxUserBillQueryParam; +import co.yixiang.modules.user.service.YxUserBillService; +import co.yixiang.modules.user.service.YxUserService; +import co.yixiang.modules.user.vo.YxUserBillQueryVo; +import com.google.common.collect.Maps; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; +import java.util.*; + +/** + * @ClassName UserBillController + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/10 + **/ +@Slf4j +@RestController +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +@Api(value = "用户分销", tags = "用户:用户分销") +public class UserBillController { + + private final YxUserBillService userBillService; + private final YxUserExtractService extractService; + private final YxSystemConfigService systemConfigService; + private final YxUserService yxUserService; + private final CreatShareProductService creatShareProductService; + + @Value("${file.path}") + private String path; + + /** + * 推广数据 昨天的佣金 累计提现金额 当前佣金 + */ + @AppLog(value = "查看推广数据", type = 1) + @AuthCheck + @GetMapping("/commission") + @ApiOperation(value = "推广数据",notes = "推广数据") + public ApiResult> commission(){ + YxUser yxUser = LocalUser.getUser(); + + //昨天的佣金 + double lastDayCount = userBillService.yesterdayCommissionSum(yxUser.getUid()); + //累计提现金额 + double extractCount = extractService.extractSum(yxUser.getUid()); + + Map map = Maps.newHashMap(); + map.put("lastDayCount",lastDayCount); + map.put("extractCount",extractCount); + map.put("commissionCount",yxUser.getBrokeragePrice()); + + return ApiResult.ok(map); + } + + /** + * 积分记录 + */ + @AppLog(value = "查看积分记录", type = 1) + @AuthCheck + @GetMapping("/integral/list") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int") + }) + @ApiOperation(value = "积分记录",notes = "积分记录") + public ApiResult> userInfo(@RequestParam(value = "page",defaultValue = "1") int page, + @RequestParam(value = "limit",defaultValue = "10") int limit){ + Long uid = LocalUser.getUser().getUid(); + return ApiResult.ok(userBillService.userBillList(uid, BillDetailEnum.CATEGORY_2.getValue() + ,page, limit)); + } + + + /** + * 分销二维码海报生成 + */ + @AppLog(value = "分销二维码海报生成", type = 1) + @AuthCheck + @GetMapping("/spread/banner") + @ApiImplicitParams({ + @ApiImplicitParam(name = "form", value = "来源", paramType = "query", dataType = "string") + }) + @ApiOperation(value = "分销二维码海报生成",notes = "分销二维码海报生成") + public ApiResult>> spreadBanner(@RequestParam(value = "",required=false) String from){ + YxUser yxUser = LocalUser.getUser(); + String siteUrl = systemConfigService.getData(SystemConfigConstants.SITE_URL); + if(StrUtil.isEmpty(siteUrl)){ + throw new YshopException("未配置h5地址!"); + } + String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL); + if(StrUtil.isEmpty(apiUrl)){ + throw new YshopException("未配置api地址!"); + } + + String spreadUrl = creatShareProductService.getSpreadUrl(from,yxUser,siteUrl,apiUrl,path); + + List> list = new ArrayList<>(); + + Map map = Maps.newHashMap(); + map.put("id",1); + map.put("pic",""); + map.put("title","分享海报"); + map.put("wap_poster",spreadUrl); + list.add(map); + return ApiResult.ok(list); + } + + + /** + * 推广人统计 + */ + @AppLog(value = "查看推广人统计", type = 1) + @AuthCheck + @PostMapping("/spread/people") + @ApiOperation(value = "推广人统计",notes = "推广人统计") + public ApiResult> spreadPeople(@Valid @RequestBody PromParam param){ + Long uid = LocalUser.getUser().getUid(); + Map map = new LinkedHashMap<>(); + map.put("list",yxUserService.getUserSpreadGrade(uid,param.getPage(),param.getLimit() + ,param.getGrade(),param.getKeyword(),param.getSort())); + + Map countMap = yxUserService.getSpreadCount(uid); + map.put("total",countMap.get("first")); + map.put("totalLevel",countMap.get("second")); + return ApiResult.ok(map); + } + + /** + * 推广佣金明细 + * type 0 全部 1 消费 2 充值 3 返佣 4 提现 + * @return mixed + */ + @AppLog(value = "查看推广佣金明细", type = 1) + @AuthCheck + @GetMapping("/spread/commission/{type}") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "type", value = "类型 0所有 1消费 2充值 3返佣 4提现 5签到积分 6退款 7系统增加 8系统减少", paramType = "query", dataType = "int") + }) + @ApiOperation(value = "推广佣金明细",notes = "推广佣金明细") + public ApiResult spreadCommission(@RequestParam(value = "page",defaultValue = "1") int page, + @RequestParam(value = "limit",defaultValue = "10") int limit, + @PathVariable String type){ + int newType = 0; + if(NumberUtil.isNumber(type)) { + newType = Integer.valueOf(type); + } + Long uid = LocalUser.getUser().getUid(); + Map map = userBillService.getUserBillList(page,limit,uid,newType); + Long total = (Long)map.get("total"); + Long totalPage = (Long)map.get("totalPage"); + return ApiResult.resultPage(total.intValue(),totalPage.intValue(),map.get("list")); + // return ApiResult.resultPage(Collections.singletonList(userBillService.getUserBillList(page,limit,uid,newType)),limit); + } + + + /** + * 推广订单 + */ + @AppLog(value = "查看推广订单", type = 1) + @AuthCheck + @PostMapping("/spread/order") + @ApiOperation(value = "推广订单",notes = "推广订单") + public ApiResult spreadOrder(@RequestBody YxUserBillQueryParam param){ + Long uid = LocalUser.getUser().getUid(); + Map map = userBillService.spreadOrder(uid,param.getPage(),param.getLimit()); + return ApiResult.ok(map); + } + + + +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/rest/UserController.java b/yshop-app/src/main/java/co/yixiang/modules/user/rest/UserController.java new file mode 100644 index 0000000..379c310 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/rest/UserController.java @@ -0,0 +1,239 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.rest; + + +import co.yixiang.api.ApiResult; +import co.yixiang.logging.aop.log.AppLog; +import co.yixiang.common.aop.NoRepeatSubmit; +import co.yixiang.common.bean.LocalUser; +import co.yixiang.common.interceptor.AuthCheck; +import co.yixiang.constant.ShopConstants; +import co.yixiang.enums.BillInfoEnum; +import co.yixiang.modules.order.service.YxStoreOrderService; +import co.yixiang.modules.order.vo.UserOrderCountVo; +import co.yixiang.modules.product.service.YxStoreProductRelationService; +import co.yixiang.modules.product.vo.YxStoreProductRelationQueryVo; +import co.yixiang.modules.shop.service.YxSystemConfigService; +import co.yixiang.modules.shop.service.YxSystemGroupDataService; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.param.UserEditParam; +import co.yixiang.modules.user.service.YxUserBillService; +import co.yixiang.modules.user.service.YxUserService; +import co.yixiang.modules.user.service.YxUserSignService; +import co.yixiang.modules.user.vo.SignVo; +import co.yixiang.modules.user.vo.YxUserQueryVo; +import com.google.common.collect.Maps; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import static co.yixiang.constant.SystemConfigConstants.YSHOP_SHOW_RECHARGE; + +/** + *

+ * 用户控制器 + *

+ * + * @author hupeng + * @since 2019-10-16 + */ +@Slf4j +@RestController +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +@Api(value = "用户中心", tags = "用户:用户中心") +public class UserController { + + private final YxUserService yxUserService; + private final YxSystemGroupDataService systemGroupDataService; + private final YxStoreOrderService orderService; + private final YxStoreProductRelationService relationService; + private final YxUserSignService userSignService; + private final YxUserBillService userBillService; + private final YxSystemConfigService systemConfigService; + + + /** + * 用户资料 + */ + @AuthCheck + @GetMapping("/userinfo") + @ApiOperation(value = "获取用户信息",notes = "获取用户信息",response = YxUserQueryVo.class) + public ApiResult userInfo(){ + YxUser yxUser = LocalUser.getUser(); + return ApiResult.ok(yxUserService.getNewYxUserById(yxUser)); + } + + /** + * 获取个人中心菜单 + */ + @GetMapping("/menu/user") + @ApiOperation(value = "获取个人中心菜单",notes = "获取个人中心菜单") + public ApiResult> userMenu(){ + Map map = new LinkedHashMap<>(); + map.put("routine_my_menus",systemGroupDataService.getDatas(ShopConstants.YSHOP_MY_MENUES)); + return ApiResult.ok(map); + } + + + + /** + * 订单统计数据 + */ + @AppLog(value = "查看订单统计数据", type = 1) + @AuthCheck + @GetMapping("/order/data") + @ApiOperation(value = "订单统计数据",notes = "订单统计数据") + public ApiResult orderData(){ + Long uid = LocalUser.getUser().getUid(); + return ApiResult.ok(orderService.orderData(uid)); + } + + /** + * 获取收藏产品 + */ + @AuthCheck + @GetMapping("/collect/user") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "type", value = "foot为足迹,collect为收藏", paramType = "query", dataType = "String") + }) + @ApiOperation(value = "获取收藏产品,或足迹",notes = "获取收藏产品,或足迹") + public ApiResult> collectUser(@RequestParam(value = "page",defaultValue = "1") int page, + @RequestParam(value = "limit",defaultValue = "10") int limit, + @RequestParam(value = "type") String type){ + Long uid = LocalUser.getUser().getUid(); + return ApiResult.ok(relationService.userCollectProduct(page,limit,uid,type)); + } + + /** + * 用户资金统计 + */ + @AppLog(value = "查看用户资金统计", type = 1) + @AuthCheck + @GetMapping("/user/balance") + @ApiOperation(value = "用户资金统计",notes = "用户资金统计") + public ApiResult userBalance(){ + YxUser yxUser = LocalUser.getUser(); + Map map = Maps.newHashMap(); + Double[] userMoneys = yxUserService.getUserMoney(yxUser.getUid()); + map.put("now_money",yxUser.getNowMoney()); + map.put("orderStatusSum",userMoneys[0]); + map.put("recharge",userMoneys[1]); + map.put("is_hide",systemConfigService.getData(YSHOP_SHOW_RECHARGE)); + return ApiResult.ok(map); + } + + + /** + * 签到用户信息 + */ + @AppLog(value = "签到用户信息", type = 1) + @AuthCheck + @PostMapping("/sign/user") + @ApiOperation(value = "签到用户信息",notes = "签到用户信息") + public ApiResult sign(){ + YxUser yxUser = LocalUser.getUser(); + return ApiResult.ok(userSignService.userSignInfo(yxUser)); + } + + /** + * 签到配置 + */ + @GetMapping("/sign/config") + @ApiOperation(value = "签到配置",notes = "签到配置") + public ApiResult signConfig(){ + return ApiResult.ok(systemGroupDataService.getDatas(ShopConstants.YSHOP_SIGN_DAY_NUM)); + } + + /** + * 签到列表 + */ + @AppLog(value = "查看签到列表", type = 1) + @AuthCheck + @GetMapping("/sign/list") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int") + }) + @ApiOperation(value = "签到列表",notes = "签到列表") + public ApiResult> signList(@RequestParam(value = "page",defaultValue = "1") int page, + @RequestParam(value = "limit",defaultValue = "10") int limit){ + Long uid = LocalUser.getUser().getUid(); + return ApiResult.ok(userSignService.getSignList(uid,page,limit)); + } + + /** + * 签到列表(年月) + */ + + @AuthCheck + @GetMapping("/sign/month") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int") + }) + @ApiOperation(value = "签到列表(年月)",notes = "签到列表(年月)") + public ApiResult signMonthList(@RequestParam(value = "page",defaultValue = "1") int page, + @RequestParam(value = "limit",defaultValue = "10") int limit){ + Long uid = LocalUser.getUser().getUid(); + return ApiResult.ok(userBillService.getUserBillList(page, limit,uid, BillInfoEnum.SIGN_INTEGRAL.getValue())); + } + + /** + * 开始签到 + */ + @AppLog(value = "开始签到", type = 1) + @NoRepeatSubmit + @AuthCheck + @PostMapping("/sign/integral") + @ApiOperation(value = "开始签到",notes = "开始签到") + public ApiResult signIntegral(){ + YxUser yxUser = LocalUser.getUser(); + int integral = userSignService.sign(yxUser);; + + Map map = new LinkedHashMap<>(); + map.put("integral",integral); + return ApiResult.ok(map,"签到获得" + integral + "积分"); + } + + @AppLog(value = "用户修改信息", type = 1) + @AuthCheck + @PostMapping("/user/edit") + @ApiOperation(value = "用户修改信息",notes = "用修改信息") + public ApiResult edit(@Validated @RequestBody UserEditParam param){ + YxUser yxUser = LocalUser.getUser(); + yxUser.setAvatar(param.getAvatar()); + yxUser.setNickname(param.getNickname()); + + yxUserService.updateById(yxUser); + + return ApiResult.ok("修改成功"); + } + + + + +} + diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/rest/UserExtractController.java b/yshop-app/src/main/java/co/yixiang/modules/user/rest/UserExtractController.java new file mode 100644 index 0000000..a7e8e1e --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/rest/UserExtractController.java @@ -0,0 +1,84 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.rest; + + +import co.yixiang.api.ApiResult; +import co.yixiang.logging.aop.log.AppLog; +import co.yixiang.common.bean.LocalUser; +import co.yixiang.common.interceptor.AuthCheck; +import co.yixiang.constant.SystemConfigConstants; +import co.yixiang.modules.activity.param.UserExtParam; +import co.yixiang.modules.activity.service.YxUserExtractService; +import co.yixiang.modules.shop.service.YxSystemConfigService; +import co.yixiang.modules.user.domain.YxUser; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + *

+ * 用户提现 前端控制器 + *

+ * + * @author hupeng + * @since 2019-11-11 + */ +@Slf4j +@RestController +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +@Api(value = "用户提现", tags = "用户:用户提现") +public class UserExtractController { + + private final YxUserExtractService userExtractService; + private final YxSystemConfigService systemConfigService; + + /** + * 提现参数 + */ + @AuthCheck + @GetMapping("/extract/bank") + @ApiOperation(value = "提现参数",notes = "提现参数") + public ApiResult bank(){ + YxUser yxUser = LocalUser.getUser(); + Map map = new LinkedHashMap<>(); + map.put("commissionCount",yxUser.getBrokeragePrice()); + map.put("minPrice",systemConfigService.getData(SystemConfigConstants.USER_EXTRACT_MIN_PRICE)); + return ApiResult.ok(map); + } + + + /** + * 用户提现 + */ + @AppLog(value = "用户提现", type = 1) + @AuthCheck + @PostMapping("/extract/cash") + @ApiOperation(value = "用户提现",notes = "用户提现") + public ApiResult addYxUserExtract(@Valid @RequestBody UserExtParam param){ + YxUser yxUser = LocalUser.getUser(); + userExtractService.userExtract(yxUser,param); + return ApiResult.ok("申请提现成功"); + } + + + + +} + diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/rest/UserLevelController.java b/yshop-app/src/main/java/co/yixiang/modules/user/rest/UserLevelController.java new file mode 100644 index 0000000..318fdd6 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/rest/UserLevelController.java @@ -0,0 +1,93 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.rest; + + +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.ApiResult; +import co.yixiang.api.YshopException; +import co.yixiang.common.bean.LocalUser; +import co.yixiang.common.interceptor.AuthCheck; +import co.yixiang.modules.user.service.YxSystemUserLevelService; +import co.yixiang.modules.user.service.YxSystemUserTaskService; +import co.yixiang.modules.user.service.YxUserLevelService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 用户等级 前端控制器 + *

+ * + * @author hupeng + * @since 2019-12-06 + */ +@Slf4j +@RestController +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +@Api(value = "用户等级", tags = "用户:用户等级") +public class UserLevelController { + + private final YxUserLevelService userLevelService; + private final YxSystemUserLevelService systemUserLevelService; + private final YxSystemUserTaskService systemUserTaskService; + + /** + * 会员等级列表 + */ + @AuthCheck + @GetMapping("/user/level/grade") + @ApiOperation(value = "会员等级列表",notes = "会员等级列表") + public ApiResult getLevelInfo(){ + Long uid = LocalUser.getUser().getUid(); + return ApiResult.ok(systemUserLevelService.getLevelInfo(uid)); + } + + /** + * 获取等级任务 + */ + @AuthCheck + @GetMapping("/user/level/task/{id}") + @ApiOperation(value = "获取等级任务",notes = "获取等级任务") + public ApiResult getTask(@PathVariable String id){ + if(StrUtil.isBlank(id) || !NumberUtil.isNumber(id)){ + throw new YshopException("参数非法"); + } + Long uid = LocalUser.getUser().getUid(); + return ApiResult.ok(systemUserTaskService.getTaskList(Integer.valueOf(id),uid)); + } + + /** + * 检测用户是否可以成为会员 + */ + @AuthCheck + @GetMapping("/user/level/detection") + @ApiOperation(value = "检测用户是否可以成为会员",notes = "检测用户是否可以成为会员") + public ApiResult detection(){ + Long uid = LocalUser.getUser().getUid(); + boolean res = userLevelService.setLevelComplete(uid); + if(res){ + return ApiResult.ok("升级成功!"); + }else{ + throw new YshopException("还不符合升级条件哦!"); + } + + } + + + +} + diff --git a/yshop-app/src/main/java/co/yixiang/modules/user/rest/UserRechargeController.java b/yshop-app/src/main/java/co/yixiang/modules/user/rest/UserRechargeController.java new file mode 100644 index 0000000..ea1f2da --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/user/rest/UserRechargeController.java @@ -0,0 +1,164 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.rest; + +import cn.hutool.core.bean.BeanUtil; +import co.yixiang.api.ApiResult; +import co.yixiang.api.YshopException; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.logging.aop.log.AppLog; +import co.yixiang.common.bean.LocalUser; +import co.yixiang.common.interceptor.AuthCheck; +import co.yixiang.constant.ShopConstants; +import co.yixiang.enums.AppFromEnum; +import co.yixiang.enums.BillDetailEnum; +import co.yixiang.modules.shop.domain.YxSystemGroupData; +import co.yixiang.modules.shop.service.YxSystemGroupDataService; +import co.yixiang.modules.shop.service.dto.YxSystemGroupDataQueryCriteria; +import co.yixiang.modules.shop.vo.YxSystemGroupDataVo; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.param.RechargeParam; +import co.yixiang.modules.user.service.YxUserRechargeService; +import co.yixiang.modules.mp.service.WeixinPayService; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.github.binarywang.wxpay.bean.order.WxPayAppOrderResult; +import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult; +import com.github.binarywang.wxpay.bean.order.WxPayMwebOrderResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * 用户充值 前端控制器 + *

+ * + * @author hupeng + * @since 2020-03-01 + */ +@Slf4j +@RestController +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +@Api(value = "用户充值", tags = "用户:用户充值") +public class UserRechargeController { + + private final YxUserRechargeService userRechargeService; + private final WeixinPayService weixinPayService; + private final YxSystemGroupDataService systemGroupDataService; + + /** + * 充值方案 + */ + @GetMapping("/recharge/index") + @ApiOperation(value = "充值方案",notes = "充值方案",response = ApiResult.class) + public ApiResult getWays(){ + YxSystemGroupDataQueryCriteria queryCriteria = new YxSystemGroupDataQueryCriteria(); + queryCriteria.setGroupName(ShopConstants.YSHOP_RECHARGE_PRICE_WAYS); + queryCriteria.setStatus(ShopCommonEnum.IS_STATUS_1.getValue()); + List yxSystemGroupDataList = systemGroupDataService.queryAll(queryCriteria); + + List systemGroupDataVoList = yxSystemGroupDataList.stream().map(s->{ + YxSystemGroupDataVo systemGroupDataVo = new YxSystemGroupDataVo(); + BeanUtil.copyProperties(s,systemGroupDataVo,"value"); + systemGroupDataVo.setValue(JSON.parseObject(s.getValue())); + return systemGroupDataVo; + }).collect(Collectors.toList()); + + Map map = new LinkedHashMap<>(); + map.put("recharge_price_ways",systemGroupDataVoList); + return ApiResult.ok(map); + } + + /** + * 公众号充值/H5充值 + */ + @AppLog(value = "公众号充值", type = 1) + @AuthCheck + @PostMapping("/recharge/wechat") + @ApiOperation(value = "公众号充值/H5充值",notes = "公众号充值/H5充值",response = ApiResult.class) + public ApiResult> add(@Valid @RequestBody RechargeParam param){ + YxUser user = LocalUser.getUser(); + + Map map = new LinkedHashMap<>(); + map.put("type",param.getFrom()); + YxSystemGroupData systemGroupData = systemGroupDataService.getById(param.getRecharId()); + if(systemGroupData == null) { + throw new YshopException("充值方案不存在"); + } + + JSONObject jsonObject = JSON.parseObject(systemGroupData.getValue()); + String price = jsonObject.getString("price"); + String giveMoney =jsonObject.getString("give_price"); + String orderSn = userRechargeService.addRecharge(user,price,giveMoney); + + if(AppFromEnum.WEIXIN_H5.getValue().equals(param.getFrom())){ + WxPayMwebOrderResult result = (WxPayMwebOrderResult)weixinPayService + .unifyPay(orderSn,param.getFrom(), BillDetailEnum.TYPE_1.getValue(),"H5充值"); + map.put("data",result.getMwebUrl()); + }else if(AppFromEnum.ROUNTINE.getValue().equals(param.getFrom())){ + WxPayMpOrderResult wxPayMpOrderResult = (WxPayMpOrderResult)weixinPayService + .unifyPay(orderSn,param.getFrom(), BillDetailEnum.TYPE_1.getValue(),"小程序充值"); + Map jsConfig = new HashMap<>(); + jsConfig.put("timeStamp",wxPayMpOrderResult.getTimeStamp()); + jsConfig.put("appId",wxPayMpOrderResult.getAppId()); + jsConfig.put("paySign",wxPayMpOrderResult.getPaySign()); + jsConfig.put("nonceStr",wxPayMpOrderResult.getNonceStr()); + jsConfig.put("package",wxPayMpOrderResult.getPackageValue()); + jsConfig.put("signType",wxPayMpOrderResult.getSignType()); + map.put("data",jsConfig); + }else if(AppFromEnum.APP.getValue().equals(param.getFrom())){ + WxPayAppOrderResult wxPayAppOrderResult = (WxPayAppOrderResult)weixinPayService + .unifyPay(orderSn,param.getFrom(), BillDetailEnum.TYPE_1.getValue(),"app充值"); + Map jsConfig = new HashMap<>(); + jsConfig.put("partnerid",wxPayAppOrderResult.getPartnerId()); + jsConfig.put("appid",wxPayAppOrderResult.getAppId()); + jsConfig.put("prepayid",wxPayAppOrderResult.getPrepayId()); + jsConfig.put("package",wxPayAppOrderResult.getPackageValue()); + jsConfig.put("noncestr",wxPayAppOrderResult.getNonceStr()); + jsConfig.put("timestamp",wxPayAppOrderResult.getTimeStamp()); + jsConfig.put("sign",wxPayAppOrderResult.getSign()); + map.put("data",jsConfig); + }else{ + WxPayMpOrderResult result = (WxPayMpOrderResult)weixinPayService + .unifyPay(orderSn,param.getFrom(), BillDetailEnum.TYPE_1.getValue(),"公众号充值"); + Map config = new HashMap<>(); + config.put("timestamp",result.getTimeStamp()); + config.put("appId",result.getAppId()); + config.put("nonceStr",result.getNonceStr()); + config.put("package",result.getPackageValue()); + config.put("signType",result.getSignType()); + config.put("paySign",result.getPaySign()); + map.put("data",config); + } + + + + + return ApiResult.ok(map); + } + + + + +} + diff --git a/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/controller/WechatController.java b/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/controller/WechatController.java new file mode 100644 index 0000000..58b02db --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/controller/WechatController.java @@ -0,0 +1,294 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.wechat.rest.controller; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import co.yixiang.annotation.AnonymousAccess; +import co.yixiang.api.ApiResult; +import co.yixiang.constant.SystemConfigConstants; +import co.yixiang.enums.BillDetailEnum; +import co.yixiang.enums.OrderInfoEnum; +import co.yixiang.enums.PayMethodEnum; +import co.yixiang.enums.PayTypeEnum; +import co.yixiang.modules.order.domain.YxStoreOrder; +import co.yixiang.modules.order.service.YxStoreOrderService; +import co.yixiang.modules.order.vo.YxStoreOrderQueryVo; +import co.yixiang.modules.shop.service.YxSystemConfigService; +import co.yixiang.modules.user.domain.YxUserRecharge; +import co.yixiang.modules.user.service.YxUserRechargeService; +import co.yixiang.modules.mp.config.WxMpConfiguration; +import co.yixiang.modules.mp.config.WxPayConfiguration; +import co.yixiang.modules.mp.config.WxMaConfiguration; +import co.yixiang.utils.BigNum; +import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse; +import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; +import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult; +import com.github.binarywang.wxpay.exception.WxPayException; +import com.github.binarywang.wxpay.service.WxPayService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.bean.WxJsapiSignature; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; +import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * @ClassName WechatController + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/5 + **/ +@Slf4j +@RestController +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +@Api(value = "微信模块", tags = "微信:微信模块") +public class WechatController { + + private final YxStoreOrderService orderService; + private final YxSystemConfigService systemConfigService; + private final YxUserRechargeService userRechargeService; + + + /** + * 微信分享配置 + */ + @GetMapping("/share") + @ApiOperation(value = "微信分享配置",notes = "微信分享配置") + public ApiResult> share() { + Map map = new LinkedHashMap<>(); + map.put("img",systemConfigService.getData(SystemConfigConstants.WECHAT_SHARE_IMG)); + map.put("title",systemConfigService.getData(SystemConfigConstants.WECHAT_SHARE_TITLE)); + map.put("synopsis",systemConfigService.getData(SystemConfigConstants.WECHAT_SHARE_SYNOPSIS)); + Map mapt = new LinkedHashMap<>(); + mapt.put("data",map); + return ApiResult.ok(mapt); + } + + /** + * jssdk配置 + */ + @GetMapping("/wechat/config") + @ApiOperation(value = "jssdk配置",notes = "jssdk配置") + public ApiResult> jsConfig(HttpServletRequest request) throws WxErrorException { + WxMpService wxService = WxMpConfiguration.getWxMpService(); + String url = request.getParameter("url"); + log.info("url:"+url); + WxJsapiSignature jsapiSignature = wxService.createJsapiSignature(url); + Map map = new LinkedHashMap<>(); + map.put("appId",jsapiSignature.getAppId()); + map.put("jsApiList",new String[]{"updateAppMessageShareData","openLocation","scanQRCode", + "chooseWXPay","updateAppMessageShareData","updateTimelineShareData", + "openAddress","editAddress","getLocation"}); + map.put("nonceStr",jsapiSignature.getNonceStr()); + map.put("signature",jsapiSignature.getSignature()); + map.put("timestamp",jsapiSignature.getTimestamp()); + map.put("url",jsapiSignature.getUrl()); + return ApiResult.ok(map); + } + + + /** + * 微信小程序接口能力配置 + */ + @GetMapping("/wxapp/config") + @ApiOperation(value = "微信小程序接口能力配置",notes = "微信小程序接口能力配置",produces = "text/plain;charset=utf-8") + public String wxAppConfig(@RequestParam(value = "signature") String signature, + @RequestParam(value = "timestamp") String timestamp, + @RequestParam(value = "nonce") String nonce, + @RequestParam(name = "echostr", required = false) String echostr) throws WxErrorException { + WxMaService wxService = WxMaConfiguration.getWxMaService(); + + if( wxService.checkSignature(timestamp,nonce,signature)){ + return echostr; + } + return "false"; + } + + /** + * 微信支付/充值回调 + */ + @AnonymousAccess + @PostMapping("/wechat/notify") + @ApiOperation(value = "微信支付充值回调",notes = "微信支付充值回调") + public String renotify(@RequestBody String xmlData) { + try { + WxPayService wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WECHAT); + if(wxPayService == null) { + wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WXAPP); + } + if(wxPayService == null) { + wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.APP); + } + WxPayOrderNotifyResult notifyResult = wxPayService.parseOrderNotifyResult(xmlData); + String orderId = notifyResult.getOutTradeNo(); + String attach = notifyResult.getAttach(); + if(BillDetailEnum.TYPE_3.getValue().equals(attach)){ + YxStoreOrderQueryVo orderInfo = orderService.getOrderInfo(orderId,null); + if(orderInfo == null) { + return WxPayNotifyResponse.success("处理成功!"); + } + if(OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderInfo.getPaid())){ + return WxPayNotifyResponse.success("处理成功!"); + } + orderService.paySuccess(orderInfo.getOrderId(),PayTypeEnum.WEIXIN.getValue()); + }else if(BillDetailEnum.TYPE_1.getValue().equals(attach)){ + //处理充值 + YxUserRecharge userRecharge = userRechargeService.getInfoByOrderId(orderId); + if(userRecharge == null) { + return WxPayNotifyResponse.success("处理成功!"); + } + if(OrderInfoEnum.PAY_STATUS_1.getValue().equals(userRecharge.getPaid())){ + return WxPayNotifyResponse.success("处理成功!"); + } + + userRechargeService.updateRecharge(userRecharge); + } + + return WxPayNotifyResponse.success("处理成功!"); + } catch (WxPayException e) { + log.error(e.getMessage()); + return WxPayNotifyResponse.fail(e.getMessage()); + } + + } + + /** + * 微信退款回调 + */ + @ApiOperation(value = "退款回调通知处理",notes = "退款回调通知处理") + @PostMapping("/notify/refund") + public String parseRefundNotifyResult(@RequestBody String xmlData) { + try { + WxPayService wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WECHAT); + if(wxPayService == null) { + wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WXAPP); + } + if(wxPayService == null) { + wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.APP); + } + WxPayRefundNotifyResult result = wxPayService.parseRefundNotifyResult(xmlData); + String orderId = result.getReqInfo().getOutTradeNo(); + BigDecimal refundFee = BigNum.div(result.getReqInfo().getRefundFee(), 100); + YxStoreOrderQueryVo orderInfo = orderService.getOrderInfo(orderId,null); + if(OrderInfoEnum.REFUND_STATUS_2.getValue().equals(orderInfo.getRefundStatus())){ + return WxPayNotifyResponse.success("处理成功!"); + } + YxStoreOrder storeOrder = new YxStoreOrder(); + //修改状态 + storeOrder.setId(orderInfo.getId()); + storeOrder.setRefundStatus(OrderInfoEnum.REFUND_STATUS_2.getValue()); + storeOrder.setRefundPrice(refundFee); + orderService.updateById(storeOrder); + orderService.retrunStock(orderId); + return WxPayNotifyResponse.success("处理成功!"); + } catch (WxPayException | IllegalAccessException e) { + log.error(e.getMessage()); + return WxPayNotifyResponse.fail(e.getMessage()); + } + } + /** + * 微信验证消息 + */ + @GetMapping( value = "/wechat/serve",produces = "text/plain;charset=utf-8") + @ApiOperation(value = "微信验证消息",notes = "微信验证消息") + public String authGet(@RequestParam(name = "signature", required = false) String signature, + @RequestParam(name = "timestamp", required = false) String timestamp, + @RequestParam(name = "nonce", required = false) String nonce, + @RequestParam(name = "echostr", required = false) String echostr){ + + final WxMpService wxService = WxMpConfiguration.getWxMpService(); + if (wxService == null) { + throw new IllegalArgumentException("未找到对应配置的服务,请核实!"); + } + + if (wxService.checkSignature(timestamp, nonce, signature)) { + return echostr; + } + + return "fail"; + } + + /** + *微信获取消息 + */ + @PostMapping("/wechat/serve") + @ApiOperation(value = "微信获取消息",notes = "微信获取消息") + public void post(@RequestBody String requestBody, + @RequestParam("signature") String signature, + @RequestParam("timestamp") String timestamp, + @RequestParam("nonce") String nonce, + @RequestParam("openid") String openid, + @RequestParam(name = "encrypt_type", required = false) String encType, + @RequestParam(name = "msg_signature", required = false) String msgSignature, + HttpServletRequest request, + HttpServletResponse response) throws IOException { + + WxMpService wxService = WxMpConfiguration.getWxMpService(); + + if (!wxService.checkSignature(timestamp, nonce, signature)) { + throw new IllegalArgumentException("非法请求,可能属于伪造的请求!"); + } + + String out = null; + if (encType == null) { + // 明文传输的消息 + WxMpXmlMessage inMessage = WxMpXmlMessage.fromXml(requestBody); + WxMpXmlOutMessage outMessage = this.route(inMessage); + if(outMessage == null) { + return; + } + out = outMessage.toXml();; + } else if ("aes".equalsIgnoreCase(encType)) { + // aes加密的消息 + WxMpXmlMessage inMessage = WxMpXmlMessage.fromEncryptedXml(requestBody, wxService.getWxMpConfigStorage(), + timestamp, nonce, msgSignature); + WxMpXmlOutMessage outMessage = this.route(inMessage); + if(outMessage == null) { + return; + } + + out = outMessage.toEncryptedXml(wxService.getWxMpConfigStorage()); + } + + response.setCharacterEncoding("UTF-8"); + PrintWriter writer = response.getWriter(); + writer.print(out); + writer.close(); + } + + private WxMpXmlOutMessage route(WxMpXmlMessage message) { + try { + return WxMpConfiguration.getWxMpMessageRouter().route(message); + } catch (Exception e) { + log.error("路由消息时出现异常!", e); + } + + return null; + } + + + + +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/controller/WechatLiveController.java b/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/controller/WechatLiveController.java new file mode 100644 index 0000000..70bc889 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/controller/WechatLiveController.java @@ -0,0 +1,47 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.wechat.rest.controller; + +import cn.binarywang.wx.miniapp.bean.live.WxMaLiveResult; +import co.yixiang.api.ApiResult; +import co.yixiang.modules.mp.service.YxWechatLiveService; +import co.yixiang.modules.mp.service.dto.YxWechatLiveQueryCriteria; +import co.yixiang.modules.mp.vo.WechatLiveVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** +* @author hupeng +* @date 2020-08-10 +*/ +@AllArgsConstructor +@Api(tags = "wxlive管理") +@RestController +@RequestMapping +public class WechatLiveController { + + private final YxWechatLiveService yxWechatLiveService; + + + @GetMapping("yxWechatLive") + @ApiOperation("查询所有直播间") + public ApiResult getYxWechatLives(YxWechatLiveQueryCriteria criteria, Pageable pageable){ + return ApiResult.ok(yxWechatLiveService.queryAll(criteria,pageable)); + } + @GetMapping("yxWechatLive/getLiveReplay/{id}") + @ApiOperation("获取直播回放") + public ApiResult> getLiveReplay(@PathVariable Integer id){ + return ApiResult.ok(yxWechatLiveService.getLiveReplay(id)); + } +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/controller/WxMaUserController.java b/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/controller/WxMaUserController.java new file mode 100644 index 0000000..f577d96 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/controller/WxMaUserController.java @@ -0,0 +1,117 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.wechat.rest.controller; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.ApiResult; +import co.yixiang.api.YshopException; +import co.yixiang.constant.ShopConstants; +import co.yixiang.logging.aop.log.AppLog; +import co.yixiang.common.bean.LocalUser; +import co.yixiang.common.interceptor.AuthCheck; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.service.YxUserService; +import co.yixiang.modules.wechat.rest.param.BindPhoneParam; +import co.yixiang.modules.wechat.rest.param.WxPhoneParam; +import co.yixiang.modules.mp.config.WxMaConfiguration; +import co.yixiang.utils.RedisUtil; +import co.yixiang.utils.RedisUtils; +import co.yixiang.utils.SecurityUtils; +import co.yixiang.utils.ShopKeyUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import me.chanjar.weixin.common.error.WxErrorException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * @author hupeng + * @date 2020/02/07 + */ +@RestController +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +@Api(value = "微信其他", tags = "微信:微信其他") +public class WxMaUserController { + + private final YxUserService userService; + private final RedisUtils redisUtils; + + @AppLog(value = "公众号绑定手机号", type = 1) + @AuthCheck + @PostMapping("/binding") + @ApiOperation(value = "公众号绑定手机号", notes = "公众号绑定手机号") + public ApiResult verify(@Validated @RequestBody BindPhoneParam param) { + Object codeObj = redisUtils.get("code_" + param.getPhone()); + if(codeObj == null){ + return ApiResult.fail("请先获取验证码"); + } + String code = codeObj.toString(); + + if (!StrUtil.equals(code, param.getCaptcha())) { + return ApiResult.fail("验证码错误"); + } + YxUser user = LocalUser.getUser(); + if(StrUtil.isNotBlank(user.getPhone())){ + return ApiResult.fail("您的账号已经绑定过手机号码"); + } + + user.setPhone(param.getPhone()); + userService.updateById(user); + + return ApiResult.ok("绑定成功"); + + } + + @AppLog(value = "小程序绑定手机号", type = 1) + @AuthCheck + @PostMapping("/wxapp/binding") + @ApiOperation(value = "小程序绑定手机号", notes = "小程序绑定手机号") + public ApiResult> phone(@Validated @RequestBody WxPhoneParam param) { + YxUser user = LocalUser.getUser(); + if(StrUtil.isNotBlank(user.getPhone())){ + throw new YshopException("您的账号已经绑定过手机号码"); + } + + //读取redis配置 + String appId = redisUtils.getY(ShopKeyUtils.getWxAppAppId()); + String secret = redisUtils.getY(ShopKeyUtils.getWxAppSecret()); + if (StrUtil.isBlank(appId) || StrUtil.isBlank(secret)) { + throw new YshopException("请先配置小程序"); + } + WxMaService wxMaService = WxMaConfiguration.getWxMaService(); + String phone = ""; + try { + String sessionKey = RedisUtil.get(ShopConstants.YSHOP_MINI_SESSION_KET+ user.getUid()).toString(); + WxMaPhoneNumberInfo phoneNoInfo = wxMaService.getUserService() + .getPhoneNoInfo(sessionKey, param.getEncryptedData(), param.getIv()); + phone = phoneNoInfo.getPhoneNumber(); + user.setPhone(phone); + userService.updateById(user); + } catch (Exception e) { + e.printStackTrace(); + throw new YshopException("绑定失败"); + } + Map map = new LinkedHashMap<>(); + map.put("phone",phone); + + return ApiResult.ok(map,"绑定成功"); + } + + + +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/param/BindPhoneParam.java b/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/param/BindPhoneParam.java new file mode 100644 index 0000000..384813c --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/param/BindPhoneParam.java @@ -0,0 +1,25 @@ +package co.yixiang.modules.wechat.rest.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; + +/** + * @ClassName BindPhoneParam + * @Author hupeng <610796224@qq.com> + * @Date 2020/2/7 + **/ +@Getter +@Setter +public class BindPhoneParam { + + @NotBlank(message = "验证码必填") + @ApiModelProperty(value = "验证码") + private String captcha; + + @NotBlank(message = "手机号必填") + @ApiModelProperty(value = "手机号码") + private String phone; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/param/WxPhoneParam.java b/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/param/WxPhoneParam.java new file mode 100644 index 0000000..59f8a2a --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/param/WxPhoneParam.java @@ -0,0 +1,23 @@ +package co.yixiang.modules.wechat.rest.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; + +/** + * @ClassName WxPhoneParam + * @Author hupeng <610796224@qq.com> + * @Date 2020/02/07 + **/ +@Getter +@Setter +public class WxPhoneParam { + + @ApiModelProperty(value = "小程序完整用户信息的加密数据") + private String encryptedData; + + @ApiModelProperty(value = "小程序加密算法的初始向量") + private String iv; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/param/YxWechatTemplateQueryParam.java b/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/param/YxWechatTemplateQueryParam.java new file mode 100644 index 0000000..6578e8d --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/param/YxWechatTemplateQueryParam.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.wechat.rest.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 微信模板 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-12-10 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxWechatTemplateQueryParam对象", description="微信模板查询参数") +public class YxWechatTemplateQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/vo/YxWechatTemplateQueryVo.java b/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/vo/YxWechatTemplateQueryVo.java new file mode 100644 index 0000000..4af91bb --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/modules/wechat/rest/vo/YxWechatTemplateQueryVo.java @@ -0,0 +1,43 @@ +package co.yixiang.modules.wechat.rest.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 微信模板 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-12-10 + */ +@Data +@ApiModel(value = "YxWechatTemplateQueryVo对象", description = "微信模板查询参数") +public class YxWechatTemplateQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "模板id") + private Integer id; + + @ApiModelProperty(value = "模板编号") + private String tempkey; + + @ApiModelProperty(value = "模板名") + private String name; + + @ApiModelProperty(value = "回复内容") + private String content; + + @ApiModelProperty(value = "模板ID") + private String tempid; + + @ApiModelProperty(value = "添加时间") + private String addTime; + + @ApiModelProperty(value = "状态") + private Integer status; + +} diff --git a/yshop-app/src/main/java/co/yixiang/sales/rest/StoreAfterSalesController.java b/yshop-app/src/main/java/co/yixiang/sales/rest/StoreAfterSalesController.java new file mode 100644 index 0000000..f16e884 --- /dev/null +++ b/yshop-app/src/main/java/co/yixiang/sales/rest/StoreAfterSalesController.java @@ -0,0 +1,178 @@ +package co.yixiang.sales.rest; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.ApiResult; +import co.yixiang.api.YshopException; +import co.yixiang.common.bean.LocalUser; +import co.yixiang.common.interceptor.AuthCheck; +import co.yixiang.logging.aop.log.AppLog; +import co.yixiang.modules.order.domain.YxExpress; +import co.yixiang.modules.order.service.YxExpressService; +import co.yixiang.modules.order.service.dto.YxExpressQueryCriteria; +import co.yixiang.modules.sales.param.StoreAfterSalesParam; +import co.yixiang.modules.sales.service.StoreAfterSalesItemService; +import co.yixiang.modules.sales.service.StoreAfterSalesService; +import co.yixiang.modules.sales.service.StoreAfterSalesStatusService; +import co.yixiang.modules.sales.service.vo.StoreAfterSalesVo; +import co.yixiang.modules.sales.service.vo.YxStoreOrderCartInfoVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + +/** + * @author : gzlv 2021/6/27 16:00 + */ +@Slf4j +@RestController +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +@Api(value = "售后记录", tags = "用户:售后记录") +public class StoreAfterSalesController { + + @Autowired + private StoreAfterSalesService storeAfterSalesService; + @Autowired + private StoreAfterSalesItemService storeAfterSalesItemService; + @Autowired + private StoreAfterSalesStatusService storeAfterSalesStatusService; + @Autowired + private YxExpressService yxExpressService; + + @AuthCheck + @PostMapping("/applyForAfterSales") + @ApiOperation(value = "申请售后", notes = "申请售后") + public ApiResult applyForAfterSales(@RequestBody StoreAfterSalesParam storeAfterSalesParam) { + storeAfterSalesService.applyForAfterSales(LocalUser.getUser().getUid(), LocalUser.getUser().getNickname(), storeAfterSalesParam); + return ApiResult.ok(); + } + + @AuthCheck + @GetMapping("/applyForAfterSales/{key}") + @ApiOperation(value = "查询订单详情", notes = "查询订单详情") + public ApiResult> checkOrderDetails(@PathVariable String key) { + return ApiResult.ok(storeAfterSalesService.checkOrderDetails(key)); + } + + @AppLog(value = "查看售后列表", type = 1) + @AuthCheck + @GetMapping("/storeAfterSales/list") + @ApiOperation(value = "售后列表", notes = "售后列表") + public ApiResult salesList(@RequestParam(value = "type", defaultValue = "0") int type, + @RequestParam(value = "page", defaultValue = "1") int page, + @RequestParam(value = "limit", defaultValue = "10") int limit) { + Map map = storeAfterSalesService.salesList(LocalUser.getUser().getUid(), type, + page, null, limit); + Long total = (Long) map.get("total"); + Long totalPage = (Long) map.get("totalPage"); + return ApiResult.resultPage(total.intValue(), totalPage.intValue(), map.get("list")); + } + + @AppLog(value = "查看售後详情", type = 1) + @AuthCheck + @GetMapping("/store/detail/{key}/{id}") + @ApiImplicitParams({ + @ApiImplicitParam(name = "key", value = "唯一的key", paramType = "query", dataType = "string") + }) + @ApiOperation(value = "订单详情", notes = "订单详情") + public ApiResult detail(@PathVariable String key, @PathVariable Long id) { + Long uid = LocalUser.getUser().getUid(); + if (StrUtil.isEmpty(key)) { + throw new YshopException("参数错误"); + } + List storeInfo = storeAfterSalesService.getStoreInfo(key, id, uid); + if (storeInfo.size() < 1) { + throw new YshopException("售后订单不存在"); + } + storeAfterSalesService.handleSales(storeInfo.get(0)); + return ApiResult.ok(storeInfo.get(0)); + } + + @AppLog(value = "通过订单号搜索", type = 1) + @AuthCheck + @GetMapping("/store/detail/{key}") + @ApiImplicitParams({ + @ApiImplicitParam(name = "key", value = "唯一的key", paramType = "query", dataType = "string") + }) + @ApiOperation(value = "订单详情", notes = "订单详情") + public ApiResult> detail(@PathVariable String key) { + Long uid = LocalUser.getUser().getUid(); + if (StrUtil.isEmpty(key)) { + throw new YshopException("参数错误"); + } + List storeInfo = storeAfterSalesService.getStoreInfo(key, null, uid); + for (StoreAfterSalesVo storeAfterSalesVo : storeInfo) { + storeAfterSalesService.handleSales(storeAfterSalesVo); + } + if (ObjectUtil.isNull(storeInfo)) { + throw new YshopException("售后订单不存在"); + } + return ApiResult.ok(storeInfo); + } + + @AppLog(value = "撤销申请", type = 1) + @AuthCheck + @GetMapping("/revoke/{key}/{id}") + @ApiImplicitParams({ + @ApiImplicitParam(name = "key", value = "订单号", paramType = "query", dataType = "string") + }) + @ApiOperation(value = "撤销申请", notes = "撤销申请") + public ApiResult revoke(@PathVariable String key, @PathVariable Long id) { + Long uid = LocalUser.getUser().getUid(); + if (StrUtil.isEmpty(key)) { + throw new YshopException("参数错误"); + } + Boolean revoke = storeAfterSalesService.revoke(key, id, uid); + return ApiResult.ok(revoke); + } + + @ApiOperation(value = "查询快递") + @GetMapping(value = "/yxExpress") + public ApiResult> getYxExpresss(YxExpressQueryCriteria criteria) { + return ApiResult.ok(yxExpressService.queryAll(criteria)); + } + + @AppLog(value = "添加物流信息", type = 1) + @AuthCheck + @PostMapping("/addLogisticsInformation") + @ApiImplicitParams({ + @ApiImplicitParam(name = "code", value = "快递公司编码", paramType = "query", dataType = "string"), + @ApiImplicitParam(name = "name", value = "快递公司名称", paramType = "query", dataType = "string"), + @ApiImplicitParam(name = "postalCode", value = "快递编号", paramType = "query", dataType = "string"), + @ApiImplicitParam(name = "orderCode", value = "订单编号", paramType = "query", dataType = "string") + }) + @ApiOperation(value = "添加物流信息", notes = "添加物流信息") + public ApiResult addLogisticsInformation(@RequestParam String code, @RequestParam String name, @RequestParam String postalCode, @RequestParam String orderCode) { + Long uid = LocalUser.getUser().getUid(); + if (StrUtil.isEmpty(code) || StrUtil.isEmpty(name) || StrUtil.isEmpty(postalCode)) { + throw new YshopException("参数错误"); + } + Boolean revoke = storeAfterSalesService.addLogisticsInformation(code, name, postalCode, orderCode); + return ApiResult.ok(revoke); + } + + @AppLog(value = "删除售后订单", type = 1) + @AuthCheck + @DeleteMapping("/deleteAfterSalesOrder") + @ApiImplicitParams({ + @ApiImplicitParam(name = "orderCode", value = "订单编码", paramType = "query", dataType = "string") + }) + @ApiOperation(value = "删除售后订单", notes = "删除售后订单") + public ApiResult deleteAfterSalesOrder(@RequestParam String orderCode, @RequestParam Long id) { + Long uid = LocalUser.getUser().getUid(); + if (StrUtil.isEmpty(orderCode) || ObjectUtil.isEmpty(id)) { + throw new YshopException("参数错误"); + } + Boolean revoke = storeAfterSalesService.deleteAfterSalesOrder(orderCode, id); + return ApiResult.ok(revoke); + } + + +} diff --git a/yshop-app/src/main/resources/background.png b/yshop-app/src/main/resources/background.png new file mode 100644 index 0000000..f05a8f9 Binary files /dev/null and b/yshop-app/src/main/resources/background.png differ diff --git a/yshop-app/src/main/resources/banner.txt b/yshop-app/src/main/resources/banner.txt new file mode 100644 index 0000000..13dced1 --- /dev/null +++ b/yshop-app/src/main/resources/banner.txt @@ -0,0 +1,12 @@ + __ + __ __ ___ / / ___ ___ + / // /(_-< / _ \/ _ \ / _ \ + \_, //___//_//_/\___// .__/ +/___/ /_/ + + :: Application Version:: ${yshop.version} + :: Spring Boot :: ${spring-boot.version} + + + + diff --git a/yshop-app/src/main/resources/city.json b/yshop-app/src/main/resources/city.json new file mode 100644 index 0000000..e5b394a --- /dev/null +++ b/yshop-app/src/main/resources/city.json @@ -0,0 +1 @@ +{"province_list":{"110000":"北京市","120000":"天津市","130000":"河北省","140000":"山西省","150000":"内蒙古自治区","210000":"辽宁省","220000":"吉林省","230000":"黑龙江省","310000":"上海市","320000":"江苏省","330000":"浙江省","340000":"安徽省","350000":"福建省","360000":"江西省","370000":"山东省","410000":"河南省","420000":"湖北省","430000":"湖南省","440000":"广东省","450000":"广西壮族自治区","460000":"海南省","500000":"重庆市","510000":"四川省","520000":"贵州省","530000":"云南省","540000":"西藏自治区","610000":"陕西省","620000":"甘肃省","630000":"青海省","640000":"宁夏回族自治区","650000":"新疆维吾尔自治区","710000":"台湾省","810000":"香港特别行政区","820000":"澳门特别行政区","900000":"海外"},"city_list":{"110100":"北京市","120100":"天津市","130100":"石家庄市","130200":"唐山市","130300":"秦皇岛市","130400":"邯郸市","130500":"邢台市","130600":"保定市","130700":"张家口市","130800":"承德市","130900":"沧州市","131000":"廊坊市","131100":"衡水市","140100":"太原市","140200":"大同市","140300":"阳泉市","140400":"长治市","140500":"晋城市","140600":"朔州市","140700":"晋中市","140800":"运城市","140900":"忻州市","141000":"临汾市","141100":"吕梁市","150100":"呼和浩特市","150200":"包头市","150300":"乌海市","150400":"赤峰市","150500":"通辽市","150600":"鄂尔多斯市","150700":"呼伦贝尔市","150800":"巴彦淖尔市","150900":"乌兰察布市","152200":"兴安盟","152500":"锡林郭勒盟","152900":"阿拉善盟","210100":"沈阳市","210200":"大连市","210300":"鞍山市","210400":"抚顺市","210500":"本溪市","210600":"丹东市","210700":"锦州市","210800":"营口市","210900":"阜新市","211000":"辽阳市","211100":"盘锦市","211200":"铁岭市","211300":"朝阳市","211400":"葫芦岛市","220100":"长春市","220200":"吉林市","220300":"四平市","220400":"辽源市","220500":"通化市","220600":"白山市","220700":"松原市","220800":"白城市","222400":"延边朝鲜族自治州","230100":"哈尔滨市","230200":"齐齐哈尔市","230300":"鸡西市","230400":"鹤岗市","230500":"双鸭山市","230600":"大庆市","230700":"伊春市","230800":"佳木斯市","230900":"七台河市","231000":"牡丹江市","231100":"黑河市","231200":"绥化市","232700":"大兴安岭地区","310100":"上海市","320100":"南京市","320200":"无锡市","320300":"徐州市","320400":"常州市","320500":"苏州市","320600":"南通市","320700":"连云港市","320800":"淮安市","320900":"盐城市","321000":"扬州市","321100":"镇江市","321200":"泰州市","321300":"宿迁市","330100":"杭州市","330200":"宁波市","330300":"温州市","330400":"嘉兴市","330500":"湖州市","330600":"绍兴市","330700":"金华市","330800":"衢州市","330900":"舟山市","331000":"台州市","331100":"丽水市","340100":"合肥市","340200":"芜湖市","340300":"蚌埠市","340400":"淮南市","340500":"马鞍山市","340600":"淮北市","340700":"铜陵市","340800":"安庆市","341000":"黄山市","341100":"滁州市","341200":"阜阳市","341300":"宿州市","341500":"六安市","341600":"亳州市","341700":"池州市","341800":"宣城市","350100":"福州市","350200":"厦门市","350300":"莆田市","350400":"三明市","350500":"泉州市","350600":"漳州市","350700":"南平市","350800":"龙岩市","350900":"宁德市","360100":"南昌市","360200":"景德镇市","360300":"萍乡市","360400":"九江市","360500":"新余市","360600":"鹰潭市","360700":"赣州市","360800":"吉安市","360900":"宜春市","361000":"抚州市","361100":"上饶市","370100":"济南市","370200":"青岛市","370300":"淄博市","370400":"枣庄市","370500":"东营市","370600":"烟台市","370700":"潍坊市","370800":"济宁市","370900":"泰安市","371000":"威海市","371100":"日照市","371300":"临沂市","371400":"德州市","371500":"聊城市","371600":"滨州市","371700":"菏泽市","410100":"郑州市","410200":"开封市","410300":"洛阳市","410400":"平顶山市","410500":"安阳市","410600":"鹤壁市","410700":"新乡市","410800":"焦作市","410900":"濮阳市","411000":"许昌市","411100":"漯河市","411200":"三门峡市","411300":"南阳市","411400":"商丘市","411500":"信阳市","411600":"周口市","411700":"驻马店市","419000":"省直辖县","420100":"武汉市","420200":"黄石市","420300":"十堰市","420500":"宜昌市","420600":"襄阳市","420700":"鄂州市","420800":"荆门市","420900":"孝感市","421000":"荆州市","421100":"黄冈市","421200":"咸宁市","421300":"随州市","422800":"恩施土家族苗族自治州","429000":"省直辖县","430100":"长沙市","430200":"株洲市","430300":"湘潭市","430400":"衡阳市","430500":"邵阳市","430600":"岳阳市","430700":"常德市","430800":"张家界市","430900":"益阳市","431000":"郴州市","431100":"永州市","431200":"怀化市","431300":"娄底市","433100":"湘西土家族苗族自治州","440100":"广州市","440200":"韶关市","440300":"深圳市","440400":"珠海市","440500":"汕头市","440600":"佛山市","440700":"江门市","440800":"湛江市","440900":"茂名市","441200":"肇庆市","441300":"惠州市","441400":"梅州市","441500":"汕尾市","441600":"河源市","441700":"阳江市","441800":"清远市","441900":"东莞市","442000":"中山市","445100":"潮州市","445200":"揭阳市","445300":"云浮市","450100":"南宁市","450200":"柳州市","450300":"桂林市","450400":"梧州市","450500":"北海市","450600":"防城港市","450700":"钦州市","450800":"贵港市","450900":"玉林市","451000":"百色市","451100":"贺州市","451200":"河池市","451300":"来宾市","451400":"崇左市","460100":"海口市","460200":"三亚市","460300":"三沙市","460400":"儋州市","469000":"省直辖县","500100":"重庆市","500200":"县","510100":"成都市","510300":"自贡市","510400":"攀枝花市","510500":"泸州市","510600":"德阳市","510700":"绵阳市","510800":"广元市","510900":"遂宁市","511000":"内江市","511100":"乐山市","511300":"南充市","511400":"眉山市","511500":"宜宾市","511600":"广安市","511700":"达州市","511800":"雅安市","511900":"巴中市","512000":"资阳市","513200":"阿坝藏族羌族自治州","513300":"甘孜藏族自治州","513400":"凉山彝族自治州","520100":"贵阳市","520200":"六盘水市","520300":"遵义市","520400":"安顺市","520500":"毕节市","520600":"铜仁市","522300":"黔西南布依族苗族自治州","522600":"黔东南苗族侗族自治州","522700":"黔南布依族苗族自治州","530100":"昆明市","530300":"曲靖市","530400":"玉溪市","530500":"保山市","530600":"昭通市","530700":"丽江市","530800":"普洱市","530900":"临沧市","532300":"楚雄彝族自治州","532500":"红河哈尼族彝族自治州","532600":"文山壮族苗族自治州","532800":"西双版纳傣族自治州","532900":"大理白族自治州","533100":"德宏傣族景颇族自治州","533300":"怒江傈僳族自治州","533400":"迪庆藏族自治州","540100":"拉萨市","540200":"日喀则市","540300":"昌都市","540400":"林芝市","540500":"山南市","540600":"那曲市","542500":"阿里地区","610100":"西安市","610200":"铜川市","610300":"宝鸡市","610400":"咸阳市","610500":"渭南市","610600":"延安市","610700":"汉中市","610800":"榆林市","610900":"安康市","611000":"商洛市","620100":"兰州市","620200":"嘉峪关市","620300":"金昌市","620400":"白银市","620500":"天水市","620600":"武威市","620700":"张掖市","620800":"平凉市","620900":"酒泉市","621000":"庆阳市","621100":"定西市","621200":"陇南市","622900":"临夏回族自治州","623000":"甘南藏族自治州","630100":"西宁市","630200":"海东市","632200":"海北藏族自治州","632300":"黄南藏族自治州","632500":"海南藏族自治州","632600":"果洛藏族自治州","632700":"玉树藏族自治州","632800":"海西蒙古族藏族自治州","640100":"银川市","640200":"石嘴山市","640300":"吴忠市","640400":"固原市","640500":"中卫市","650100":"乌鲁木齐市","650200":"克拉玛依市","650400":"吐鲁番市","650500":"哈密市","652300":"昌吉回族自治州","652700":"博尔塔拉蒙古自治州","652800":"巴音郭楞蒙古自治州","652900":"阿克苏地区","653000":"克孜勒苏柯尔克孜自治州","653100":"喀什地区","653200":"和田地区","654000":"伊犁哈萨克自治州","654200":"塔城地区","654300":"阿勒泰地区","659000":"自治区直辖县级行政区划","710100":"台北市","710200":"高雄市","710300":"台南市","710400":"台中市","710500":"金门县","710600":"南投县","710700":"基隆市","710800":"新竹市","710900":"嘉义市","711100":"新北市","711200":"宜兰县","711300":"新竹县","711400":"桃园县","711500":"苗栗县","711700":"彰化县","711900":"嘉义县","712100":"云林县","712400":"屏东县","712500":"台东县","712600":"花莲县","712700":"澎湖县","712800":"连江县","810100":"香港岛","810200":"九龙","810300":"新界","820100":"澳门半岛","820200":"离岛","900400":"阿富汗","900800":"阿尔巴尼亚","901000":"南极洲","901200":"阿尔及利亚","901600":"美属萨摩亚","902000":"安道尔","902400":"安哥拉","902800":"安提瓜和巴布达","903100":"阿塞拜疆","903200":"阿根廷","903600":"澳大利亚","904000":"奥地利","904400":"巴哈马","904800":"巴林","905000":"孟加拉","905100":"亚美尼亚","905200":"巴巴多斯","905600":"比利时","906000":"百慕大","906400":"不丹","906800":"玻利维亚","907000":"波黑","907200":"博茨瓦纳","907400":"布韦岛","907600":"巴西","908400":"伯利兹","908600":"英属印度洋领地","909000":"所罗门群岛","909200":"英属维尔京群岛","909600":"文莱","910000":"保加利亚","910400":"缅甸","910800":"布隆迪","911200":"白俄罗斯","911600":"柬埔寨","912000":"喀麦隆","912400":"加拿大","913200":"佛得角","913600":"开曼群岛","914000":"中非","914400":"斯里兰卡","914800":"乍得","915200":"智利","916200":"圣诞岛","916600":"科科斯群岛","917000":"哥伦比亚","917400":"科摩罗","917500":"马约特","917800":"刚果(布)","918000":"刚果(金)","918400":"库克群岛","918800":"哥斯达黎加","919100":"克罗地亚","919200":"古巴","919600":"塞浦路斯","920300":"捷克","920400":"贝宁","920800":"丹麦","921200":"多米尼克","921400":"多米尼加","921800":"厄瓜多尔","922200":"萨尔瓦多","922600":"赤道几内亚","923100":"埃塞俄比亚","923200":"厄立特里亚","923300":"爱沙尼亚","923400":"法罗群岛","923800":"马尔维纳斯群岛( 福克兰)","923900":"南乔治亚岛和南桑威奇群岛","924200":"斐济群岛","924600":"芬兰","924800":"奥兰群岛","925000":"法国","925400":"法属圭亚那","925800":"法属波利尼西亚","926000":"法属南部领地","926200":"吉布提","926600":"加蓬","926800":"格鲁吉亚","927000":"冈比亚","927500":"巴勒斯坦","927600":"德国","928800":"加纳","929200":"直布罗陀","929600":"基里巴斯","930000":"希腊","930400":"格陵兰","930800":"格林纳达","931200":"瓜德罗普","931600":"关岛","932000":"危地马拉","932400":"几内亚","932800":"圭亚那","933200":"海地","933400":"赫德岛和麦克唐纳群岛","933600":"梵蒂冈","934000":"洪都拉斯","934800":"匈牙利","935200":"冰岛","935600":"印度","936000":"印尼","936400":"伊朗","936800":"伊拉克","937200":"爱尔兰","937600":"以色列","938000":"意大利","938400":"科特迪瓦","938800":"牙买加","939200":"日本","939800":"哈萨克斯坦","940000":"约旦","940400":"肯尼亚","940800":"朝鲜 北朝鲜","941000":"韩国","941400":"科威特","941700":"吉尔吉斯斯坦","941800":"老挝","942200":"黎巴嫩","942600":"莱索托","942800":"拉脱维亚","943000":"利比里亚","943400":"利比亚","943800":"列支敦士登","944000":"立陶宛","944200":"卢森堡","945000":"马达加斯加","945400":"马拉维","945800":"马来西亚","946200":"马尔代夫","946600":"马里","947000":"马耳他","947400":"马提尼克","947800":"毛里塔尼亚","948000":"毛里求斯","948400":"墨西哥","949200":"摩纳哥","949600":"蒙古国","949800":"摩尔多瓦","949900":"黑山","950000":"蒙塞拉特岛","950400":"摩洛哥","950800":"莫桑比克","951200":"阿曼","951600":"纳米比亚","952000":"瑙鲁","952400":"尼泊尔","952800":"荷兰","953300":"阿鲁巴","953500":"荷兰加勒比区","954000":"新喀里多尼亚","954800":"瓦努阿图","955400":"新西兰","955800":"尼加拉瓜","956200":"尼日尔","956600":"尼日利亚","957000":"纽埃","957400":"诺福克岛","957800":"挪威","958000":"北马里亚纳群岛","958100":"美国本土外小岛屿","958300":"密克罗尼西亚联邦","958400":"马绍尔群岛","958500":"帕劳","958600":"巴基斯坦","959100":"巴拿马","959800":"巴布亚新几内亚","960000":"巴拉圭","960400":"秘鲁","960800":"菲律宾","961200":"皮特凯恩群岛","961600":"波兰","962000":"葡萄牙","962400":"几内亚比绍","962600":"东帝汶","963000":"波多黎各","963400":"卡塔尔","963800":"留尼汪","964200":"罗马尼亚","964300":"俄罗斯","964600":"卢旺达","965200":"圣巴泰勒米岛","965400":"圣赫勒拿","965900":"圣基茨和尼维斯","966000":"安圭拉","966200":"圣卢西亚","966300":"法属圣马丁","966600":"圣皮埃尔和密克隆","967000":"圣文森特和格林纳丁斯","967400":"圣马力诺","967800":"圣多美和普林西比","968200":"沙特阿拉伯","968600":"塞内加尔","968800":"塞尔维亚","969000":"塞舌尔","969400":"塞拉利昂","970200":"新加坡","970300":"斯洛伐克","970400":"越南","970500":"斯洛文尼亚","970600":"索马里","971000":"南非","971600":"津巴布韦","972400":"西班牙","972800":"南苏丹","972900":"苏丹","973200":"西撒哈拉","974000":"苏里南","974400":"斯瓦尔巴群岛和 扬马延岛","974800":"斯威士兰","975200":"瑞典","975600":"瑞士","976000":"叙利亚","976200":"塔吉克斯坦","976400":"泰国","976800":"多哥","977200":"托克劳","977600":"汤加","978000":"特立尼达和多巴哥","978400":"阿联酋","978800":"突尼斯","979200":"土耳其","979500":"土库曼斯坦","979600":"特克斯和凯科斯群岛","979800":"图瓦卢","980000":"乌干达","980400":"乌克兰","980700":"马其顿","981800":"埃及","982600":"英国","983100":"根西岛","983200":"泽西岛","983300":"马恩岛","983400":"坦桑尼亚","984000":"美国","985000":"美属维尔京群岛","985400":"布基纳法索","985800":"乌拉圭","986000":"乌兹别克斯坦","986200":"委内瑞拉","987600":"瓦利斯和富图纳","988200":"萨摩亚","988700":"也门","989400":"赞比亚"},"county_list":{"110101":"东城区","110102":"西城区","110105":"朝阳区","110106":"丰台区","110107":"石景山区","110108":"海淀区","110109":"门头沟区","110111":"房山区","110112":"通州区","110113":"顺义区","110114":"昌平区","110115":"大兴区","110116":"怀柔区","110117":"平谷区","110118":"密云区","110119":"延庆区","120101":"和平区","120102":"河东区","120103":"河西区","120104":"南开区","120105":"河北区","120106":"红桥区","120110":"东丽区","120111":"西青区","120112":"津南区","120113":"北辰区","120114":"武清区","120115":"宝坻区","120116":"滨海新区","120117":"宁河区","120118":"静海区","120119":"蓟州区","130102":"长安区","130104":"桥西区","130105":"新华区","130107":"井陉矿区","130108":"裕华区","130109":"藁城区","130110":"鹿泉区","130111":"栾城区","130121":"井陉县","130123":"正定县","130125":"行唐县","130126":"灵寿县","130127":"高邑县","130128":"深泽县","130129":"赞皇县","130130":"无极县","130131":"平山县","130132":"元氏县","130133":"赵县","130181":"辛集市","130183":"晋州市","130184":"新乐市","130202":"路南区","130203":"路北区","130204":"古冶区","130205":"开平区","130207":"丰南区","130208":"丰润区","130209":"曹妃甸区","130224":"滦南县","130225":"乐亭县","130227":"迁西县","130229":"玉田县","130281":"遵化市","130283":"迁安市","130284":"滦州市","130302":"海港区","130303":"山海关区","130304":"北戴河区","130306":"抚宁区","130321":"青龙满族自治县","130322":"昌黎县","130324":"卢龙县","130390":"经济技术开发区","130402":"邯山区","130403":"丛台区","130404":"复兴区","130406":"峰峰矿区","130407":"肥乡区","130408":"永年区","130423":"临漳县","130424":"成安县","130425":"大名县","130426":"涉县","130427":"磁县","130430":"邱县","130431":"鸡泽县","130432":"广平县","130433":"馆陶县","130434":"魏县","130435":"曲周县","130481":"武安市","130502":"桥东区","130503":"桥西区","130521":"邢台县","130522":"临城县","130523":"内丘县","130524":"柏乡县","130525":"隆尧县","130526":"任县","130527":"南和县","130528":"宁晋县","130529":"巨鹿县","130530":"新河县","130531":"广宗县","130532":"平乡县","130533":"威县","130534":"清河县","130535":"临西县","130581":"南宫市","130582":"沙河市","130602":"竞秀区","130606":"莲池区","130607":"满城区","130608":"清苑区","130609":"徐水区","130623":"涞水县","130624":"阜平县","130626":"定兴县","130627":"唐县","130628":"高阳县","130629":"容城县","130630":"涞源县","130631":"望都县","130632":"安新县","130633":"易县","130634":"曲阳县","130635":"蠡县","130636":"顺平县","130637":"博野县","130638":"雄县","130681":"涿州市","130682":"定州市","130683":"安国市","130684":"高碑店市","130702":"桥东区","130703":"桥西区","130705":"宣化区","130706":"下花园区","130708":"万全区","130709":"崇礼区","130722":"张北县","130723":"康保县","130724":"沽源县","130725":"尚义县","130726":"蔚县","130727":"阳原县","130728":"怀安县","130730":"怀来县","130731":"涿鹿县","130732":"赤城县","130802":"双桥区","130803":"双滦区","130804":"鹰手营子矿区","130821":"承德县","130822":"兴隆县","130824":"滦平县","130825":"隆化县","130826":"丰宁满族自治县","130827":"宽城满族自治县","130828":"围场满族蒙古族自治县","130881":"平泉市","130902":"新华区","130903":"运河区","130921":"沧县","130922":"青县","130923":"东光县","130924":"海兴县","130925":"盐山县","130926":"肃宁县","130927":"南皮县","130928":"吴桥县","130929":"献县","130930":"孟村回族自治县","130981":"泊头市","130982":"任丘市","130983":"黄骅市","130984":"河间市","131002":"安次区","131003":"广阳区","131022":"固安县","131023":"永清县","131024":"香河县","131025":"大城县","131026":"文安县","131028":"大厂回族自治县","131081":"霸州市","131082":"三河市","131090":"开发区","131102":"桃城区","131103":"冀州区","131121":"枣强县","131122":"武邑县","131123":"武强县","131124":"饶阳县","131125":"安平县","131126":"故城县","131127":"景县","131128":"阜城县","131182":"深州市","140105":"小店区","140106":"迎泽区","140107":"杏花岭区","140108":"尖草坪区","140109":"万柏林区","140110":"晋源区","140121":"清徐县","140122":"阳曲县","140123":"娄烦县","140181":"古交市","140212":"新荣区","140213":"平城区","140214":"云冈区","140215":"云州区","140221":"阳高县","140222":"天镇县","140223":"广灵县","140224":"灵丘县","140225":"浑源县","140226":"左云县","140302":"城区","140303":"矿区","140311":"郊区","140321":"平定县","140322":"盂县","140403":"潞州区","140404":"上党区","140405":"屯留区","140406":"潞城区","140423":"襄垣县","140425":"平顺县","140426":"黎城县","140427":"壶关县","140428":"长子县","140429":"武乡县","140430":"沁县","140431":"沁源县","140502":"城区","140521":"沁水县","140522":"阳城县","140524":"陵川县","140525":"泽州县","140581":"高平市","140602":"朔城区","140603":"平鲁区","140621":"山阴县","140622":"应县","140623":"右玉县","140681":"怀仁市","140702":"榆次区","140721":"榆社县","140722":"左权县","140723":"和顺县","140724":"昔阳县","140725":"寿阳县","140726":"太谷县","140727":"祁县","140728":"平遥县","140729":"灵石县","140781":"介休市","140802":"盐湖区","140821":"临猗县","140822":"万荣县","140823":"闻喜县","140824":"稷山县","140825":"新绛县","140826":"绛县","140827":"垣曲县","140828":"夏县","140829":"平陆县","140830":"芮城县","140881":"永济市","140882":"河津市","140902":"忻府区","140921":"定襄县","140922":"五台县","140923":"代县","140924":"繁峙县","140925":"宁武县","140926":"静乐县","140927":"神池县","140928":"五寨县","140929":"岢岚县","140930":"河曲县","140931":"保德县","140932":"偏关县","140981":"原平市","141002":"尧都区","141021":"曲沃县","141022":"翼城县","141023":"襄汾县","141024":"洪洞县","141025":"古县","141026":"安泽县","141027":"浮山县","141028":"吉县","141029":"乡宁县","141030":"大宁县","141031":"隰县","141032":"永和县","141033":"蒲县","141034":"汾西县","141081":"侯马市","141082":"霍州市","141102":"离石区","141121":"文水县","141122":"交城县","141123":"兴县","141124":"临县","141125":"柳林县","141126":"石楼县","141127":"岚县","141128":"方山县","141129":"中阳县","141130":"交口县","141181":"孝义市","141182":"汾阳市","150102":"新城区","150103":"回民区","150104":"玉泉区","150105":"赛罕区","150121":"土默特左旗","150122":"托克托县","150123":"和林格尔县","150124":"清水河县","150125":"武川县","150202":"东河区","150203":"昆都仑区","150204":"青山区","150205":"石拐区","150206":"白云鄂博矿区","150207":"九原区","150221":"土默特右旗","150222":"固阳县","150223":"达尔罕茂明安联合旗","150302":"海勃湾区","150303":"海南区","150304":"乌达区","150402":"红山区","150403":"元宝山区","150404":"松山区","150421":"阿鲁科尔沁旗","150422":"巴林左旗","150423":"巴林右旗","150424":"林西县","150425":"克什克腾旗","150426":"翁牛特旗","150428":"喀喇沁旗","150429":"宁城县","150430":"敖汉旗","150502":"科尔沁区","150521":"科尔沁左翼中旗","150522":"科尔沁左翼后旗","150523":"开鲁县","150524":"库伦旗","150525":"奈曼旗","150526":"扎鲁特旗","150581":"霍林郭勒市","150602":"东胜区","150603":"康巴什区","150621":"达拉特旗","150622":"准格尔旗","150623":"鄂托克前旗","150624":"鄂托克旗","150625":"杭锦旗","150626":"乌审旗","150627":"伊金霍洛旗","150702":"海拉尔区","150703":"扎赉诺尔区","150721":"阿荣旗","150722":"莫力达瓦达斡尔族自治旗","150723":"鄂伦春自治旗","150724":"鄂温克族自治旗","150725":"陈巴尔虎旗","150726":"新巴尔虎左旗","150727":"新巴尔虎右旗","150781":"满洲里市","150782":"牙克石市","150783":"扎兰屯市","150784":"额尔古纳市","150785":"根河市","150802":"临河区","150821":"五原县","150822":"磴口县","150823":"乌拉特前旗","150824":"乌拉特中旗","150825":"乌拉特后旗","150826":"杭锦后旗","150902":"集宁区","150921":"卓资县","150922":"化德县","150923":"商都县","150924":"兴和县","150925":"凉城县","150926":"察哈尔右翼前旗","150927":"察哈尔右翼中旗","150928":"察哈尔右翼后旗","150929":"四子王旗","150981":"丰镇市","152201":"乌兰浩特市","152202":"阿尔山市","152221":"科尔沁右翼前旗","152222":"科尔沁右翼中旗","152223":"扎赉特旗","152224":"突泉县","152501":"二连浩特市","152502":"锡林浩特市","152522":"阿巴嘎旗","152523":"苏尼特左旗","152524":"苏尼特右旗","152525":"东乌珠穆沁旗","152526":"西乌珠穆沁旗","152527":"太仆寺旗","152528":"镶黄旗","152529":"正镶白旗","152530":"正蓝旗","152531":"多伦县","152921":"阿拉善左旗","152922":"阿拉善右旗","152923":"额济纳旗","210102":"和平区","210103":"沈河区","210104":"大东区","210105":"皇姑区","210106":"铁西区","210111":"苏家屯区","210112":"浑南区","210113":"沈北新区","210114":"于洪区","210115":"辽中区","210123":"康平县","210124":"法库县","210181":"新民市","210190":"经济技术开发区","210202":"中山区","210203":"西岗区","210204":"沙河口区","210211":"甘井子区","210212":"旅顺口区","210213":"金州区","210214":"普兰店区","210224":"长海县","210281":"瓦房店市","210283":"庄河市","210302":"铁东区","210303":"铁西区","210304":"立山区","210311":"千山区","210321":"台安县","210323":"岫岩满族自治县","210381":"海城市","210390":"高新区","210402":"新抚区","210403":"东洲区","210404":"望花区","210411":"顺城区","210421":"抚顺县","210422":"新宾满族自治县","210423":"清原满族自治县","210502":"平山区","210503":"溪湖区","210504":"明山区","210505":"南芬区","210521":"本溪满族自治县","210522":"桓仁满族自治县","210602":"元宝区","210603":"振兴区","210604":"振安区","210624":"宽甸满族自治县","210681":"东港市","210682":"凤城市","210702":"古塔区","210703":"凌河区","210711":"太和区","210726":"黑山县","210727":"义县","210781":"凌海市","210782":"北镇市","210793":"经济技术开发区","210802":"站前区","210803":"西市区","210804":"鲅鱼圈区","210811":"老边区","210881":"盖州市","210882":"大石桥市","210902":"海州区","210903":"新邱区","210904":"太平区","210905":"清河门区","210911":"细河区","210921":"阜新蒙古族自治县","210922":"彰武县","211002":"白塔区","211003":"文圣区","211004":"宏伟区","211005":"弓长岭区","211011":"太子河区","211021":"辽阳县","211081":"灯塔市","211102":"双台子区","211103":"兴隆台区","211104":"大洼区","211122":"盘山县","211202":"银州区","211204":"清河区","211221":"铁岭县","211223":"西丰县","211224":"昌图县","211281":"调兵山市","211282":"开原市","211302":"双塔区","211303":"龙城区","211321":"朝阳县","211322":"建平县","211324":"喀喇沁左翼蒙古族自治县","211381":"北票市","211382":"凌源市","211402":"连山区","211403":"龙港区","211404":"南票区","211421":"绥中县","211422":"建昌县","211481":"兴城市","220102":"南关区","220103":"宽城区","220104":"朝阳区","220105":"二道区","220106":"绿园区","220112":"双阳区","220113":"九台区","220122":"农安县","220182":"榆树市","220183":"德惠市","220192":"经济技术开发区","220202":"昌邑区","220203":"龙潭区","220204":"船营区","220211":"丰满区","220221":"永吉县","220281":"蛟河市","220282":"桦甸市","220283":"舒兰市","220284":"磐石市","220302":"铁西区","220303":"铁东区","220322":"梨树县","220323":"伊通满族自治县","220381":"公主岭市","220382":"双辽市","220402":"龙山区","220403":"西安区","220421":"东丰县","220422":"东辽县","220502":"东昌区","220503":"二道江区","220521":"通化县","220523":"辉南县","220524":"柳河县","220581":"梅河口市","220582":"集安市","220602":"浑江区","220605":"江源区","220621":"抚松县","220622":"靖宇县","220623":"长白朝鲜族自治县","220681":"临江市","220702":"宁江区","220721":"前郭尔罗斯蒙古族自治县","220722":"长岭县","220723":"乾安县","220781":"扶余市","220802":"洮北区","220821":"镇赉县","220822":"通榆县","220881":"洮南市","220882":"大安市","222401":"延吉市","222402":"图们市","222403":"敦化市","222404":"珲春市","222405":"龙井市","222406":"和龙市","222424":"汪清县","222426":"安图县","230102":"道里区","230103":"南岗区","230104":"道外区","230108":"平房区","230109":"松北区","230110":"香坊区","230111":"呼兰区","230112":"阿城区","230113":"双城区","230123":"依兰县","230124":"方正县","230125":"宾县","230126":"巴彦县","230127":"木兰县","230128":"通河县","230129":"延寿县","230183":"尚志市","230184":"五常市","230202":"龙沙区","230203":"建华区","230204":"铁锋区","230205":"昂昂溪区","230206":"富拉尔基区","230207":"碾子山区","230208":"梅里斯达斡尔族区","230221":"龙江县","230223":"依安县","230224":"泰来县","230225":"甘南县","230227":"富裕县","230229":"克山县","230230":"克东县","230231":"拜泉县","230281":"讷河市","230302":"鸡冠区","230303":"恒山区","230304":"滴道区","230305":"梨树区","230306":"城子河区","230307":"麻山区","230321":"鸡东县","230381":"虎林市","230382":"密山市","230402":"向阳区","230403":"工农区","230404":"南山区","230405":"兴安区","230406":"东山区","230407":"兴山区","230421":"萝北县","230422":"绥滨县","230502":"尖山区","230503":"岭东区","230505":"四方台区","230506":"宝山区","230521":"集贤县","230522":"友谊县","230523":"宝清县","230524":"饶河县","230602":"萨尔图区","230603":"龙凤区","230604":"让胡路区","230605":"红岗区","230606":"大同区","230621":"肇州县","230622":"肇源县","230623":"林甸县","230624":"杜尔伯特蒙古族自治县","230702":"伊春区","230703":"南岔区","230704":"友好区","230705":"西林区","230706":"翠峦区","230707":"新青区","230708":"美溪区","230709":"金山屯区","230710":"五营区","230711":"乌马河区","230712":"汤旺河区","230713":"带岭区","230714":"乌伊岭区","230715":"红星区","230716":"上甘岭区","230722":"嘉荫县","230781":"铁力市","230803":"向阳区","230804":"前进区","230805":"东风区","230811":"郊区","230822":"桦南县","230826":"桦川县","230828":"汤原县","230881":"同江市","230882":"富锦市","230883":"抚远市","230902":"新兴区","230903":"桃山区","230904":"茄子河区","230921":"勃利县","231002":"东安区","231003":"阳明区","231004":"爱民区","231005":"西安区","231025":"林口县","231081":"绥芬河市","231083":"海林市","231084":"宁安市","231085":"穆棱市","231086":"东宁市","231102":"爱辉区","231121":"嫩江县","231123":"逊克县","231124":"孙吴县","231181":"北安市","231182":"五大连池市","231202":"北林区","231221":"望奎县","231222":"兰西县","231223":"青冈县","231224":"庆安县","231225":"明水县","231226":"绥棱县","231281":"安达市","231282":"肇东市","231283":"海伦市","232701":"漠河市","232721":"呼玛县","232722":"塔河县","232790":"松岭区","232791":"呼中区","232792":"加格达奇区","232793":"新林区","310101":"黄浦区","310104":"徐汇区","310105":"长宁区","310106":"静安区","310107":"普陀区","310109":"虹口区","310110":"杨浦区","310112":"闵行区","310113":"宝山区","310114":"嘉定区","310115":"浦东新区","310116":"金山区","310117":"松江区","310118":"青浦区","310120":"奉贤区","310151":"崇明区","320102":"玄武区","320104":"秦淮区","320105":"建邺区","320106":"鼓楼区","320111":"浦口区","320113":"栖霞区","320114":"雨花台区","320115":"江宁区","320116":"六合区","320117":"溧水区","320118":"高淳区","320205":"锡山区","320206":"惠山区","320211":"滨湖区","320213":"梁溪区","320214":"新吴区","320281":"江阴市","320282":"宜兴市","320302":"鼓楼区","320303":"云龙区","320305":"贾汪区","320311":"泉山区","320312":"铜山区","320321":"丰县","320322":"沛县","320324":"睢宁县","320381":"新沂市","320382":"邳州市","320391":"工业园区","320402":"天宁区","320404":"钟楼区","320411":"新北区","320412":"武进区","320413":"金坛区","320481":"溧阳市","320505":"虎丘区","320506":"吴中区","320507":"相城区","320508":"姑苏区","320509":"吴江区","320581":"常熟市","320582":"张家港市","320583":"昆山市","320585":"太仓市","320590":"工业园区","320591":"高新区","320602":"崇川区","320611":"港闸区","320612":"通州区","320623":"如东县","320681":"启东市","320682":"如皋市","320684":"海门市","320685":"海安市","320691":"高新区","320703":"连云区","320706":"海州区","320707":"赣榆区","320722":"东海县","320723":"灌云县","320724":"灌南县","320803":"淮安区","320804":"淮阴区","320812":"清江浦区","320813":"洪泽区","320826":"涟水县","320830":"盱眙县","320831":"金湖县","320890":"经济开发区","320902":"亭湖区","320903":"盐都区","320904":"大丰区","320921":"响水县","320922":"滨海县","320923":"阜宁县","320924":"射阳县","320925":"建湖县","320981":"东台市","321002":"广陵区","321003":"邗江区","321012":"江都区","321023":"宝应县","321081":"仪征市","321084":"高邮市","321090":"经济开发区","321102":"京口区","321111":"润州区","321112":"丹徒区","321181":"丹阳市","321182":"扬中市","321183":"句容市","321202":"海陵区","321203":"高港区","321204":"姜堰区","321281":"兴化市","321282":"靖江市","321283":"泰兴市","321302":"宿城区","321311":"宿豫区","321322":"沭阳县","321323":"泗阳县","321324":"泗洪县","330102":"上城区","330103":"下城区","330104":"江干区","330105":"拱墅区","330106":"西湖区","330108":"滨江区","330109":"萧山区","330110":"余杭区","330111":"富阳区","330112":"临安区","330122":"桐庐县","330127":"淳安县","330182":"建德市","330203":"海曙区","330205":"江北区","330206":"北仑区","330211":"镇海区","330212":"鄞州区","330213":"奉化区","330225":"象山县","330226":"宁海县","330281":"余姚市","330282":"慈溪市","330302":"鹿城区","330303":"龙湾区","330304":"瓯海区","330305":"洞头区","330324":"永嘉县","330326":"平阳县","330327":"苍南县","330328":"文成县","330329":"泰顺县","330381":"瑞安市","330382":"乐清市","330402":"南湖区","330411":"秀洲区","330421":"嘉善县","330424":"海盐县","330481":"海宁市","330482":"平湖市","330483":"桐乡市","330502":"吴兴区","330503":"南浔区","330521":"德清县","330522":"长兴县","330523":"安吉县","330602":"越城区","330603":"柯桥区","330604":"上虞区","330624":"新昌县","330681":"诸暨市","330683":"嵊州市","330702":"婺城区","330703":"金东区","330723":"武义县","330726":"浦江县","330727":"磐安县","330781":"兰溪市","330782":"义乌市","330783":"东阳市","330784":"永康市","330802":"柯城区","330803":"衢江区","330822":"常山县","330824":"开化县","330825":"龙游县","330881":"江山市","330902":"定海区","330903":"普陀区","330921":"岱山县","330922":"嵊泗县","331002":"椒江区","331003":"黄岩区","331004":"路桥区","331022":"三门县","331023":"天台县","331024":"仙居县","331081":"温岭市","331082":"临海市","331083":"玉环市","331102":"莲都区","331121":"青田县","331122":"缙云县","331123":"遂昌县","331124":"松阳县","331125":"云和县","331126":"庆元县","331127":"景宁畲族自治县","331181":"龙泉市","340102":"瑶海区","340103":"庐阳区","340104":"蜀山区","340111":"包河区","340121":"长丰县","340122":"肥东县","340123":"肥西县","340124":"庐江县","340181":"巢湖市","340190":"高新技术开发区","340191":"经济技术开发区","340202":"镜湖区","340203":"弋江区","340207":"鸠江区","340208":"三山区","340221":"芜湖县","340222":"繁昌县","340223":"南陵县","340225":"无为县","340302":"龙子湖区","340303":"蚌山区","340304":"禹会区","340311":"淮上区","340321":"怀远县","340322":"五河县","340323":"固镇县","340402":"大通区","340403":"田家庵区","340404":"谢家集区","340405":"八公山区","340406":"潘集区","340421":"凤台县","340422":"寿县","340503":"花山区","340504":"雨山区","340506":"博望区","340521":"当涂县","340522":"含山县","340523":"和县","340602":"杜集区","340603":"相山区","340604":"烈山区","340621":"濉溪县","340705":"铜官区","340706":"义安区","340711":"郊区","340722":"枞阳县","340802":"迎江区","340803":"大观区","340811":"宜秀区","340822":"怀宁县","340824":"潜山县","340825":"太湖县","340826":"宿松县","340827":"望江县","340828":"岳西县","340881":"桐城市","341002":"屯溪区","341003":"黄山区","341004":"徽州区","341021":"歙县","341022":"休宁县","341023":"黟县","341024":"祁门县","341102":"琅琊区","341103":"南谯区","341122":"来安县","341124":"全椒县","341125":"定远县","341126":"凤阳县","341181":"天长市","341182":"明光市","341202":"颍州区","341203":"颍东区","341204":"颍泉区","341221":"临泉县","341222":"太和县","341225":"阜南县","341226":"颍上县","341282":"界首市","341302":"埇桥区","341321":"砀山县","341322":"萧县","341323":"灵璧县","341324":"泗县","341390":"经济开发区","341502":"金安区","341503":"裕安区","341504":"叶集区","341522":"霍邱县","341523":"舒城县","341524":"金寨县","341525":"霍山县","341602":"谯城区","341621":"涡阳县","341622":"蒙城县","341623":"利辛县","341702":"贵池区","341721":"东至县","341722":"石台县","341723":"青阳县","341802":"宣州区","341821":"郎溪县","341822":"广德县","341823":"泾县","341824":"绩溪县","341825":"旌德县","341881":"宁国市","350102":"鼓楼区","350103":"台江区","350104":"仓山区","350105":"马尾区","350111":"晋安区","350112":"长乐区","350121":"闽侯县","350122":"连江县","350123":"罗源县","350124":"闽清县","350125":"永泰县","350128":"平潭县","350181":"福清市","350203":"思明区","350205":"海沧区","350206":"湖里区","350211":"集美区","350212":"同安区","350213":"翔安区","350302":"城厢区","350303":"涵江区","350304":"荔城区","350305":"秀屿区","350322":"仙游县","350402":"梅列区","350403":"三元区","350421":"明溪县","350423":"清流县","350424":"宁化县","350425":"大田县","350426":"尤溪县","350427":"沙县","350428":"将乐县","350429":"泰宁县","350430":"建宁县","350481":"永安市","350502":"鲤城区","350503":"丰泽区","350504":"洛江区","350505":"泉港区","350521":"惠安县","350524":"安溪县","350525":"永春县","350526":"德化县","350527":"金门县","350581":"石狮市","350582":"晋江市","350583":"南安市","350602":"芗城区","350603":"龙文区","350622":"云霄县","350623":"漳浦县","350624":"诏安县","350625":"长泰县","350626":"东山县","350627":"南靖县","350628":"平和县","350629":"华安县","350681":"龙海市","350702":"延平区","350703":"建阳区","350721":"顺昌县","350722":"浦城县","350723":"光泽县","350724":"松溪县","350725":"政和县","350781":"邵武市","350782":"武夷山市","350783":"建瓯市","350802":"新罗区","350803":"永定区","350821":"长汀县","350823":"上杭县","350824":"武平县","350825":"连城县","350881":"漳平市","350902":"蕉城区","350921":"霞浦县","350922":"古田县","350923":"屏南县","350924":"寿宁县","350925":"周宁县","350926":"柘荣县","350981":"福安市","350982":"福鼎市","360102":"东湖区","360103":"西湖区","360104":"青云谱区","360105":"湾里区","360111":"青山湖区","360112":"新建区","360121":"南昌县","360123":"安义县","360124":"进贤县","360190":"经济技术开发区","360192":"高新区","360202":"昌江区","360203":"珠山区","360222":"浮梁县","360281":"乐平市","360302":"安源区","360313":"湘东区","360321":"莲花县","360322":"上栗县","360323":"芦溪县","360402":"濂溪区","360403":"浔阳区","360404":"柴桑区","360423":"武宁县","360424":"修水县","360425":"永修县","360426":"德安县","360428":"都昌县","360429":"湖口县","360430":"彭泽县","360481":"瑞昌市","360482":"共青城市","360483":"庐山市","360490":"经济技术开发区","360502":"渝水区","360521":"分宜县","360602":"月湖区","360603":"余江区","360681":"贵溪市","360702":"章贡区","360703":"南康区","360704":"赣县区","360722":"信丰县","360723":"大余县","360724":"上犹县","360725":"崇义县","360726":"安远县","360727":"龙南县","360728":"定南县","360729":"全南县","360730":"宁都县","360731":"于都县","360732":"兴国县","360733":"会昌县","360734":"寻乌县","360735":"石城县","360781":"瑞金市","360802":"吉州区","360803":"青原区","360821":"吉安县","360822":"吉水县","360823":"峡江县","360824":"新干县","360825":"永丰县","360826":"泰和县","360827":"遂川县","360828":"万安县","360829":"安福县","360830":"永新县","360881":"井冈山市","360902":"袁州区","360921":"奉新县","360922":"万载县","360923":"上高县","360924":"宜丰县","360925":"靖安县","360926":"铜鼓县","360981":"丰城市","360982":"樟树市","360983":"高安市","361002":"临川区","361003":"东乡区","361021":"南城县","361022":"黎川县","361023":"南丰县","361024":"崇仁县","361025":"乐安县","361026":"宜黄县","361027":"金溪县","361028":"资溪县","361030":"广昌县","361102":"信州区","361103":"广丰区","361121":"上饶县","361123":"玉山县","361124":"铅山县","361125":"横峰县","361126":"弋阳县","361127":"余干县","361128":"鄱阳县","361129":"万年县","361130":"婺源县","361181":"德兴市","370102":"历下区","370103":"市中区","370104":"槐荫区","370105":"天桥区","370112":"历城区","370113":"长清区","370114":"章丘区","370115":"济阳区","370124":"平阴县","370126":"商河县","370190":"高新区","370191":"莱芜区","370202":"市南区","370203":"市北区","370211":"黄岛区","370212":"崂山区","370213":"李沧区","370214":"城阳区","370215":"即墨区","370281":"胶州市","370283":"平度市","370285":"莱西市","370290":"开发区","370302":"淄川区","370303":"张店区","370304":"博山区","370305":"临淄区","370306":"周村区","370321":"桓台县","370322":"高青县","370323":"沂源县","370402":"市中区","370403":"薛城区","370404":"峄城区","370405":"台儿庄区","370406":"山亭区","370481":"滕州市","370502":"东营区","370503":"河口区","370505":"垦利区","370522":"利津县","370523":"广饶县","370602":"芝罘区","370611":"福山区","370612":"牟平区","370613":"莱山区","370634":"长岛县","370681":"龙口市","370682":"莱阳市","370683":"莱州市","370684":"蓬莱市","370685":"招远市","370686":"栖霞市","370687":"海阳市","370690":"开发区","370702":"潍城区","370703":"寒亭区","370704":"坊子区","370705":"奎文区","370724":"临朐县","370725":"昌乐县","370781":"青州市","370782":"诸城市","370783":"寿光市","370784":"安丘市","370785":"高密市","370786":"昌邑市","370790":"开发区","370791":"高新区","370811":"任城区","370812":"兖州区","370826":"微山县","370827":"鱼台县","370828":"金乡县","370829":"嘉祥县","370830":"汶上县","370831":"泗水县","370832":"梁山县","370881":"曲阜市","370883":"邹城市","370890":"高新区","370902":"泰山区","370911":"岱岳区","370921":"宁阳县","370923":"东平县","370982":"新泰市","370983":"肥城市","371002":"环翠区","371003":"文登区","371082":"荣成市","371083":"乳山市","371091":"经济技术开发区","371102":"东港区","371103":"岚山区","371121":"五莲县","371122":"莒县","371302":"兰山区","371311":"罗庄区","371312":"河东区","371321":"沂南县","371322":"郯城县","371323":"沂水县","371324":"兰陵县","371325":"费县","371326":"平邑县","371327":"莒南县","371328":"蒙阴县","371329":"临沭县","371402":"德城区","371403":"陵城区","371422":"宁津县","371423":"庆云县","371424":"临邑县","371425":"齐河县","371426":"平原县","371427":"夏津县","371428":"武城县","371481":"乐陵市","371482":"禹城市","371502":"东昌府区","371521":"阳谷县","371522":"莘县","371523":"茌平县","371524":"东阿县","371525":"冠县","371526":"高唐县","371581":"临清市","371602":"滨城区","371603":"沾化区","371621":"惠民县","371622":"阳信县","371623":"无棣县","371625":"博兴县","371681":"邹平市","371702":"牡丹区","371703":"定陶区","371721":"曹县","371722":"单县","371723":"成武县","371724":"巨野县","371725":"郓城县","371726":"鄄城县","371728":"东明县","410102":"中原区","410103":"二七区","410104":"管城回族区","410105":"金水区","410106":"上街区","410108":"惠济区","410122":"中牟县","410181":"巩义市","410182":"荥阳市","410183":"新密市","410184":"新郑市","410185":"登封市","410190":"高新技术开发区","410191":"经济技术开发区","410202":"龙亭区","410203":"顺河回族区","410204":"鼓楼区","410205":"禹王台区","410212":"祥符区","410221":"杞县","410222":"通许县","410223":"尉氏县","410225":"兰考县","410302":"老城区","410303":"西工区","410304":"瀍河回族区","410305":"涧西区","410306":"吉利区","410311":"洛龙区","410322":"孟津县","410323":"新安县","410324":"栾川县","410325":"嵩县","410326":"汝阳县","410327":"宜阳县","410328":"洛宁县","410329":"伊川县","410381":"偃师市","410402":"新华区","410403":"卫东区","410404":"石龙区","410411":"湛河区","410421":"宝丰县","410422":"叶县","410423":"鲁山县","410425":"郏县","410481":"舞钢市","410482":"汝州市","410502":"文峰区","410503":"北关区","410505":"殷都区","410506":"龙安区","410522":"安阳县","410523":"汤阴县","410526":"滑县","410527":"内黄县","410581":"林州市","410590":"开发区","410602":"鹤山区","410603":"山城区","410611":"淇滨区","410621":"浚县","410622":"淇县","410702":"红旗区","410703":"卫滨区","410704":"凤泉区","410711":"牧野区","410721":"新乡县","410724":"获嘉县","410725":"原阳县","410726":"延津县","410727":"封丘县","410728":"长垣县","410781":"卫辉市","410782":"辉县市","410802":"解放区","410803":"中站区","410804":"马村区","410811":"山阳区","410821":"修武县","410822":"博爱县","410823":"武陟县","410825":"温县","410882":"沁阳市","410883":"孟州市","410902":"华龙区","410922":"清丰县","410923":"南乐县","410926":"范县","410927":"台前县","410928":"濮阳县","411002":"魏都区","411003":"建安区","411024":"鄢陵县","411025":"襄城县","411081":"禹州市","411082":"长葛市","411102":"源汇区","411103":"郾城区","411104":"召陵区","411121":"舞阳县","411122":"临颍县","411202":"湖滨区","411203":"陕州区","411221":"渑池县","411224":"卢氏县","411281":"义马市","411282":"灵宝市","411302":"宛城区","411303":"卧龙区","411321":"南召县","411322":"方城县","411323":"西峡县","411324":"镇平县","411325":"内乡县","411326":"淅川县","411327":"社旗县","411328":"唐河县","411329":"新野县","411330":"桐柏县","411381":"邓州市","411402":"梁园区","411403":"睢阳区","411421":"民权县","411422":"睢县","411423":"宁陵县","411424":"柘城县","411425":"虞城县","411426":"夏邑县","411481":"永城市","411502":"浉河区","411503":"平桥区","411521":"罗山县","411522":"光山县","411523":"新县","411524":"商城县","411525":"固始县","411526":"潢川县","411527":"淮滨县","411528":"息县","411602":"川汇区","411621":"扶沟县","411622":"西华县","411623":"商水县","411624":"沈丘县","411625":"郸城县","411626":"淮阳县","411627":"太康县","411628":"鹿邑县","411681":"项城市","411690":"经济开发区","411702":"驿城区","411721":"西平县","411722":"上蔡县","411723":"平舆县","411724":"正阳县","411725":"确山县","411726":"泌阳县","411727":"汝南县","411728":"遂平县","411729":"新蔡县","419001":"济源市","420102":"江岸区","420103":"江汉区","420104":"硚口区","420105":"汉阳区","420106":"武昌区","420107":"青山区","420111":"洪山区","420112":"东西湖区","420113":"汉南区","420114":"蔡甸区","420115":"江夏区","420116":"黄陂区","420117":"新洲区","420202":"黄石港区","420203":"西塞山区","420204":"下陆区","420205":"铁山区","420222":"阳新县","420281":"大冶市","420302":"茅箭区","420303":"张湾区","420304":"郧阳区","420322":"郧西县","420323":"竹山县","420324":"竹溪县","420325":"房县","420381":"丹江口市","420502":"西陵区","420503":"伍家岗区","420504":"点军区","420505":"猇亭区","420506":"夷陵区","420525":"远安县","420526":"兴山县","420527":"秭归县","420528":"长阳土家族自治县","420529":"五峰土家族自治县","420581":"宜都市","420582":"当阳市","420583":"枝江市","420590":"经济开发区","420602":"襄城区","420606":"樊城区","420607":"襄州区","420624":"南漳县","420625":"谷城县","420626":"保康县","420682":"老河口市","420683":"枣阳市","420684":"宜城市","420702":"梁子湖区","420703":"华容区","420704":"鄂城区","420802":"东宝区","420804":"掇刀区","420822":"沙洋县","420881":"钟祥市","420882":"京山市","420902":"孝南区","420921":"孝昌县","420922":"大悟县","420923":"云梦县","420981":"应城市","420982":"安陆市","420984":"汉川市","421002":"沙市区","421003":"荆州区","421022":"公安县","421023":"监利县","421024":"江陵县","421081":"石首市","421083":"洪湖市","421087":"松滋市","421102":"黄州区","421121":"团风县","421122":"红安县","421123":"罗田县","421124":"英山县","421125":"浠水县","421126":"蕲春县","421127":"黄梅县","421181":"麻城市","421182":"武穴市","421202":"咸安区","421221":"嘉鱼县","421222":"通城县","421223":"崇阳县","421224":"通山县","421281":"赤壁市","421303":"曾都区","421321":"随县","421381":"广水市","422801":"恩施市","422802":"利川市","422822":"建始县","422823":"巴东县","422825":"宣恩县","422826":"咸丰县","422827":"来凤县","422828":"鹤峰县","429004":"仙桃市","429005":"潜江市","429006":"天门市","429021":"神农架林区","430102":"芙蓉区","430103":"天心区","430104":"岳麓区","430105":"开福区","430111":"雨花区","430112":"望城区","430121":"长沙县","430181":"浏阳市","430182":"宁乡市","430202":"荷塘区","430203":"芦淞区","430204":"石峰区","430211":"天元区","430212":"渌口区","430223":"攸县","430224":"茶陵县","430225":"炎陵县","430281":"醴陵市","430302":"雨湖区","430304":"岳塘区","430321":"湘潭县","430381":"湘乡市","430382":"韶山市","430405":"珠晖区","430406":"雁峰区","430407":"石鼓区","430408":"蒸湘区","430412":"南岳区","430421":"衡阳县","430422":"衡南县","430423":"衡山县","430424":"衡东县","430426":"祁东县","430481":"耒阳市","430482":"常宁市","430502":"双清区","430503":"大祥区","430511":"北塔区","430521":"邵东县","430522":"新邵县","430523":"邵阳县","430524":"隆回县","430525":"洞口县","430527":"绥宁县","430528":"新宁县","430529":"城步苗族自治县","430581":"武冈市","430602":"岳阳楼区","430603":"云溪区","430611":"君山区","430621":"岳阳县","430623":"华容县","430624":"湘阴县","430626":"平江县","430681":"汨罗市","430682":"临湘市","430702":"武陵区","430703":"鼎城区","430721":"安乡县","430722":"汉寿县","430723":"澧县","430724":"临澧县","430725":"桃源县","430726":"石门县","430781":"津市市","430802":"永定区","430811":"武陵源区","430821":"慈利县","430822":"桑植县","430902":"资阳区","430903":"赫山区","430921":"南县","430922":"桃江县","430923":"安化县","430981":"沅江市","431002":"北湖区","431003":"苏仙区","431021":"桂阳县","431022":"宜章县","431023":"永兴县","431024":"嘉禾县","431025":"临武县","431026":"汝城县","431027":"桂东县","431028":"安仁县","431081":"资兴市","431102":"零陵区","431103":"冷水滩区","431121":"祁阳县","431122":"东安县","431123":"双牌县","431124":"道县","431125":"江永县","431126":"宁远县","431127":"蓝山县","431128":"新田县","431129":"江华瑶族自治县","431202":"鹤城区","431221":"中方县","431222":"沅陵县","431223":"辰溪县","431224":"溆浦县","431225":"会同县","431226":"麻阳苗族自治县","431227":"新晃侗族自治县","431228":"芷江侗族自治县","431229":"靖州苗族侗族自治县","431230":"通道侗族自治县","431281":"洪江市","431302":"娄星区","431321":"双峰县","431322":"新化县","431381":"冷水江市","431382":"涟源市","433101":"吉首市","433122":"泸溪县","433123":"凤凰县","433124":"花垣县","433125":"保靖县","433126":"古丈县","433127":"永顺县","433130":"龙山县","440103":"荔湾区","440104":"越秀区","440105":"海珠区","440106":"天河区","440111":"白云区","440112":"黄埔区","440113":"番禺区","440114":"花都区","440115":"南沙区","440117":"从化区","440118":"增城区","440203":"武江区","440204":"浈江区","440205":"曲江区","440222":"始兴县","440224":"仁化县","440229":"翁源县","440232":"乳源瑶族自治县","440233":"新丰县","440281":"乐昌市","440282":"南雄市","440303":"罗湖区","440304":"福田区","440305":"南山区","440306":"宝安区","440307":"龙岗区","440308":"盐田区","440309":"龙华区","440310":"坪山区","440311":"光明区","440402":"香洲区","440403":"斗门区","440404":"金湾区","440507":"龙湖区","440511":"金平区","440512":"濠江区","440513":"潮阳区","440514":"潮南区","440515":"澄海区","440523":"南澳县","440604":"禅城区","440605":"南海区","440606":"顺德区","440607":"三水区","440608":"高明区","440703":"蓬江区","440704":"江海区","440705":"新会区","440781":"台山市","440783":"开平市","440784":"鹤山市","440785":"恩平市","440802":"赤坎区","440803":"霞山区","440804":"坡头区","440811":"麻章区","440823":"遂溪县","440825":"徐闻县","440881":"廉江市","440882":"雷州市","440883":"吴川市","440890":"经济技术开发区","440902":"茂南区","440904":"电白区","440981":"高州市","440982":"化州市","440983":"信宜市","441202":"端州区","441203":"鼎湖区","441204":"高要区","441223":"广宁县","441224":"怀集县","441225":"封开县","441226":"德庆县","441284":"四会市","441302":"惠城区","441303":"惠阳区","441322":"博罗县","441323":"惠东县","441324":"龙门县","441402":"梅江区","441403":"梅县区","441422":"大埔县","441423":"丰顺县","441424":"五华县","441426":"平远县","441427":"蕉岭县","441481":"兴宁市","441502":"城区","441521":"海丰县","441523":"陆河县","441581":"陆丰市","441602":"源城区","441621":"紫金县","441622":"龙川县","441623":"连平县","441624":"和平县","441625":"东源县","441702":"江城区","441704":"阳东区","441721":"阳西县","441781":"阳春市","441802":"清城区","441803":"清新区","441821":"佛冈县","441823":"阳山县","441825":"连山壮族瑶族自治县","441826":"连南瑶族自治县","441881":"英德市","441882":"连州市","441901":"中堂镇","441903":"南城街道办事处","441904":"长安镇","441905":"东坑镇","441906":"樟木头镇","441907":"莞城街道办事处","441908":"石龙镇","441909":"桥头镇","441910":"万江街道办事处","441911":"麻涌镇","441912":"虎门镇","441913":"谢岗镇","441914":"石碣镇","441915":"茶山镇","441916":"东城街道办事处","441917":"洪梅镇","441918":"道滘镇","441919":"高埗镇","441920":"企石镇","441921":"凤岗镇","441922":"大岭山镇","441923":"松山湖管委会","441924":"清溪镇","441925":"望牛墩镇","441926":"厚街镇","441927":"常平镇","441928":"寮步镇","441929":"石排镇","441930":"横沥镇","441931":"塘厦镇","441932":"黄江镇","441933":"大朗镇","441934":"东莞港","441935":"东莞生态园","441990":"沙田镇","442001":"南头镇","442002":"神湾镇","442003":"东凤镇","442004":"五桂山街道办事处","442005":"黄圃镇","442006":"小榄镇","442007":"石岐区街道办事处","442008":"横栏镇","442009":"三角镇","442010":"三乡镇","442011":"港口镇","442012":"沙溪镇","442013":"板芙镇","442015":"东升镇","442016":"阜沙镇","442017":"民众镇","442018":"东区街道办事处","442019":"火炬开发区街道办事处","442020":"西区街道办事处","442021":"南区街道办事处","442022":"古镇镇","442023":"坦洲镇","442024":"大涌镇","442025":"南朗镇","445102":"湘桥区","445103":"潮安区","445122":"饶平县","445202":"榕城区","445203":"揭东区","445222":"揭西县","445224":"惠来县","445281":"普宁市","445302":"云城区","445303":"云安区","445321":"新兴县","445322":"郁南县","445381":"罗定市","450102":"兴宁区","450103":"青秀区","450105":"江南区","450107":"西乡塘区","450108":"良庆区","450109":"邕宁区","450110":"武鸣区","450123":"隆安县","450124":"马山县","450125":"上林县","450126":"宾阳县","450127":"横县","450202":"城中区","450203":"鱼峰区","450204":"柳南区","450205":"柳北区","450206":"柳江区","450222":"柳城县","450223":"鹿寨县","450224":"融安县","450225":"融水苗族自治县","450226":"三江侗族自治县","450302":"秀峰区","450303":"叠彩区","450304":"象山区","450305":"七星区","450311":"雁山区","450312":"临桂区","450321":"阳朔县","450323":"灵川县","450324":"全州县","450325":"兴安县","450326":"永福县","450327":"灌阳县","450328":"龙胜各族自治县","450329":"资源县","450330":"平乐县","450332":"恭城瑶族自治县","450381":"荔浦市","450403":"万秀区","450405":"长洲区","450406":"龙圩区","450421":"苍梧县","450422":"藤县","450423":"蒙山县","450481":"岑溪市","450502":"海城区","450503":"银海区","450512":"铁山港区","450521":"合浦县","450602":"港口区","450603":"防城区","450621":"上思县","450681":"东兴市","450702":"钦南区","450703":"钦北区","450721":"灵山县","450722":"浦北县","450802":"港北区","450803":"港南区","450804":"覃塘区","450821":"平南县","450881":"桂平市","450902":"玉州区","450903":"福绵区","450921":"容县","450922":"陆川县","450923":"博白县","450924":"兴业县","450981":"北流市","451002":"右江区","451021":"田阳县","451022":"田东县","451023":"平果县","451024":"德保县","451026":"那坡县","451027":"凌云县","451028":"乐业县","451029":"田林县","451030":"西林县","451031":"隆林各族自治县","451081":"靖西市","451102":"八步区","451103":"平桂区","451121":"昭平县","451122":"钟山县","451123":"富川瑶族自治县","451202":"金城江区","451203":"宜州区","451221":"南丹县","451222":"天峨县","451223":"凤山县","451224":"东兰县","451225":"罗城仫佬族自治县","451226":"环江毛南族自治县","451227":"巴马瑶族自治县","451228":"都安瑶族自治县","451229":"大化瑶族自治县","451302":"兴宾区","451321":"忻城县","451322":"象州县","451323":"武宣县","451324":"金秀瑶族自治县","451381":"合山市","451402":"江州区","451421":"扶绥县","451422":"宁明县","451423":"龙州县","451424":"大新县","451425":"天等县","451481":"凭祥市","460105":"秀英区","460106":"龙华区","460107":"琼山区","460108":"美兰区","460202":"海棠区","460203":"吉阳区","460204":"天涯区","460205":"崖州区","460321":"西沙群岛","460322":"南沙群岛","460323":"中沙群岛的岛礁及其海域","460401":"那大镇","460402":"和庆镇","460403":"南丰镇","460404":"大成镇","460405":"雅星镇","460406":"兰洋镇","460407":"光村镇","460408":"木棠镇","460409":"海头镇","460410":"峨蔓镇","460411":"王五镇","460412":"白马井镇","460413":"中和镇","460414":"排浦镇","460415":"东成镇","460416":"新州镇","460417":"洋浦经济开发区","460418":"华南热作学院","469001":"五指山市","469002":"琼海市","469005":"文昌市","469006":"万宁市","469007":"东方市","469021":"定安县","469022":"屯昌县","469023":"澄迈县","469024":"临高县","469025":"白沙黎族自治县","469026":"昌江黎族自治县","469027":"乐东黎族自治县","469028":"陵水黎族自治县","469029":"保亭黎族苗族自治县","469030":"琼中黎族苗族自治县","500101":"万州区","500102":"涪陵区","500103":"渝中区","500104":"大渡口区","500105":"江北区","500106":"沙坪坝区","500107":"九龙坡区","500108":"南岸区","500109":"北碚区","500110":"綦江区","500111":"大足区","500112":"渝北区","500113":"巴南区","500114":"黔江区","500115":"长寿区","500116":"江津区","500117":"合川区","500118":"永川区","500119":"南川区","500120":"璧山区","500151":"铜梁区","500152":"潼南区","500153":"荣昌区","500154":"开州区","500155":"梁平区","500156":"武隆区","500229":"城口县","500230":"丰都县","500231":"垫江县","500233":"忠县","500235":"云阳县","500236":"奉节县","500237":"巫山县","500238":"巫溪县","500240":"石柱土家族自治县","500241":"秀山土家族苗族自治县","500242":"酉阳土家族苗族自治县","500243":"彭水苗族土家族自治县","510104":"锦江区","510105":"青羊区","510106":"金牛区","510107":"武侯区","510108":"成华区","510112":"龙泉驿区","510113":"青白江区","510114":"新都区","510115":"温江区","510116":"双流区","510117":"郫都区","510121":"金堂县","510129":"大邑县","510131":"蒲江县","510132":"新津县","510181":"都江堰市","510182":"彭州市","510183":"邛崃市","510184":"崇州市","510185":"简阳市","510191":"高新区","510302":"自流井区","510303":"贡井区","510304":"大安区","510311":"沿滩区","510321":"荣县","510322":"富顺县","510402":"东区","510403":"西区","510411":"仁和区","510421":"米易县","510422":"盐边县","510502":"江阳区","510503":"纳溪区","510504":"龙马潭区","510521":"泸县","510522":"合江县","510524":"叙永县","510525":"古蔺县","510603":"旌阳区","510604":"罗江区","510623":"中江县","510681":"广汉市","510682":"什邡市","510683":"绵竹市","510703":"涪城区","510704":"游仙区","510705":"安州区","510722":"三台县","510723":"盐亭县","510725":"梓潼县","510726":"北川羌族自治县","510727":"平武县","510781":"江油市","510791":"高新区","510802":"利州区","510811":"昭化区","510812":"朝天区","510821":"旺苍县","510822":"青川县","510823":"剑阁县","510824":"苍溪县","510903":"船山区","510904":"安居区","510921":"蓬溪县","510922":"射洪县","510923":"大英县","511002":"市中区","511011":"东兴区","511024":"威远县","511025":"资中县","511083":"隆昌市","511102":"市中区","511111":"沙湾区","511112":"五通桥区","511113":"金口河区","511123":"犍为县","511124":"井研县","511126":"夹江县","511129":"沐川县","511132":"峨边彝族自治县","511133":"马边彝族自治县","511181":"峨眉山市","511302":"顺庆区","511303":"高坪区","511304":"嘉陵区","511321":"南部县","511322":"营山县","511323":"蓬安县","511324":"仪陇县","511325":"西充县","511381":"阆中市","511402":"东坡区","511403":"彭山区","511421":"仁寿县","511423":"洪雅县","511424":"丹棱县","511425":"青神县","511502":"翠屏区","511503":"南溪区","511504":"叙州区","511523":"江安县","511524":"长宁县","511525":"高县","511526":"珙县","511527":"筠连县","511528":"兴文县","511529":"屏山县","511602":"广安区","511603":"前锋区","511621":"岳池县","511622":"武胜县","511623":"邻水县","511681":"华蓥市","511702":"通川区","511703":"达川区","511722":"宣汉县","511723":"开江县","511724":"大竹县","511725":"渠县","511781":"万源市","511802":"雨城区","511803":"名山区","511822":"荥经县","511823":"汉源县","511824":"石棉县","511825":"天全县","511826":"芦山县","511827":"宝兴县","511902":"巴州区","511903":"恩阳区","511921":"通江县","511922":"南江县","511923":"平昌县","512002":"雁江区","512021":"安岳县","512022":"乐至县","513201":"马尔康市","513221":"汶川县","513222":"理县","513223":"茂县","513224":"松潘县","513225":"九寨沟县","513226":"金川县","513227":"小金县","513228":"黑水县","513230":"壤塘县","513231":"阿坝县","513232":"若尔盖县","513233":"红原县","513301":"康定市","513322":"泸定县","513323":"丹巴县","513324":"九龙县","513325":"雅江县","513326":"道孚县","513327":"炉霍县","513328":"甘孜县","513329":"新龙县","513330":"德格县","513331":"白玉县","513332":"石渠县","513333":"色达县","513334":"理塘县","513335":"巴塘县","513336":"乡城县","513337":"稻城县","513338":"得荣县","513401":"西昌市","513422":"木里藏族自治县","513423":"盐源县","513424":"德昌县","513425":"会理县","513426":"会东县","513427":"宁南县","513428":"普格县","513429":"布拖县","513430":"金阳县","513431":"昭觉县","513432":"喜德县","513433":"冕宁县","513434":"越西县","513435":"甘洛县","513436":"美姑县","513437":"雷波县","520102":"南明区","520103":"云岩区","520111":"花溪区","520112":"乌当区","520113":"白云区","520115":"观山湖区","520121":"开阳县","520122":"息烽县","520123":"修文县","520181":"清镇市","520201":"钟山区","520203":"六枝特区","520221":"水城县","520281":"盘州市","520302":"红花岗区","520303":"汇川区","520304":"播州区","520322":"桐梓县","520323":"绥阳县","520324":"正安县","520325":"道真仡佬族苗族自治县","520326":"务川仡佬族苗族自治县","520327":"凤冈县","520328":"湄潭县","520329":"余庆县","520330":"习水县","520381":"赤水市","520382":"仁怀市","520402":"西秀区","520403":"平坝区","520422":"普定县","520423":"镇宁布依族苗族自治县","520424":"关岭布依族苗族自治县","520425":"紫云苗族布依族自治县","520502":"七星关区","520521":"大方县","520522":"黔西县","520523":"金沙县","520524":"织金县","520525":"纳雍县","520526":"威宁彝族回族苗族自治县","520527":"赫章县","520602":"碧江区","520603":"万山区","520621":"江口县","520622":"玉屏侗族自治县","520623":"石阡县","520624":"思南县","520625":"印江土家族苗族自治县","520626":"德江县","520627":"沿河土家族自治县","520628":"松桃苗族自治县","522301":"兴义市","522302":"兴仁市","522323":"普安县","522324":"晴隆县","522325":"贞丰县","522326":"望谟县","522327":"册亨县","522328":"安龙县","522601":"凯里市","522622":"黄平县","522623":"施秉县","522624":"三穗县","522625":"镇远县","522626":"岑巩县","522627":"天柱县","522628":"锦屏县","522629":"剑河县","522630":"台江县","522631":"黎平县","522632":"榕江县","522633":"从江县","522634":"雷山县","522635":"麻江县","522636":"丹寨县","522701":"都匀市","522702":"福泉市","522722":"荔波县","522723":"贵定县","522725":"瓮安县","522726":"独山县","522727":"平塘县","522728":"罗甸县","522729":"长顺县","522730":"龙里县","522731":"惠水县","522732":"三都水族自治县","530102":"五华区","530103":"盘龙区","530111":"官渡区","530112":"西山区","530113":"东川区","530114":"呈贡区","530115":"晋宁区","530124":"富民县","530125":"宜良县","530126":"石林彝族自治县","530127":"嵩明县","530128":"禄劝彝族苗族自治县","530129":"寻甸回族彝族自治县","530181":"安宁市","530302":"麒麟区","530303":"沾益区","530304":"马龙区","530322":"陆良县","530323":"师宗县","530324":"罗平县","530325":"富源县","530326":"会泽县","530381":"宣威市","530402":"红塔区","530403":"江川区","530422":"澄江县","530423":"通海县","530424":"华宁县","530425":"易门县","530426":"峨山彝族自治县","530427":"新平彝族傣族自治县","530428":"元江哈尼族彝族傣族自治县","530502":"隆阳区","530521":"施甸县","530523":"龙陵县","530524":"昌宁县","530581":"腾冲市","530602":"昭阳区","530621":"鲁甸县","530622":"巧家县","530623":"盐津县","530624":"大关县","530625":"永善县","530626":"绥江县","530627":"镇雄县","530628":"彝良县","530629":"威信县","530681":"水富市","530702":"古城区","530721":"玉龙纳西族自治县","530722":"永胜县","530723":"华坪县","530724":"宁蒗彝族自治县","530802":"思茅区","530821":"宁洱哈尼族彝族自治县","530822":"墨江哈尼族自治县","530823":"景东彝族自治县","530824":"景谷傣族彝族自治县","530825":"镇沅彝族哈尼族拉祜族自治县","530826":"江城哈尼族彝族自治县","530827":"孟连傣族拉祜族佤族自治县","530828":"澜沧拉祜族自治县","530829":"西盟佤族自治县","530902":"临翔区","530921":"凤庆县","530922":"云县","530923":"永德县","530924":"镇康县","530925":"双江拉祜族佤族布朗族傣族自治县","530926":"耿马傣族佤族自治县","530927":"沧源佤族自治县","532301":"楚雄市","532322":"双柏县","532323":"牟定县","532324":"南华县","532325":"姚安县","532326":"大姚县","532327":"永仁县","532328":"元谋县","532329":"武定县","532331":"禄丰县","532501":"个旧市","532502":"开远市","532503":"蒙自市","532504":"弥勒市","532523":"屏边苗族自治县","532524":"建水县","532525":"石屏县","532527":"泸西县","532528":"元阳县","532529":"红河县","532530":"金平苗族瑶族傣族自治县","532531":"绿春县","532532":"河口瑶族自治县","532601":"文山市","532622":"砚山县","532623":"西畴县","532624":"麻栗坡县","532625":"马关县","532626":"丘北县","532627":"广南县","532628":"富宁县","532801":"景洪市","532822":"勐海县","532823":"勐腊县","532901":"大理市","532922":"漾濞彝族自治县","532923":"祥云县","532924":"宾川县","532925":"弥渡县","532926":"南涧彝族自治县","532927":"巍山彝族回族自治县","532928":"永平县","532929":"云龙县","532930":"洱源县","532931":"剑川县","532932":"鹤庆县","533102":"瑞丽市","533103":"芒市","533122":"梁河县","533123":"盈江县","533124":"陇川县","533301":"泸水市","533323":"福贡县","533324":"贡山独龙族怒族自治县","533325":"兰坪白族普米族自治县","533401":"香格里拉市","533422":"德钦县","533423":"维西傈僳族自治县","540102":"城关区","540103":"堆龙德庆区","540104":"达孜区","540121":"林周县","540122":"当雄县","540123":"尼木县","540124":"曲水县","540127":"墨竹工卡县","540202":"桑珠孜区","540221":"南木林县","540222":"江孜县","540223":"定日县","540224":"萨迦县","540225":"拉孜县","540226":"昂仁县","540227":"谢通门县","540228":"白朗县","540229":"仁布县","540230":"康马县","540231":"定结县","540232":"仲巴县","540233":"亚东县","540234":"吉隆县","540235":"聂拉木县","540236":"萨嘎县","540237":"岗巴县","540302":"卡若区","540321":"江达县","540322":"贡觉县","540323":"类乌齐县","540324":"丁青县","540325":"察雅县","540326":"八宿县","540327":"左贡县","540328":"芒康县","540329":"洛隆县","540330":"边坝县","540402":"巴宜区","540421":"工布江达县","540422":"米林县","540423":"墨脱县","540424":"波密县","540425":"察隅县","540426":"朗县","540502":"乃东区","540521":"扎囊县","540522":"贡嘎县","540523":"桑日县","540524":"琼结县","540525":"曲松县","540526":"措美县","540527":"洛扎县","540528":"加查县","540529":"隆子县","540530":"错那县","540531":"浪卡子县","540602":"色尼区","540621":"嘉黎县","540622":"比如县","540623":"聂荣县","540624":"安多县","540625":"申扎县","540626":"索县","540627":"班戈县","540628":"巴青县","540629":"尼玛县","540630":"双湖县","542521":"普兰县","542522":"札达县","542523":"噶尔县","542524":"日土县","542525":"革吉县","542526":"改则县","542527":"措勤县","610102":"新城区","610103":"碑林区","610104":"莲湖区","610111":"灞桥区","610112":"未央区","610113":"雁塔区","610114":"阎良区","610115":"临潼区","610116":"长安区","610117":"高陵区","610118":"鄠邑区","610122":"蓝田县","610124":"周至县","610202":"王益区","610203":"印台区","610204":"耀州区","610222":"宜君县","610302":"渭滨区","610303":"金台区","610304":"陈仓区","610322":"凤翔县","610323":"岐山县","610324":"扶风县","610326":"眉县","610327":"陇县","610328":"千阳县","610329":"麟游县","610330":"凤县","610331":"太白县","610402":"秦都区","610403":"杨陵区","610404":"渭城区","610422":"三原县","610423":"泾阳县","610424":"乾县","610425":"礼泉县","610426":"永寿县","610428":"长武县","610429":"旬邑县","610430":"淳化县","610431":"武功县","610481":"兴平市","610482":"彬州市","610502":"临渭区","610503":"华州区","610522":"潼关县","610523":"大荔县","610524":"合阳县","610525":"澄城县","610526":"蒲城县","610527":"白水县","610528":"富平县","610581":"韩城市","610582":"华阴市","610602":"宝塔区","610603":"安塞区","610621":"延长县","610622":"延川县","610623":"子长县","610625":"志丹县","610626":"吴起县","610627":"甘泉县","610628":"富县","610629":"洛川县","610630":"宜川县","610631":"黄龙县","610632":"黄陵县","610702":"汉台区","610703":"南郑区","610722":"城固县","610723":"洋县","610724":"西乡县","610725":"勉县","610726":"宁强县","610727":"略阳县","610728":"镇巴县","610729":"留坝县","610730":"佛坪县","610802":"榆阳区","610803":"横山区","610822":"府谷县","610824":"靖边县","610825":"定边县","610826":"绥德县","610827":"米脂县","610828":"佳县","610829":"吴堡县","610830":"清涧县","610831":"子洲县","610881":"神木市","610902":"汉滨区","610921":"汉阴县","610922":"石泉县","610923":"宁陕县","610924":"紫阳县","610925":"岚皋县","610926":"平利县","610927":"镇坪县","610928":"旬阳县","610929":"白河县","611002":"商州区","611021":"洛南县","611022":"丹凤县","611023":"商南县","611024":"山阳县","611025":"镇安县","611026":"柞水县","620102":"城关区","620103":"七里河区","620104":"西固区","620105":"安宁区","620111":"红古区","620121":"永登县","620122":"皋兰县","620123":"榆中县","620201":"市辖区","620290":"雄关区","620291":"长城区","620292":"镜铁区","620293":"新城镇","620294":"峪泉镇","620295":"文殊镇","620302":"金川区","620321":"永昌县","620402":"白银区","620403":"平川区","620421":"靖远县","620422":"会宁县","620423":"景泰县","620502":"秦州区","620503":"麦积区","620521":"清水县","620522":"秦安县","620523":"甘谷县","620524":"武山县","620525":"张家川回族自治县","620602":"凉州区","620621":"民勤县","620622":"古浪县","620623":"天祝藏族自治县","620702":"甘州区","620721":"肃南裕固族自治县","620722":"民乐县","620723":"临泽县","620724":"高台县","620725":"山丹县","620802":"崆峒区","620821":"泾川县","620822":"灵台县","620823":"崇信县","620825":"庄浪县","620826":"静宁县","620881":"华亭市","620902":"肃州区","620921":"金塔县","620922":"瓜州县","620923":"肃北蒙古族自治县","620924":"阿克塞哈萨克族自治县","620981":"玉门市","620982":"敦煌市","621002":"西峰区","621021":"庆城县","621022":"环县","621023":"华池县","621024":"合水县","621025":"正宁县","621026":"宁县","621027":"镇原县","621102":"安定区","621121":"通渭县","621122":"陇西县","621123":"渭源县","621124":"临洮县","621125":"漳县","621126":"岷县","621202":"武都区","621221":"成县","621222":"文县","621223":"宕昌县","621224":"康县","621225":"西和县","621226":"礼县","621227":"徽县","621228":"两当县","622901":"临夏市","622921":"临夏县","622922":"康乐县","622923":"永靖县","622924":"广河县","622925":"和政县","622926":"东乡族自治县","622927":"积石山保安族东乡族撒拉族自治县","623001":"合作市","623021":"临潭县","623022":"卓尼县","623023":"舟曲县","623024":"迭部县","623025":"玛曲县","623026":"碌曲县","623027":"夏河县","630102":"城东区","630103":"城中区","630104":"城西区","630105":"城北区","630121":"大通回族土族自治县","630122":"湟中县","630123":"湟源县","630202":"乐都区","630203":"平安区","630222":"民和回族土族自治县","630223":"互助土族自治县","630224":"化隆回族自治县","630225":"循化撒拉族自治县","632221":"门源回族自治县","632222":"祁连县","632223":"海晏县","632224":"刚察县","632321":"同仁县","632322":"尖扎县","632323":"泽库县","632324":"河南蒙古族自治县","632521":"共和县","632522":"同德县","632523":"贵德县","632524":"兴海县","632525":"贵南县","632621":"玛沁县","632622":"班玛县","632623":"甘德县","632624":"达日县","632625":"久治县","632626":"玛多县","632701":"玉树市","632722":"杂多县","632723":"称多县","632724":"治多县","632725":"囊谦县","632726":"曲麻莱县","632801":"格尔木市","632802":"德令哈市","632803":"茫崖市","632821":"乌兰县","632822":"都兰县","632823":"天峻县","640104":"兴庆区","640105":"西夏区","640106":"金凤区","640121":"永宁县","640122":"贺兰县","640181":"灵武市","640202":"大武口区","640205":"惠农区","640221":"平罗县","640302":"利通区","640303":"红寺堡区","640323":"盐池县","640324":"同心县","640381":"青铜峡市","640402":"原州区","640422":"西吉县","640423":"隆德县","640424":"泾源县","640425":"彭阳县","640502":"沙坡头区","640521":"中宁县","640522":"海原县","650102":"天山区","650103":"沙依巴克区","650104":"新市区","650105":"水磨沟区","650106":"头屯河区","650107":"达坂城区","650109":"米东区","650121":"乌鲁木齐县","650202":"独山子区","650203":"克拉玛依区","650204":"白碱滩区","650205":"乌尔禾区","650402":"高昌区","650421":"鄯善县","650422":"托克逊县","650502":"伊州区","650521":"巴里坤哈萨克自治县","650522":"伊吾县","652301":"昌吉市","652302":"阜康市","652323":"呼图壁县","652324":"玛纳斯县","652325":"奇台县","652327":"吉木萨尔县","652328":"木垒哈萨克自治县","652701":"博乐市","652702":"阿拉山口市","652722":"精河县","652723":"温泉县","652801":"库尔勒市","652822":"轮台县","652823":"尉犁县","652824":"若羌县","652825":"且末县","652826":"焉耆回族自治县","652827":"和静县","652828":"和硕县","652829":"博湖县","652901":"阿克苏市","652922":"温宿县","652923":"库车县","652924":"沙雅县","652925":"新和县","652926":"拜城县","652927":"乌什县","652928":"阿瓦提县","652929":"柯坪县","653001":"阿图什市","653022":"阿克陶县","653023":"阿合奇县","653024":"乌恰县","653101":"喀什市","653121":"疏附县","653122":"疏勒县","653123":"英吉沙县","653124":"泽普县","653125":"莎车县","653126":"叶城县","653127":"麦盖提县","653128":"岳普湖县","653129":"伽师县","653130":"巴楚县","653131":"塔什库尔干塔吉克自治县","653201":"和田市","653221":"和田县","653222":"墨玉县","653223":"皮山县","653224":"洛浦县","653225":"策勒县","653226":"于田县","653227":"民丰县","654002":"伊宁市","654003":"奎屯市","654004":"霍尔果斯市","654021":"伊宁县","654022":"察布查尔锡伯自治县","654023":"霍城县","654024":"巩留县","654025":"新源县","654026":"昭苏县","654027":"特克斯县","654028":"尼勒克县","654201":"塔城市","654202":"乌苏市","654221":"额敏县","654223":"沙湾县","654224":"托里县","654225":"裕民县","654226":"和布克赛尔蒙古自治县","654301":"阿勒泰市","654321":"布尔津县","654322":"富蕴县","654323":"福海县","654324":"哈巴河县","654325":"青河县","654326":"吉木乃县","659001":"石河子市","659002":"阿拉尔市","659003":"图木舒克市","659004":"五家渠市","659005":"北屯市","659006":"铁门关市","659007":"双河市","659008":"可克达拉市","659009":"昆玉市","710101":"中正区","710102":"大同区","710103":"中山区","710104":"松山区","710105":"大安区","710106":"万华区","710107":"信义区","710108":"士林区","710109":"北投区","710110":"内湖区","710111":"南港区","710112":"文山区","710199":"其它区","710201":"新兴区","710202":"前金区","710203":"芩雅区","710204":"盐埕区","710205":"鼓山区","710206":"旗津区","710207":"前镇区","710208":"三民区","710209":"左营区","710210":"楠梓区","710211":"小港区","710241":"苓雅区","710242":"仁武区","710243":"大社区","710244":"冈山区","710245":"路竹区","710246":"阿莲区","710247":"田寮区","710248":"燕巢区","710249":"桥头区","710250":"梓官区","710251":"弥陀区","710252":"永安区","710253":"湖内区","710254":"凤山区","710255":"大寮区","710256":"林园区","710257":"鸟松区","710258":"大树区","710259":"旗山区","710260":"美浓区","710261":"六龟区","710262":"内门区","710263":"杉林区","710264":"甲仙区","710265":"桃源区","710266":"那玛夏区","710267":"茂林区","710268":"茄萣区","710299":"其它区","710301":"中西区","710302":"东区","710303":"南区","710304":"北区","710305":"安平区","710306":"安南区","710339":"永康区","710340":"归仁区","710341":"新化区","710342":"左镇区","710343":"玉井区","710344":"楠西区","710345":"南化区","710346":"仁德区","710347":"关庙区","710348":"龙崎区","710349":"官田区","710350":"麻豆区","710351":"佳里区","710352":"西港区","710353":"七股区","710354":"将军区","710355":"学甲区","710356":"北门区","710357":"新营区","710358":"后壁区","710359":"白河区","710360":"东山区","710361":"六甲区","710362":"下营区","710363":"柳营区","710364":"盐水区","710365":"善化区","710366":"大内区","710367":"山上区","710368":"新市区","710369":"安定区","710399":"其它区","710401":"中区","710402":"东区","710403":"南区","710404":"西区","710405":"北区","710406":"北屯区","710407":"西屯区","710408":"南屯区","710431":"太平区","710432":"大里区","710433":"雾峰区","710434":"乌日区","710435":"丰原区","710436":"后里区","710437":"石冈区","710438":"东势区","710439":"和平区","710440":"新社区","710441":"潭子区","710442":"大雅区","710443":"神冈区","710444":"大肚区","710445":"沙鹿区","710446":"龙井区","710447":"梧栖区","710448":"清水区","710449":"大甲区","710450":"外埔区","710451":"大安区","710499":"其它区","710507":"金沙镇","710508":"金湖镇","710509":"金宁乡","710510":"金城镇","710511":"烈屿乡","710512":"乌坵乡","710614":"南投市","710615":"中寮乡","710616":"草屯镇","710617":"国姓乡","710618":"埔里镇","710619":"仁爱乡","710620":"名间乡","710621":"集集镇","710622":"水里乡","710623":"鱼池乡","710624":"信义乡","710625":"竹山镇","710626":"鹿谷乡","710701":"仁爱区","710702":"信义区","710703":"中正区","710704":"中山区","710705":"安乐区","710706":"暖暖区","710707":"七堵区","710799":"其它区","710801":"东区","710802":"北区","710803":"香山区","710899":"其它区","710901":"东区","710902":"西区","710999":"其它区","711130":"万里区","711132":"板桥区","711133":"汐止区","711134":"深坑区","711135":"石碇区","711136":"瑞芳区","711137":"平溪区","711138":"双溪区","711139":"贡寮区","711140":"新店区","711141":"坪林区","711142":"乌来区","711143":"永和区","711144":"中和区","711145":"土城区","711146":"三峡区","711147":"树林区","711148":"莺歌区","711149":"三重区","711150":"新庄区","711151":"泰山区","711152":"林口区","711153":"芦洲区","711154":"五股区","711155":"八里区","711156":"淡水区","711157":"三芝区","711158":"石门区","711287":"宜兰市","711288":"头城镇","711289":"礁溪乡","711290":"壮围乡","711291":"员山乡","711292":"罗东镇","711293":"三星乡","711294":"大同乡","711295":"五结乡","711296":"冬山乡","711297":"苏澳镇","711298":"南澳乡","711299":"钓鱼台","711387":"竹北市","711388":"湖口乡","711389":"新丰乡","711390":"新埔镇","711391":"关西镇","711392":"芎林乡","711393":"宝山乡","711394":"竹东镇","711395":"五峰乡","711396":"横山乡","711397":"尖石乡","711398":"北埔乡","711399":"峨眉乡","711414":"中坜区","711415":"平镇区","711417":"杨梅区","711418":"新屋区","711419":"观音区","711420":"桃园区","711421":"龟山区","711422":"八德区","711423":"大溪区","711425":"大园区","711426":"芦竹区","711487":"中坜市","711488":"平镇市","711489":"龙潭乡","711490":"杨梅市","711491":"新屋乡","711492":"观音乡","711493":"桃园市","711494":"龟山乡","711495":"八德市","711496":"大溪镇","711497":"复兴乡","711498":"大园乡","711499":"芦竹乡","711520":"头份市","711582":"竹南镇","711583":"头份镇","711584":"三湾乡","711585":"南庄乡","711586":"狮潭乡","711587":"后龙镇","711588":"通霄镇","711589":"苑里镇","711590":"苗栗市","711591":"造桥乡","711592":"头屋乡","711593":"公馆乡","711594":"大湖乡","711595":"泰安乡","711596":"铜锣乡","711597":"三义乡","711598":"西湖乡","711599":"卓兰镇","711736":"员林市","711774":"彰化市","711775":"芬园乡","711776":"花坛乡","711777":"秀水乡","711778":"鹿港镇","711779":"福兴乡","711780":"线西乡","711781":"和美镇","711782":"伸港乡","711783":"员林镇","711784":"社头乡","711785":"永靖乡","711786":"埔心乡","711787":"溪湖镇","711788":"大村乡","711789":"埔盐乡","711790":"田中镇","711791":"北斗镇","711792":"田尾乡","711793":"埤头乡","711794":"溪州乡","711795":"竹塘乡","711796":"二林镇","711797":"大城乡","711798":"芳苑乡","711799":"二水乡","711982":"番路乡","711983":"梅山乡","711984":"竹崎乡","711985":"阿里山乡","711986":"中埔乡","711987":"大埔乡","711988":"水上乡","711989":"鹿草乡","711990":"太保市","711991":"朴子市","711992":"东石乡","711993":"六脚乡","711994":"新港乡","711995":"民雄乡","711996":"大林镇","711997":"溪口乡","711998":"义竹乡","711999":"布袋镇","712180":"斗南镇","712181":"大埤乡","712182":"虎尾镇","712183":"土库镇","712184":"褒忠乡","712185":"东势乡","712186":"台西乡","712187":"仑背乡","712188":"麦寮乡","712189":"斗六市","712190":"林内乡","712191":"古坑乡","712192":"莿桐乡","712193":"西螺镇","712194":"二仑乡","712195":"北港镇","712196":"水林乡","712197":"口湖乡","712198":"四湖乡","712199":"元长乡","712451":"崁顶乡","712467":"屏东市","712468":"三地门乡","712469":"雾台乡","712470":"玛家乡","712471":"九如乡","712472":"里港乡","712473":"高树乡","712474":"盐埔乡","712475":"长治乡","712476":"麟洛乡","712477":"竹田乡","712478":"内埔乡","712479":"万丹乡","712480":"潮州镇","712481":"泰武乡","712482":"来义乡","712483":"万峦乡","712484":"莰顶乡","712485":"新埤乡","712486":"南州乡","712487":"林边乡","712488":"东港镇","712489":"琉球乡","712490":"佳冬乡","712491":"新园乡","712492":"枋寮乡","712493":"枋山乡","712494":"春日乡","712495":"狮子乡","712496":"车城乡","712497":"牡丹乡","712498":"恒春镇","712499":"满州乡","712584":"台东市","712585":"绿岛乡","712586":"兰屿乡","712587":"延平乡","712588":"卑南乡","712589":"鹿野乡","712590":"关山镇","712591":"海端乡","712592":"池上乡","712593":"东河乡","712594":"成功镇","712595":"长滨乡","712596":"金峰乡","712597":"大武乡","712598":"达仁乡","712599":"太麻里乡","712686":"花莲市","712687":"新城乡","712688":"太鲁阁","712689":"秀林乡","712690":"吉安乡","712691":"寿丰乡","712692":"凤林镇","712693":"光复乡","712694":"丰滨乡","712695":"瑞穗乡","712696":"万荣乡","712697":"玉里镇","712698":"卓溪乡","712699":"富里乡","712794":"马公市","712795":"西屿乡","712796":"望安乡","712797":"七美乡","712798":"白沙乡","712799":"湖西乡","712896":"南竿乡","712897":"北竿乡","712898":"东引乡","712899":"莒光乡","810101":"中西区","810102":"湾仔区","810103":"东区","810104":"南区","810201":"九龙城区","810202":"油尖旺区","810203":"深水埗区","810204":"黄大仙区","810205":"观塘区","810301":"北区","810302":"大埔区","810303":"沙田区","810304":"西贡区","810305":"元朗区","810306":"屯门区","810307":"荃湾区","810308":"葵青区","810309":"离岛区","820101":"澳门半岛","820201":"离岛"}} \ No newline at end of file diff --git a/yshop-app/src/main/resources/config/application-dev.yml b/yshop-app/src/main/resources/config/application-dev.yml new file mode 100644 index 0000000..8ca258c --- /dev/null +++ b/yshop-app/src/main/resources/config/application-dev.yml @@ -0,0 +1,93 @@ +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driverClassName: com.mysql.cj.jdbc.Driver + druid: + # 主库数据源 + master: + url: jdbc:mysql://localhost:3306/yshopb2c?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8 + username: root + password: 123456 + # 从库数据源 + slave: + # 从数据源开关/默认关闭 + enabled: false + url: + username: + password: + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 FROM DUAL + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + statViewServlet: + enabled: true + url-pattern: /monitor/druid/* + filter: + stat: + # 慢SQL记录 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true + redis: + host: localhost # Redis服务器地址 + database: 2 # Redis数据库索引(默认为0) + port: 6379 # Redis服务器连接端口 + password: # Redis服务器连接密码(默认为空) + jedis: + pool: + max-active: 8 # 连接池最大连接数(使用负值表示没有限制) + max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制) + max-idle: 8 # 连接池中的最大空闲连接 + min-idle: 0 # 连接池中的最小空闲连接 + timeout: 3000ms # 连接超时时间(毫秒) + cache: + # spring cache 缓存类型为redis 也可以是其他的实现 + type: redis + + + +yshop: + security: + jwt-key: yshopmini + token-expired-in: 86400000 + +# 是否限制单用户登录 +single: + login: false + + +#是否开启 swagger-ui +swagger: + enabled: true + title: yshop商城移动端API + serverUrl: http://localhost:8009 + version: 3.2 + +# 文件存储路径 +file: + path: D:\yshop\file\ + avatar: D:\yshop\avatar\ + # 文件大小 /M + maxSize: 100 + avatarMaxSize: 5 + + + diff --git a/yshop-app/src/main/resources/config/application-docker.yml b/yshop-app/src/main/resources/config/application-docker.yml new file mode 100644 index 0000000..693dee4 --- /dev/null +++ b/yshop-app/src/main/resources/config/application-docker.yml @@ -0,0 +1,99 @@ +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driverClassName: com.mysql.cj.jdbc.Driver + druid: + # 主库数据源 + master: + url: jdbc:mysql://172.30.0.10:3366/yshopb2c?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull + username: yshopb2c + password: bkfGfAimifjPZtNE + # 从库数据源 + slave: + # 从数据源开关/默认关闭 + enabled: false + url: + username: + password: + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 FROM DUAL + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + statViewServlet: + enabled: true + url-pattern: /monitor/druid/* + filter: + stat: + # 慢SQL记录 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true + redis: + host: 172.30.0.10 # Redis服务器地址 + database: 5 # Redis数据库索引(默认为0) + port: 6399 # Redis服务器连接端口 + password: 6379@@6379 # Redis服务器连接密码(默认为空) + jedis: + pool: + max-active: 8 # 连接池最大连接数(使用负值表示没有限制) + max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制) + max-idle: 8 # 连接池中的最大空闲连接 + min-idle: 0 # 连接池中的最小空闲连接 + timeout: 3000ms # 连接超时时间(毫秒) + cache: + # spring cache 缓存类型为redis 也可以是其他的实现 + type: redis + +# 是否限制单用户登录 +single: + login: false + +yshop: + security: + jwt-key: yshopmini + token-expired-in: 72000 + + + + +#如果生产环境要开启swagger,需要配置请求地址 +#springfox: +# documentation: +# swagger: +# v2: +# host: # 接口域名或外网ip + +#是否开启 swagger-ui,生产环境默认不开启 +swagger: + enabled: true + title: yshop商城移动端API + serverUrl: http://localhost:8009 + version: 3.2 + +# 文件存储路径 +file: + path: /home/yshop/file/ + avatar: /home/yshop/avatar/ + # 文件大小 /M + maxSize: 100 + avatarMaxSize: 5 + + diff --git a/yshop-app/src/main/resources/config/application-prod.yml b/yshop-app/src/main/resources/config/application-prod.yml new file mode 100644 index 0000000..5c20767 --- /dev/null +++ b/yshop-app/src/main/resources/config/application-prod.yml @@ -0,0 +1,99 @@ +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driverClassName: com.mysql.cj.jdbc.Driver + druid: + # 主库数据源 + master: + url: jdbc:mysql://localhost:3366/yshopb2c?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull + username: yshopb2c + password: bkfGfAimifjPZtNE + # 从库数据源 + slave: + # 从数据源开关/默认关闭 + enabled: false + url: + username: + password: + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 FROM DUAL + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + statViewServlet: + enabled: true + url-pattern: /monitor/druid/* + filter: + stat: + # 慢SQL记录 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true + redis: + host: 127.0.0.1 # Redis服务器地址 + database: 5 # Redis数据库索引(默认为0) + port: 6379 # Redis服务器连接端口 + password: # Redis服务器连接密码(默认为空) + jedis: + pool: + max-active: 8 # 连接池最大连接数(使用负值表示没有限制) + max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制) + max-idle: 8 # 连接池中的最大空闲连接 + min-idle: 0 # 连接池中的最小空闲连接 + timeout: 3000ms # 连接超时时间(毫秒) + cache: + # spring cache 缓存类型为redis 也可以是其他的实现 + type: redis + +# 是否限制单用户登录 +single: + login: false + +yshop: + security: + jwt-key: yshopmini + token-expired-in: 72000 + + + + +#如果生产环境要开启swagger,需要配置请求地址 +#springfox: +# documentation: +# swagger: +# v2: +# host: # 接口域名或外网ip + +#是否开启 swagger-ui,生产环境默认不开启 +swagger: + enabled: true + title: yshop商城移动端API + serverUrl: http://localhost:8009 + version: 3.2 + +# 文件存储路径 +file: + path: /home/yshop/file/ + avatar: /home/yshop/avatar/ + # 文件大小 /M + maxSize: 100 + avatarMaxSize: 5 + + diff --git a/yshop-app/src/main/resources/config/application.yml b/yshop-app/src/main/resources/config/application.yml new file mode 100644 index 0000000..0866357 --- /dev/null +++ b/yshop-app/src/main/resources/config/application.yml @@ -0,0 +1,92 @@ +server: + port: 8008 + servlet: + context-path: /api + encoding: + charset: UTF-8 + enabled: true + force: true + tomcat: + uri-encoding: UTF-8 + + +spring: + freemarker: + check-template-location: false + profiles: + active: dev + jackson: + time-zone: GMT+8 + data: + redis: + repositories: + enabled: false + #配置 Jpa +# jpa: +# properties: +# hibernate: +# dialect: org.hibernate.dialect.MySQL5InnoDBDialect +# open-in-view: true + + + + + +#七牛云 +qiniu: + # 文件大小 /M + max-size: 15 + +#邮箱验证码有效时间/分钟 +code: + expiration: 5 + +#登录图形验证码有效时间/分钟 +loginCode: + expiration: 2 + +mybatis-plus: + check-config-location: true + configuration: + map-underscore-to-camel-case: true + global-config: + db-config: + id-type: auto + logic-delete-value: 1 + logic-not-delete-value: 0 +# mapper-locations: classpath*:mapper/**/*Mapper.xml + +logging: + level: + co.yixiang: DEBUG + org.springframework.web: DEBUG + com.github.binarywang.demo.wx.mp: DEBUG + me.chanjar.weixin: DEBUG + + + + + +yshop: + #相关配置 + version: 3.2 + +# 防止XSS攻击 +xss: + # 过滤开关 + enabled: true + # 排除链接(多个用逗号分隔) + excludes: + # 匹配链接 + urlPatterns: + +jwt: + header: Authorization + # 令牌前缀 + token-start-with: Bearer + online-key: yshopapp + + +# sm.ms 图床的 token +smms: + token: 1oOP3ykFDI0K6ifmtvU7c8Y1eTWZSlyl diff --git a/yshop-app/src/main/resources/fx.jpg b/yshop-app/src/main/resources/fx.jpg new file mode 100644 index 0000000..739d0c1 Binary files /dev/null and b/yshop-app/src/main/resources/fx.jpg differ diff --git a/yshop-app/src/main/resources/generator.properties b/yshop-app/src/main/resources/generator.properties new file mode 100644 index 0000000..2ed9370 --- /dev/null +++ b/yshop-app/src/main/resources/generator.properties @@ -0,0 +1,27 @@ +#数据库类型转Java类型 +tinyint=Integer +smallint=Integer +mediumint=Integer +int=Integer +integer=Integer + +bigint=Long + +float=Float + +double=Double + +decimal=BigDecimal + +bit=Boolean + +char=String +varchar=String +tinytext=String +text=String +mediumtext=String +longtext=String + +date=Timestamp +datetime=Timestamp +timestamp=Timestamp \ No newline at end of file diff --git a/yshop-app/src/main/resources/log4jdbc.log4j2.properties b/yshop-app/src/main/resources/log4jdbc.log4j2.properties new file mode 100644 index 0000000..302525f --- /dev/null +++ b/yshop-app/src/main/resources/log4jdbc.log4j2.properties @@ -0,0 +1,4 @@ +# If you use SLF4J. First, you need to tell log4jdbc-log4j2 that you want to use the SLF4J logger +log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator +log4jdbc.auto.load.popular.drivers=false +log4jdbc.drivers=com.mysql.cj.jdbc.Driver \ No newline at end of file diff --git a/yshop-app/src/main/resources/logback.xml b/yshop-app/src/main/resources/logback.xml new file mode 100644 index 0000000..2a020c2 --- /dev/null +++ b/yshop-app/src/main/resources/logback.xml @@ -0,0 +1,60 @@ + + + + + + + + yshop + + + + + + ${log.pattern} + ${log.charset} + + + + + + ${log.path}/error.log + + ${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz + 50MB + 30 + + + %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n + UTF-8 + + + ERROR + + + + + + ${log.path}/info.log + + ${log.path}/%d{yyyy-MM}/info.%d{yyyy-MM-dd}.%i.log.gz + 50MB + 30 + + + %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n + UTF-8 + + + INFO + + + + + + + + + + + diff --git a/yshop-app/src/main/resources/poster.jpg b/yshop-app/src/main/resources/poster.jpg new file mode 100644 index 0000000..7687578 Binary files /dev/null and b/yshop-app/src/main/resources/poster.jpg differ diff --git a/yshop-app/src/main/resources/red.jpg b/yshop-app/src/main/resources/red.jpg new file mode 100644 index 0000000..01c147c Binary files /dev/null and b/yshop-app/src/main/resources/red.jpg differ diff --git a/yshop-app/src/main/resources/simsunb.ttf b/yshop-app/src/main/resources/simsunb.ttf new file mode 100644 index 0000000..1c14f7f Binary files /dev/null and b/yshop-app/src/main/resources/simsunb.ttf differ diff --git a/yshop-app/src/test/resources/templates/controller.java.vm b/yshop-app/src/test/resources/templates/controller.java.vm new file mode 100644 index 0000000..86507e1 --- /dev/null +++ b/yshop-app/src/test/resources/templates/controller.java.vm @@ -0,0 +1,114 @@ +package ${package.Controller}; + +import ${package.Entity}.${entity}; +import ${package.Service}.${table.serviceName}; +import ${cfg.queryParamPath}; +import ${cfg.queryVoPath}; +#if(${superControllerClassPackage}) +import ${superControllerClassPackage}; +#end +import co.yixiang.commonold.api.ApiResult; + #if(${swagger2}) +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +#end +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +#if(${restControllerStyle}) +import org.springframework.web.bind.annotation.RestController; +#else +import org.springframework.stereotype.Controller; +#end + +import javax.validation.Valid; + +import ${cfg.paging}; +import ${cfg.idParamPath}; + +/** + *

+ * $!{table.comment} 前端控制器 + *

+ * + * @author ${author} + * @since ${date} + */ +@Slf4j +#if(${restControllerStyle}) +@RestController +#else +@Controller +#end +@RequestMapping("/${cfg.entityObjectName}") +@Api("$!{table.comment} API") +#if(${kotlin}) +class ${table.controllerName}#if(${superControllerClass}) : ${superControllerClass}()#end + +#else +#if(${superControllerClass}) +public class ${table.controllerName} extends ${superControllerClass} { +#else +public class ${table.controllerName} { +#end + + @Autowired + private ${table.serviceName} ${cfg.serviceObjectName}; + +#if(${cfg.generatorStrategy}) + /** + * 添加$!{table.comment} + */ + @PostMapping("/add") + @ApiOperation(value = "添加${entity}对象",notes = "添加$!{table.comment}",response = ApiResult.class) + public ApiResult add${entity}(@Valid @RequestBody ${entity} ${cfg.entityObjectName}) throws Exception{ + boolean flag = ${cfg.serviceObjectName}.save(${cfg.entityObjectName}); + return ApiResult.result(flag); + } + + /** + * 修改$!{table.comment} + */ + @PostMapping("/update") + @ApiOperation(value = "修改${entity}对象",notes = "修改$!{table.comment}",response = ApiResult.class) + public ApiResult update${entity}(@Valid @RequestBody ${entity} ${cfg.entityObjectName}) throws Exception{ + boolean flag = ${cfg.serviceObjectName}.updateById(${cfg.entityObjectName}); + return ApiResult.result(flag); + } + + /** + * 删除$!{table.comment} + */ + @PostMapping("/delete") + @ApiOperation(value = "删除${entity}对象",notes = "删除$!{table.comment}",response = ApiResult.class) + public ApiResult delete${entity}(@Valid @RequestBody IdParam idParam) throws Exception{ + boolean flag = ${cfg.serviceObjectName}.removeById(idParam.getId()); + return ApiResult.result(flag); + } + + /** + * 获取$!{table.comment} + */ + @PostMapping("/info") + @ApiOperation(value = "获取${entity}对象详情",notes = "查看$!{table.comment}",response = ${entity}QueryVo.class) + public ApiResult<${entity}QueryVo> get${entity}(@Valid @RequestBody IdParam idParam) throws Exception{ + ${entity}QueryVo ${cfg.entityObjectName}QueryVo = ${cfg.serviceObjectName}.get${entity}ById(idParam.getId()); + return ApiResult.ok(${cfg.entityObjectName}QueryVo); + } + + /** + * $!{table.comment}分页列表 + */ + @PostMapping("/getPageList") + @ApiOperation(value = "获取${entity}分页列表",notes = "$!{table.comment}分页列表",response = ${entity}QueryVo.class) + public ApiResult> get${entity}PageList(@Valid @RequestBody(required = false) ${entity}QueryParam ${cfg.entityObjectName}QueryParam) throws Exception{ + Paging<${entity}QueryVo> paging = ${cfg.entityObjectName}Service.get${entity}PageList(${cfg.entityObjectName}QueryParam); + return ApiResult.ok(paging); + } +#end + +} + +#end \ No newline at end of file diff --git a/yshop-app/src/test/resources/templates/entity.java.vm b/yshop-app/src/test/resources/templates/entity.java.vm new file mode 100644 index 0000000..61c3326 --- /dev/null +++ b/yshop-app/src/test/resources/templates/entity.java.vm @@ -0,0 +1,161 @@ +package ${package.Entity}; + +#foreach($pkg in ${table.importPackages}) +import ${pkg}; +#end +#if(${swagger2}) +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +#end +#if(${entityLombokModel}) +import lombok.Data; +import lombok.EqualsAndHashCode; +## import lombok.experimental.Accessors; +#end + +import java.util.Date; + +/** + *

+ * $!{table.comment} + *

+ * + * @author ${author} + * @since ${date} + */ +#if(${entityLombokModel}) +@Data +#if(${superEntityClass}) +@EqualsAndHashCode(callSuper = true) +#else +@EqualsAndHashCode(callSuper = false) +#end +## @Accessors(chain = true) +#end +#if(${table.convert}) +@TableName("${table.name}") +#end +#if(${swagger2}) +@ApiModel(value="${entity}对象", description="$!{table.comment}") +#end +#if(${superEntityClass}) +public class ${entity} extends ${superEntityClass}#if(${activeRecord})<${entity}>#end { +#elseif(${activeRecord}) +public class ${entity} extends Model<${entity}> { +#else +public class ${entity} implements Serializable { +#end + + private static final long serialVersionUID = 1L; +## ---------- BEGIN 字段循环遍历 ---------- +#foreach($field in ${table.fields}) +## 自定义属性,是否是主键 +#set($custom_is_pk=false) + +#if(${field.keyFlag}) +#set($keyPropertyName=${field.propertyName}) +#end +#if("$!field.comment" != "") + #if(${swagger2}) +@ApiModelProperty(value = "${field.comment}") + #else +/** + * ${field.comment} + */ + #end +#end +#if(${field.keyFlag}) +## 主键 +#if(${field.keyIdentityFlag}) +@TableId(value = "${field.name}", type = IdType.AUTO) +#elseif(!$null.isNull(${idType}) && "$!idType" != "") +## 设置主键注解 +@TableId(value = "${field.name}", type = IdType.${idType}) +## 是主键类型 +#set($custom_is_pk=true) +#elseif(${field.convert}) +@TableId("${field.name}") +#end +## 普通字段 +#elseif(${field.fill}) +## ----- 存在字段填充设置 ----- +#if(${field.convert}) + @TableField(value = "${field.name}", fill = FieldFill.${field.fill}) +#else + @TableField(fill = FieldFill.${field.fill}) +#end +#elseif(${field.convert}) + @TableField("${field.name}") +#end +## 乐观锁注解 +#if(${versionFieldName}==${field.name}) + @Version +#end +## 逻辑删除注解 +#if(${logicDeleteFieldName}==${field.name}) + @TableLogic +#end +#if(${custom_is_pk}) + private ${field.propertyType} ${field.propertyName}; +#else +private ${field.propertyType} ${field.propertyName}; +#end +#end +## ---------- END 字段循环遍历 ---------- +#if(!${entityLombokModel}) +#foreach($field in ${table.fields}) +#if(${field.propertyType.equals("boolean")}) +#set($getprefix="is") +#else +#set($getprefix="get") +#end + + public ${field.propertyType} ${getprefix}${field.capitalName}() { + return ${field.propertyName}; + } + +#if(${entityBuilderModel}) + public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) { +#else + public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) { +#end + this.${field.propertyName} = ${field.propertyName}; +#if(${entityBuilderModel}) + return this; +#end + } +#end +#end + +#if(${entityColumnConstant}) +#foreach($field in ${table.fields}) + public static final String ${field.name.toUpperCase()} = "${field.name}"; + +#end +#end +#if(${activeRecord}) + @Override + protected Serializable pkVal() { +#if(${keyPropertyName}) + return this.${keyPropertyName}; +#else + return null; +#end + } + +#end +#if(!${entityLombokModel}) + @Override + public String toString() { + return "${entity}{" + +#foreach($field in ${table.fields}) +#if($!{foreach.index}==0) + "${field.propertyName}=" + ${field.propertyName} + +#else + ", ${field.propertyName}=" + ${field.propertyName} + +#end +#end + "}"; + } +#end +} diff --git a/yshop-app/src/test/resources/templates/mapper.java.vm b/yshop-app/src/test/resources/templates/mapper.java.vm new file mode 100644 index 0000000..207c1cb --- /dev/null +++ b/yshop-app/src/test/resources/templates/mapper.java.vm @@ -0,0 +1,46 @@ +package ${package.Mapper}; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import ${superMapperClassPackage}; +import ${package.Entity}.${entity}; +import ${cfg.queryParamPath}; +import ${cfg.queryVoPath}; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.io.Serializable; + +/** + *

+ * $!{table.comment} Mapper 接口 + *

+ * + * @author ${author} + * @since ${date} + */ +#if(${kotlin}) +interface ${table.mapperName} : ${superMapperClass}<${entity}> +#else +@Repository +public interface ${table.mapperName} extends ${superMapperClass}<${entity}> { +#if(${cfg.generatorStrategy}) + + /** + * 根据ID获取查询对象 + * @param id + * @return + */ + ${entity}QueryVo get${entity}ById(Serializable id); + + /** + * 获取分页对象 + * @param page + * @param ${cfg.entityObjectName}QueryParam + * @return + */ + IPage<${entity}QueryVo> get${entity}PageList(@Param("page") Page page, @Param("param") ${entity}QueryParam ${cfg.entityObjectName}QueryParam); +#end + +} +#end diff --git a/yshop-app/src/test/resources/templates/mapper.xml.vm b/yshop-app/src/test/resources/templates/mapper.xml.vm new file mode 100644 index 0000000..b3829d3 --- /dev/null +++ b/yshop-app/src/test/resources/templates/mapper.xml.vm @@ -0,0 +1,47 @@ + + + + +#if(${enableCache}) + + + +#end +#if(${baseResultMap}) + + +#foreach($field in ${table.fields}) +#if(${field.keyFlag})##生成主键排在第一位 + +#end +#end +#foreach($field in ${table.commonFields})##生成公共字段 + +#end +#foreach($field in ${table.fields}) +#if(!${field.keyFlag})##生成普通字段 + +#end +#end + + +#end + + +#foreach($field in ${table.commonFields}) + ${field.name}, +#end + ${table.fieldNames} + +#if(${cfg.generatorStrategy}) + + + + + +#end + diff --git a/yshop-app/src/test/resources/templates/queryParam.java.vm b/yshop-app/src/test/resources/templates/queryParam.java.vm new file mode 100644 index 0000000..208ffbb --- /dev/null +++ b/yshop-app/src/test/resources/templates/queryParam.java.vm @@ -0,0 +1,30 @@ +package co.yixiang.modules.${package.ModuleName}.web.param; + +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +#if(${cfg.pageListOrder}) +import ${cfg.orderQueryParamPath}; +#else +import ${cfg.queryParamCommonPath}; +#end + +/** + *

+ * $!{table.comment} 查询参数对象 + *

+ * + * @author ${author} + * @date ${date} + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="${entity}QueryParam对象", description="$!{table.comment}查询参数") +#if(${cfg.pageListOrder}) +public class ${entity}QueryParam extends OrderQueryParam { +#else +public class ${entity}QueryParam extends QueryParam { +#end + private static final long serialVersionUID = 1L; +} diff --git a/yshop-app/src/test/resources/templates/queryVo.java.vm b/yshop-app/src/test/resources/templates/queryVo.java.vm new file mode 100644 index 0000000..25ed1c4 --- /dev/null +++ b/yshop-app/src/test/resources/templates/queryVo.java.vm @@ -0,0 +1,124 @@ +package co.yixiang.modules.${package.ModuleName}.web.vo; + +#if(${swagger2}) +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +#end +#if(${entityLombokModel}) +import lombok.Data; +#end +import java.io.Serializable; + +import java.util.Date; + +/** + *

+ * $!{table.comment} 查询结果对象 + *

+ * + * @author ${author} + * @date ${date} + */ +#if(${entityLombokModel}) +@Data +#end +#if(${table.convert}) +@TableName("${table.name}") +#end +@ApiModel(value="${entity}QueryVo对象", description="$!{table.comment}查询参数") +public class ${entity}QueryVo implements Serializable{ + private static final long serialVersionUID = 1L; +## ---------- BEGIN 字段循环遍历 ---------- +#foreach($field in ${table.fields}) + +#if(${field.keyFlag}) +#set($keyPropertyName=${field.propertyName}) +#end +#if("$!field.comment" != "") + #if(${swagger2}) +@ApiModelProperty(value = "${field.comment}") + #else +/** + * ${field.comment} + */ + #end +#end +#if(${field.keyFlag}) +## 普通字段 +#elseif(${field.fill}) +## ----- 存在字段填充设置 ----- +#if(${field.convert}) + @TableField(value = "${field.name}", fill = FieldFill.${field.fill}) +#else + @TableField(fill = FieldFill.${field.fill}) +#end +#elseif(${field.convert}) + @TableField("${field.name}") +#end +## 乐观锁注解 +#if(${versionFieldName}==${field.name}) + @Version +#end +## 逻辑删除注解 +#if(${logicDeleteFieldName}==${field.name}) + @TableLogic +#end +private ${field.propertyType} ${field.propertyName}; +#end +## ---------- END 字段循环遍历 ---------- +#if(!${entityLombokModel}) +#foreach($field in ${table.fields}) +#if(${field.propertyType.equals("boolean")}) +#set($getprefix="is") +#else +#set($getprefix="get") +#end + + public ${field.propertyType} ${getprefix}${field.capitalName}() { + return ${field.propertyName}; + } + +#if(${entityBuilderModel}) + public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) { +#else + public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) { +#end + this.${field.propertyName} = ${field.propertyName}; +#if(${entityBuilderModel}) + return this; +#end + } +#end +#end + +#if(${entityColumnConstant}) +#foreach($field in ${table.fields}) + public static final String ${field.name.toUpperCase()} = "${field.name}"; + +#end +#end +#if(${activeRecord}) + @Override + protected Serializable pkVal() { +#if(${keyPropertyName}) + return this.${keyPropertyName}; +#else + return null; +#end + } +#end +#if(!${entityLombokModel}) + @Override + public String toString() { + return "${entity}{" + +#foreach($field in ${table.fields}) +#if($!{foreach.index}==0) + "${field.propertyName}=" + ${field.propertyName} + +#else + ", ${field.propertyName}=" + ${field.propertyName} + +#end +#end + "}"; + } +#end +} \ No newline at end of file diff --git a/yshop-app/src/test/resources/templates/service.java.vm b/yshop-app/src/test/resources/templates/service.java.vm new file mode 100644 index 0000000..9009d5c --- /dev/null +++ b/yshop-app/src/test/resources/templates/service.java.vm @@ -0,0 +1,41 @@ +package ${package.Service}; + +import ${package.Entity}.${entity}; +import ${superServiceClassPackage}; +import ${cfg.queryParamPath}; +import ${cfg.queryVoPath}; +import ${cfg.paging}; + +import java.io.Serializable; + +/** + *

+ * $!{table.comment} 服务类 + *

+ * + * @author ${author} + * @since ${date} + */ +#if(${kotlin}) +interface ${table.serviceName} : ${superServiceClass}<${entity}> +#else +public interface ${table.serviceName} extends ${superServiceClass}<${entity}> { +#if(${cfg.generatorStrategy}) + + /** + * 根据ID获取查询对象 + * @param id + * @return + */ + ${entity}QueryVo get${entity}ById(Serializable id) throws Exception; + + /** + * 获取分页对象 + * @param ${cfg.entityObjectName}QueryParam + * @return + */ + Paging<${entity}QueryVo> get${entity}PageList(${entity}QueryParam ${cfg.entityObjectName}QueryParam) throws Exception; +#end + +} +#end diff --git a/yshop-app/src/test/resources/templates/serviceImpl.java.vm b/yshop-app/src/test/resources/templates/serviceImpl.java.vm new file mode 100644 index 0000000..648f327 --- /dev/null +++ b/yshop-app/src/test/resources/templates/serviceImpl.java.vm @@ -0,0 +1,57 @@ +package ${package.ServiceImpl}; + +import ${package.Entity}.${entity}; +import ${package.Mapper}.${table.mapperName}; +import ${package.Service}.${table.serviceName}; +import ${cfg.queryParamPath}; +import ${cfg.queryVoPath}; +import ${superServiceImplClassPackage}; +import ${cfg.paging}; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.beans.factory.annotation.Autowired; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import java.io.Serializable; + + +/** + *

+ * $!{table.comment} 服务实现类 + *

+ * + * @author ${author} + * @since ${date} + */ +@Slf4j +@Service +@Transactional(rollbackFor = Exception.class) +#if(${kotlin}) +open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} { + +} +#else +public class ${table.serviceImplName} extends BaseServiceImpl<${table.mapperName}, ${entity}> implements ${table.serviceName} { + + @Autowired + private ${table.mapperName} ${cfg.mapperObjectName}; +#if(${cfg.generatorStrategy}) + + @Override + public ${entity}QueryVo get${entity}ById(Serializable id) throws Exception{ + return ${cfg.mapperObjectName}.get${entity}ById(id); + } + + @Override + public Paging<${entity}QueryVo> get${entity}PageList(${entity}QueryParam ${cfg.entityObjectName}QueryParam) throws Exception{ + Page page = setPageParam(${cfg.entityObjectName}QueryParam,OrderItem.desc("create_time")); + IPage<${entity}QueryVo> iPage = ${cfg.mapperObjectName}.get${entity}PageList(page,${cfg.entityObjectName}QueryParam); + return new Paging(iPage); + } +#end + +} +#end diff --git a/yshop-common/pom.xml b/yshop-common/pom.xml new file mode 100644 index 0000000..c48ca69 --- /dev/null +++ b/yshop-common/pom.xml @@ -0,0 +1,73 @@ + + + + yshop + co.yixiang + 3.2 + + 4.0.0 + + yshop-common + 公共模块 + + 4.1.0 + + + + com.github.binarywang + weixin-java-mp + ${weixin-java.version} + + + com.github.binarywang + weixin-java-pay + ${weixin-java.version} + + + com.github.binarywang + wx-java-miniapp-spring-boot-starter + ${weixin-java.version} + + + net.sf.dozer + dozer-spring + 5.5.1 + + + net.sf.dozer + dozer + 5.5.1 + + + jcl-over-slf4j + org.slf4j + + + + + com.google.zxing + core + 3.2.1 + + + + co.yixiang + yshop-mproot + 3.2 + + + org.apache.httpcomponents + httpcore + + + org.apache.httpcomponents + httpclient + + + org.springframework.boot + spring-boot-starter-security + + + diff --git a/yshop-common/src/main/java/co/yixiang/annotation/AnonymousAccess.java b/yshop-common/src/main/java/co/yixiang/annotation/AnonymousAccess.java new file mode 100644 index 0000000..6596e34 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/annotation/AnonymousAccess.java @@ -0,0 +1,21 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author jacky + * 用于标记匿名访问方法 + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface AnonymousAccess { + +} diff --git a/yshop-common/src/main/java/co/yixiang/annotation/DataSource.java b/yshop-common/src/main/java/co/yixiang/annotation/DataSource.java new file mode 100644 index 0000000..65d96c2 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/annotation/DataSource.java @@ -0,0 +1,19 @@ +package co.yixiang.annotation; + +import co.yixiang.enums.DataSourceType; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface DataSource { + /** + * 切换数据源名称 + */ + DataSourceType value() default DataSourceType.MASTER; +} diff --git a/yshop-common/src/main/java/co/yixiang/annotation/Limit.java b/yshop-common/src/main/java/co/yixiang/annotation/Limit.java new file mode 100644 index 0000000..fa00c88 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/annotation/Limit.java @@ -0,0 +1,40 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.annotation; + +import co.yixiang.aspect.LimitType; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author jacky + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Limit { + + // 资源名称,用于描述接口功能 + String name() default ""; + + // 资源 key + String key() default ""; + + // key prefix + String prefix() default ""; + + // 时间的,单位秒 + int period(); + + // 限制访问次数 + int count(); + + // 限制类型 + LimitType limitType() default LimitType.CUSTOMER; + +} diff --git a/yshop-common/src/main/java/co/yixiang/annotation/Query.java b/yshop-common/src/main/java/co/yixiang/annotation/Query.java new file mode 100644 index 0000000..e5a925b --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/annotation/Query.java @@ -0,0 +1,84 @@ +/* +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.annotation; + +/** + * @author Zheng Jie + * @date 2019-6-4 13:52:30 + *//* + +@Target(ElementType.FIELD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Query { + + // Dong ZhaoYang 2017/8/7 基本对象的属性名 + String propName() default ""; + // Dong ZhaoYang 2017/8/7 查询方式 + Type type() default Type.EQUAL; + + */ +/** + * 连接查询的属性名,如User类中的dept + *//* + + String joinName() default ""; + + */ +/** + * 默认左连接 + *//* + + Join join() default Join.LEFT; + + */ +/** + * 多字段模糊搜索,仅支持String类型字段,多个用逗号隔开, 如@Query(blurry = "email,username") + *//* + + String blurry() default ""; + + enum Type { + // jie 2019/6/4 相等 + EQUAL + // Dong ZhaoYang 2017/8/7 大于等于 + , GREATER_THAN + // Dong ZhaoYang 2017/8/7 小于等于 + , LESS_THAN + // Dong ZhaoYang 2017/8/7 中模糊查询 + , INNER_LIKE + // Dong ZhaoYang 2017/8/7 左模糊查询 + , LEFT_LIKE + // Dong ZhaoYang 2017/8/7 右模糊查询 + , RIGHT_LIKE + // Dong ZhaoYang 2017/8/7 小于 + , LESS_THAN_NQ + // jie 2019/6/4 包含 + , IN + // 不等于 + ,NOT_EQUAL + // between + ,BETWEEN + // 不为空 + ,NOT_NULL + } + + */ +/** + * @author Zheng Jie + * 适用于简单连接查询,复杂的请自定义该注解,或者使用sql查询 + *//* + + enum Join { + */ +/** jie 2019-6-4 13:18:30 左右连接 *//* + + LEFT, RIGHT + } + +} + +*/ diff --git a/yshop-common/src/main/java/co/yixiang/api/ApiCode.java b/yshop-common/src/main/java/co/yixiang/api/ApiCode.java new file mode 100644 index 0000000..1e207c4 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/api/ApiCode.java @@ -0,0 +1,126 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.api; + + +/** + * API 响应码 + * @author hupeng + * @date 2020-04-30 + */ +public enum ApiCode { + + /** + * 操作成功 + **/ + SUCCESS(200, "操作成功"), + /** + * 非法访问 + **/ + UNAUTHORIZED(401, "非法访问"), + /** + * 没有权限 + **/ + NOT_PERMISSION(403, "没有权限"), + /** + * 你请求的资源不存在 + **/ + NOT_FOUND(404, "你请求的资源不存在"), + /** + * 操作失败 + **/ + FAIL(500, "操作失败"), + /** + * 登录失败 + **/ + LOGIN_EXCEPTION(4000, "登录失败"), + /** + * 系统异常 + **/ + SYSTEM_EXCEPTION(5000, "系统异常"), + /** + * 请求参数校验异常 + **/ + PARAMETER_EXCEPTION(5001, "请求参数校验异常"), + /** + * 请求参数解析异常 + **/ + PARAMETER_PARSE_EXCEPTION(5002, "请求参数解析异常"), + /** + * HTTP内容类型异常 + **/ + HTTP_MEDIA_TYPE_EXCEPTION(5003, "HTTP内容类型异常"), + /** + * 系统处理异常 + **/ + YSHOP_SYSTEM_EXCEPTION(5100, "系统处理异常"), + /** + * 业务处理异常 + **/ + BUSINESS_EXCEPTION(5101, "业务处理异常"), + /** + * 数据库处理异常 + **/ + DAO_EXCEPTION(5102, "数据库处理异常"), + /** + * 验证码校验异常 + **/ + VERIFICATION_CODE_EXCEPTION(5103, "验证码校验异常"), + /** + * 登录授权异常 + **/ + AUTHENTICATION_EXCEPTION(5104, "登录授权异常"), + /** + * 没有访问权限 + **/ + UNAUTHENTICATED_EXCEPTION(5105, "没有访问权限"), + /** + * 没有访问权限 + **/ + UNAUTHORIZED_EXCEPTION(5106, "没有访问权限"), + /** + * JWT Token解析异常 + **/ + JWTDECODE_EXCEPTION(5107, "Token解析异常"), + + HTTP_REQUEST_METHOD_NOT_SUPPORTED_EXCEPTION(5108, "METHOD NOT SUPPORTED"), + + /** + * 访问次数受限制 + **/ + BAD_LIMIT_EXCEPTION(5109, "访问次数受限制"), + ; + + private final int code; + private final String message; + + ApiCode(final int code, final String message) { + this.code = code; + this.message = message; + } + + public static ApiCode getApiCode(int code) { + ApiCode[] ecs = ApiCode.values(); + for (ApiCode ec : ecs) { + if (ec.getCode() == code) { + return ec; + } + } + return SUCCESS; + } + + public int getCode() { + return code; + } + + public String getMessage() { + return message; + } + +} diff --git a/yshop-common/src/main/java/co/yixiang/api/ApiResult.java b/yshop-common/src/main/java/co/yixiang/api/ApiResult.java new file mode 100644 index 0000000..d6900d7 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/api/ApiResult.java @@ -0,0 +1,231 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.api; + + +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Accessors; +import org.apache.commons.lang3.StringUtils; + +import java.io.Serializable; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * API 返回结果 + * @author hupeng + * @date 2020-04-30 + */ +@Data +@Accessors(chain = true) +@Builder +@AllArgsConstructor +public class ApiResult implements Serializable { + private static final long serialVersionUID = 8004487252556526569L; + + /** + * 响应码 + */ + @ApiModelProperty(value = "响应码") + private int status; + + /** + * 是否成功 + */ + @ApiModelProperty(value = "是否成功:成功true,失败false") + private boolean success; + + /** + * 响应消息 + */ + @ApiModelProperty(value = "响应消息") + private String msg; + + /** + * 总条数 + */ + @ApiModelProperty(value = "总条数") + private Integer total; + + /** + * 总页数 + */ + @ApiModelProperty(value = "总页数") + private Integer totalPage; + + /** + * 响应数据 + */ + @ApiModelProperty(value = "响应数据") + private T data; + + /** + * 响应时间 + */ + @ApiModelProperty(value = "响应时间") + @JSONField(format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date time; + + public ApiResult() { + time = new Date(); + } + + public static ApiResult result(boolean flag){ + if (flag){ + return ok(); + } + return fail(); + } + + public static ApiResult result(ApiCode apiCode){ + return result(apiCode,null); + } + + public static ApiResult result(ApiCode apiCode, T data){ + return result(apiCode,null,data); + } + + public static ApiResult resultPage(Integer total, Integer totalPage, T data){ + return (ApiResult) ApiResult.builder() + .total(total) + .totalPage(totalPage) + .status(200) + .msg(null) + .data(data) + .success(true) + .time(new Date()) + .build(); + } + + + public static ApiResult result(ApiCode apiCode, String message, T data){ + boolean success = false; + if (apiCode.getCode() == ApiCode.SUCCESS.getCode()){ + success = true; + } + if (StringUtils.isBlank(message)){ + message = apiCode.getMessage(); + } + return (ApiResult) ApiResult.builder() + .status(apiCode.getCode()) + .msg(message) + .data(data) + .success(success) + .time(new Date()) + .build(); + } + + public static ApiResult ok(){ + return ok(null); + } + + public static ApiResult ok(T data){ + return result(ApiCode.SUCCESS,data); + } + + public static ApiResult ok(T data, String message){ + return result(ApiCode.SUCCESS,message,data); + } + + public static ApiResult> okMap(String key, Object value){ + Map map = new HashMap<>(1); + map.put(key,value); + return ok(map); + } + + public static ApiResult fail(ApiCode apiCode){ + return result(apiCode,null); + } + + public static ApiResult fail(String message){ + return result(ApiCode.FAIL,message,null); + + } + + public static ApiResult fail(ApiCode apiCode, T data){ + if (ApiCode.SUCCESS == apiCode){ + throw new RuntimeException("失败结果状态码不能为" + ApiCode.SUCCESS.getCode()); + } + return result(apiCode,data); + + } + + public static ApiResult fail(Integer errorCode, String message){ + return new ApiResult() + .setSuccess(false) + .setStatus(errorCode) + .setMsg(message); + } + + public static ApiResult> fail(String key, Object value){ + Map map = new HashMap<>(1); + map.put(key,value); + return result(ApiCode.FAIL,map); + } + + public static ApiResult resultPage(T t, int limit){ + List list = (List) t; + int count = list.size() / limit; + if (list.size() == 0) { + return (ApiResult) ApiResult.builder() + .total(0) + .totalPage(0) + .status(200) + .msg(null) + .data(list) + .success(true) + .time(new Date()) + .build(); + } + if (list.size() <= limit) { + return (ApiResult) ApiResult.builder() + .total(list.size()) + .totalPage(1) + .status(200) + .msg(null) + .data(list) + .success(true) + .time(new Date()) + .build(); + } else if (count % limit == 0) { + return (ApiResult) ApiResult.builder() + .total(list.size()) + .totalPage(count) + .status(200) + .msg(null) + .data(list) + .success(true) + .time(new Date()) + .build(); + } else { + return (ApiResult) ApiResult.builder() + .total(list.size()) + .totalPage(count+1) + .status(200) + .msg(null) + .data(list) + .success(true) + .time(new Date()) + .build(); + } + } + + public static ApiResult fail() { + return fail(ApiCode.FAIL); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/api/BusinessException.java b/yshop-common/src/main/java/co/yixiang/api/BusinessException.java new file mode 100644 index 0000000..37cb369 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/api/BusinessException.java @@ -0,0 +1,35 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.api; + + + + + +/** + * 业务异常 + * @author hupeng + * @date 2020-04-30 + */ +public class BusinessException extends YshopException { + private static final long serialVersionUID = -2303357122330162359L; + + public BusinessException(String message) { + super(message); + } + + public BusinessException(Integer errorCode, String message) { + super(errorCode, message); + } + + public BusinessException(ApiCode apiCode) { + super(apiCode); + } + +} diff --git a/yshop-common/src/main/java/co/yixiang/api/DaoException.java b/yshop-common/src/main/java/co/yixiang/api/DaoException.java new file mode 100644 index 0000000..bb5dfc7 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/api/DaoException.java @@ -0,0 +1,31 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.api; + + +/** + * DAO异常 + * @author hupeng + * @date 2020-04-30 + */ +public class DaoException extends YshopException { + private static final long serialVersionUID = -6912618737345878854L; + + public DaoException(String message) { + super(message); + } + + public DaoException(Integer errorCode, String message) { + super(errorCode, message); + } + + public DaoException(ApiCode apiCode) { + super(apiCode); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/api/UnAuthenticatedException.java b/yshop-common/src/main/java/co/yixiang/api/UnAuthenticatedException.java new file mode 100644 index 0000000..e55aa72 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/api/UnAuthenticatedException.java @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.api; + +/** + * 认证异常 + * @author hupeng + * @date 2020-04-30 + */ +public class UnAuthenticatedException extends YshopException { + public UnAuthenticatedException(String message) { + super(message); + } + + public UnAuthenticatedException(Integer errorCode, String message) { + super(errorCode, message); + } + + public UnAuthenticatedException(ApiCode apiCode) { + super(apiCode); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/api/YshopException.java b/yshop-common/src/main/java/co/yixiang/api/YshopException.java new file mode 100644 index 0000000..26d8c59 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/api/YshopException.java @@ -0,0 +1,58 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.api; + + +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 自定义异常 + * @author hupeng + * @date 2020-04-30 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class YshopException extends RuntimeException{ + + private static final long serialVersionUID = -2470461654663264392L; + + private Integer errorCode; + private String message; + + public YshopException() { + super(); + } + + public YshopException(String message) { + super(message); + this.message = message; + } + + public YshopException(Integer errorCode, String message) { + super(message); + this.errorCode = errorCode; + this.message = message; + } + + public YshopException(ApiCode apiCode) { + super(apiCode.getMessage()); + this.errorCode = apiCode.getCode(); + this.message = apiCode.getMessage(); + } + + public YshopException(String message, Throwable cause) { + super(message, cause); + } + + public YshopException(Throwable cause) { + super(cause); + } + +} diff --git a/yshop-common/src/main/java/co/yixiang/aspect/DataSourceAspect.java b/yshop-common/src/main/java/co/yixiang/aspect/DataSourceAspect.java new file mode 100644 index 0000000..ca72e1d --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/aspect/DataSourceAspect.java @@ -0,0 +1,42 @@ +package co.yixiang.aspect; + +import co.yixiang.annotation.DataSource; +import co.yixiang.config.datasource.DynamicDataSourceContextHolder; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Method; + +@Aspect +@Order(1) +@Component +@Slf4j +public class DataSourceAspect { + + @Pointcut("@annotation(co.yixiang.annotation.DataSource)") + public void dsPointCut() { + + } + + @Around("dsPointCut()") + public Object around(ProceedingJoinPoint point) throws Throwable { + MethodSignature signature = (MethodSignature) point.getSignature(); + Method method = signature.getMethod(); + DataSource dataSource = method.getAnnotation(DataSource.class); + if (dataSource != null) { + DynamicDataSourceContextHolder.setDataSourceType(dataSource.value().name()); + } + try { + return point.proceed(); + } finally { + // 销毁数据源 在执行方法之后 + DynamicDataSourceContextHolder.clearDataSourceType(); + } + } +} diff --git a/yshop-common/src/main/java/co/yixiang/aspect/LimitAspect.java b/yshop-common/src/main/java/co/yixiang/aspect/LimitAspect.java new file mode 100644 index 0000000..5dc2ba0 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/aspect/LimitAspect.java @@ -0,0 +1,91 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.aspect; + +import co.yixiang.annotation.Limit; +import co.yixiang.exception.BadLimitRequestException; +import co.yixiang.exception.BadRequestException; +import co.yixiang.utils.RequestHolder; +import co.yixiang.utils.StringUtils; +import com.google.common.collect.ImmutableList; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.script.DefaultRedisScript; +import org.springframework.data.redis.core.script.RedisScript; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.Method; + +/** + * @author / + */ +@Aspect +@Component +public class LimitAspect { + + private final RedisTemplate redisTemplate; + private static final Logger logger = LoggerFactory.getLogger(LimitAspect.class); + + public LimitAspect(RedisTemplate redisTemplate) { + this.redisTemplate = redisTemplate; + } + + @Pointcut("@annotation(co.yixiang.annotation.Limit)") + public void pointcut() { + } + + @Around("pointcut()") + public Object around(ProceedingJoinPoint joinPoint) throws Throwable { + HttpServletRequest request = RequestHolder.getHttpServletRequest(); + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + Method signatureMethod = signature.getMethod(); + Limit limit = signatureMethod.getAnnotation(Limit.class); + LimitType limitType = limit.limitType(); + String key = limit.key(); + if (StringUtils.isEmpty(key)) { + if (limitType == LimitType.IP) { + key = StringUtils.getIp(request); + } else { + key = signatureMethod.getName(); + } + } + + ImmutableList keys = ImmutableList.of(StringUtils.join(limit.prefix(), "_", key, "_", request.getRequestURI().replaceAll("/","_"))); + + String luaScript = buildLuaScript(); + RedisScript redisScript = new DefaultRedisScript<>(luaScript, Number.class); + Number count = redisTemplate.execute(redisScript, keys, limit.count(), limit.period()); + if (null != count && count.intValue() <= limit.count()) { + logger.info("第{}次访问key为 {},描述为 [{}] 的接口", count, keys, limit.name()); + return joinPoint.proceed(); + } else { + throw new BadLimitRequestException("访问次数受限制"); + } + } + + /** + * 限流脚本 + */ + private String buildLuaScript() { + return "local c" + + "\nc = redis.call('get',KEYS[1])" + + "\nif c and tonumber(c) > tonumber(ARGV[1]) then" + + "\nreturn c;" + + "\nend" + + "\nc = redis.call('incr',KEYS[1])" + + "\nif tonumber(c) == 1 then" + + "\nredis.call('expire',KEYS[1],ARGV[2])" + + "\nend" + + "\nreturn c;"; + } +} diff --git a/yshop-common/src/main/java/co/yixiang/aspect/LimitType.java b/yshop-common/src/main/java/co/yixiang/aspect/LimitType.java new file mode 100644 index 0000000..ef4c440 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/aspect/LimitType.java @@ -0,0 +1,17 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.aspect; + +/** + * 限流枚举 + * @author / + */ +public enum LimitType { + // 默认 + CUSTOMER, + // by ip addr + IP +} diff --git a/yshop-common/src/main/java/co/yixiang/config/ElPermissionConfig.java b/yshop-common/src/main/java/co/yixiang/config/ElPermissionConfig.java new file mode 100644 index 0000000..acaf369 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/config/ElPermissionConfig.java @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.config; + +import co.yixiang.utils.SecurityUtils; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.stereotype.Service; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author Zheng Jie + */ +@Service(value = "el") +public class ElPermissionConfig { + + public Boolean check(String ...permissions){ + // 获取当前用户的所有权限 + List elPermissions = SecurityUtils.getUserDetails().getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.toList()); + // 判断当前用户的所有权限是否包含接口上定义的权限 + return elPermissions.contains("admin") || Arrays.stream(permissions).anyMatch(elPermissions::contains); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/config/RedisConfig.java b/yshop-common/src/main/java/co/yixiang/config/RedisConfig.java new file mode 100644 index 0000000..b1980da --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/config/RedisConfig.java @@ -0,0 +1,205 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.config; + +import cn.hutool.core.lang.Assert; +import co.yixiang.utils.StringUtils; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.parser.ParserConfig; +import com.alibaba.fastjson.serializer.SerializerFeature; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.digest.DigestUtils; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.data.redis.RedisProperties; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.cache.Cache; +import org.springframework.cache.annotation.CachingConfigurerSupport; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cache.interceptor.CacheErrorHandler; +import org.springframework.cache.interceptor.KeyGenerator; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.cache.RedisCacheConfiguration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisOperations; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.RedisSerializationContext; +import org.springframework.data.redis.serializer.RedisSerializer; + +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.HashMap; +import java.util.Map; + +/** + * @author Zheng Jie + * @date 2018-11-24 + */ +@Slf4j +@Configuration(proxyBeanMethods = false) +@EnableCaching +@ConditionalOnClass(RedisOperations.class) +@EnableConfigurationProperties(RedisProperties.class) +public class RedisConfig extends CachingConfigurerSupport { + + /** + * 设置 redis 数据默认过期时间,默认2小时 + * 设置@cacheable 序列化方式 + */ + @Bean + public RedisCacheConfiguration redisCacheConfiguration(){ + FastJsonRedisSerializer fastJsonRedisSerializer = new FastJsonRedisSerializer<>(Object.class); + RedisCacheConfiguration configuration = RedisCacheConfiguration.defaultCacheConfig(); + configuration = configuration.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(fastJsonRedisSerializer)).entryTtl(Duration.ofHours(2)); + return configuration; + } + + @SuppressWarnings("all") + @Bean(name = "redisTemplate") + @ConditionalOnMissingBean(name = "redisTemplate") + public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory) { + RedisTemplate template = new RedisTemplate<>(); + //序列化 + FastJsonRedisSerializer fastJsonRedisSerializer = new FastJsonRedisSerializer<>(Object.class); + // value值的序列化采用fastJsonRedisSerializer + template.setValueSerializer(fastJsonRedisSerializer); + template.setHashValueSerializer(fastJsonRedisSerializer); + // 全局开启AutoType,这里方便开发,使用全局的方式 + ParserConfig.getGlobalInstance().setAutoTypeSupport(true); + // 建议使用这种方式,小范围指定白名单 + // ParserConfig.getGlobalInstance().addAccept("me.zhengjie.domain"); + // key的序列化采用StringRedisSerializer + template.setKeySerializer(new StringRedisSerializer()); + template.setHashKeySerializer(new StringRedisSerializer()); + template.setConnectionFactory(redisConnectionFactory); + return template; + } + + /** + * 自定义缓存key生成策略,默认将使用该策略 + */ + @Bean + @Override + public KeyGenerator keyGenerator() { + return (target, method, params) -> { + Map container = new HashMap<>(3); + Class targetClassClass = target.getClass(); + // 类地址 + container.put("class",targetClassClass.toGenericString()); + // 方法名称 + container.put("methodName",method.getName()); + // 包名称 + container.put("package",targetClassClass.getPackage()); + // 参数列表 + for (int i = 0; i < params.length; i++) { + container.put(String.valueOf(i),params[i]); + } + // 转为JSON字符串 + String jsonString = JSON.toJSONString(container); + // 做SHA256 Hash计算,得到一个SHA256摘要作为Key + return DigestUtils.sha256Hex(jsonString); + }; + } + + @Bean + @Override + public CacheErrorHandler errorHandler() { + // 异常处理,当Redis发生异常时,打印日志,但是程序正常走 + log.info("初始化 -> [{}]", "Redis CacheErrorHandler"); + return new CacheErrorHandler() { + @Override + public void handleCacheGetError(RuntimeException e, Cache cache, Object key) { + log.error("Redis occur handleCacheGetError:key -> [{}]", key, e); + } + + @Override + public void handleCachePutError(RuntimeException e, Cache cache, Object key, Object value) { + log.error("Redis occur handleCachePutError:key -> [{}];value -> [{}]", key, value, e); + } + + @Override + public void handleCacheEvictError(RuntimeException e, Cache cache, Object key) { + log.error("Redis occur handleCacheEvictError:key -> [{}]", key, e); + } + + @Override + public void handleCacheClearError(RuntimeException e, Cache cache) { + log.error("Redis occur handleCacheClearError:", e); + } + }; + } + +} + +/** + * Value 序列化 + * + * @author / + * @param + */ + class FastJsonRedisSerializer implements RedisSerializer { + + private final Class clazz; + + FastJsonRedisSerializer(Class clazz) { + super(); + this.clazz = clazz; + } + + @Override + public byte[] serialize(T t) { + if (t == null) { + return new byte[0]; + } + return JSON.toJSONString(t, SerializerFeature.WriteClassName).getBytes(StandardCharsets.UTF_8); + } + + @Override + public T deserialize(byte[] bytes) { + if (bytes == null || bytes.length <= 0) { + return null; + } + String str = new String(bytes, StandardCharsets.UTF_8); + return JSON.parseObject(str, clazz); + } + +} + +/** + * 重写序列化器 + * + * @author / + */ +class StringRedisSerializer implements RedisSerializer { + + private final Charset charset; + + StringRedisSerializer() { + this(StandardCharsets.UTF_8); + } + + private StringRedisSerializer(Charset charset) { + Assert.notNull(charset, "Charset must not be null!"); + this.charset = charset; + } + + @Override + public String deserialize(byte[] bytes) { + return (bytes == null ? null : new String(bytes, charset)); + } + + @Override + public byte[] serialize(Object object) { + String string = JSON.toJSONString(object); + if (StringUtils.isBlank(string)) { + return null; + } + string = string.replace("\"", ""); + return string.getBytes(charset); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/config/SwaggerConfig.java b/yshop-common/src/main/java/co/yixiang/config/SwaggerConfig.java new file mode 100644 index 0000000..7acfc05 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/config/SwaggerConfig.java @@ -0,0 +1,140 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.config; + +import com.fasterxml.classmate.TypeResolver; +import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; +import com.google.common.base.Predicates; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.core.Ordered; +import org.springframework.data.domain.Pageable; +import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.ParameterBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.schema.AlternateTypeRule; +import springfox.documentation.schema.AlternateTypeRuleConvention; +import springfox.documentation.schema.ModelRef; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Contact; +import springfox.documentation.service.Parameter; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import java.util.ArrayList; +import java.util.List; + +import static com.google.common.collect.Lists.newArrayList; +import static springfox.documentation.schema.AlternateTypeRules.newRule; + + +/** + * api页面 /doc.html + * @Author hupeng <610796224@qq.com> + * @Date 2019/1/9 + **/ + +@Configuration(proxyBeanMethods = false) +@EnableSwagger2 +public class SwaggerConfig { + + @Value("${jwt.header}") + private String tokenHeader; + + @Value("${jwt.token-start-with}") + private String tokenStartWith; + + @Value("${swagger.enabled}") + private Boolean enabled; + + @Value("${swagger.title}") + private String title; + + @Value("${swagger.version}") + private String version; + + @Value("${swagger.serverUrl}") + private String serverUrl; + + @Bean + @SuppressWarnings("all") + public Docket createRestApi() { + ParameterBuilder ticketPar = new ParameterBuilder(); + List pars = new ArrayList<>(); + ticketPar.name(tokenHeader).description("token") + .modelRef(new ModelRef("string")) + .parameterType("header") + .defaultValue(tokenStartWith + " ") + .required(true) + .build(); + pars.add(ticketPar.build()); + return new Docket(DocumentationType.SWAGGER_2) + .enable(enabled) + .apiInfo(apiInfo()) + .select() + .apis(RequestHandlerSelectors.basePackage("co.yixiang.modules")) + .paths(Predicates.not(PathSelectors.regex("/error.*"))) + .build() + .globalOperationParameters(pars); + } + + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title(title) + .termsOfServiceUrl(serverUrl) + .description(title) + .version(version) + .contact(new Contact("hupeng","https://www.yixiang.co","guchengwuyue@163.com")) + .build(); + } + +} + +/** + * 将Pageable转换展示在swagger中 + */ +@Configuration(proxyBeanMethods = false) +@EnableSwagger2 +@EnableKnife4j +@Import(BeanValidatorPluginsConfiguration.class) +class SwaggerDataConfig { + + @Bean + public AlternateTypeRuleConvention pageableConvention(final TypeResolver resolver) { + return new AlternateTypeRuleConvention() { + @Override + public int getOrder() { + return Ordered.HIGHEST_PRECEDENCE; + } + + @Override + public List rules() { + return newArrayList(newRule(resolver.resolve(Pageable.class), resolver.resolve(Page.class))); + } + }; + } + + @ApiModel + @Data + private static class Page { + @ApiModelProperty("页码 (0..N)") + private Integer page; + + @ApiModelProperty("每页显示的数目") + private Integer size; + + @ApiModelProperty("以下列格式排序标准:property[,asc | desc]。 默认排序顺序为升序。 支持多种排序条件:如:id,asc") + private List sort; + } +} diff --git a/yshop-common/src/main/java/co/yixiang/config/datasource/DynamicDataSourceContextHolder.java b/yshop-common/src/main/java/co/yixiang/config/datasource/DynamicDataSourceContextHolder.java new file mode 100644 index 0000000..1c2e7b0 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/config/datasource/DynamicDataSourceContextHolder.java @@ -0,0 +1,45 @@ +package co.yixiang.config.datasource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 数据源切换处理 + * + * @author hupeng + */ +public class DynamicDataSourceContextHolder +{ + public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class); + + /** + * 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本, + * 所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。 + */ + private static final ThreadLocal CONTEXT_HOLDER = new ThreadLocal<>(); + + /** + * 设置数据源的变量 + */ + public static void setDataSourceType(String dsType) + { + log.info("切换到{}数据源", dsType); + CONTEXT_HOLDER.set(dsType); + } + + /** + * 获得数据源的变量 + */ + public static String getDataSourceType() + { + return CONTEXT_HOLDER.get(); + } + + /** + * 清空数据源变量 + */ + public static void clearDataSourceType() + { + CONTEXT_HOLDER.remove(); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/constant/ShopConstants.java b/yshop-common/src/main/java/co/yixiang/constant/ShopConstants.java new file mode 100644 index 0000000..a14723f --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/constant/ShopConstants.java @@ -0,0 +1,182 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.constant; + +/** + * 商城统一常量 + * @author hupeng + * @since 2020-02-27 + */ +public interface ShopConstants { + + /** + * 订单自动取消时间(分钟) + */ + long ORDER_OUTTIME_UNPAY = 30; + /** + * 订单自动收货时间(天) + */ + long ORDER_OUTTIME_UNCONFIRM = 7; + /** + * redis订单未付款key + */ + String REDIS_ORDER_OUTTIME_UNPAY = "order:unpay:"; + /** + * redis订单收货key + */ + String REDIS_ORDER_OUTTIME_UNCONFIRM = "order:unconfirm:"; + + /** + * redis拼团key + */ + String REDIS_PINK_CANCEL_KEY = "pink:cancel:"; + + /** + * 微信支付service + */ + String YSHOP_WEIXIN_PAY_SERVICE = "yshop_weixin_pay_service"; + + /** + * 微信支付小程序service + */ + String YSHOP_WEIXIN_MINI_PAY_SERVICE = "yshop_weixin_mini_pay_service"; + + /** + * 微信支付app service + */ + String YSHOP_WEIXIN_APP_PAY_SERVICE = "yshop_weixin_app_pay_service"; + + /** + * 微信公众号service + */ + String YSHOP_WEIXIN_MP_SERVICE = "yshop_weixin_mp_service"; + /** + * 微信小程序service + */ + String YSHOP_WEIXIN_MA_SERVICE = "yshop_weixin_ma_service"; + + /** + * 商城默认密码 + */ + String YSHOP_DEFAULT_PWD = "123456"; + + /** + * 商城默认注册图片 + */ + String YSHOP_DEFAULT_AVATAR = "https://image.dayouqiantu.cn/5e79f6cfd33b6.png"; + + /** + * 腾讯地图地址解析 + */ + String QQ_MAP_URL = "https://apis.map.qq.com/ws/geocoder/v1/"; + + /** + * redis首页键 + */ + String YSHOP_REDIS_INDEX_KEY = "yshop:index_data"; + + /** + * 配置列表缓存 + */ + String YSHOP_REDIS_CONFIG_DATAS = "yshop:config_datas"; + + /** + * 充值方案 + */ + String YSHOP_RECHARGE_PRICE_WAYS = "yshop_recharge_price_ways"; + /** + * 首页banner + */ + String YSHOP_HOME_BANNER = "yshop_home_banner"; + /** + * 首页菜单 + */ + String YSHOP_HOME_MENUS = "yshop_home_menus"; + /** + * 首页滚动新闻 + */ + String YSHOP_HOME_ROLL_NEWS = "yshop_home_roll_news"; + /** + * 热门搜索 + */ + String YSHOP_HOT_SEARCH = "yshop_hot_search"; + /** + * 个人中心菜单 + */ + String YSHOP_MY_MENUES = "yshop_my_menus"; + /** + * 秒杀时间段 + */ + String YSHOP_SECKILL_TIME = "yshop_seckill_time"; + /** + * 签到天数 + */ + String YSHOP_SIGN_DAY_NUM = "yshop_sign_day_num"; + + /** + * 打印机配置 + */ + String YSHOP_ORDER_PRINT_COUNT = "order_print_count"; + /** + * 飞蛾用户信息 + */ + String YSHOP_FEI_E_USER = "fei_e_user"; + /** + * 飞蛾用户密钥 + */ + String YSHOP_FEI_E_UKEY= "fei_e_ukey"; + + /** + * 打印机配置 + */ + String YSHOP_ORDER_PRINT_COUNT_DETAIL = "order_print_count_detail"; + + /** + * 短信验证码长度 + */ + int YSHOP_SMS_SIZE = 6; + + /** + * 短信缓存时间 + */ + long YSHOP_SMS_REDIS_TIME = 600L; + + //零标识 + String YSHOP_ZERO = "0"; + + //业务标识标识 + String YSHOP_ONE = "1"; + + //目前完成任务数量是3 + int TASK_FINISH_COUNT = 3; + + int YSHOP_ONE_NUM = 1; + + String YSHOP_ORDER_CACHE_KEY = "yshop:order"; + + long YSHOP_ORDER_CACHE_TIME = 600L; + + String WECHAT_MENUS = "wechat_menus"; + + String YSHOP_EXPRESS_SERVICE = "yshop_express_service"; + + String YSHOP_REDIS_SYS_CITY_KEY = "yshop:city_list"; + + String YSHOP_REDIS_CITY_KEY = "yshop:city"; + + String YSHOP_APP_LOGIN_USER = "app-online-token:"; + + String YSHOP_WECHAT_PUSH_REMARK = "yshop为您服务!"; + + String DEFAULT_UNI_H5_URL = "https://h5.yixiang.co"; + + String YSHOP_MINI_SESSION_KET = "yshop:session_key:"; + + /**公众号二维码*/ + String WECHAT_FOLLOW_IMG="wechat_follow_img"; + /**后台api地址*/ + String ADMIN_API_URL="admin_api_url"; +} diff --git a/yshop-common/src/main/java/co/yixiang/constant/SystemConfigConstants.java b/yshop-common/src/main/java/co/yixiang/constant/SystemConfigConstants.java new file mode 100644 index 0000000..be39605 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/constant/SystemConfigConstants.java @@ -0,0 +1,57 @@ +package co.yixiang.constant; + +public class SystemConfigConstants { + //地址配置 + public final static String API="api"; + public final static String API_URL="api_url"; + public final static String SITE_URL="site_url"; + public final static String UNI_SITE_URL="uni_site_url"; + public final static String TENGXUN_MAP_KEY="tengxun_map_key"; + public final static String FILE_STORE_MODE="file_store_mode"; + //业务相关配置 + public final static String IMAGEARR="imageArr"; + public final static String INTERGRAL_FULL="integral_full"; + public final static String INTERGRAL_MAX="integral_max"; + public final static String INTERGRAL_RATIO="integral_ratio"; + public final static String ORDER_CANCEL_JOB_TIME="order_cancel_job_time"; + public final static String STORE_BROKERAGE_OPEN="store_brokerage_open"; + public final static String STORE_BROKERAGE_RATIO="store_brokerage_ratio"; + public final static String STORE_BROKERAGE_STATU="store_brokerage_statu"; + public final static String STORE_BROKERAGE_TWO="store_brokerage_two"; + public final static String STORE_FREE_POSTAGE="store_free_postage"; + public final static String STORE_POSTAGE="store_postage"; + public final static String STORE_SEFL_MENTION="store_self_mention"; + public final static String STORE_USER_MIN_RECHARGE="store_user_min_recharge"; + public final static String USER_EXTRACT_MIN_PRICE="user_extract_min_price"; + public final static String YSHOP_SHOW_RECHARGE = "yshop_show_recharge"; + //微信相关配置 + public final static String WECHAT_APPID="wechat_appid"; + public final static String WECHAT_APPSECRET="wechat_appsecret"; + public final static String WECHAT_AVATAR="wechat_avatar"; + public final static String WECHAT_ENCODE="wechat_encode"; + public final static String WECHAT_ENCODINGAESKEY="wechat_encodingaeskey"; + public final static String WECHAT_ID="wechat_id"; + public final static String WECHAT_NAME="wechat_name"; + public final static String WECHAT_QRCODE="wechat_qrcode"; + public final static String WECHAT_SHARE_IMG="wechat_share_img"; + public final static String WECHAT_SHARE_SYNOPSIS="wechat_share_synopsis"; + public final static String WECHAT_SHARE_TITLE="wechat_share_title"; + public final static String WECHAT_SOURCEID="wechat_sourceid"; + public final static String WECHAT_TOKEN="wechat_token"; + public final static String WECHAT_MA_TOKEN="wechat_ma_token"; + public final static String WECHAT_MA_ENCODINGAESKEY="wechat_ma_encodingaeskey"; + public final static String WECHAT_TYPE="wechat_type"; + public final static String WXAPP_APPID="wxapp_appId"; + public final static String WXAPP_SECRET="wxapp_secret"; + public final static String WXPAY_APPID="wxpay_appId"; + public final static String WXPAY_KEYPATH="wxpay_keyPath"; + public final static String WXPAY_MCHID="wxpay_mchId"; + public final static String WXPAY_MCHKEY="wxpay_mchKey"; + public final static String WX_NATIVE_APP_APPID="wx_native_app_appId"; + public final static String EXP_APPID = "exp_appId"; + + + //播放状态变化事件,detail = {code} + public static final String BINDSTATECHANGE = "bindstatechange"; + +} diff --git a/yshop-common/src/main/java/co/yixiang/domain/BaseDomain.java b/yshop-common/src/main/java/co/yixiang/domain/BaseDomain.java new file mode 100644 index 0000000..cb3ec4a --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/domain/BaseDomain.java @@ -0,0 +1,39 @@ +package co.yixiang.domain; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + + +/** + * @ClassName 公共模型 + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/13 + **/ +@Getter +@Setter +public class BaseDomain implements Serializable { + + private static final long serialVersionUID = 1L; + + + @TableField(fill= FieldFill.INSERT) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date createTime; + + @TableField(fill= FieldFill.UPDATE) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date updateTime; + + @TableLogic + @JsonIgnore + @TableField(fill= FieldFill.INSERT) + private Integer isDel; +} diff --git a/yshop-common/src/main/java/co/yixiang/domain/PageResult.java b/yshop-common/src/main/java/co/yixiang/domain/PageResult.java new file mode 100644 index 0000000..4e36c7a --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/domain/PageResult.java @@ -0,0 +1,37 @@ +package co.yixiang.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + +/** + * @author :LionCity + * @date :Created in 2020-08-04 16:55 + * @description:分页参数返回 + * @modified By: + * @version: V1.0 + */ +@Data +@Accessors(chain = true) +@Builder +public class PageResult implements Serializable { + + + @ApiModelProperty("总数量") + private long totalElements; + + @ApiModelProperty("内容") + private List content; + + public PageResult(long totalElements, List content) { + this.totalElements = totalElements; + this.content = content; + } + + public PageResult() { + } +} diff --git a/yshop-common/src/main/java/co/yixiang/dozer/config/DozerMapperConfig.java b/yshop-common/src/main/java/co/yixiang/dozer/config/DozerMapperConfig.java new file mode 100644 index 0000000..7c6f0d4 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/dozer/config/DozerMapperConfig.java @@ -0,0 +1,34 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.dozer.config; + +import org.dozer.spring.DozerBeanMapperFactoryBean; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.Resource; + +/** + * @author :LionCity + * @date :Created in 2019/10/9 10:40 + * @description:Dozer转换 + * @modified By: + * @version: 1.0 + */ +@Configuration(proxyBeanMethods = false) +public class DozerMapperConfig { + @Bean + public DozerBeanMapperFactoryBean dozerBeanMapperFactoryBean(@Value("classpath*:dozer/*.xml" ) Resource[] resources) throws Exception { + final DozerBeanMapperFactoryBean dozerBeanMapperFactoryBean = new DozerBeanMapperFactoryBean(); + dozerBeanMapperFactoryBean.setMappingFiles(resources); + return dozerBeanMapperFactoryBean; + } + + /* @Bean + public IGenerator ejbGenerator() { + return new EJBGenerator(); + }*/ +} diff --git a/yshop-common/src/main/java/co/yixiang/dozer/service/EJBGenerator.java b/yshop-common/src/main/java/co/yixiang/dozer/service/EJBGenerator.java new file mode 100644 index 0000000..e3d55eb --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/dozer/service/EJBGenerator.java @@ -0,0 +1,75 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.dozer.service; + +import co.yixiang.common.web.vo.Paging; +import co.yixiang.domain.PageResult; +import com.github.pagehelper.PageInfo; +import org.dozer.Mapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Array; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * @author :LionCity + * @date :Created in 2019/10/9 10:43 + * @description:dozer实现类 + * @modified By: + * @version: 1.0 + */ +@Component +@Lazy(true) +public class EJBGenerator implements IGenerator { + + @Autowired + protected Mapper dozerMapper; + + @Override + public T convert(final S s, Class clz) { + return s == null ? null : this.dozerMapper.map(s, clz); + } + + @Override + public List convert(List s, Class clz) { + return s == null ? null : s.stream().map(vs -> this.dozerMapper.map(vs, clz)).collect(Collectors.toList()); + } + + @Override + public Paging convertPaging(Paging paging, Class clz) { + Paging pagingVo=new Paging(); + pagingVo.setRecords(convert(paging.getRecords(),clz)); + pagingVo.setTotal(paging.getTotal()); + return pagingVo; + } + + @Override + public Set convert(Set s, Class clz) { + return s == null ? null : s.stream().map(vs -> this.dozerMapper.map(vs, clz)).collect(Collectors.toSet()); + } + + @Override + public T[] convert(S[] s, Class clz) { + if (s == null) { + return null; + } + @SuppressWarnings("unchecked") + T[] arr = (T[]) Array.newInstance(clz, s.length); + for (int i = 0; i < s.length; i++) { + arr[i] = this.dozerMapper.map(s[i], clz); + } + return arr; + } + + @Override + public PageResult convertPageInfo(PageInfo s, Class clz) { + return new PageResult(s.getTotal(), convert(s.getList(), clz)); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/dozer/service/IGenerator.java b/yshop-common/src/main/java/co/yixiang/dozer/service/IGenerator.java new file mode 100644 index 0000000..f93fb92 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/dozer/service/IGenerator.java @@ -0,0 +1,91 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.dozer.service; + +import co.yixiang.common.web.vo.Paging; +import co.yixiang.domain.PageResult; +import com.github.pagehelper.PageInfo; + +import java.util.List; +import java.util.Set; + +/** + * @author :LionCity + * @date :Created in 2019/10/9 10:42 + * @description:doczer转换接口 + * @modified By: + * @version: 1.0 + */ +public interface IGenerator { + + /** + * 转换 + * + * @param s 数据对象 + * @param clz 复制目标类型 + * @return {@link T} + * @Description: 单个对象的深度复制及类型转换,vo/domain , po + * @author banjuer@outlook.com + * @Time 2018年5月9日 下午3:53:24 + */ + T convert(S s, Class clz); + + /** + * @Description: 深度复制结果集(ResultSet为自定义的分页结果集) + * @param s 数据对象 + * @param clz 复制目标类型 + * @return + * @author banjuer@outlook.com + * @Time 2018年5月9日 下午3:53:24 + */ + // Result convert(Result s, Class clz); + + /** + * 转换 + * @param s 数据对象 + * @param clz 复制目标类型 + * @return {@link List} + * @Description: list深度复制 + * @author banjuer@outlook.com + * @Time 2018年5月9日 下午3:54:08 + */ + List convert(List s, Class clz); + + /** + * + * @param s + * @param clz + * @param + * @param + * @return + */ + Paging convertPaging(Paging s, Class clz); + /** + * @param s 数据对象 + * @param clz 复制目标类型 + * @return + * @Description: set深度复制 + * @author banjuer@outlook.com + * @Time 2018年5月9日 下午3:54:39 + */ + Set convert(Set s, Class clz); + + /** + * @param s 数据对象 + * @param clz 复制目标类型 + * @return + * @Description: 数组深度复制 + * @author banjuer@outlook.com + * @Time 2018年5月9日 下午3:54:57 + */ + T[] convert(S[] s, Class clz); + + /** + * 分页信息转换 + * @return {@link PageResult} + */ + PageResult convertPageInfo(PageInfo s, Class clz); +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/AppFromEnum.java b/yshop-common/src/main/java/co/yixiang/enums/AppFromEnum.java new file mode 100644 index 0000000..aa176d7 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/AppFromEnum.java @@ -0,0 +1,32 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author hupeng + * 应用来源相关枚举 + */ +@Getter +@AllArgsConstructor +public enum AppFromEnum { + + WEIXIN_H5("weixinh5","weixinh5"), + H5("h5","H5"), + WECHAT("wechat","公众号"), + APP("app","APP"), + PC("pc","PC"), + ROUNTINE("routine","小程序"), + UNIAPPH5("uniappH5","uniappH5"); + + + private String value; + private String desc; + + +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/BillDetailEnum.java b/yshop-common/src/main/java/co/yixiang/enums/BillDetailEnum.java new file mode 100644 index 0000000..1cd28b8 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/BillDetailEnum.java @@ -0,0 +1,40 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author hupeng + * 账单明细相关枚举 + */ +@Getter +@AllArgsConstructor +public enum BillDetailEnum { + + TYPE_1("recharge","充值"), + TYPE_2("brokerage","返佣"), + TYPE_3("pay_product","消费"), + TYPE_4("extract","提现"), + TYPE_5("pay_product_refund","退款"), + TYPE_6("system_add","系统添加"), + TYPE_7("system_sub","系统减少"), + TYPE_8("deduction","减去"), + TYPE_9("gain","奖励"), + TYPE_10("sign","签到"), + + + CATEGORY_1("now_money","金额"), + CATEGORY_2("integral","积分"); + + + + private String value; + private String desc; + + +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/BillEnum.java b/yshop-common/src/main/java/co/yixiang/enums/BillEnum.java new file mode 100644 index 0000000..ae6181f --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/BillEnum.java @@ -0,0 +1,44 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.stream.Stream; + +/** + * @author hupeng + * 账单相关枚举 + */ +@Getter +@AllArgsConstructor +public enum BillEnum { + + PM_0(0,"支出"), + PM_1(1,"获得"), + + STATUS_0(0,"默认"), + STATUS_1(1,"有效"), + STATUS_2(2,"无效"); + + + + + + private Integer value; + private String desc; + + public static BillEnum toType(int value) { + return Stream.of(BillEnum.values()) + .filter(p -> p.value == value) + .findAny() + .orElse(null); + } + + + +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/BillInfoEnum.java b/yshop-common/src/main/java/co/yixiang/enums/BillInfoEnum.java new file mode 100644 index 0000000..07a19bd --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/BillInfoEnum.java @@ -0,0 +1,45 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.stream.Stream; + +/** + * @author hupeng + * 账单相关枚举 + */ +@Getter +@AllArgsConstructor +public enum BillInfoEnum { + + DEAFUL_ALL(0,"所有"), + PAY_PRODUCT(1,"消费"), + RECHAREGE(2,"充值"), + BROKERAGE(3,"返佣"), + EXTRACT(4,"提现"), + SIGN_INTEGRAL(5,"签到积分"), + PAY_PRODUCT_REFUND(6,"退款"), + SYSTEM_ADD(7,"系统添加"), + SYSTEM_SUB(8,"系统减少"); + + + + private Integer value; + private String desc; + + public static BillInfoEnum toType(int value) { + return Stream.of(BillInfoEnum.values()) + .filter(p -> p.value == value) + .findAny() + .orElse(null); + } + + + +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/Brokerage.java b/yshop-common/src/main/java/co/yixiang/enums/Brokerage.java new file mode 100644 index 0000000..f7b883e --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/Brokerage.java @@ -0,0 +1,20 @@ +package co.yixiang.enums; + + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author hupeng + * 分销级别 + */ +@Getter +@AllArgsConstructor +public enum Brokerage { + + LEVEL_1(1,"一级"), + LEVEL_2(2,"二级"); + + private Integer value; + private String desc; +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/CartTypeEnum.java b/yshop-common/src/main/java/co/yixiang/enums/CartTypeEnum.java new file mode 100644 index 0000000..b1f2337 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/CartTypeEnum.java @@ -0,0 +1,18 @@ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author hupeng + * 优惠券类型枚举 + */ +@Getter +@AllArgsConstructor +public enum CartTypeEnum { + NEW_0(0,"加入购物车"), + NEW_1(1,"加入购物车直接购买"); + + private Integer value; + private String desc; +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/CommonEnum.java b/yshop-common/src/main/java/co/yixiang/enums/CommonEnum.java new file mode 100644 index 0000000..3f6f436 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/CommonEnum.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author hupeng + * 通用枚举 + */ +@Getter +@AllArgsConstructor +public enum CommonEnum { + + DEL_STATUS_0(0,"未删除"), + DEL_STATUS_1(1,"已删除"), + + SHOW_STATUS_0(0,"未显示"), + SHOW_STATUS_1(1,"显示"); + + + private Integer value; + private String desc; + + +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/CouponEnum.java b/yshop-common/src/main/java/co/yixiang/enums/CouponEnum.java new file mode 100644 index 0000000..4e043f4 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/CouponEnum.java @@ -0,0 +1,52 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.stream.Stream; + +/** + * @author hupeng + * 优惠券相关枚举 + */ +@Getter +@AllArgsConstructor +public enum CouponEnum { + + FALI_0(0,"有效"), + FALI_1(1,"无效"), + + USE_0(0,"不可用"), + USE_1(1,"可用"), + + STATUS_0(0,"未使用"), + STATUS_1(1,"已使用"), + STATUS_2(2,"已过期"), + + TYPE_0(0,"通用券"), + TYPE_1(1,"商品券"), + TYPE_2(2,"内部券"), + + PERMANENT_0(0,"限量"), + PERMANENT_1(1,"不限量"); + + + + + private Integer value; + private String desc; + + public static CouponEnum toType(int value) { + return Stream.of(CouponEnum.values()) + .filter(p -> p.value == value) + .findAny() + .orElse(null); + } + + +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/CouponGetEnum.java b/yshop-common/src/main/java/co/yixiang/enums/CouponGetEnum.java new file mode 100644 index 0000000..06d3681 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/CouponGetEnum.java @@ -0,0 +1,18 @@ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author hupeng + * 优惠券获取类型枚举 + */ +@Getter +@AllArgsConstructor +public enum CouponGetEnum { + GET("get","领取"), + SEND("send","派送"); + + private String value; + private String desc; +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/DataSourceType.java b/yshop-common/src/main/java/co/yixiang/enums/DataSourceType.java new file mode 100644 index 0000000..c8ebe03 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/DataSourceType.java @@ -0,0 +1,18 @@ +package co.yixiang.enums; + +/** + * 数据源 + * @author hupeng + */ +public enum DataSourceType +{ + /** + * 主库 + */ + MASTER, + + /** + * 从库 + */ + SLAVE +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/LiveGoodsEnum.java b/yshop-common/src/main/java/co/yixiang/enums/LiveGoodsEnum.java new file mode 100644 index 0000000..7d3dc8b --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/LiveGoodsEnum.java @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author hupeng + * 直播商品相关枚举 + */ +@Getter +@AllArgsConstructor +public enum LiveGoodsEnum { + + IS_Audit_0(0,"未审核"), + IS_Audit_1(1,"审核中"), + IS_Audit_2(2,"审核通过"), + IS_Audit_3(3,"审核失败"); + + private Integer value; + private String desc; + +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/OrderCountEnum.java b/yshop-common/src/main/java/co/yixiang/enums/OrderCountEnum.java new file mode 100644 index 0000000..6206866 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/OrderCountEnum.java @@ -0,0 +1,39 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.stream.Stream; + +/** + * @author hupeng + * 订单相关枚举 + */ +@Getter +@AllArgsConstructor +public enum OrderCountEnum { + + TODAY(1,"今天"), + YESTERDAY(2,"昨天"), + WEEK(3,"上周"), + MONTH(4,"本月"); + + + + private Integer value; + private String desc; + + public static OrderCountEnum toType(int value) { + return Stream.of(OrderCountEnum.values()) + .filter(p -> p.value == value) + .findAny() + .orElse(null); + } + + +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/OrderInfoEnum.java b/yshop-common/src/main/java/co/yixiang/enums/OrderInfoEnum.java new file mode 100644 index 0000000..dd7d5b0 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/OrderInfoEnum.java @@ -0,0 +1,70 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.stream.Stream; + +/** + * @author hupeng + * 订单相关枚举 + */ +@Getter +@AllArgsConstructor +public enum OrderInfoEnum { + + STATUS_0(0,"默认"), + STATUS_1(1,"待收货"), + STATUS_2(2,"已收货"), + STATUS_3(3,"已完成"), + + PAY_STATUS_0(0,"未支付"), + PAY_STATUS_1(1,"已支付"), + + REFUND_STATUS_0(0,"正常"), + REFUND_STATUS_1(1,"退款中"), + REFUND_STATUS_2(2,"已退款"), + + BARGAIN_STATUS_1(1,"参与中"), + BARGAIN_STATUS_2(2,"参与失败"), + BARGAIN_STATUS_3(3,"参与成功"), + + PINK_STATUS_1(1,"进行中"), + PINK_STATUS_2(2,"已完成"), + PINK_STATUS_3(3,"未完成"), + + PINK_REFUND_STATUS_0(0,"拼团正常"), + PINK_REFUND_STATUS_1(1,"拼团已退款"), + + CANCEL_STATUS_0(0,"正常"), + CANCEL_STATUS_1(1,"已取消"), + + CONFIRM_STATUS_0(0,"正常"), + CONFIRM_STATUS_1(1,"确认"), + + PAY_CHANNEL_0(0,"公众号/H5支付渠道"), + PAY_CHANNEL_1(1,"小程序支付渠道"), + + + SHIPPIING_TYPE_1(1,"快递"), + SHIPPIING_TYPE_2(2,"门店自提"); + + + + private Integer value; + private String desc; + + public static OrderInfoEnum toType(int value) { + return Stream.of(OrderInfoEnum.values()) + .filter(p -> p.value == value) + .findAny() + .orElse(null); + } + + +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/OrderLogEnum.java b/yshop-common/src/main/java/co/yixiang/enums/OrderLogEnum.java new file mode 100644 index 0000000..0db3ad9 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/OrderLogEnum.java @@ -0,0 +1,49 @@ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.stream.Stream; + +/** + * @author hupeng + * 订单操作相关枚举 + */ +@Getter +@AllArgsConstructor +public enum OrderLogEnum { + + PINK_ORDER_FAIL_1("ORDER_EXIST","订单生成失败,你已经参加该团了,请先支付订单"), + PINK_ORDER_FAIL_2("ORDER_EXIST","订单生成失败,你已经在该团内不能再参加了"), + REFUND_ORDER_SUCCESS("refund_price_success","退款成功"), + ORDER_EDIT("order_edit","订单改价"), + REMOVE_ORDER("remove_order","删除订单"), + EVAL_ORDER("order_eval","用户评价"), + REFUND_ORDER_APPLY("apply_refund","用户申请退款"), + TAKE_ORDER_DELIVERY("user_take_delivery","用户已收货"), + PAY_ORDER_FAIL("PAY_DEFICIENCY","余额不足"), + PAY_ORDER_SUCCESS("pay_success","用户付款成功"), + CREATE_ORDER_SUCCESS("SUCCESS","订单创建成功"), + CREATE_ORDER("yshop_create_order","订单生成"), + NONE_ORDER("NONE","订单OK"), + DELIVERY_GOODS("delivery_goods", "订单发货"), + EXTEND_ORDER("EXTEND_ORDER","订单已生成"); + + + private String value; + private String desc; + + + + public static OrderLogEnum toType(String value) { + return Stream.of(OrderLogEnum.values()) + .filter(p -> p.value.equals(value)) + .findAny() + .orElse(null); + } + + public static String getDesc(String value) { + return toType(value) == null ? null : toType(value).desc; + } + +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/OrderStatusEnum.java b/yshop-common/src/main/java/co/yixiang/enums/OrderStatusEnum.java new file mode 100644 index 0000000..818fb8b --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/OrderStatusEnum.java @@ -0,0 +1,44 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.stream.Stream; + +/** + * @author hupeng + * 订单相关枚举 + */ +@Getter +@AllArgsConstructor +public enum OrderStatusEnum { + + STATUS__1(-1,"全部订单"), + STATUS_0(0,"未支付"), + STATUS_1(1,"待发货"), + STATUS_2(2,"待收货"), + STATUS_3(3,"待评价"), + STATUS_4(4,"已完成"), + STATUS_MINUS_1(-1,"退款中"), + STATUS_MINUS_2(-2,"已退款"), + STATUS_MINUS_3(-3,"退款"); + + + + private Integer value; + private String desc; + + public static OrderStatusEnum toType(int value) { + return Stream.of(OrderStatusEnum.values()) + .filter(p -> p.value == value) + .findAny() + .orElse(null); + } + + +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/PayMethodEnum.java b/yshop-common/src/main/java/co/yixiang/enums/PayMethodEnum.java new file mode 100644 index 0000000..06e9715 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/PayMethodEnum.java @@ -0,0 +1,37 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.stream.Stream; + +/** + * @author hupeng + * 支付相关枚举 + */ +@Getter +@AllArgsConstructor +public enum PayMethodEnum { + + WECHAT("wechat","公众号支付"), + WXAPP("wxapp","小程序支付"), + APP("app","app支付"); + + + private String value; + private String desc; + + public static PayMethodEnum toType(String value) { + return Stream.of(PayMethodEnum.values()) + .filter(p -> p.value.equals(value)) + .findAny() + .orElse(null); + } + + +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/PayTypeEnum.java b/yshop-common/src/main/java/co/yixiang/enums/PayTypeEnum.java new file mode 100644 index 0000000..277e090 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/PayTypeEnum.java @@ -0,0 +1,38 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.stream.Stream; + +/** + * @author hupeng + * 支付相关枚举 + */ +@Getter +@AllArgsConstructor +public enum PayTypeEnum { + + ALI("alipay","支付宝支付"), + WEIXIN("weixin","微信支付"), + YUE("yue","余额支付"), + INTEGRAL("integral","积分兑换"); + + + private String value; + private String desc; + + public static PayTypeEnum toType(String value) { + return Stream.of(PayTypeEnum.values()) + .filter(p -> p.value.equals(value)) + .findAny() + .orElse(null); + } + + +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/PinkEnum.java b/yshop-common/src/main/java/co/yixiang/enums/PinkEnum.java new file mode 100644 index 0000000..3534843 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/PinkEnum.java @@ -0,0 +1,35 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author hupeng + * 拼团相关枚举 + */ +@Getter +@AllArgsConstructor +public enum PinkEnum { + + IS_OK_0(0,"未完成"), + IS_OK_1(1,"已完成"), + + PINK_BOOL_0(0,"未成功,进行中"), + PINK_BOOL_1(1,"已成功"), + PINK_BOOL_MINUS_1(-1,"拼团失败"), + + USER_BOOL_0(0,"不在团内"), + USER_BOOL_1(1,"在团内"); + + private Integer value; + private String desc; + + + + +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/ProductEnum.java b/yshop-common/src/main/java/co/yixiang/enums/ProductEnum.java new file mode 100644 index 0000000..d96cba3 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/ProductEnum.java @@ -0,0 +1,38 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.stream.Stream; + +/** + * @author hupeng + * 产品相关枚举 + */ +@Getter +@AllArgsConstructor +public enum ProductEnum { + + TYPE_1(1,"精品推荐"), + TYPE_2(2,"热门榜单"), + TYPE_3(3,"首发新品"), + TYPE_4(4,"猜你喜欢"); + + + private Integer value; + private String desc; + + public static ProductEnum toType(int value) { + return Stream.of(ProductEnum.values()) + .filter(p -> p.value == value) + .findAny() + .orElse(null); + } + + +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/ProductTypeEnum.java b/yshop-common/src/main/java/co/yixiang/enums/ProductTypeEnum.java new file mode 100644 index 0000000..7526ee9 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/ProductTypeEnum.java @@ -0,0 +1,24 @@ +package co.yixiang.enums; + + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author hupeng + * 产品类型枚举 + */ + +@Getter +@AllArgsConstructor +public enum ProductTypeEnum { + + PINK("pink","拼团"), + + SECKILL("seckill","秒杀"), + + COMBINATION("combination","拼团产品"); + + private String value; + private String desc; +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/RedisKeyEnum.java b/yshop-common/src/main/java/co/yixiang/enums/RedisKeyEnum.java new file mode 100644 index 0000000..7835a50 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/RedisKeyEnum.java @@ -0,0 +1,32 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * rediskey 相关枚举 + */ +@Getter +@AllArgsConstructor +public enum RedisKeyEnum { + + WXAPP_APPID("wxapp_appId","微信小程序id"), + WXAPP_SECRET("wxapp_secret","微信小程序秘钥"), + WX_NATIVE_APP_APPID("wx_native_app_appId","支付appId"), + WXPAY_MCHID("wxpay_mchId","商户号"), + WXPAY_MCHKEY("wxpay_mchKey","商户秘钥"), + WXPAY_KEYPATH("wxpay_keyPath","商户证书路径"), + WECHAT_APPID("wechat_appid","微信公众号id"), + WECHAT_APPSECRET("wechat_appsecret","微信公众号secret"), + WECHAT_TOKEN("wechat_token","微信公众号验证token"), + WECHAT_ENCODINGAESKEY("wechat_encodingaeskey","EncodingAESKey"), + TENGXUN_MAP_KEY("tengxun_map_key","腾讯mapkey"); + + private String value; + private String desc; +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/ShipperCodeEnum.java b/yshop-common/src/main/java/co/yixiang/enums/ShipperCodeEnum.java new file mode 100644 index 0000000..3ad3631 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/ShipperCodeEnum.java @@ -0,0 +1,18 @@ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author hupeng + * 快递公司编码相关枚举 + */ +@Getter +@AllArgsConstructor +public enum ShipperCodeEnum { + + SF("SF","顺丰速运"); + + private String value; + private String desc; +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/ShippingTempEnum.java b/yshop-common/src/main/java/co/yixiang/enums/ShippingTempEnum.java new file mode 100644 index 0000000..bfd87b6 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/ShippingTempEnum.java @@ -0,0 +1,20 @@ +package co.yixiang.enums; + + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author hupeng + * 运费模板类型枚举 + */ +@Getter +@AllArgsConstructor +public enum ShippingTempEnum { + TYPE_1(1,"按件数"), + TYPE_2(2,"按重量"), + TYPE_3(3,"按体积"); + + private Integer value; + private String desc; +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/ShopCommonEnum.java b/yshop-common/src/main/java/co/yixiang/enums/ShopCommonEnum.java new file mode 100644 index 0000000..6d10925 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/ShopCommonEnum.java @@ -0,0 +1,73 @@ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author hupeng + * 商城常用枚举 + */ +@Getter +@AllArgsConstructor +public enum ShopCommonEnum { + + STORE_MODE_1(1,"本地存储"), + STORE_MODE_2(2,"云存储"), + + ENABLE_1(1,"开启"), + ENABLE_2(2,"关闭"), + + EXTRACT_MINUS_1(-1,"提现未通过"), + EXTRACT_0(0,"提现审核中"), + EXTRACT_1(1,"提现已完成"), + + IS_FINISH_0(0,"未完成"), + IS_FINISH_1(1,"已完成"), + + IS_FOREVER_0(0,"不是永久"), + IS_FOREVER_1(1,"永久"), + + AGREE_1(1,"同意"), + AGREE_2(2,"拒绝"), + + IS_PERMANENT_0(0,"限制"), + IS_PERMANENT_1(1,"不限制"), + + IS_STATUS_0(0,"否"), + IS_STATUS_1(1,"是"), + + + IS_PROMOTER_0(0,"默认"), + IS_PROMOTER_1(1,"是客服"), + + IS_NEW_0(0,"默认"), + IS_NEW_1(1,"新品"), + + IS_SUB_0(0,"不单独分佣"), + IS_SUB_1(1,"单独分佣"), + + + GRADE_0(0,"一级推荐人"), + GRADE_1(1,"二级推荐人"), + + REPLY_0(0,"未回复"), + REPLY_1(1,"已回复"), + + ADD_1(1,"增加"), + ADD_2(2,"减少"), + + DELETE_0(0,"未删除"), + DELETE_1(1,"已删除"), + + SHOW_0(0,"不显示"), + SHOW_1(1,"显示"), + + DEFAULT_0(0,"不是默认"), + DEFAULT_1(1,"默认"); + + + + + private Integer value; + private String desc; +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/SortEnum.java b/yshop-common/src/main/java/co/yixiang/enums/SortEnum.java new file mode 100644 index 0000000..6ed8fa9 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/SortEnum.java @@ -0,0 +1,31 @@ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.stream.Stream; + +/** + * @author hupeng + * sort关枚举 + */ +@Getter +@AllArgsConstructor +public enum SortEnum { + + DESC("desc","降序"), + ASC("asc","升序"); + + + private String value; + private String desc; + + public static SortEnum toType(String value) { + return Stream.of(SortEnum.values()) + .filter(p -> p.value == value) + .findAny() + .orElse(null); + } + + +} diff --git a/yshop-common/src/main/java/co/yixiang/enums/SpecTypeEnum.java b/yshop-common/src/main/java/co/yixiang/enums/SpecTypeEnum.java new file mode 100644 index 0000000..5a0240b --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/enums/SpecTypeEnum.java @@ -0,0 +1,18 @@ +package co.yixiang.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author hupeng + * 产品相关规格类型枚举 + */ +@Getter +@AllArgsConstructor +public enum SpecTypeEnum { + TYPE_0(0,"单规格"), + TYPE_1(1,"多规格"); + + private Integer value; + private String desc; +} diff --git a/yshop-common/src/main/java/co/yixiang/event/TemplateBean.java b/yshop-common/src/main/java/co/yixiang/event/TemplateBean.java new file mode 100644 index 0000000..f08e4fa --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/event/TemplateBean.java @@ -0,0 +1,33 @@ +package co.yixiang.event; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +/** + * @ClassName TemplateBean + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/6 + **/ +@Getter +@Setter +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class TemplateBean { + private String templateType; + private String orderId; + private String time; + private String price; + private String deliveryName; + private String deliveryId; + private String payType; + private Long uid; + /** + * 提现申请ID + */ + private Long extractId; + +} diff --git a/yshop-common/src/main/java/co/yixiang/event/TemplateEvent.java b/yshop-common/src/main/java/co/yixiang/event/TemplateEvent.java new file mode 100644 index 0000000..d89cca9 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/event/TemplateEvent.java @@ -0,0 +1,23 @@ +package co.yixiang.event; + +import lombok.Getter; +import org.springframework.context.ApplicationEvent; + +/** + * @author hupeng + * 微信模板事件 + */ +@Getter +public class TemplateEvent extends ApplicationEvent { + + private TemplateBean templateBean; + /** + * 重写构造函数 + * @param source 发生事件的对象 + * @param templateBean 自定义 + */ + public TemplateEvent(Object source,TemplateBean templateBean) { + super(source); + this.templateBean = templateBean; + } +} diff --git a/yshop-common/src/main/java/co/yixiang/event/TemplateListenEnum.java b/yshop-common/src/main/java/co/yixiang/event/TemplateListenEnum.java new file mode 100644 index 0000000..9dc68b5 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/event/TemplateListenEnum.java @@ -0,0 +1,35 @@ +package co.yixiang.event; + + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.stream.Stream; + + +/** + * @author hupeng + * 模板监听枚举 + */ +@Getter +@AllArgsConstructor +public enum TemplateListenEnum { + TYPE_1("1","支付成功模板通知"), + TYPE_2("2","退款成功通知"), + TYPE_3("3","发货成功通知"), + TYPE_4("4","充值成功通知"), + TYPE_5("5","在线买单/收款成功通知"), + TYPE_6("6","商家收款通知"), + TYPE_7("7","用户下单未支付通知"), + TYPE_8("8","用户提现通知"), + TYPE_9("9","退款申请通知"); + private String value; + private String desc; + + public static TemplateListenEnum toType(String value) { + return Stream.of(TemplateListenEnum.values()) + .filter(p -> p.value.equals(value)) + .findAny() + .orElse(null); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/exception/BadLimitRequestException.java b/yshop-common/src/main/java/co/yixiang/exception/BadLimitRequestException.java new file mode 100644 index 0000000..376dba0 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/exception/BadLimitRequestException.java @@ -0,0 +1,32 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.exception; + +import co.yixiang.api.ApiCode; +import lombok.Getter; +import org.springframework.http.HttpStatus; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +/** + * @author Zheng Jie + * @date 2018-11-23 + * 统一异常处理 + */ +@Getter +public class BadLimitRequestException extends RuntimeException{ + + private Integer status = ApiCode.BAD_LIMIT_EXCEPTION.getCode(); + + public BadLimitRequestException(String msg){ + super(msg); + } + + public BadLimitRequestException(HttpStatus status, String msg){ + super(msg); + this.status = status.value(); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/exception/BadRequestException.java b/yshop-common/src/main/java/co/yixiang/exception/BadRequestException.java new file mode 100644 index 0000000..ec80c96 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/exception/BadRequestException.java @@ -0,0 +1,31 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.exception; + +import lombok.Getter; +import org.springframework.http.HttpStatus; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +/** + * @author Zheng Jie + * @date 2018-11-23 + * 统一异常处理 + */ +@Getter +public class BadRequestException extends RuntimeException{ + + private Integer status = BAD_REQUEST.value(); + + public BadRequestException(String msg){ + super(msg); + } + + public BadRequestException(HttpStatus status,String msg){ + super(msg); + this.status = status.value(); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/exception/EntityExistException.java b/yshop-common/src/main/java/co/yixiang/exception/EntityExistException.java new file mode 100644 index 0000000..0771cdd --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/exception/EntityExistException.java @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.exception; + +import org.springframework.util.StringUtils; + +/** + * @author Zheng Jie + * @date 2018-11-23 + */ +public class EntityExistException extends RuntimeException { + + public EntityExistException(Class clazz, String field, String val) { + super(EntityExistException.generateMessage(clazz.getSimpleName(), field, val)); + } + + private static String generateMessage(String entity, String field, String val) { + return StringUtils.capitalize(entity) + + " with " + field + " "+ val + " existed"; + } +} diff --git a/yshop-common/src/main/java/co/yixiang/exception/EntityNotFoundException.java b/yshop-common/src/main/java/co/yixiang/exception/EntityNotFoundException.java new file mode 100644 index 0000000..470400f --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/exception/EntityNotFoundException.java @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.exception; + +import org.springframework.util.StringUtils; + +/** + * @author Zheng Jie + * @date 2018-11-23 + */ +public class EntityNotFoundException extends RuntimeException { + + public EntityNotFoundException(Class clazz, String field, String val) { + super(EntityNotFoundException.generateMessage(clazz.getSimpleName(), field, val)); + } + + private static String generateMessage(String entity, String field, String val) { + return StringUtils.capitalize(entity) + + " with " + field + " "+ val + " does not exist"; + } +} diff --git a/yshop-common/src/main/java/co/yixiang/exception/ErrorRequestException.java b/yshop-common/src/main/java/co/yixiang/exception/ErrorRequestException.java new file mode 100644 index 0000000..123b9c6 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/exception/ErrorRequestException.java @@ -0,0 +1,31 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.exception; + +import lombok.Getter; +import org.springframework.http.HttpStatus; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +/** + * @author hupeng + * @date 2019-11-11 + * 统一异常处理 + */ +@Getter +public class ErrorRequestException extends RuntimeException{ + + private Integer status = BAD_REQUEST.value(); + + public ErrorRequestException(String msg){ + super(msg); + } + + public ErrorRequestException(HttpStatus status, String msg){ + super(msg); + this.status = status.value(); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/mapper/EntityMapper.java b/yshop-common/src/main/java/co/yixiang/mapper/EntityMapper.java new file mode 100644 index 0000000..c190d65 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/mapper/EntityMapper.java @@ -0,0 +1,43 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.mapper; + +import java.util.List; + +/** + * @author Zheng Jie + * @date 2018-11-23 + */ +public interface EntityMapper { + + /** + * DTO转Entity + * @param dto + * @return + */ + E toEntity(D dto); + + /** + * Entity转DTO + * @param entity + * @return + */ + D toDto(E entity); + + /** + * DTO集合转Entity集合 + * @param dtoList + * @return + */ + List toEntity(List dtoList); + + /** + * Entity集合转DTO集合 + * @param entityList + * @return + */ + List toDto(List entityList); +} diff --git a/yshop-common/src/main/java/co/yixiang/print/OrderPrint.java b/yshop-common/src/main/java/co/yixiang/print/OrderPrint.java new file mode 100644 index 0000000..a6328f0 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/print/OrderPrint.java @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.print; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 打印订单数据 + */ +@Builder +@Data +@NoArgsConstructor +@AllArgsConstructor +public class OrderPrint { + private String title; + private String price; + private String num; +} diff --git a/yshop-common/src/main/java/co/yixiang/print/PrintOrderDataVO.java b/yshop-common/src/main/java/co/yixiang/print/PrintOrderDataVO.java new file mode 100644 index 0000000..99ed336 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/print/PrintOrderDataVO.java @@ -0,0 +1,43 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.print; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @author :LionCity + * @date :Created in 2020-05-11 10:33 + * @description:打印数据VO + * @modified By: + * @version: V1.0 + */ +@Builder +@Data +@NoArgsConstructor +@AllArgsConstructor +public class PrintOrderDataVO implements Serializable{ + @ApiModelProperty(value = "订单号") + private String orderId; + @ApiModelProperty(value = "实际支付金额") + private BigDecimal payPrice; + @ApiModelProperty(value = "用户姓名") + private String realName; + @ApiModelProperty(value = "详细地址") + private String userAddress; + @ApiModelProperty(value = "用户电话") + private String userPhone; + @ApiModelProperty(value = "备注") + private String mark; + @ApiModelProperty(value = "门店名称") + private String storeName; +} diff --git a/yshop-common/src/main/java/co/yixiang/print/PrintStoreOrderVO.java b/yshop-common/src/main/java/co/yixiang/print/PrintStoreOrderVO.java new file mode 100644 index 0000000..fa9e6af --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/print/PrintStoreOrderVO.java @@ -0,0 +1,40 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.print; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author :LionCity + * @date :Created in 2020-05-11 11:01 + * @description:门店销售数据 + * @modified By: + * @version: V1.0 + */ +@Builder +@Data +@NoArgsConstructor +@AllArgsConstructor +public class PrintStoreOrderVO implements Serializable { + @ApiModelProperty(value = "开始时间") + private String startTime; + @ApiModelProperty(value = "结束时间") + private String endTime; + @ApiModelProperty(value = "打印机编号") + private String driverNo; + @ApiModelProperty(value = "门店列表") + private Integer storeId; + @ApiModelProperty(hidden = true) + Long startSecond; + @ApiModelProperty(hidden = true) + Long endSecond; +} diff --git a/yshop-common/src/main/java/co/yixiang/print/PrintUtil4.java b/yshop-common/src/main/java/co/yixiang/print/PrintUtil4.java new file mode 100644 index 0000000..063b83e --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/print/PrintUtil4.java @@ -0,0 +1,593 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.print; + +import co.yixiang.constant.ShopConstants; +import co.yixiang.utils.DateUtils; +import co.yixiang.utils.RedisUtil; +import org.apache.commons.codec.digest.DigestUtils; +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@SuppressWarnings("static-access") +public class PrintUtil4 { + public static final String URL = "http://api.feieyun.cn/Api/Open/";//不需要修改 + + public static final String USER = RedisUtil.get(ShopConstants.YSHOP_FEI_E_USER);//*必填*:账号名 + public static final String UKEY = RedisUtil.get(ShopConstants.YSHOP_FEI_E_UKEY);//*必填*: 飞鹅云后台注册账号后生成的UKEY 【备注:这不是填打印机的KEY】 + public static final String SN = "918502791";//*必填*:打印机编号,必须要在管理后台里添加打印机或调用API接口添加之后,才能调用API + + /** + * 保存文件到磁盘 + * + * @param path 保存路径 + * @param content 打印内容 + * writeFile("E:/retlog.txt", result); + */ + public void writeFile(String path, String content) { + content = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒").format(new Date()) + ",保存的订单日志信息为: " + content; + FileOutputStream fos = null; + try { + fos = new FileOutputStream(path, true); + fos.write(content.getBytes()); + fos.write("\r
".getBytes()); + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (fos != null) { + try { + fos.flush(); + fos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + + public static void main(String[] args) { + try { + System.out.println(new String(addPrintEquip("918502791", "nvz8kw5n", "测试", "").getBytes("ISO-8859-1"), "UTF-8")); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + } + + /** + * 添加打印机 + * + * @param sn 编号 + * @param key 密钥 + * @param remark 备注 + * @param phone 流量卡号码 + * @return 返回打印结果 + */ + public static String addPrintEquip(String sn, String key, String remark, String phone) { + String printerContent = sn + " # " + key + " # " + remark + " # " + phone; + List nvps = new ArrayList(); + nvps.add(new BasicNameValuePair("user", USER)); + String STIME = String.valueOf(System.currentTimeMillis() / 1000); + nvps.add(new BasicNameValuePair("stime", STIME)); + nvps.add(new BasicNameValuePair("sig", signature(USER, UKEY, STIME))); + nvps.add(new BasicNameValuePair("apiname", "Open_printerAddlist")); + nvps.add(new BasicNameValuePair("printerContent", printerContent));// 固定值,不需要修改 + return sendHttpRequest(nvps); + } + + /** + * 编辑打印机信息 + * + * @param sn 编号 + * @param remark 备注 + * @param phone 电话 + * @return 结果 + */ + public static String editPrintEquip(String sn, String remark, String phone) { + List nvps = new ArrayList(); + nvps.add(new BasicNameValuePair("user", USER)); + String STIME = String.valueOf(System.currentTimeMillis() / 1000); + nvps.add(new BasicNameValuePair("stime", STIME)); + nvps.add(new BasicNameValuePair("sig", signature(USER, UKEY, STIME))); + nvps.add(new BasicNameValuePair("apiname", "Open_printerEdit")); + nvps.add(new BasicNameValuePair("sn", sn)); + nvps.add(new BasicNameValuePair("name", remark)); + nvps.add(new BasicNameValuePair("phonenum", phone)); + return sendHttpRequest(nvps); + } + + /** + * 打印订单数据 + * + * @param sn 打印机编号 + * @param contentTitle 打印标题 + * @param orderList 订单数据 + * @param order + * @return + */ + public static String printOrder(String sn, String contentTitle, List orderList, PrintOrderDataVO order, int lian) { + String content = getPrintContent(contentTitle, orderList, 14, 6, 3, 6, order, lian + 1);//orderList为数组 b1代表名称列占用(14个字节) b2单价列(6个字节) b3数量列(3个字节) b4金额列(6个字节)-->这里的字节数可按自己需求自由改写,14+6+3+6再加上代码写的3个空格就是32了,58mm打印机一行总占32字节 +// List nvps = new ArrayList(); +// nvps.add(new BasicNameValuePair("user", USER)); +// String STIME = String.valueOf(System.currentTimeMillis() / 1000); +// nvps.add(new BasicNameValuePair("stime", STIME)); +// nvps.add(new BasicNameValuePair("sig", signature(USER, UKEY, STIME))); +// nvps.add(new BasicNameValuePair("apiname", "Open_printMsg"));// 固定值,不需要修改 +// nvps.add(new BasicNameValuePair("sn", sn)); +// nvps.add(new BasicNameValuePair("content", content)); +// nvps.add(new BasicNameValuePair("times", "1"));// 打印联数 +// return sendHttpRequest(nvps); + return print(sn, content); + } + + + /** + * 打印预养订单 + * + * @param orderList 订单数据 + * @param title 标题 + * @param mobile 联系方式 + * @param name 用户姓名 + * @param payPrice 实际支付 + * @return + */ + public static String printOrderByAdvance(List orderList, String title, String mobile, String name, String payPrice) { + String content = getOrderByAdvance(orderList, 14, 6, 3, 6, title, mobile, name, payPrice);//orderList为数组 b1代表名称列占用(14个字节) b2单价列(6个字节) b3数量列(3个字节) b4金额列(6个字节)-->这里的字节数可按自己需求自由改写,14+6+3+6再加上代码写的3个空格就是32了,58mm打印机一行总占32字节 +// List nvps = new ArrayList(); +// nvps.add(new BasicNameValuePair("user", USER)); +// String STIME = String.valueOf(System.currentTimeMillis() / 1000); +// nvps.add(new BasicNameValuePair("stime", STIME)); +// nvps.add(new BasicNameValuePair("sig", signature(USER, UKEY, STIME))); +// nvps.add(new BasicNameValuePair("apiname", "Open_printMsg"));// 固定值,不需要修改 +// nvps.add(new BasicNameValuePair("sn", SN)); +// nvps.add(new BasicNameValuePair("content", content)); +// nvps.add(new BasicNameValuePair("times", "1"));// 打印联数 +// return sendHttpRequest(nvps); + return print(SN, content); + } + + /** + * 打印订单数据 + * + * @param contentTitle 打印标题 + * @param orderList 订单数据 + * @return + */ + public static String printContentByStore(String contentTitle, List orderList, int b1, int b3, PrintStoreOrderVO printStoreOrder, int lian) { + String content = getPrintContentByStore(contentTitle, orderList, b1, b3, printStoreOrder, lian + 1);//orderList为数组 b1代表名称列占用(14个字节) b2单价列(6个字节) b3数量列(3个字节) b4金额列(6个字节)-->这里的字节数可按自己需求自由改写,14+6+3+6再加上代码写的3个空格就是32了,58mm打印机一行总占32字节 +// List nvps = new ArrayList(); +// nvps.add(new BasicNameValuePair("user", USER)); +// String STIME = String.valueOf(System.currentTimeMillis() / 1000); +// nvps.add(new BasicNameValuePair("stime", STIME)); +// nvps.add(new BasicNameValuePair("sig", signature(USER, UKEY, STIME))); +// nvps.add(new BasicNameValuePair("apiname", "Open_printMsg"));// 固定值,不需要修改 +// nvps.add(new BasicNameValuePair("sn", sn)); +// nvps.add(new BasicNameValuePair("content", content)); +// nvps.add(new BasicNameValuePair("times", "1"));// 打印联数 +// return sendHttpRequest(nvps); + return print(printStoreOrder.getDriverNo(), content); + } + + /** + * 打印订单数据 + * + * @param sn 打印机编号 + * @param content 打印内容 + * @return + */ + public static String print(String sn, String content) { + List nvps = new ArrayList(); + nvps.add(new BasicNameValuePair("user", USER)); + String STIME = String.valueOf(System.currentTimeMillis() / 1000); + nvps.add(new BasicNameValuePair("stime", STIME)); + nvps.add(new BasicNameValuePair("sig", signature(USER, UKEY, STIME))); + nvps.add(new BasicNameValuePair("apiname", "Open_printMsg"));// 固定值,不需要修改 + nvps.add(new BasicNameValuePair("sn", sn)); + nvps.add(new BasicNameValuePair("content", content)); + nvps.add(new BasicNameValuePair("times", "1"));// 打印联数 + return sendHttpRequest(nvps); + } + + + /** + * 获取预养订单文本信息 + * + * @return + */ + public static String getOrderByAdvance(List orderList, int b1, int b2, int b3, int b4, String headTitle, String mobile, String name, String payPrice) { + String orderInfo = "" + headTitle + "
"; + orderInfo += "名称 单价 数量 金额
"; + orderInfo += "--------------------------------
"; + double totals = 0.0; + for (int i = 0; i < orderList.size(); i++) { + String title = orderList.get(i).getTitle(); + String price = orderList.get(i).getPrice(); + String num = orderList.get(i).getNum(); + String total = "" + Double.valueOf(price) * Integer.parseInt(num); + totals += Double.parseDouble(total); + price = addSpace(price, b2); + num = addSpace(num, b3); + total = addSpace(total, b4); + String otherStr = " " + price + num + " " + total; + + int tl = 0; + try { + tl = title.getBytes("GBK").length; + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + int spaceNum = (tl / b1 + 1) * b1 - tl; + if (tl < b1) { + for (int k = 0; k < spaceNum; k++) { + title += " "; + } + title += otherStr; + } else if (tl == b1) { + title += otherStr; + } else { + List list = null; + if (isEn(title)) { + list = getStrList(title, b1); + } else { + list = getStrList(title, b1 / 2); + } + String s0 = titleAddSpace(list.get(0)); + title = s0 + otherStr + "
";// 添加 单价 数量 总额 + String s = ""; + for (int k = 1; k < list.size(); k++) { + s += list.get(k); + } + try { + s = getStringByEnter(b1, s); + } catch (Exception e) { + e.printStackTrace(); + } + title += s; + } + orderInfo += title + "
"; + } + orderInfo += "--------------------------------
"; + + orderInfo += "合计:" + totals + "元
"; + orderInfo += "实付:" + payPrice + "元
"; + //orderInfo += "送货地点:广州市南沙区xx路xx号
"; + orderInfo += "联系人:" + name + "
"; + orderInfo += "联系电话:" + mobile + "
"; + orderInfo += "下单时间:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "
"; + //orderInfo += "https://admin.jidanguo10.com/weixin?id=2"; + return orderInfo; + } + + + /** + * 打印各门店订单数据信息 + * + * @param contentTitle + * @param orderList + * @param b1 + * @param b3 + * @param lian + * @return + */ + public static String getPrintContentByStore(String contentTitle, List orderList, int b1, int b3, PrintStoreOrderVO printStoreOrder, int lian) { + String orderInfo = "----第" + lian + "联----
"; + orderInfo += "" + contentTitle + "
"; + orderInfo += "名称 数量
"; + orderInfo += "--------------------------------
"; + for (int i = 0; i < orderList.size(); i++) { + String title = orderList.get(i).getTitle(); + String num = orderList.get(i).getNum(); + num = addSpace(num, b3); + String otherStr = " " + num; + + int tl = 0; + try { + tl = title.getBytes("GBK").length; + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + int spaceNum = (tl / b1 + 1) * b1 - tl; + if (tl < b1) { + for (int k = 0; k < spaceNum; k++) { + title += " "; + } + title += otherStr; + } else if (tl == b1) { + title += otherStr; + } else { + List list = null; + if (isEn(title)) { + list = getStrList(title, b1); + } else { + list = getStrList(title, b1 / 2); + } + String s0 = titleAddSpace(list.get(0)); + title = s0 + otherStr + "
";// 添加 单价 数量 总额 + String s = ""; + for (int k = 1; k < list.size(); k++) { + s += list.get(k); + } + try { + s = getStringByEnter(b1, s); + } catch (Exception e) { + e.printStackTrace(); + } + title += s; + } + orderInfo += title + "
"; + } + orderInfo += "--------------------------------
"; + orderInfo += "社区门店:" + contentTitle + "
"; + orderInfo += "开始时间:" + printStoreOrder.getStartTime() + "
"; + orderInfo += "截止时间:" + printStoreOrder.getEndTime() + "
"; + orderInfo += "打印时间:" + DateUtils.getTime() + "
"; + //orderInfo += "https://admin.jidanguo10.com/weixin?id=2"; + return orderInfo; + } + + + //orderList为数组 b1代表名称列占用字节 b2单价列 b3数量列 b4金额列-->这里的字节数可按自己需求自由改写,详细往上看112行调用实际例子运用 + + /** + * 获取打印订单的文本内容 + * + * @param contentTitle 打印内容标题 + * @param orderList 订单数据 + * @param b1 + * @param b2 + * @param b3 + * @param b4 + * @param order + * @return + */ + public static String getPrintContent(String contentTitle, List orderList, int b1, int b2, int b3, int b4, PrintOrderDataVO order, int lian) { + String orderInfo = "----第" + lian + "联----
"; + orderInfo += "" + contentTitle + "
"; + orderInfo += "名称 单价 数量 金额
"; + orderInfo += "--------------------------------
"; + double totals = 0.0; + for (int i = 0; i < orderList.size(); i++) { + String title = orderList.get(i).getTitle(); + String price = orderList.get(i).getPrice(); + String num = orderList.get(i).getNum(); + String total = "" + Double.valueOf(price) * Integer.parseInt(num); + totals += Double.parseDouble(total); + price = addSpace(price, b2); + num = addSpace(num, b3); + total = addSpace(total, b4); + String otherStr = " " + price + num + " " + total; + + int tl = 0; + try { + tl = title.getBytes("GBK").length; + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + int spaceNum = (tl / b1 + 1) * b1 - tl; + if (tl < b1) { + for (int k = 0; k < spaceNum; k++) { + title += " "; + } + title += otherStr; + } else if (tl == b1) { + title += otherStr; + } else { + List list = null; + if (isEn(title)) { + list = getStrList(title, b1); + } else { + list = getStrList(title, b1 / 2); + } + String s0 = titleAddSpace(list.get(0)); + title = s0 + otherStr + "
";// 添加 单价 数量 总额 + String s = ""; + for (int k = 1; k < list.size(); k++) { + s += list.get(k); + } + try { + s = getStringByEnter(b1, s); + } catch (Exception e) { + e.printStackTrace(); + } + title += s; + } + orderInfo += title + "
"; + } + orderInfo += "--------------------------------
"; + orderInfo += "社区门店:" + order.getStoreName() + "
"; + orderInfo += "订单编号:" + order.getOrderId() + "
"; + orderInfo += "合计:" + totals + "元
"; + orderInfo += "实付:" + order.getPayPrice() + "元
"; + //orderInfo += "送货地点:广州市南沙区xx路xx号
"; + orderInfo += "联系人:" + order.getRealName() + "
"; + orderInfo += "详细地址:" + order.getUserAddress() + "
"; + orderInfo += "联系电话:" + order.getUserPhone() + "
"; + orderInfo += "下单时间:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "
"; + orderInfo += "备注:" + order.getMark() + "
"; + //orderInfo += "https://admin.jidanguo10.com/weixin?id=2"; + return orderInfo; + } + + + /** + * 发送打印请求 + * + * @param nvps + * @return + */ + public static String sendHttpRequest(List nvps) { + // 通过POST请求,发送打印信息到服务器 + RequestConfig requestConfig = RequestConfig.custom() + .setSocketTimeout(30000)// 读取超时 + .setConnectTimeout(30000)// 连接超时 + .build(); + + CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build(); + + HttpPost post = new HttpPost(URL); + CloseableHttpResponse response = null; + String result = null; + try { + post.setEntity(new UrlEncodedFormEntity(nvps, "utf-8")); + response = httpClient.execute(post); + int statecode = response.getStatusLine().getStatusCode(); + if (statecode == 200) { + HttpEntity httpentity = response.getEntity(); + if (httpentity != null) { + // 服务器返回的JSON字符串,建议要当做日志记录起来 + result = EntityUtils.toString(httpentity); + } + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + close(response, post, httpClient); + } + return result; + } + + /** + * 关闭流 + * + * @param response + * @param post + * @param httpClient + */ + public static void close(CloseableHttpResponse response, HttpPost post, CloseableHttpClient httpClient) { + try { + if (response != null) { + response.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + try { + post.abort(); + } catch (Exception e) { + e.printStackTrace(); + } + try { + httpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + + public static String titleAddSpace(String str) { + int k = 0; + int b = 14; + try { + k = str.getBytes("GBK").length; + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + for (int i = 0; i < b - k; i++) { + str += " "; + } + return str; + } + + public static String getStringByEnter(int length, String string) throws Exception { + for (int i = 1; i <= string.length(); i++) { + if (string.substring(0, i).getBytes("GBK").length > length) { + return string.substring(0, i - 1) + "
" + getStringByEnter(length, string.substring(i - 1)); + } + } + return string; + } + + /** + * 添加空格,文本对齐 + * + * @param str + * @param size + * @return + */ + public static String addSpace(String str, int size) { + int len = str.length(); + if (len < size) { + for (int i = 0; i < size - len; i++) { + str += " "; + } + } + return str; + } + + public static Boolean isEn(String str) { + Boolean b = false; + try { + b = str.getBytes("GBK").length == str.length(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return b; + } + + public static List getStrList(String inputString, int length) { + int size = inputString.length() / length; + if (inputString.length() % length != 0) { + size += 1; + } + return getStrList(inputString, length, size); + } + + public static List getStrList(String inputString, int length, int size) { + List list = new ArrayList(); + for (int index = 0; index < size; index++) { + String childStr = substring(inputString, index * length, (index + 1) * length); + list.add(childStr); + } + return list; + } + + /** + * 字符串切割 + * + * @param str + * @param f + * @param t + * @return + */ + public static String substring(String str, int f, int t) { + if (f > str.length()) { + return null; + } + if (t > str.length()) { + return str.substring(f, str.length()); + } else { + return str.substring(f, t); + } + } + + /** + * 签名 + * + * @param USER 用户 + * @param UKEY UKEY + * @param STIME 时间戳 + * @return {@link String} + */ + private static String signature(String USER, String UKEY, String STIME) { + return DigestUtils.sha1Hex(USER + UKEY + STIME); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/serializer/BigDecimalSerializer.java b/yshop-common/src/main/java/co/yixiang/serializer/BigDecimalSerializer.java new file mode 100644 index 0000000..953dae9 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/serializer/BigDecimalSerializer.java @@ -0,0 +1,28 @@ +package co.yixiang.serializer; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; +import java.math.BigDecimal; +import java.text.DecimalFormat; + +/** + * @author :LionCity + * @date :Created in 2020-05-30 14:12 + * @description: + * @modified By: + * @version: + */ +public class BigDecimalSerializer extends JsonSerializer { + @Override + public void serialize(BigDecimal value, JsonGenerator gen, SerializerProvider serializerProvider) throws IOException { + if (value != null && !"".equals(value)) { + DecimalFormat df2 =new DecimalFormat("0.00"); + gen.writeString(df2.format(value)); + } else { + gen.writeString(value + ""); + } + } +} diff --git a/yshop-common/src/main/java/co/yixiang/serializer/DoubleSerializer.java b/yshop-common/src/main/java/co/yixiang/serializer/DoubleSerializer.java new file mode 100644 index 0000000..d23311f --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/serializer/DoubleSerializer.java @@ -0,0 +1,27 @@ +package co.yixiang.serializer; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; +import java.text.DecimalFormat; + +/** + * @author :LionCity + * @date :Created in 2020-05-30 14:12 + * @description: + * @modified By: + * @version: + */ +public class DoubleSerializer extends JsonSerializer { + @Override + public void serialize(Double value, JsonGenerator gen, SerializerProvider serializerProvider) throws IOException { + if (value != null && !"".equals(value)) { + DecimalFormat df2 =new DecimalFormat("0.00"); + gen.writeString(df2.format(value)); + } else { + gen.writeString(value + ""); + } + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/BeanUtil.java b/yshop-common/src/main/java/co/yixiang/utils/BeanUtil.java new file mode 100644 index 0000000..efe406c --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/BeanUtil.java @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +@Component +public class BeanUtil implements ApplicationContextAware { + protected static ApplicationContext context; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + context = applicationContext; + } + + public static Object getBean(String name) { + return context.getBean(name); + } + + public static T getBean(Class c){ + return context.getBean(c); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/BigNum.java b/yshop-common/src/main/java/co/yixiang/utils/BigNum.java new file mode 100644 index 0000000..6a92e6e --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/BigNum.java @@ -0,0 +1,201 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; +import java.math.BigDecimal; +import java.text.DecimalFormat; + +public class BigNum { + public static final String BIG_NUM_FMT_COMMA = "#,###,###,###,###,###,##0.00";//千位分隔符 方便查看金额具体大小 + public static final String BIG_NUM_FMT = "##################0.00";//不带千位分隔符 + public static final String BIG_NUM_HUNDRED = "100";//100常量 + public static final int BIG_NUM_SCALE = 2;//保留两位小数 + + + // 除法运算默认精度 + private static final int DEF_DIV_SCALE = 10; + + + /** + * 精确加法 + */ + public static BigDecimal add(double value1, double value2) { + BigDecimal b1 = BigDecimal.valueOf(value1); + BigDecimal b2 = BigDecimal.valueOf(value2); + return new BigDecimal(b1.add(b2).toString()); + } + + /** + * 精确加法 + */ + public static BigDecimal add(Object value1, Object value2) { + BigDecimal b1 = new BigDecimal(value1.toString()); + BigDecimal b2 = new BigDecimal(value2.toString()); + return new BigDecimal(b1.add(b2).toString()); + } + + /** + * 精确减法 + */ + public static BigDecimal sub(double value1, double value2) { + BigDecimal b1 = BigDecimal.valueOf(value1); + BigDecimal b2 = BigDecimal.valueOf(value2); + return new BigDecimal(b1.subtract(b2).toString()); + } + + /** + * 精确减法 + */ + public static BigDecimal sub(Object value1, Object value2) { + BigDecimal b1 = new BigDecimal(value1.toString()); + BigDecimal b2 = new BigDecimal(value2.toString()); + return new BigDecimal(b1.subtract(b2).toString()); + } + + /** + * 精确乘法 + */ + public static BigDecimal mul(double value1, double value2) { + BigDecimal b1 = BigDecimal.valueOf(value1); + BigDecimal b2 = BigDecimal.valueOf(value2); + return new BigDecimal(b1.multiply(b2).toString()); + } + + /** + * 精确乘法 + */ + public static BigDecimal mul(Object value1, Object value2) { + BigDecimal b1 = new BigDecimal(value1.toString()); + BigDecimal b2 = new BigDecimal(value2.toString()); + return new BigDecimal(b1.multiply(b2).toString()); + } + + /** + * 精确除法 使用默认精度 + */ + public static BigDecimal div(double value1, double value2) throws IllegalAccessException { + return div(value1, value2, DEF_DIV_SCALE); + } + + /** + * 精确除法 使用默认精度 + */ + public static BigDecimal div(String value1, String value2) throws IllegalAccessException { + return div(value1, value2, DEF_DIV_SCALE); + } + + /** + * 精确除法 + * + * @param scale + * 精度 + */ + public static BigDecimal div(double value1, double value2, int scale) throws IllegalAccessException { + if (scale < 0) { + throw new IllegalAccessException("精确度不能小于0"); + } + BigDecimal b1 = BigDecimal.valueOf(value1); + BigDecimal b2 = BigDecimal.valueOf(value2); + // return b1.divide(b2, scale).doubleValue(); + return new BigDecimal(b1.divide(b2, scale, BigDecimal.ROUND_HALF_UP).toString()); + } + + /** + * 精确除法 + * + * @param scale + * 精度 + */ + public static BigDecimal div(String value1, String value2, int scale) throws IllegalAccessException { + if (scale < 0) { + throw new IllegalAccessException("精确度不能小于0"); + } + BigDecimal b1 = new BigDecimal(value1); + BigDecimal b2 = new BigDecimal(value2); + // return b1.divide(b2, scale).doubleValue(); + return b1.divide(b2, scale, BigDecimal.ROUND_HALF_UP); + } + + /** + * 四舍五入 + * + * @param scale + * 小数点后保留几位 + */ + public static BigDecimal round(double v, int scale) throws IllegalAccessException { + return div(v, 1, scale); + } + + /** + * 四舍五入 + * + * @param scale + * 小数点后保留几位 + */ + public static BigDecimal round(String v, int scale) throws IllegalAccessException { + return div(v, "1", scale); + } + + /** + * 比较大小 + */ + public static boolean equalTo(BigDecimal b1, BigDecimal b2) { + if (b1 == null || b2 == null) { + return false; + } + return 0 == b1.compareTo(b2); + } + + + /** + * 分转换成元 + * @param v + * @return + */ + public static BigDecimal penny2dollar(String v){ + BigDecimal s = new BigDecimal("0.00");//保留两位小数 + try { + s = div(v,"100",2); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + return s; + } + + /** + * 元转换成分 + * @param v + * @return + */ + public static BigDecimal dollar2penny(String v){ + return mul(v, "100"); + } + + /** + * 格式化金额 + * 千位分隔符 方便查看金额具体大小 BIG_NUM_FMT = "#,###,###,###,###,###,##0.00" + * 精确两位小数 .99 -> 0.99 + * 1111111.985 -> 1,111,111.99 + * @param v + * @return + */ + public static String formatNumber(String v){ + return formatNumber(v,BIG_NUM_FMT_COMMA); + } + + /** + * 格式化金额 + * @param v + * @param pattern BigNum类中的常量 BIG_NUM_FMT_COMMA,BIG_NUM_FMT + * @return + */ + public static String formatNumber(String v,String pattern) { + return new DecimalFormat(pattern).format(new BigDecimal(v)); + } + + public static void main(String[] args) { + System.out.println(new BigDecimal("0.00").toString()); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/CateDTO.java b/yshop-common/src/main/java/co/yixiang/utils/CateDTO.java new file mode 100644 index 0000000..e31edfb --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/CateDTO.java @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + + +/** + *

+ * 商城商品分类 + *

+ * + * @author hupeng + * @since 2019-09-08 + */ +@Data +public class CateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + + private Long id; + /** + * 上级分类编号 + */ + private Long pid; + + /** + * 商品分类名称 + */ + private String cateName; + + /** + * 缩略图url + */ + private String pic; + + private List children = new ArrayList<>(); + +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/DateUtils.java b/yshop-common/src/main/java/co/yixiang/utils/DateUtils.java new file mode 100644 index 0000000..37212cd --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/DateUtils.java @@ -0,0 +1,154 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + +import org.apache.commons.lang3.time.DateFormatUtils; + +import java.lang.management.ManagementFactory; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + +/** + * 时间工具类 + */ +public class DateUtils extends org.apache.commons.lang3.time.DateUtils { + public static String YYYY = "yyyy"; + + public static String YYYY_MM = "yyyy-MM"; + + public static String YYYY_MM_DD = "yyyy-MM-dd"; + + public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; + + public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; + + private static String[] parsePatterns = { + "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", + "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", + "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; + + /** + * 获取当前Date型日期 + * + * @return Date() 当前日期 + */ + public static Date getNowDate() { + return new Date(); + } + + /** + * 获取当前日期, 默认格式为yyyy-MM-dd + * + * @return String + */ + public static String getDate() { + return dateTimeNow(YYYY_MM_DD); + } + + public static final String getTime() { + return dateTimeNow(YYYY_MM_DD_HH_MM_SS); + } + + public static final String dateTimeNow() { + return dateTimeNow(YYYYMMDDHHMMSS); + } + + public static final String dateTimeNow(final String format) { + return parseDateToStr(format, new Date()); + } + + public static final String dateTime(final Date date) { + return parseDateToStr(YYYY_MM_DD, date); + } + + public static final String parseDateToStr(final String format, final Date date) { + return new SimpleDateFormat(format).format(date); + } + + public static final Date dateTime(final String format, final String ts) { + try { + return new SimpleDateFormat(format).parse(ts); + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + + /** + * 日期路径 即年/月/日 如2018/08/08 + */ + public static final String datePath() { + Date now = new Date(); + return DateFormatUtils.format(now, "yyyy/MM/dd"); + } + + /** + * 日期路径 即年/月/日 如20180808 + */ + public static final String dateTime() { + Date now = new Date(); + return DateFormatUtils.format(now, "yyyyMMdd"); + } + + /** + * 日期型字符串转化为日期 格式 + */ + public static Date parseDate(Object str) { + if (str == null) { + return null; + } + try { + return parseDate(str.toString(), parsePatterns); + } catch (ParseException e) { + return null; + } + } + + /** + * 获取服务器启动时间 + */ + public static Date getServerStartDate() { + long time = ManagementFactory.getRuntimeMXBean().getStartTime(); + return new Date(time); + } + + /** + * 计算两个时间差 + */ + public static String getDatePoor(Date endDate, Date nowDate) { + long nd = 1000 * 24 * 60 * 60; + long nh = 1000 * 60 * 60; + long nm = 1000 * 60; + // long ns = 1000; + // 获得两个时间的毫秒时间差异 + long diff = endDate.getTime() - nowDate.getTime(); + // 计算差多少天 + long day = diff / nd; + // 计算差多少小时 + long hour = diff % nd / nh; + // 计算差多少分钟 + long min = diff % nd % nh / nm; + // 计算差多少秒//输出结果 + // long sec = diff % nd % nh % nm / ns; + return day + "天" + hour + "小时" + min + "分钟"; + } + + /** + * 秒转换为指定格式的日期 + * + * @param second + * @return + */ + public static String secondToDate(long second) { + Calendar calendar = Calendar.getInstance(); + calendar.setTimeInMillis(second * 1000);//转换为毫秒 + Date date = calendar.getTime(); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + String dateString = format.format(date); + return dateString; + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/ElAdminConstant.java b/yshop-common/src/main/java/co/yixiang/utils/ElAdminConstant.java new file mode 100644 index 0000000..89893fa --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/ElAdminConstant.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + +/** + * 常用静态常量 + * @author Zheng Jie + * @date 2018-12-26 + */ +public class ElAdminConstant { + + public static final String RESET_PASS = "重置密码"; + + public static final String RESET_MAIL = "重置邮箱"; + + /** + * 用于IP定位转换 + */ + public static final String REGION = "内网IP|内网IP"; + + /** + * 常用接口 + */ + public static class Url{ + public static final String SM_MS_URL = "https://sm.ms/api/upload"; + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/EncryptUtils.java b/yshop-common/src/main/java/co/yixiang/utils/EncryptUtils.java new file mode 100644 index 0000000..6365416 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/EncryptUtils.java @@ -0,0 +1,100 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + +import org.springframework.util.DigestUtils; + +import javax.crypto.Cipher; +import javax.crypto.SecretKey; +import javax.crypto.SecretKeyFactory; +import javax.crypto.spec.DESKeySpec; +import javax.crypto.spec.IvParameterSpec; +import java.nio.charset.StandardCharsets; + +/** + * 加密 + * @author Zheng Jie + * @date 2018-11-23 + */ +public class EncryptUtils { + + private static String strParam = "Passw0rd"; + + private static Cipher cipher; + + private static IvParameterSpec iv = new IvParameterSpec(strParam.getBytes(StandardCharsets.UTF_8)); + + private static DESKeySpec getDesKeySpec(String source) throws Exception { + if (source == null || source.length() == 0){ + return null; + } + cipher = Cipher.getInstance("DES/CBC/PKCS5Padding"); + String strKey = "Passw0rd"; + return new DESKeySpec(strKey.getBytes(StandardCharsets.UTF_8)); + } + + /** + * 对称加密 + */ + public static String desEncrypt(String source) throws Exception { + DESKeySpec desKeySpec = getDesKeySpec(source); + SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); + SecretKey secretKey = keyFactory.generateSecret(desKeySpec); + cipher.init(Cipher.ENCRYPT_MODE, secretKey, iv); + return byte2hex( + cipher.doFinal(source.getBytes(StandardCharsets.UTF_8))).toUpperCase(); + } + + /** + * 对称解密 + */ + public static String desDecrypt(String source) throws Exception { + byte[] src = hex2byte(source.getBytes()); + DESKeySpec desKeySpec = getDesKeySpec(source); + SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); + SecretKey secretKey = keyFactory.generateSecret(desKeySpec); + cipher.init(Cipher.DECRYPT_MODE, secretKey, iv); + byte[] retByte = cipher.doFinal(src); + return new String(retByte); + } + + private static String byte2hex(byte[] inStr) { + String stmp; + StringBuilder out = new StringBuilder(inStr.length * 2); + for (byte b : inStr) { + stmp = Integer.toHexString(b & 0xFF); + if (stmp.length() == 1) { + // 如果是0至F的单位字符串,则添加0 + out.append("0").append(stmp); + } else { + out.append(stmp); + } + } + return out.toString(); + } + + private static byte[] hex2byte(byte[] b) { + int size = 2; + if ((b.length % size) != 0){ + throw new IllegalArgumentException("长度不是偶数"); + } + byte[] b2 = new byte[b.length / 2]; + for (int n = 0; n < b.length; n += size) { + String item = new String(b, n, 2); + b2[n / 2] = (byte) Integer.parseInt(item, 16); + } + return b2; + } + + /** + * 密码加密 + * @param password + * @return + */ + public static String encryptPassword(String password){ + return DigestUtils.md5DigestAsHex(password.getBytes()); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/FeiEHttpUtil.java b/yshop-common/src/main/java/co/yixiang/utils/FeiEHttpUtil.java new file mode 100644 index 0000000..1bf0c83 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/FeiEHttpUtil.java @@ -0,0 +1,17 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + +/** + * @author :LionCity + * @date :Created in 2020-04-21 17:30 + * @description:飞鹅打印机打印帮助类 + * @modified By: + * @version: V1.0 + */ +public class FeiEHttpUtil { + +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/FileUtil.java b/yshop-common/src/main/java/co/yixiang/utils/FileUtil.java new file mode 100644 index 0000000..a66fd49 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/FileUtil.java @@ -0,0 +1,454 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + +import cn.hutool.core.codec.Base64; +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.poi.excel.BigExcelWriter; +import cn.hutool.poi.excel.ExcelUtil; +import co.yixiang.exception.BadRequestException; +import org.apache.poi.util.IOUtils; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.Reader; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.security.MessageDigest; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Random; + +/** + * File工具类,扩展 hutool 工具包 + * @author Zheng Jie + * @date 2018-12-27 + */ +public class FileUtil extends cn.hutool.core.io.FileUtil { + + /** + * 定义GB的计算常量 + */ + private static final int GB = 1024 * 1024 * 1024; + /** + * 定义MB的计算常量 + */ + private static final int MB = 1024 * 1024; + /** + * 定义KB的计算常量 + */ + private static final int KB = 1024; + + /** + * 格式化小数 + */ + private static final DecimalFormat DF = new DecimalFormat("0.00"); + + /** + * MultipartFile转File + */ + public static File toFile(MultipartFile multipartFile){ + // 获取文件名 + String fileName = multipartFile.getOriginalFilename(); + // 获取文件后缀 + String prefix="."+getExtensionName(fileName); + File file = null; + try { + // 用uuid作为文件名,防止生成的临时文件重复 + file = File.createTempFile(IdUtil.simpleUUID(), prefix); + // MultipartFile to File + multipartFile.transferTo(file); + } catch (IOException e) { + e.printStackTrace(); + } + return file; + } + + /** + * 获取文件扩展名,不带 . + */ + public static String getExtensionName(String filename) { + if ((filename != null) && (filename.length() > 0)) { + int dot = filename.lastIndexOf('.'); + if ((dot >-1) && (dot < (filename.length() - 1))) { + return filename.substring(dot + 1); + } + } + return filename; + } + + /** + * Java文件操作 获取不带扩展名的文件名 + */ + public static String getFileNameNoEx(String filename) { + if ((filename != null) && (filename.length() > 0)) { + int dot = filename.lastIndexOf('.'); + if ((dot >-1) && (dot < (filename.length()))) { + return filename.substring(0, dot); + } + } + return filename; + } + + /** + * 文件大小转换 + */ + public static String getSize(long size){ + String resultSize; + if (size / GB >= 1) { + //如果当前Byte的值大于等于1GB + resultSize = DF.format(size / (float) GB) + "GB "; + } else if (size / MB >= 1) { + //如果当前Byte的值大于等于1MB + resultSize = DF.format(size / (float) MB) + "MB "; + } else if (size / KB >= 1) { + //如果当前Byte的值大于等于1KB + resultSize = DF.format(size / (float) KB) + "KB "; + } else { + resultSize = size + "B "; + } + return resultSize; + } + + /** + * inputStream 转 File + */ + public static File inputStreamToFile(InputStream ins, String name) throws Exception{ + File file = new File(System.getProperty("java.io.tmpdir") + File.separator + name); + if (file.exists()) { + return file; + } + OutputStream os = new FileOutputStream(file); + int bytesRead; + int len = 8192; + byte[] buffer = new byte[len]; + while ((bytesRead = ins.read(buffer, 0, len)) != -1) { + os.write(buffer, 0, bytesRead); + } + os.close(); + ins.close(); + return file; + } + + /** + * 将文件名解析成文件的上传路径 + */ + public static File upload(MultipartFile file, String filePath) { + //String name = getFileNameNoEx(file.getOriginalFilename()); + String suffix = getExtensionName(file.getOriginalFilename()); + StringBuffer nowStr = fileRename(); + try { + String fileName = nowStr + "." + suffix; + String path = filePath + fileName; + // getCanonicalFile 可解析正确各种路径 + File dest = new File(path).getCanonicalFile(); + // 检测是否存在目录 + if (!dest.getParentFile().exists()) { + dest.getParentFile().mkdirs(); + } + // 文件写入 + file.transferTo(dest); + return dest; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public static String fileToBase64(File file) throws Exception { + FileInputStream inputFile = new FileInputStream(file); + String base64; + byte[] buffer = new byte[(int)file.length()]; + inputFile.read(buffer); + inputFile.close(); + base64=Base64.encode(buffer); + return base64.replaceAll("[\\s*\t\n\r]", ""); + } + + /** + * 导出excel + */ + public static void downloadExcel(List> list, HttpServletResponse response) throws IOException { + String tempPath =System.getProperty("java.io.tmpdir") + IdUtil.fastSimpleUUID() + ".xlsx"; + File file = new File(tempPath); + BigExcelWriter writer= ExcelUtil.getBigWriter(file); + // 一次性写出内容,使用默认样式,强制输出标题 + writer.write(list, true); + //response为HttpServletResponse对象 + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"); + //test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码 + response.setHeader("Content-Disposition","attachment;filename=file.xlsx"); + ServletOutputStream out=response.getOutputStream(); + // 终止后删除临时文件 + file.deleteOnExit(); + writer.flush(out, true); + //此处记得关闭输出Servlet流 + IoUtil.close(out); + } + + public static String getFileType(String type) { + String documents = "txt doc pdf ppt pps xlsx xls docx"; + String music = "mp3 wav wma mpa ram ra aac aif m4a"; + String video = "avi mpg mpe mpeg asf wmv mov qt rm mp4 flv m4v webm ogv ogg"; + String image = "bmp dib pcp dif wmf gif jpg tif eps psd cdr iff tga pcd mpt png jpeg"; + if(image.contains(type)){ + return "pic"; + } else if(documents.contains(type)){ + return "txt"; + } else if(music.contains(type)){ + return "music"; + } else if(video.contains(type)){ + return "vedio"; + } else { + return "other"; + } + } + + + public static void checkSize(long maxSize, long size) { + // 1M + int len = 1024 * 1024; + if(size > (maxSize * len)){ + throw new BadRequestException("文件超出规定大小"); + } + } + + /** + * 判断两个文件是否相同 + */ + public static boolean check(File file1, File file2) { + String img1Md5 = getMd5(file1); + String img2Md5 = getMd5(file2); + return img1Md5.equals(img2Md5); + } + + /** + * 判断两个文件是否相同 + */ + public static boolean check(String file1Md5, String file2Md5) { + return file1Md5.equals(file2Md5); + } + + private static byte[] getByte(File file) { + // 得到文件长度 + byte[] b = new byte[(int) file.length()]; + try { + InputStream in = new FileInputStream(file); + try { + in.read(b); + } catch (IOException e) { + e.printStackTrace(); + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + return null; + } + return b; + } + + private static String getMd5(byte[] bytes) { + // 16进制字符 + char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; + try { + MessageDigest mdTemp = MessageDigest.getInstance("MD5"); + mdTemp.update(bytes); + byte[] md = mdTemp.digest(); + int j = md.length; + char[] str = new char[j * 2]; + int k = 0; + // 移位 输出字符串 + for (byte byte0 : md) { + str[k++] = hexDigits[byte0 >>> 4 & 0xf]; + str[k++] = hexDigits[byte0 & 0xf]; + } + return new String(str); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + /** + * 下载文件 + * @param request / + * @param response / + * @param file / + */ + public static void downloadFile(HttpServletRequest request, HttpServletResponse response, File file, boolean deleteOnExit){ + response.setCharacterEncoding(request.getCharacterEncoding()); + response.setContentType("application/octet-stream"); + FileInputStream fis = null; + try { + fis = new FileInputStream(file); + response.setHeader("Content-Disposition", "attachment; filename="+file.getName()); + IOUtils.copy(fis,response.getOutputStream()); + response.flushBuffer(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (fis != null) { + try { + fis.close(); + if(deleteOnExit){ + file.deleteOnExit(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + public static String getMd5(File file) { + return getMd5(getByte(file)); + } + + /** + * 读取json文件,返回json串 + * @param fileName + * @return + */ + public static String readJsonFile(String fileName) { + String jsonStr = ""; + try { + File jsonFile = new File(fileName); + FileReader fileReader = new FileReader(jsonFile); + + Reader reader = new InputStreamReader(new FileInputStream(jsonFile),"utf-8"); + int ch = 0; + StringBuffer sb = new StringBuffer(); + while ((ch = reader.read()) != -1) { + sb.append((char) ch); + } + fileReader.close(); + reader.close(); + jsonStr = sb.toString(); + return jsonStr; + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public static BufferedImage inputImage(MultipartFile file) { + BufferedImage srcImage = null; + try { + FileInputStream in = (FileInputStream) file.getInputStream(); + srcImage = javax.imageio.ImageIO.read(in); + } catch (IOException e) { + System.out.println("读取图片文件出错!" + e.getMessage()); + } + return srcImage; + } + /** + * 自动调节精度(经验数值) + * + * @param size 源图片大小 + * @return 图片压缩质量比 + */ + public static float getAccuracy(long size) { + float accuracy; + if (size < 400) { + accuracy = 0.85f; + } else if (size < 900) { + accuracy = 0.75f; + } else if (size < 2047) { + accuracy = 0.6f; + } else if (size < 3275) { + accuracy = 0.44f; + } else { + accuracy = 0.4f; + } + return accuracy; + } + + /** + * 上传文件重命名 + * @return 新的文件名 + */ + public static StringBuffer fileRename() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); + String time = sdf.format(new Date()); + StringBuffer buf = new StringBuffer(time); + Random r = new Random(); + //循环取得三个不大于10的随机整数 + for (int x = 0; x < 3; x++) { + buf.append(r.nextInt(10)); + } + return buf; + } + + /** + * 对中文字符进行UTF-8编码 + * @param source 要转义的字符串 + * @return + * @throws UnsupportedEncodingException + */ + public static String transformStyle(String source) throws UnsupportedEncodingException + { + char[] arr = source.toCharArray(); + StringBuilder sb = new StringBuilder(); + for(int i = 0; i < arr.length; i++) + { + char temp = arr[i]; + if(isChinese(temp)) + { + sb.append(URLEncoder.encode("" + temp, "UTF-8")); + continue; + } + sb.append(arr[i]); + } + return sb.toString(); + } + + /** + * 判断是不是中文字符 + * @param c + * @return + */ + public static boolean isChinese(char c) + { + + Character.UnicodeBlock ub = Character.UnicodeBlock.of(c); + + if(ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS + + || ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS + + || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A + + || ub == Character.UnicodeBlock.GENERAL_PUNCTUATION + + || ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION + + || ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS) + { + + return true; + + } + + return false; + + } + +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/FontUtil.java b/yshop-common/src/main/java/co/yixiang/utils/FontUtil.java new file mode 100644 index 0000000..dd2af13 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/FontUtil.java @@ -0,0 +1,86 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + +import java.awt.Font; +import java.awt.FontFormatException; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; + +/** + * 字体工具类 + * Created by 刘彦民 on 2018/5/5. + */ +public class FontUtil { + /** + * 默认字体 + */ + public static final int DEFAULT_FONT = 1; + /** + * PingFangSC字体 + */ + public static final int PINGFANG_FONT = 2; + /** + * PingFangSCBold字体 + */ + public static final int PINGFANG_BOLD_FONT = 3; + /** + * 方正兰亭特黑GBK + */ + public static final int FZLTTH_GBK_FONT = 4; + + + /** + * 根据字体类型获取字体 + * @param type + * @param size + * @return + */ + public static Font getFont(int type, float size) { + // 字体路径 + String path = ""; + switch (type) { + case DEFAULT_FONT: + path = "D:/upload/resources/font/simhei.ttf"; + break; + case PINGFANG_FONT: + path = "D:/upload/resources/font/PingFangSC.ttf"; + break; + case PINGFANG_BOLD_FONT: + path = "D:/upload/resources/font/PingFangBold.ttf"; + break; + case FZLTTH_GBK_FONT: + path = "D:/upload/resources/font/fzltthjwgb10.ttf"; + break; + default: + path = "D:/upload/resources/font/simhei.ttf"; + } + + File file = new File(path); + InputStream inputStream = null; + try { + inputStream = new FileInputStream(file); + Font sPfBoldFont = Font.createFont(Font.TRUETYPE_FONT, inputStream); + sPfBoldFont = sPfBoldFont.deriveFont(size); + return sPfBoldFont; + } catch (FontFormatException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (inputStream != null) { + inputStream.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + return null; + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/GsonParser.java b/yshop-common/src/main/java/co/yixiang/utils/GsonParser.java new file mode 100644 index 0000000..c62bb9b --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/GsonParser.java @@ -0,0 +1,26 @@ +package co.yixiang.utils; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.google.gson.stream.JsonReader; + +import java.io.Reader; + +/** + * @author niefy + */ +public class GsonParser { + private static final JsonParser JSON_PARSER = new JsonParser(); + + public static JsonObject parse(String json) { + return JSON_PARSER.parse(json).getAsJsonObject(); + } + + public static JsonObject parse(Reader json) { + return JSON_PARSER.parse(json).getAsJsonObject(); + } + + public static JsonObject parse(JsonReader json) { + return JSON_PARSER.parse(json).getAsJsonObject(); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/IpUtil.java b/yshop-common/src/main/java/co/yixiang/utils/IpUtil.java new file mode 100644 index 0000000..abf02cb --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/IpUtil.java @@ -0,0 +1,165 @@ +package co.yixiang.utils; + +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; + +public class IpUtil { + private IpUtil(){} + /** + * 此方法描述的是:获得服务器的IP地址 + * @author: zhangyang33@sinopharm.com + * @version: 2014年9月5日 下午4:57:15 + */ + public static String getLocalIP() { + String sIP = ""; + InetAddress ip = null; + try { + boolean bFindIP = false; + Enumeration netInterfaces = (Enumeration) NetworkInterface + .getNetworkInterfaces(); + while (netInterfaces.hasMoreElements()) { + if (bFindIP) { + break; + } + NetworkInterface ni = (NetworkInterface) netInterfaces + .nextElement(); + Enumeration ips = ni.getInetAddresses(); + while (ips.hasMoreElements()) { + ip = (InetAddress) ips.nextElement(); + if (!ip.isLoopbackAddress() + && ip.getHostAddress().matches( + "(\\d{1,3}\\.){3}\\d{1,3}")) { + bFindIP = true; + break; + } + } + } + } catch (Exception e) { + } + if (null != ip) { + sIP = ip.getHostAddress(); + } + return sIP; + } + /** + * 此方法描述的是:获得服务器的IP地址(多网卡) + * @author: zhangyang33@sinopharm.com + * @version: 2014年9月5日 下午4:57:15 + */ + public static List getLocalIPS() { + InetAddress ip = null; + List ipList = new ArrayList(); + try { + Enumeration netInterfaces = (Enumeration) NetworkInterface + .getNetworkInterfaces(); + while (netInterfaces.hasMoreElements()) { + NetworkInterface ni = (NetworkInterface) netInterfaces + .nextElement(); + Enumeration ips = ni.getInetAddresses(); + while (ips.hasMoreElements()) { + ip = (InetAddress) ips.nextElement(); + if (!ip.isLoopbackAddress() + && ip.getHostAddress().matches( + "(\\d{1,3}\\.){3}\\d{1,3}")) { + ipList.add(ip.getHostAddress()); + } + } + } + } catch (Exception e) { + } + return ipList; + } + /** + * 此方法描述的是:获得服务器的MAC地址 + * @author: zhangyang33@sinopharm.com + * @version: 2014年9月5日 下午1:27:25 + */ + public static String getMacId() { + String macId = ""; + InetAddress ip = null; + NetworkInterface ni = null; + try { + boolean bFindIP = false; + Enumeration netInterfaces = (Enumeration) NetworkInterface + .getNetworkInterfaces(); + while (netInterfaces.hasMoreElements()) { + if (bFindIP) { + break; + } + ni = (NetworkInterface) netInterfaces + .nextElement(); + // ----------特定情况,可以考虑用ni.getName判断 + // 遍历所有ip + Enumeration ips = ni.getInetAddresses(); + while (ips.hasMoreElements()) { + ip = (InetAddress) ips.nextElement(); + if (!ip.isLoopbackAddress() // 非127.0.0.1 + && ip.getHostAddress().matches( + "(\\d{1,3}\\.){3}\\d{1,3}")) { + bFindIP = true; + break; + } + } + } + } catch (Exception e) { + } + if (null != ip) { + try { + macId = getMacFromBytes(ni.getHardwareAddress()); + } catch (SocketException e) { + } + } + return macId; + } + /** + * 此方法描述的是:获得服务器的MAC地址(多网卡) + * @author: zhangyang33@sinopharm.com + * @version: 2014年9月5日 下午1:27:25 + */ + public static List getMacIds() { + InetAddress ip = null; + NetworkInterface ni = null; + List macList = new ArrayList(); + try { + Enumeration netInterfaces = (Enumeration) NetworkInterface + .getNetworkInterfaces(); + while (netInterfaces.hasMoreElements()) { + ni = (NetworkInterface) netInterfaces + .nextElement(); + // ----------特定情况,可以考虑用ni.getName判断 + // 遍历所有ip + Enumeration ips = ni.getInetAddresses(); + while (ips.hasMoreElements()) { + ip = (InetAddress) ips.nextElement(); + if (!ip.isLoopbackAddress() // 非127.0.0.1 + && ip.getHostAddress().matches( + "(\\d{1,3}\\.){3}\\d{1,3}")) { + macList.add(getMacFromBytes(ni.getHardwareAddress())); + } + } + } + } catch (Exception e) { + } + return macList; + } + private static String getMacFromBytes(byte[] bytes) { + StringBuffer mac = new StringBuffer(); + byte currentByte; + boolean first = false; + for (byte b : bytes) { + if (first) { + mac.append("-"); + } + currentByte = (byte) ((b & 240) >> 4); + mac.append(Integer.toHexString(currentByte)); + currentByte = (byte) (b & 15); + mac.append(Integer.toHexString(currentByte)); + first = true; + } + return mac.toString().toUpperCase(); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/OrderUtil.java b/yshop-common/src/main/java/co/yixiang/utils/OrderUtil.java new file mode 100644 index 0000000..1ae5b20 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/OrderUtil.java @@ -0,0 +1,295 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.NumberUtil; +import co.yixiang.enums.ShopCommonEnum; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Random; + +/** + * @ClassName OrderUtil + * @Author hupeng <610796224@qq.com> + * @Date 2019/9/13 + **/ +public class OrderUtil { + + + /** + * 获取精确到秒的时间戳 + * @return + **/ + public static int getSecondTimestamp(){ + String timestamp = String.valueOf(System.currentTimeMillis()/1000); + return Integer.valueOf(timestamp); + } + + + /** + * 返回活动状态 + * @param starTime 开始时间 + * @param endTime 结束时间 + * @param status 0-关闭 其他表示相反 + * @return String + */ + public static String checkActivityStatus(Date starTime,Date endTime,Integer status){ + Date nowTime = new Date(); + + if(ShopCommonEnum.IS_STATUS_0.getValue().equals(status)) { + return "关闭"; + } + + if(DateUtil.compare(starTime,nowTime) > 0){ + return "活动未开始"; + }else if(DateUtil.compare(endTime,nowTime) < 0){ + return "活动已结束"; + }else if(DateUtil.compare(endTime,nowTime) > 0 && DateUtil.compare(starTime,nowTime) < 0){ + return "正在进行中"; + } + + return "未知"; + + } + + /** + * 生成邀请码 + * + * @return + */ + public static String createShareCode() { + int maxNum = 36; + int i; + int count = 0; + char[] str = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', + 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; + StringBuffer pwd = new StringBuffer(""); + Random r = new Random(); + while (count < 10) { + i = Math.abs(r.nextInt(maxNum)); + if (i >= 0 && i < str.length) { + pwd.append(str[i]); + count++; + } + } + return pwd.toString(); + } + + /** + * 获取俩个数之间的随机数 + * + * @param min + * @param max + * @return + */ + public static Double randomNumber(double min, double max) { + return NumberUtil.add(min, + NumberUtil.mul(Math.random(), + NumberUtil.sub(max, min))); + } + + /** + * 时间戳订单号 + * + * @return + */ + public static String orderSn() { + Date date = DateUtil.date(); + return DateUtil.format(date, "yyyyMMddHHmmssSSS"); + } + + /* + * 将时间戳转换为时间 + */ + public static String stampToDate(String s) { + String res; + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + long lt = new Long(s) * 1000; + Date date = new Date(lt); + res = simpleDateFormat.format(date); + return res; + } + + /* + * 将时间戳转换为date + */ + public static Date stampToDateObj(String s) { + long lt = new Long(s) * 1000; + Date date = new Date(lt); + return date; + } + + + /** + * 获取精确到秒的时间戳 + * + * @return + **/ + public static int getSecondTimestampTwo() { + String timestamp = String.valueOf(System.currentTimeMillis() / 1000); + return Integer.valueOf(timestamp); + } + + /** + * 获取精确到秒的时间戳 + * + * @return + **/ + public static int dateToTimestamp(Date date) { + String timestamp = String.valueOf(date.getTime() / 1000); + return Integer.valueOf(timestamp); + } + + /** + * 获取精确到秒的时间戳 + * + * @return + **/ + public static int dateToTimestampT(DateTime date) { + String timestamp = String.valueOf(date.getTime() / 1000); + return Integer.valueOf(timestamp); + } + + public static long dateToSecond(String str) throws Exception { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date date = simpleDateFormat.parse(str); + long ts = date.getTime(); + return ts/1000; + } + + /** + * 获取订单状态名称 + * + * @param paid + * @param status + * @param shipping_type + * @param refund_status + * @return + */ + public static String orderStatusStr(int paid, int status, + int shipping_type, int refund_status) { + String statusName = ""; + if (paid == 0 && status == 0) { + statusName = "未支付"; + } else if (paid == 1 && status == 0 && shipping_type == 1 && refund_status == 0) { + statusName = "未发货"; + } else if (paid == 1 && status == 0 && shipping_type == 2 && refund_status == 0) { + statusName = "未核销"; + } else if (paid == 1 && status == 1 && shipping_type == 1 && refund_status == 0) { + statusName = "待收货"; + } else if (paid == 1 && status == 1 && shipping_type == 2 && refund_status == 0) { + statusName = "未核销"; + } else if (paid == 1 && status == 2 && refund_status == 0) { + statusName = "待评价"; + } else if (paid == 1 && status == 3 && refund_status == 0) { + statusName = "已完成"; + } else if (paid == 1 && refund_status == 1) { + statusName = "退款中"; + } else if (paid == 1 && refund_status == 2) { + statusName = "已退款"; + } + + return statusName; + } + + + /** + * 获取状态数值 + * + * @param paid + * @param status + * @param refund_status + * @return + */ + public static int orderStatus(int paid, int status, int refund_status) { + //todo 1-未付款 2-未发货 3-退款中 4-待收货 5-待评价 6-已完成 7-已退款 + int _status = 0; + + if (paid == 0 && status == 0 && refund_status == 0) { + _status = 1; + } else if (paid == 1 && status == 0 && refund_status == 0) { + _status = 2; + } else if (paid == 1 && refund_status == 1) { + _status = 3; + } else if (paid == 1 && status == 1 && refund_status == 0) { + _status = 4; + } else if (paid == 1 && status == 2 && refund_status == 0) { + _status = 5; + } else if (paid == 1 && status == 3 && refund_status == 0) { + _status = 6; + } else if (paid == 1 && refund_status == 2) { + _status = 7; + } + + return _status; + + } + + + /** + * 支付方式 + * + * @param pay_type + * @param paid + * @return + */ + public static String payTypeName(String pay_type, int paid) { + String payTypeName = ""; + if (paid == 1) { + switch (pay_type) { + case "weixin": + payTypeName = "微信支付"; + break; + case "yue": + payTypeName = "余额支付"; + break; + case "integral": + payTypeName = "积分兑换"; + break; + case "offline": + payTypeName = "线下支付"; + break; + default: + payTypeName = "其他支付"; + break; + } + } else { + switch (pay_type) { + default: + payTypeName = "未支付"; + break; + case "offline": + payTypeName = "线下支付"; + break; + } + } + return payTypeName; + } + + /** + * 支付渠道(0微信公众号1微信小程序) + * + * @return + */ + public static String payChannel(Integer pay_channel) { + if (pay_channel.equals(1)) { + return "微信小程序"; + } else { + return "微信公众号"; + } + } + + //todo 订单类型 + public static String orderType(int pinkId) { + return "普通订单"; + } + + +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/PageUtil.java b/yshop-common/src/main/java/co/yixiang/utils/PageUtil.java new file mode 100644 index 0000000..05d6932 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/PageUtil.java @@ -0,0 +1,59 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + +import org.springframework.data.domain.Page; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * 分页工具 + * @author Zheng Jie + * @date 2018-12-10 + */ +public class PageUtil extends cn.hutool.core.util.PageUtil { + + /** + * List 分页 + */ + public static List toPage(int page, int size , List list) { + int fromIndex = page * size; + int toIndex = page * size + size; + if(fromIndex > list.size()){ + return new ArrayList(); + } else if(toIndex >= list.size()) { + return list.subList(fromIndex,list.size()); + } else { + return list.subList(fromIndex,toIndex); + } + } + + /** + * Page 数据处理,预防redis反序列化报错 + */ + public static Map toPage(Page page) { + Map map = new LinkedHashMap<>(2); + map.put("content",page.getContent()); + map.put("totalElements",page.getTotalElements()); + return map; + } + + + + /** + * 自定义分页 + */ + public static Map toPage(Object object, Object totalElements) { + Map map = new LinkedHashMap<>(2); + map.put("content",object); + map.put("totalElements",totalElements); + return map; + } + +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/RecodeUtil.java b/yshop-common/src/main/java/co/yixiang/utils/RecodeUtil.java new file mode 100644 index 0000000..4282d0b --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/RecodeUtil.java @@ -0,0 +1,72 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; +import com.google.zxing.BarcodeFormat; +import com.google.zxing.EncodeHintType; +import com.google.zxing.MultiFormatWriter; +import com.google.zxing.WriterException; +import com.google.zxing.common.BitMatrix; +import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; + +import javax.imageio.ImageIO; +import javax.servlet.http.HttpServletResponse; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.Hashtable; + +/** + * @author :LionCity + * @date :Created in 2020/2/27 15:33 + * @description: + * @modified By: + * @version: + */ +public class RecodeUtil { + + public static void creatRrCode(String contents, int width, int height, HttpServletResponse response) { + Hashtable hints = new Hashtable(); + + hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); //容错级别最高 + hints.put(EncodeHintType.CHARACTER_SET, "utf-8"); //设置字符编码 + hints.put(EncodeHintType.MARGIN, 1); //二维码空白区域,最小为0也有白边,只是很小,最小是6像素左右 + try { + BitMatrix bitMatrix = new MultiFormatWriter().encode(contents, BarcodeFormat.QR_CODE, width, height, hints); // 1、读取文件转换为字节数组 +// ByteArrayOutputStream out = new ByteArrayOutputStream(); + BufferedImage image = toBufferedImage(bitMatrix); + //转换成png格式的IO流 + ImageIO.write(image, "png", response.getOutputStream()); +// byte[] bytes = out.toByteArray(); +// // 2、将字节数组转为二进制 +// BASE64Encoder encoder = new BASE64Encoder(); +// binary = encoder.encodeBuffer(bytes).trim(); + } catch (WriterException e) { // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + + + /** + * image流数据处理 + * + * @author ianly + */ + public static BufferedImage toBufferedImage(BitMatrix matrix) { + int width = matrix.getWidth(); + int height = matrix.getHeight(); + BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + for (int x = 0; x < width; x++) { + for (int y = 0; y < height; y++) { + image.setRGB(x, y, matrix.get(x, y) ? 0xFF000000 : 0xFFFFFFFF); + } + } + return image; + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/RedisUtil.java b/yshop-common/src/main/java/co/yixiang/utils/RedisUtil.java new file mode 100644 index 0000000..dea302d --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/RedisUtil.java @@ -0,0 +1,149 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.util.CollectionUtils; + +import java.util.Collection; +import java.util.concurrent.TimeUnit; + +@SuppressWarnings("unchecked") +public class RedisUtil { + private static RedisTemplate redisTemplate = SpringContextUtils + .getBean("redisTemplate",RedisTemplate.class); + + /** + * 指定缓存失效时间 + * @param key 键 + * @param time 时间(秒) + * @return + */ + public static boolean expire(String key,long time){ + try { + if(time>0){ + redisTemplate.expire(key, time, TimeUnit.SECONDS); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 根据key 获取过期时间 + * @param key 键 不能为null + * @return 时间(秒) 返回0代表为永久有效 失效时间为负数,说明该主键未设置失效时间(失效时间默认为-1) + */ + public static long getExpire(String key){ + return redisTemplate.getExpire(key,TimeUnit.SECONDS); + } + + /** + * 判断key是否存在 + * @param key 键 + * @return true 存在 false 不存在 + */ + public static boolean hasKey(String key){ + try { + return redisTemplate.hasKey(key); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 删除缓存 + * @param key 可以传一个值 或多个 + */ + @SuppressWarnings("unchecked") + public static void del(String ... key){ + if(key!=null&&key.length>0){ + if(key.length==1){ + redisTemplate.delete(key[0]); + }else{ + redisTemplate.delete((Collection) CollectionUtils.arrayToList(key)); + } + } + } + + + /** + * 普通缓存获取 + * @param key 键 + * @return 值 + */ + @SuppressWarnings("unchecked") + public static T get(String key){ + return key==null?null:(T)redisTemplate.opsForValue().get(key); + } + + /** + * 普通缓存放入 + * @param key 键 + * @param value 值 + * @return true成功 false失败 + */ + public static boolean set(String key,Object value) { + try { + redisTemplate.opsForValue().set(key, value); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + + } + + /** + * 普通缓存放入并设置时间 + * @param key 键 + * @param value 值 + * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期 + * @return true成功 false 失败 + */ + public static boolean set(String key,Object value,long time){ + try { + if(time>0){ + redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); + }else{ + set(key, value); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 递增 此时value值必须为int类型 否则报错 + * @param key 键 + * @param delta 要增加几(大于0) + * @return + */ + public static long incr(String key, long delta){ + if(delta<0){ + throw new RuntimeException("递增因子必须大于0"); + } + return redisTemplate.opsForValue().increment(key, delta); + } + + /** + * 递减 + * @param key 键 + * @param delta 要减少几(小于0) + * @return + */ + public static long decr(String key, long delta){ + if(delta<0){ + throw new RuntimeException("递减因子必须大于0"); + } + return redisTemplate.opsForValue().increment(key, -delta); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/RedisUtils.java b/yshop-common/src/main/java/co/yixiang/utils/RedisUtils.java new file mode 100644 index 0000000..95827ee --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/RedisUtils.java @@ -0,0 +1,636 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.utils; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.connection.RedisConnection; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.Cursor; +import org.springframework.data.redis.core.RedisConnectionUtils; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.ScanOptions; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +/** + * @author / + */ +@Component +@SuppressWarnings({"unchecked","all"}) +public class RedisUtils { + + private RedisTemplate redisTemplate; + @Value("${jwt.online-key}") + private String onlineKey; + + public RedisUtils(RedisTemplate redisTemplate) { + this.redisTemplate = redisTemplate; + } + + // =============================commonold============================ + + /** + * 指定缓存失效时间 + * @param key 键 + * @param time 时间(秒) + */ + public boolean expire(String key, long time) { + try { + if (time > 0) { + redisTemplate.expire(key, time, TimeUnit.SECONDS); + } + } catch (Exception e) { + e.printStackTrace(); + return false; + } + return true; + } + + /** + * 根据 key 获取过期时间 + * @param key 键 不能为null + * @return 时间(秒) 返回0代表为永久有效 + */ + public long getExpire(Object key) { + return redisTemplate.getExpire(key, TimeUnit.SECONDS); + } + + /** + * 查找匹配key + * @param pattern key + * @return / + */ + public List scan(String pattern) { + ScanOptions options = ScanOptions.scanOptions().match(pattern).build(); + RedisConnectionFactory factory = redisTemplate.getConnectionFactory(); + RedisConnection rc = Objects.requireNonNull(factory).getConnection(); + Cursor cursor = rc.scan(options); + List result = new ArrayList<>(); + while (cursor.hasNext()) { + result.add(new String(cursor.next())); + } + try { + RedisConnectionUtils.releaseConnection(rc, factory); + } catch (Exception e) { + e.printStackTrace(); + } + return result; + } + + /** + * 分页查询 key + * @param patternKey key + * @param page 页码 + * @param size 每页数目 + * @return / + */ + public List findKeysForPage(String patternKey, int page, int size) { + ScanOptions options = ScanOptions.scanOptions().match(patternKey).build(); + RedisConnectionFactory factory = redisTemplate.getConnectionFactory(); + RedisConnection rc = Objects.requireNonNull(factory).getConnection(); + Cursor cursor = rc.scan(options); + List result = new ArrayList<>(size); + int tmpIndex = 0; + int fromIndex = page * size; + int toIndex = page * size + size; + while (cursor.hasNext()) { + if (tmpIndex >= fromIndex && tmpIndex < toIndex) { + result.add(new String(cursor.next())); + tmpIndex++; + continue; + } + // 获取到满足条件的数据后,就可以退出了 + if(tmpIndex >=toIndex) { + break; + } + tmpIndex++; + cursor.next(); + } + try { + RedisConnectionUtils.releaseConnection(rc, factory); + } catch (Exception e) { + e.printStackTrace(); + } + return result; + } + + /** + * 判断key是否存在 + * @param key 键 + * @return true 存在 false不存在 + */ + public boolean hasKey(String key) { + try { + return redisTemplate.hasKey(key); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 删除缓存 + * @param key 可以传一个值 或多个 + */ + public void del(String... key) { + if (key != null && key.length > 0) { + if (key.length == 1) { + redisTemplate.delete(key[0]); + } else { + redisTemplate.delete(CollectionUtils.arrayToList(key)); + } + } + } + + // ============================String============================= + + /** + * 普通缓存获取 + * @param key 键 + * @return 值 + */ + public Object get(String key) { + return key == null ? null : redisTemplate.opsForValue().get(key); + } + + public String getY(String key){ + return key == null || !redisTemplate.hasKey(key) ? "" : redisTemplate.opsForValue().get(key).toString(); + } + + /** + * 批量获取 + * @param keys + * @return + */ + public List multiGet(List keys) { + Object obj = redisTemplate.opsForValue().multiGet(Collections.singleton(keys)); + return null; + } + + /** + * 普通缓存放入 + * @param key 键 + * @param value 值 + * @return true成功 false失败 + */ + public boolean set(String key, Object value) { + try { + redisTemplate.opsForValue().set(key, value); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 普通缓存放入并设置时间 + * @param key 键 + * @param value 值 + * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期 + * @return true成功 false 失败 + */ + public boolean set(String key, Object value, long time) { + try { + if (time > 0) { + redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); + } else { + set(key, value); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 普通缓存放入并设置时间 + * @param key 键 + * @param value 值 + * @param time 时间 + * @param timeUnit 类型 + * @return true成功 false 失败 + */ + public boolean set(String key, Object value, long time, TimeUnit timeUnit) { + try { + if (time > 0) { + redisTemplate.opsForValue().set(key, value, time, timeUnit); + } else { + set(key, value); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + // ================================Map================================= + + /** + * HashGet + * @param key 键 不能为null + * @param item 项 不能为null + * @return 值 + */ + public Object hget(String key, String item) { + return redisTemplate.opsForHash().get(key, item); + } + + /** + * 获取hashKey对应的所有键值 + * @param key 键 + * @return 对应的多个键值 + */ + public Map hmget(String key) { + return redisTemplate.opsForHash().entries(key); + + } + + /** + * HashSet + * @param key 键 + * @param map 对应多个键值 + * @return true 成功 false 失败 + */ + public boolean hmset(String key, Map map) { + try { + redisTemplate.opsForHash().putAll(key, map); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * HashSet 并设置时间 + * @param key 键 + * @param map 对应多个键值 + * @param time 时间(秒) + * @return true成功 false失败 + */ + public boolean hmset(String key, Map map, long time) { + try { + redisTemplate.opsForHash().putAll(key, map); + if (time > 0) { + expire(key, time); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 向一张hash表中放入数据,如果不存在将创建 + * + * @param key 键 + * @param item 项 + * @param value 值 + * @return true 成功 false失败 + */ + public boolean hset(String key, String item, Object value) { + try { + redisTemplate.opsForHash().put(key, item, value); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 向一张hash表中放入数据,如果不存在将创建 + * + * @param key 键 + * @param item 项 + * @param value 值 + * @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间 + * @return true 成功 false失败 + */ + public boolean hset(String key, String item, Object value, long time) { + try { + redisTemplate.opsForHash().put(key, item, value); + if (time > 0) { + expire(key, time); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 删除hash表中的值 + * + * @param key 键 不能为null + * @param item 项 可以使多个 不能为null + */ + public void hdel(String key, Object... item) { + redisTemplate.opsForHash().delete(key, item); + } + + /** + * 判断hash表中是否有该项的值 + * + * @param key 键 不能为null + * @param item 项 不能为null + * @return true 存在 false不存在 + */ + public boolean hHasKey(String key, String item) { + return redisTemplate.opsForHash().hasKey(key, item); + } + + /** + * hash递增 如果不存在,就会创建一个 并把新增后的值返回 + * + * @param key 键 + * @param item 项 + * @param by 要增加几(大于0) + * @return + */ + public double hincr(String key, String item, double by) { + return redisTemplate.opsForHash().increment(key, item, by); + } + + /** + * hash递减 + * + * @param key 键 + * @param item 项 + * @param by 要减少记(小于0) + * @return + */ + public double hdecr(String key, String item, double by) { + return redisTemplate.opsForHash().increment(key, item, -by); + } + + // ============================set============================= + + /** + * 根据key获取Set中的所有值 + * + * @param key 键 + * @return + */ + public Set sGet(String key) { + try { + return redisTemplate.opsForSet().members(key); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 根据value从一个set中查询,是否存在 + * + * @param key 键 + * @param value 值 + * @return true 存在 false不存在 + */ + public boolean sHasKey(String key, Object value) { + try { + return redisTemplate.opsForSet().isMember(key, value); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 将数据放入set缓存 + * + * @param key 键 + * @param values 值 可以是多个 + * @return 成功个数 + */ + public long sSet(String key, Object... values) { + try { + return redisTemplate.opsForSet().add(key, values); + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } + + /** + * 将set数据放入缓存 + * @param key 键 + * @param time 时间(秒) + * @param values 值 可以是多个 + * @return 成功个数 + */ + public long sSetAndTime(String key, long time, Object... values) { + try { + Long count = redisTemplate.opsForSet().add(key, values); + if (time > 0) { + expire(key, time); + } + return count; + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } + + /** + * 获取set缓存的长度 + * @param key 键 + * @return + */ + public long sGetSetSize(String key) { + try { + return redisTemplate.opsForSet().size(key); + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } + + /** + * 移除值为value的 + * @param key 键 + * @param values 值 可以是多个 + * @return 移除的个数 + */ + public long setRemove(String key, Object... values) { + try { + Long count = redisTemplate.opsForSet().remove(key, values); + return count; + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } + + // ===============================list================================= + + /** + * 获取list缓存的内容 + * @param key 键 + * @param start 开始 + * @param end 结束 0 到 -1代表所有值 + * @return + */ + public List lGet(String key, long start, long end) { + try { + return redisTemplate.opsForList().range(key, start, end); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 获取list缓存的长度 + * @param key 键 + * @return + */ + public long lGetListSize(String key) { + try { + return redisTemplate.opsForList().size(key); + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } + + /** + * 通过索引 获取list中的值 + * @param key 键 + * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推 + * @return + */ + public Object lGetIndex(String key, long index) { + try { + return redisTemplate.opsForList().index(key, index); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 将list放入缓存 + * @param key 键 + * @param value 值 + * @return + */ + public boolean lSet(String key, Object value) { + try { + redisTemplate.opsForList().rightPush(key, value); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 将list放入缓存 + * @param key 键 + * @param value 值 + * @param time 时间(秒) + * @return + */ + public boolean lSet(String key, Object value, long time) { + try { + redisTemplate.opsForList().rightPush(key, value); + if (time > 0) { + expire(key, time); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 将list放入缓存 + * @param key 键 + * @param value 值 + * @return + */ + public boolean lSet(String key, List value) { + try { + redisTemplate.opsForList().rightPushAll(key, value); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 将list放入缓存 + * @param key 键 + * @param value 值 + * @param time 时间(秒) + * @return + */ + public boolean lSet(String key, List value, long time) { + try { + redisTemplate.opsForList().rightPushAll(key, value); + if (time > 0) { + expire(key, time); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 根据索引修改list中的某条数据 + * @param key 键 + * @param index 索引 + * @param value 值 + * @return / + */ + public boolean lUpdateIndex(String key, long index, Object value) { + try { + redisTemplate.opsForList().set(key, index, value); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 移除N个值为value + * @param key 键 + * @param count 移除多少个 + * @param value 值 + * @return 移除的个数 + */ + public long lRemove(String key, long count, Object value) { + try { + return redisTemplate.opsForList().remove(key, count, value); + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/RegexUtil.java b/yshop-common/src/main/java/co/yixiang/utils/RegexUtil.java new file mode 100644 index 0000000..1b7fee3 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/RegexUtil.java @@ -0,0 +1,86 @@ +package co.yixiang.utils; + + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * @author :LionCity + * @date :Created in 2020-10-19 14:44 + * @description:正则表达式匹配两个字符串之间的内容 + * @modified By: + * @version: + */ +public class RegexUtil { + + + /** + * 转换产品描述 + * + * @param str str + * @return {@link String} + */ + public static String converProductDescription(String str){ + StringBuilder sb = new StringBuilder(); + List imgArr=Arrays.asList(str.split("p>0){ + if(img.indexOf("style=")>0){ + String rgex = "style=\"(.*?)\""; + String rgexStr = getSubUtilSimple(img, rgex); + if(rgexStr.indexOf("max-width: 100%;")<0){ + img=img.replace( rgexStr ,rgexStr+"max-width: 100%"); + } + }else{ + img=" style=\"max-width: 100%;\""+img; + } + } + sb.append(img); + } + return sb.toString(); + } + + + /** + * 正则表达式匹配两个指定字符串中间的内容 + * + * @param soap + * @return + */ + public static List getSubUtil(String soap, String rgex) { + List list = new ArrayList(); + // 匹配的模式 + Pattern pattern = Pattern.compile(rgex); + Matcher m = pattern.matcher(soap); + while (m.find()) { + int i = 1; + list.add(m.group(i)); + i++; + } + return list; + } + + /** + * 返回单个字符串,若匹配到多个的话就返回第一个,方法与getSubUtil一样 + * + * @param soap + * @param rgex + * @return + */ + public static String getSubUtilSimple(String soap, String rgex) { + // 匹配的模式 + Pattern pattern = Pattern.compile(rgex); + Matcher m = pattern.matcher(soap); + while (m.find()) { + return m.group(1); + } + return ""; + } +} \ No newline at end of file diff --git a/yshop-common/src/main/java/co/yixiang/utils/RequestHolder.java b/yshop-common/src/main/java/co/yixiang/utils/RequestHolder.java new file mode 100644 index 0000000..80a0d52 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/RequestHolder.java @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import java.util.Objects; + +/** + * 获取 HttpServletRequest + * @author Zheng Jie + * @date 2018-11-24 + */ +public class RequestHolder { + + public static HttpServletRequest getHttpServletRequest() { + return ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/SecurityUtils.java b/yshop-common/src/main/java/co/yixiang/utils/SecurityUtils.java new file mode 100644 index 0000000..1388d4f --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/SecurityUtils.java @@ -0,0 +1,58 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + +import cn.hutool.json.JSONObject; +import co.yixiang.exception.BadRequestException; +import org.springframework.http.HttpStatus; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; + +/** + * 获取当前登录的用户 + * @author Zheng Jie + * @date 2019-01-17 + */ +public class SecurityUtils { + + public static UserDetails getUserDetails() { + final Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication == null) { + throw new BadRequestException(HttpStatus.UNAUTHORIZED, "当前登录状态过期"); + } + if (authentication.getPrincipal() instanceof UserDetails) { + UserDetails userDetails = (UserDetails) authentication.getPrincipal(); + UserDetailsService userDetailsService = SpringContextHolder.getBean(UserDetailsService.class); + return userDetailsService.loadUserByUsername(userDetails.getUsername()); + } + throw new BadRequestException(HttpStatus.UNAUTHORIZED, "找不到当前登录的信息"); + } + + /** + * 获取系统用户名称 + * @return 系统用户名称 + */ + public static String getUsername(){ + final Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication == null) { + throw new BadRequestException(HttpStatus.UNAUTHORIZED, "当前登录状态过期"); + } + UserDetails userDetails = (UserDetails) authentication.getPrincipal(); + return userDetails.getUsername(); + } + + /** + * 获取系统用户id + * @return 系统用户id + */ + public static Long getUserId(){ + Object obj = getUserDetails(); + JSONObject json = new JSONObject(obj); + return json.get("id", Long.class); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/ShopKeyUtils.java b/yshop-common/src/main/java/co/yixiang/utils/ShopKeyUtils.java new file mode 100644 index 0000000..5ee4187 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/ShopKeyUtils.java @@ -0,0 +1,180 @@ +package co.yixiang.utils; + +import co.yixiang.constant.ShopConstants; +import co.yixiang.constant.SystemConfigConstants; + +/** + * 处理缓存key值的统一入口,方面后面扩展, + * 例如:多租户就要在每个key后拼接上租户ID,只要统一修改这里就可以了 + */ +public class ShopKeyUtils { + /** + *扩展值,默认为空, 把这个值追加到所有key值上 + */ + private static String getExtendValue(){ + String extendValue= ""; + return extendValue; + } + + //*********************************begin yx_system_config 通用值 ***************************************************** + + /** + * api_url + */ + public static String getApiUrl(){ + String apiUrl= SystemConfigConstants.API_URL; + return apiUrl; + } + /** + * site_url + */ + public static String getSiteUrl(){ + String siteUrl= SystemConfigConstants.SITE_URL; + return siteUrl; + } + /** + * 腾讯mapkey tengxun_map_key + */ + public static String getTengXunMapKey(){ + String tengxunMapKey= SystemConfigConstants.TENGXUN_MAP_KEY; + return tengxunMapKey; + } + + //*********************************begin yx_system_config 业务字段 ***************************************************** + /** + * store_self_mention + */ + public static String getStoreSelfMention(){ + String storeSelfMention= SystemConfigConstants.STORE_SEFL_MENTION; + return storeSelfMention+getExtendValue(); + } + + + //*********************************begin yx_system_config 微信配置相关字段 ***************************************************** + + /** + * 微信公众号service + */ + public static String getYshopWeiXinMpSevice(){ + String yshopWeiXinMpSevice= ShopConstants.YSHOP_WEIXIN_MP_SERVICE; + return yshopWeiXinMpSevice+getExtendValue(); + } + + /** + * 微信公众号id + */ + public static String getWechatAppId(){ + String wechatAppId= SystemConfigConstants.WECHAT_APPID; + return wechatAppId+getExtendValue(); + } + /** + * 微信公众号secret + */ + public static String getWechatAppSecret(){ + String wechatAppSecret= SystemConfigConstants.WECHAT_APPSECRET; + return wechatAppSecret+getExtendValue(); + } + /** + * 微信公众号验证token + */ + public static String getWechatToken(){ + String wechatToken= SystemConfigConstants.WECHAT_TOKEN; + return wechatToken+getExtendValue(); + } + /** + * 微信公众号 EncodingAESKey + */ + public static String getWechatEncodingAESKey(){ + String wechatEncodingAESKey= SystemConfigConstants.WECHAT_ENCODINGAESKEY; + return wechatEncodingAESKey+getExtendValue(); + } + /** + * 微信支付service + */ + public static String getYshopWeiXinPayService(){ + String yshopWeiXinPayService= ShopConstants.YSHOP_WEIXIN_PAY_SERVICE; + return yshopWeiXinPayService+getExtendValue(); + } + /** + * 商户号 + */ + public static String getWxPayMchId(){ + String wxPayMchId= SystemConfigConstants.WXPAY_MCHID; + return wxPayMchId+getExtendValue(); + } + /** + * 商户秘钥 + */ + public static String getWxPayMchKey(){ + String wxPayMchKey= SystemConfigConstants.WXPAY_MCHKEY; + return wxPayMchKey+getExtendValue(); + } + /** + * 商户证书路径 + */ + public static String getWxPayKeyPath(){ + String wxPayKeyPath= SystemConfigConstants.WXPAY_KEYPATH; + return wxPayKeyPath+getExtendValue(); + } + /** + * 微信支付小程序service + */ + public static String getYshopWeiXinMiniPayService(){ + String yshopWeiXinMiniPayService= ShopConstants.YSHOP_WEIXIN_MINI_PAY_SERVICE; + return yshopWeiXinMiniPayService+getExtendValue(); + } + /** + * 微信支付app service + */ + public static String getYshopWeiXinAppPayService(){ + String yshopWeiXinAppPayService= ShopConstants.YSHOP_WEIXIN_APP_PAY_SERVICE; + return yshopWeiXinAppPayService+getExtendValue(); + } + /** + * 微信小程序id + */ + public static String getWxAppAppId(){ + String wxAppAppId= SystemConfigConstants.WXAPP_APPID; + return wxAppAppId+getExtendValue(); + } + /** + * 微信小程序秘钥 + */ + public static String getWxAppSecret(){ + String wxAppSecret= SystemConfigConstants.WXAPP_SECRET; + return wxAppSecret+getExtendValue(); + } + + /** + * 微信公众号验证token + */ + public static String getWechatMaToken(){ + String wechatToken= SystemConfigConstants.WECHAT_MA_TOKEN; + return wechatToken+getExtendValue(); + } + /** + * 微信公众号 EncodingAESKey + */ + public static String getWechatMaEncodingAESKey(){ + String wechatEncodingAESKey= SystemConfigConstants.WECHAT_MA_ENCODINGAESKEY; + return wechatEncodingAESKey+getExtendValue(); + } + + /** + * 支付appId + */ + public static String getWxNativeAppAppId(){ + String wxNativeAppAppId= SystemConfigConstants.WX_NATIVE_APP_APPID; + return wxNativeAppAppId+getExtendValue(); + } + + /** + * 微信小程序service + * @return + */ + public static String getYshopWeiXinMaSevice() { + String yshopWeiXinMaSevice= ShopConstants.YSHOP_WEIXIN_MA_SERVICE; + return yshopWeiXinMaSevice+getExtendValue(); + } + +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/SpringContextHolder.java b/yshop-common/src/main/java/co/yixiang/utils/SpringContextHolder.java new file mode 100644 index 0000000..77685e7 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/SpringContextHolder.java @@ -0,0 +1,71 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.DisposableBean; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; + +/** + * @author Jie + * @date 2019-01-07 + */ +@Slf4j +public class SpringContextHolder implements ApplicationContextAware, DisposableBean { + + private static ApplicationContext applicationContext = null; + + /** + * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型. + */ + @SuppressWarnings("unchecked") + public static T getBean(String name) { + assertContextInjected(); + return (T) applicationContext.getBean(name); + } + + /** + * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型. + */ + public static T getBean(Class requiredType) { + assertContextInjected(); + return applicationContext.getBean(requiredType); + } + + /** + * 检查ApplicationContext不为空. + */ + private static void assertContextInjected() { + if (applicationContext == null) { + throw new IllegalStateException("applicaitonContext属性未注入, 请在applicationContext" + + ".xml中定义SpringContextHolder或在SpringBoot启动类中注册SpringContextHolder."); + } + } + + /** + * 清除SpringContextHolder中的ApplicationContext为Null. + */ + private static void clearHolder() { + log.debug("清除SpringContextHolder中的ApplicationContext:" + + applicationContext); + applicationContext = null; + } + + @Override + public void destroy(){ + SpringContextHolder.clearHolder(); + } + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + if (SpringContextHolder.applicationContext != null) { + log.warn("SpringContextHolder中的ApplicationContext被覆盖, 原有ApplicationContext为:" + SpringContextHolder.applicationContext); + } + SpringContextHolder.applicationContext = applicationContext; + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/SpringContextUtils.java b/yshop-common/src/main/java/co/yixiang/utils/SpringContextUtils.java new file mode 100644 index 0000000..1bc0ab0 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/SpringContextUtils.java @@ -0,0 +1,46 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +/** + * Spring Context 工具类 + */ +@Component +public class SpringContextUtils implements ApplicationContextAware { + public static ApplicationContext applicationContext; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) + throws BeansException { + SpringContextUtils.applicationContext = applicationContext; + } + + public static Object getBean(String name) { + return applicationContext.getBean(name); + } + + public static T getBean(String name, Class requiredType) { + return applicationContext.getBean(name, requiredType); + } + + public static boolean containsBean(String name) { + return applicationContext.containsBean(name); + } + + public static boolean isSingleton(String name) { + return applicationContext.isSingleton(name); + } + + public static Class getType(String name) { + return applicationContext.getType(name); + } + +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/StringUtils.java b/yshop-common/src/main/java/co/yixiang/utils/StringUtils.java new file mode 100644 index 0000000..4793fd0 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/StringUtils.java @@ -0,0 +1,174 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import eu.bitwalker.useragentutils.Browser; +import eu.bitwalker.useragentutils.UserAgent; + +import javax.servlet.http.HttpServletRequest; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Calendar; +import java.util.Date; + +/** + * @author Zheng Jie + * 字符串工具类, 继承org.apache.commons.lang3.StringUtils类 + */ +public class StringUtils extends org.apache.commons.lang3.StringUtils { + + private static final char SEPARATOR = '_'; + + private static final String UNKNOWN = "unknown"; + + /** + * 驼峰命名法工具 + * + * @return toCamelCase(" hello_world ") == "helloWorld" + * toCapitalizeCamelCase("hello_world") == "HelloWorld" + * toUnderScoreCase("helloWorld") = "hello_world" + */ + public static String toCamelCase(String s) { + if (s == null) { + return null; + } + + s = s.toLowerCase(); + + StringBuilder sb = new StringBuilder(s.length()); + boolean upperCase = false; + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + + if (c == SEPARATOR) { + upperCase = true; + } else if (upperCase) { + sb.append(Character.toUpperCase(c)); + upperCase = false; + } else { + sb.append(c); + } + } + + return sb.toString(); + } + + /** + * 驼峰命名法工具 + * + * @return toCamelCase(" hello_world ") == "helloWorld" + * toCapitalizeCamelCase("hello_world") == "HelloWorld" + * toUnderScoreCase("helloWorld") = "hello_world" + */ + public static String toCapitalizeCamelCase(String s) { + if (s == null) { + return null; + } + s = toCamelCase(s); + return s.substring(0, 1).toUpperCase() + s.substring(1); + } + + /** + * 驼峰命名法工具 + * + * @return toCamelCase(" hello_world ") == "helloWorld" + * toCapitalizeCamelCase("hello_world") == "HelloWorld" + * toUnderScoreCase("helloWorld") = "hello_world" + */ + static String toUnderScoreCase(String s) { + if (s == null) { + return null; + } + + StringBuilder sb = new StringBuilder(); + boolean upperCase = false; + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + + boolean nextUpperCase = true; + + if (i < (s.length() - 1)) { + nextUpperCase = Character.isUpperCase(s.charAt(i + 1)); + } + + if ((i > 0) && Character.isUpperCase(c)) { + if (!upperCase || !nextUpperCase) { + sb.append(SEPARATOR); + } + upperCase = true; + } else { + upperCase = false; + } + + sb.append(Character.toLowerCase(c)); + } + + return sb.toString(); + } + + /** + * 获取ip地址 + */ + public static String getIp(HttpServletRequest request) { + String ip = request.getHeader("x-forwarded-for"); + if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getRemoteAddr(); + } + String comma = ","; + String localhost = "127.0.0.1"; + if (ip.contains(comma)) { + ip = ip.split(",")[0]; + } + if (localhost.equals(ip)) { + // 获取本机真正的ip地址 + try { + ip = InetAddress.getLocalHost().getHostAddress(); + } catch (UnknownHostException e) { + e.printStackTrace(); + } + } + return ip; + } + + /** + * 根据ip获取详细地址 + */ + public static String getCityInfo(String ip) { + String api = String.format(YshopConstant.Url.IP_URL,ip); + JSONObject object = JSONUtil.parseObj(HttpUtil.get(api)); + return object.get("addr", String.class); + } + + public static String getBrowser(HttpServletRequest request){ + UserAgent userAgent = UserAgent.parseUserAgentString(request.getHeader("User-Agent")); + Browser browser = userAgent.getBrowser(); + return browser.getName(); + } + + /** + * 获得当天是周几 + */ + public static String getWeekDay(){ + String[] weekDays = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; + Calendar cal = Calendar.getInstance(); + cal.setTime(new Date()); + + int w = cal.get(Calendar.DAY_OF_WEEK) - 1; + if (w < 0){ + w = 0; + } + return weekDays[w]; + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/ThrowableUtil.java b/yshop-common/src/main/java/co/yixiang/utils/ThrowableUtil.java new file mode 100644 index 0000000..f159c52 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/ThrowableUtil.java @@ -0,0 +1,42 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + +import co.yixiang.exception.BadRequestException; + +import javax.validation.ConstraintViolationException; +import java.io.PrintWriter; +import java.io.StringWriter; + +/** + * 异常工具 2019-01-06 + * @author Zheng Jie + */ +public class ThrowableUtil { + + /** + * 获取堆栈信息 + */ + public static String getStackTrace(Throwable throwable){ + StringWriter sw = new StringWriter(); + try (PrintWriter pw = new PrintWriter(sw)) { + throwable.printStackTrace(pw); + return sw.toString(); + } + } + + public static void throwForeignKeyException(Throwable e, String msg){ + Throwable t = e.getCause(); + while ((t != null) && !(t instanceof ConstraintViolationException)) { + t = t.getCause(); + } + if (t != null) { + throw new BadRequestException(msg); + } + assert false; + throw new BadRequestException("删除失败:" + t.getMessage()); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/TranslatorUtil.java b/yshop-common/src/main/java/co/yixiang/utils/TranslatorUtil.java new file mode 100644 index 0000000..514f7d3 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/TranslatorUtil.java @@ -0,0 +1,57 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + +import cn.hutool.json.JSONArray; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; + +/** + * @author Zheng Jie + * 翻译工具类 + */ +public class TranslatorUtil { + + public static String translate(String word){ + try { + String url = "https://translate.googleapis.com/translate_a/single?" + + "client=gtx&" + + "sl=en" + + "&tl=zh-CN" + + "&dt=t&q=" + URLEncoder.encode(word, "UTF-8"); + + URL obj = new URL(url); + HttpURLConnection con = (HttpURLConnection) obj.openConnection(); + con.setRequestProperty("User-Agent", "Mozilla/5.0"); + + BufferedReader in = new BufferedReader( + new InputStreamReader(con.getInputStream())); + String inputLine; + StringBuilder response = new StringBuilder(); + + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + in.close(); + return parseResult(response.toString()); + }catch (Exception e){ + return word; + } + } + + private static String parseResult(String inputJson){ + JSONArray jsonArray2 = (JSONArray) new JSONArray(inputJson).get(0); + StringBuilder result = new StringBuilder(); + for (Object o : jsonArray2) { + result.append(((JSONArray) o).get(0).toString()); + } + return result.toString(); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/TreeUtil.java b/yshop-common/src/main/java/co/yixiang/utils/TreeUtil.java new file mode 100644 index 0000000..2897085 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/TreeUtil.java @@ -0,0 +1,93 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + + +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * @ClassName TreeUtil + * @Author hupeng <610796224@qq.com> + * @Date 2019/10/22 + **/ +public class TreeUtil { + /** + * 获得指定节点下所有归档 + * @param list + * @param parentId + * @return + */ + public static List list2TreeConverter(List list, int parentId) { + List returnList = new ArrayList<>(); + + for (CateDTO res : list) { + //判断对象是否为根节点 + + if (res.getPid() == parentId) { + //该节点为根节点,开始递归 + + recursionFn(list, res); //通过递归为节点设置childList + + returnList.add(res); + } + } + + return returnList; + } + + /** + * 递归列表 + * 通过递归,给指定t节点设置childList + * @param list + * @param t + */ + public static void recursionFn(List list, CateDTO t) { + //只能获取当前t节点的子节点集,并不是所有子节点集 + List childsList = getChildList(list, t); + //设置他的子集对象集 + t.setChildren(childsList); + + //迭代子集对象集 + for (CateDTO nextChild : childsList) { //遍历完,则退出递归 + + //判断子集对象是否还有子节点 + if (!CollectionUtils.isEmpty(childsList)) { + //有下一个子节点,继续递归 + recursionFn(list, nextChild); + } + } + } + + /** + * 获得指定节点下的所有子节点 + * @param list + * @param t + * @return + */ + public static List getChildList(List list, CateDTO t) { + List childsList = new ArrayList(); + //遍历集合元素,如果元素的Parentid==指定元素的id,则说明是该元素的子节点 + for (CateDTO t1 : list) { + if (t1.getPid().equals(t.getId())) { + childsList.add(t1); + } + } + + return childsList; + } + + /** + * 判断是否还有下一个子节点 + * @param list + * @param t + */ + public static boolean hasChild(List list, CateDTO t) { + return getChildList(list, t).size() > 0 ? true : false; + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/ValidationUtil.java b/yshop-common/src/main/java/co/yixiang/utils/ValidationUtil.java new file mode 100644 index 0000000..c655c6b --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/ValidationUtil.java @@ -0,0 +1,35 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + +import cn.hutool.core.util.ObjectUtil; +import co.yixiang.exception.BadRequestException; +import org.hibernate.validator.internal.constraintvalidators.hv.EmailValidator; + +/** + * 验证工具 + * @author Zheng Jie + * @date 2018-11-23 + */ +public class ValidationUtil{ + + /** + * 验证空 + */ + public static void isNull(Object obj, String entity, String parameter , Object value){ + if(ObjectUtil.isNull(obj)){ + String msg = entity + " 不存在: "+ parameter +" is "+ value; + throw new BadRequestException(msg); + } + } + + /** + * 验证是否为邮箱 + */ + public static boolean isEmail(String email) { + return new EmailValidator().isValid(email, null); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/YshopConstant.java b/yshop-common/src/main/java/co/yixiang/utils/YshopConstant.java new file mode 100644 index 0000000..51b2b55 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/YshopConstant.java @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.utils; + +/** + * 常用静态常量 + * @author Zheng Jie + * @date 2018-12-26 + */ +public class YshopConstant { + + public static final String RESET_PASS = "重置密码"; + + public static final String RESET_MAIL = "重置邮箱"; + + /** + * 常用接口 + */ + public static class Url{ + //免费图床 + public static final String SM_MS_URL = "https://sm.ms/api"; + + // IP归属地查询 + public static final String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp?ip=%s&json=true"; + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/html/EscapeUtil.java b/yshop-common/src/main/java/co/yixiang/utils/html/EscapeUtil.java new file mode 100644 index 0000000..0d4986f --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/html/EscapeUtil.java @@ -0,0 +1,154 @@ +package co.yixiang.utils.html; + +import cn.hutool.core.util.StrUtil; + + +/** + * 转义和反转义工具类 + * @author hupeng + */ +public class EscapeUtil +{ + public static final String RE_HTML_MARK = "(<[^<]*?>)|(<[\\s]*?/[^<]*?>)|(<[^<]*?/[\\s]*?>)"; + + private static final char[][] TEXT = new char[64][]; + + static + { + for (int i = 0; i < 64; i++) + { + TEXT[i] = new char[] { (char) i }; + } + + // special HTML characters + TEXT['\''] = "'".toCharArray(); // 单引号 + TEXT['"'] = """.toCharArray(); // 单引号 + TEXT['&'] = "&".toCharArray(); // &符 + TEXT['<'] = "<".toCharArray(); // 小于号 + TEXT['>'] = ">".toCharArray(); // 大于号 + } + + /** + * 转义文本中的HTML字符为安全的字符 + * + * @param text 被转义的文本 + * @return 转义后的文本 + */ + public static String escape(String text) + { + return encode(text); + } + + /** + * 还原被转义的HTML特殊字符 + * + * @param content 包含转义符的HTML内容 + * @return 转换后的字符串 + */ + public static String unescape(String content) + { + return decode(content); + } + + /** + * 清除所有HTML标签,但是不删除标签内的内容 + * + * @param content 文本 + * @return 清除标签后的文本 + */ + public static String clean(String content) + { + return new HTMLFilter().filter(content); + } + + /** + * Escape编码 + * + * @param text 被编码的文本 + * @return 编码后的字符 + */ + private static String encode(String text) + { + int len; + if ((text == null) || ((len = text.length()) == 0)) + { + return StrUtil.EMPTY; + } + StringBuilder buffer = new StringBuilder(len + (len >> 2)); + char c; + for (int i = 0; i < len; i++) + { + c = text.charAt(i); + if (c < 64) + { + buffer.append(TEXT[c]); + } + else + { + buffer.append(c); + } + } + return buffer.toString(); + } + + /** + * Escape解码 + * + * @param content 被转义的内容 + * @return 解码后的字符串 + */ + public static String decode(String content) + { + if (StrUtil.isEmpty(content)) + { + return content; + } + + StringBuilder tmp = new StringBuilder(content.length()); + int lastPos = 0, pos = 0; + char ch; + while (lastPos < content.length()) + { + pos = content.indexOf("%", lastPos); + if (pos == lastPos) + { + if (content.charAt(pos + 1) == 'u') + { + ch = (char) Integer.parseInt(content.substring(pos + 2, pos + 6), 16); + tmp.append(ch); + lastPos = pos + 6; + } + else + { + ch = (char) Integer.parseInt(content.substring(pos + 1, pos + 3), 16); + tmp.append(ch); + lastPos = pos + 3; + } + } + else + { + if (pos == -1) + { + tmp.append(content.substring(lastPos)); + lastPos = content.length(); + } + else + { + tmp.append(content.substring(lastPos, pos)); + lastPos = pos; + } + } + } + return tmp.toString(); + } + + public static void main(String[] args) + { + String html = ""; + // String html = "ipt>alert(\"XSS\")ipt>"; + // String html = "<123"; + System.out.println(EscapeUtil.clean(html)); + System.out.println(EscapeUtil.escape(html)); + System.out.println(EscapeUtil.unescape(html)); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/html/HTMLFilter.java b/yshop-common/src/main/java/co/yixiang/utils/html/HTMLFilter.java new file mode 100644 index 0000000..1f3be19 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/html/HTMLFilter.java @@ -0,0 +1,570 @@ +package co.yixiang.utils.html; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * HTML过滤器,用于去除XSS漏洞隐患。 + * + * @author hupeng + */ +public final class HTMLFilter +{ + /** + * regex flag union representing /si modifiers in php + **/ + private static final int REGEX_FLAGS_SI = Pattern.CASE_INSENSITIVE | Pattern.DOTALL; + private static final Pattern P_COMMENTS = Pattern.compile("", Pattern.DOTALL); + private static final Pattern P_COMMENT = Pattern.compile("^!--(.*)--$", REGEX_FLAGS_SI); + private static final Pattern P_TAGS = Pattern.compile("<(.*?)>", Pattern.DOTALL); + private static final Pattern P_END_TAG = Pattern.compile("^/([a-z0-9]+)", REGEX_FLAGS_SI); + private static final Pattern P_START_TAG = Pattern.compile("^([a-z0-9]+)(.*?)(/?)$", REGEX_FLAGS_SI); + private static final Pattern P_QUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)=([\"'])(.*?)\\2", REGEX_FLAGS_SI); + private static final Pattern P_UNQUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)(=)([^\"\\s']+)", REGEX_FLAGS_SI); + private static final Pattern P_PROTOCOL = Pattern.compile("^([^:]+):", REGEX_FLAGS_SI); + private static final Pattern P_ENTITY = Pattern.compile("&#(\\d+);?"); + private static final Pattern P_ENTITY_UNICODE = Pattern.compile("&#x([0-9a-f]+);?"); + private static final Pattern P_ENCODE = Pattern.compile("%([0-9a-f]{2});?"); + private static final Pattern P_VALID_ENTITIES = Pattern.compile("&([^&;]*)(?=(;|&|$))"); + private static final Pattern P_VALID_QUOTES = Pattern.compile("(>|^)([^<]+?)(<|$)", Pattern.DOTALL); + private static final Pattern P_END_ARROW = Pattern.compile("^>"); + // private static final Pattern P_BODY_TO_END = Pattern.compile("<([^>]*?)(?=<|$)"); + private static final Pattern P_XML_CONTENT = Pattern.compile("(^|>)([^<]*?)(?=>)"); + private static final Pattern P_STRAY_LEFT_ARROW = Pattern.compile("<([^>]*?)(?=<|$)"); + private static final Pattern P_STRAY_RIGHT_ARROW = Pattern.compile("(^|>)([^<]*?)(?=>)"); + private static final Pattern P_AMP = Pattern.compile("&"); + private static final Pattern P_QUOTE = Pattern.compile("\""); + private static final Pattern P_LEFT_ARROW = Pattern.compile("<"); + private static final Pattern P_RIGHT_ARROW = Pattern.compile(">"); + private static final Pattern P_BOTH_ARROWS = Pattern.compile("<>"); + + // @xxx could grow large... maybe use sesat's ReferenceMap + private static final ConcurrentMap P_REMOVE_PAIR_BLANKS = new ConcurrentHashMap<>(); + private static final ConcurrentMap P_REMOVE_SELF_BLANKS = new ConcurrentHashMap<>(); + + /** + * set of allowed html elements, along with allowed attributes for each element + **/ + private final Map> vAllowed; + /** + * counts of open tags for each (allowable) html element + **/ + private final Map vTagCounts = new HashMap<>(); + + /** + * html elements which must always be self-closing (e.g. "") + **/ + private final String[] vSelfClosingTags; + /** + * html elements which must always have separate opening and closing tags (e.g. "") + **/ + private final String[] vNeedClosingTags; + /** + * set of disallowed html elements + **/ + private final String[] vDisallowed; + /** + * attributes which should be checked for valid protocols + **/ + private final String[] vProtocolAtts; + /** + * allowed protocols + **/ + private final String[] vAllowedProtocols; + /** + * tags which should be removed if they contain no content (e.g. "" or "") + **/ + private final String[] vRemoveBlanks; + /** + * entities allowed within html markup + **/ + private final String[] vAllowedEntities; + /** + * flag determining whether comments are allowed in input String. + */ + private final boolean stripComment; + private final boolean encodeQuotes; + /** + * flag determining whether to try to make tags when presented with "unbalanced" angle brackets (e.g. "" + * becomes " text "). If set to false, unbalanced angle brackets will be html escaped. + */ + private final boolean alwaysMakeTags; + + /** + * Default constructor. + */ + public HTMLFilter() + { + vAllowed = new HashMap<>(); + + final ArrayList a_atts = new ArrayList<>(); + a_atts.add("href"); + a_atts.add("target"); + vAllowed.put("a", a_atts); + + final ArrayList img_atts = new ArrayList<>(); + img_atts.add("src"); + img_atts.add("width"); + img_atts.add("height"); + img_atts.add("alt"); + vAllowed.put("img", img_atts); + + final ArrayList no_atts = new ArrayList<>(); + vAllowed.put("b", no_atts); + vAllowed.put("strong", no_atts); + vAllowed.put("i", no_atts); + vAllowed.put("em", no_atts); + + vSelfClosingTags = new String[] { "img" }; + vNeedClosingTags = new String[] { "a", "b", "strong", "i", "em" }; + vDisallowed = new String[] {}; + vAllowedProtocols = new String[] { "http", "mailto", "https" }; // no ftp. + vProtocolAtts = new String[] { "src", "href" }; + vRemoveBlanks = new String[] { "a", "b", "strong", "i", "em" }; + vAllowedEntities = new String[] { "amp", "gt", "lt", "quot" }; + stripComment = true; + encodeQuotes = true; + alwaysMakeTags = true; + } + + /** + * Map-parameter configurable constructor. + * + * @param conf map containing configuration. keys match field names. + */ + @SuppressWarnings("unchecked") + public HTMLFilter(final Map conf) + { + + assert conf.containsKey("vAllowed") : "configuration requires vAllowed"; + assert conf.containsKey("vSelfClosingTags") : "configuration requires vSelfClosingTags"; + assert conf.containsKey("vNeedClosingTags") : "configuration requires vNeedClosingTags"; + assert conf.containsKey("vDisallowed") : "configuration requires vDisallowed"; + assert conf.containsKey("vAllowedProtocols") : "configuration requires vAllowedProtocols"; + assert conf.containsKey("vProtocolAtts") : "configuration requires vProtocolAtts"; + assert conf.containsKey("vRemoveBlanks") : "configuration requires vRemoveBlanks"; + assert conf.containsKey("vAllowedEntities") : "configuration requires vAllowedEntities"; + + vAllowed = Collections.unmodifiableMap((HashMap>) conf.get("vAllowed")); + vSelfClosingTags = (String[]) conf.get("vSelfClosingTags"); + vNeedClosingTags = (String[]) conf.get("vNeedClosingTags"); + vDisallowed = (String[]) conf.get("vDisallowed"); + vAllowedProtocols = (String[]) conf.get("vAllowedProtocols"); + vProtocolAtts = (String[]) conf.get("vProtocolAtts"); + vRemoveBlanks = (String[]) conf.get("vRemoveBlanks"); + vAllowedEntities = (String[]) conf.get("vAllowedEntities"); + stripComment = conf.containsKey("stripComment") ? (Boolean) conf.get("stripComment") : true; + encodeQuotes = conf.containsKey("encodeQuotes") ? (Boolean) conf.get("encodeQuotes") : true; + alwaysMakeTags = conf.containsKey("alwaysMakeTags") ? (Boolean) conf.get("alwaysMakeTags") : true; + } + + private void reset() + { + vTagCounts.clear(); + } + + // --------------------------------------------------------------- + // my versions of some PHP library functions + public static String chr(final int decimal) + { + return String.valueOf((char) decimal); + } + + public static String htmlSpecialChars(final String s) + { + String result = s; + result = regexReplace(P_AMP, "&", result); + result = regexReplace(P_QUOTE, """, result); + result = regexReplace(P_LEFT_ARROW, "<", result); + result = regexReplace(P_RIGHT_ARROW, ">", result); + return result; + } + + // --------------------------------------------------------------- + + /** + * given a user submitted input String, filter out any invalid or restricted html. + * + * @param input text (i.e. submitted by a user) than may contain html + * @return "clean" version of input, with only valid, whitelisted html elements allowed + */ + public String filter(final String input) + { + reset(); + String s = input; + + s = escapeComments(s); + + s = balanceHTML(s); + + s = checkTags(s); + + s = processRemoveBlanks(s); + + s = validateEntities(s); + + return s; + } + + public boolean isAlwaysMakeTags() + { + return alwaysMakeTags; + } + + public boolean isStripComments() + { + return stripComment; + } + + private String escapeComments(final String s) + { + final Matcher m = P_COMMENTS.matcher(s); + final StringBuffer buf = new StringBuffer(); + if (m.find()) + { + final String match = m.group(1); // (.*?) + m.appendReplacement(buf, Matcher.quoteReplacement("")); + } + m.appendTail(buf); + + return buf.toString(); + } + + private String balanceHTML(String s) + { + if (alwaysMakeTags) + { + // + // try and form html + // + s = regexReplace(P_END_ARROW, "", s); + // 不追加结束标签 + // s = regexReplace(P_BODY_TO_END, "<$1>", s); + s = regexReplace(P_XML_CONTENT, "$1<$2", s); + + } + else + { + // + // escape stray brackets + // + s = regexReplace(P_STRAY_LEFT_ARROW, "<$1", s); + s = regexReplace(P_STRAY_RIGHT_ARROW, "$1$2><", s); + + // + // the last regexp causes '<>' entities to appear + // (we need to do a lookahead assertion so that the last bracket can + // be used in the next pass of the regexp) + // + s = regexReplace(P_BOTH_ARROWS, "", s); + } + + return s; + } + + private String checkTags(String s) + { + Matcher m = P_TAGS.matcher(s); + + final StringBuffer buf = new StringBuffer(); + while (m.find()) + { + String replaceStr = m.group(1); + replaceStr = processTag(replaceStr); + m.appendReplacement(buf, Matcher.quoteReplacement(replaceStr)); + } + m.appendTail(buf); + + // these get tallied in processTag + // (remember to reset before subsequent calls to filter method) + final StringBuilder sBuilder = new StringBuilder(buf.toString()); + for (String key : vTagCounts.keySet()) + { + for (int ii = 0; ii < vTagCounts.get(key); ii++) + { + sBuilder.append(""); + } + } + s = sBuilder.toString(); + + return s; + } + + private String processRemoveBlanks(final String s) + { + String result = s; + for (String tag : vRemoveBlanks) + { + if (!P_REMOVE_PAIR_BLANKS.containsKey(tag)) + { + P_REMOVE_PAIR_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?>")); + } + result = regexReplace(P_REMOVE_PAIR_BLANKS.get(tag), "", result); + if (!P_REMOVE_SELF_BLANKS.containsKey(tag)) + { + P_REMOVE_SELF_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?/>")); + } + result = regexReplace(P_REMOVE_SELF_BLANKS.get(tag), "", result); + } + + return result; + } + + private static String regexReplace(final Pattern regex_pattern, final String replacement, final String s) + { + Matcher m = regex_pattern.matcher(s); + return m.replaceAll(replacement); + } + + private String processTag(final String s) + { + // ending tags + Matcher m = P_END_TAG.matcher(s); + if (m.find()) + { + final String name = m.group(1).toLowerCase(); + if (allowed(name)) + { + if (false == inArray(name, vSelfClosingTags)) + { + if (vTagCounts.containsKey(name)) + { + vTagCounts.put(name, vTagCounts.get(name) - 1); + return ""; + } + } + } + } + + // starting tags + m = P_START_TAG.matcher(s); + if (m.find()) + { + final String name = m.group(1).toLowerCase(); + final String body = m.group(2); + String ending = m.group(3); + + // debug( "in a starting tag, name='" + name + "'; body='" + body + "'; ending='" + ending + "'" ); + if (allowed(name)) + { + final StringBuilder params = new StringBuilder(); + + final Matcher m2 = P_QUOTED_ATTRIBUTES.matcher(body); + final Matcher m3 = P_UNQUOTED_ATTRIBUTES.matcher(body); + final List paramNames = new ArrayList<>(); + final List paramValues = new ArrayList<>(); + while (m2.find()) + { + paramNames.add(m2.group(1)); // ([a-z0-9]+) + paramValues.add(m2.group(3)); // (.*?) + } + while (m3.find()) + { + paramNames.add(m3.group(1)); // ([a-z0-9]+) + paramValues.add(m3.group(3)); // ([^\"\\s']+) + } + + String paramName, paramValue; + for (int ii = 0; ii < paramNames.size(); ii++) + { + paramName = paramNames.get(ii).toLowerCase(); + paramValue = paramValues.get(ii); + + // debug( "paramName='" + paramName + "'" ); + // debug( "paramValue='" + paramValue + "'" ); + // debug( "allowed? " + vAllowed.get( name ).contains( paramName ) ); + + if (allowedAttribute(name, paramName)) + { + if (inArray(paramName, vProtocolAtts)) + { + paramValue = processParamProtocol(paramValue); + } + params.append(' ').append(paramName).append("=\"").append(paramValue).append("\""); + } + } + + if (inArray(name, vSelfClosingTags)) + { + ending = " /"; + } + + if (inArray(name, vNeedClosingTags)) + { + ending = ""; + } + + if (ending == null || ending.length() < 1) + { + if (vTagCounts.containsKey(name)) + { + vTagCounts.put(name, vTagCounts.get(name) + 1); + } + else + { + vTagCounts.put(name, 1); + } + } + else + { + ending = " /"; + } + return "<" + name + params + ending + ">"; + } + else + { + return ""; + } + } + + // comments + m = P_COMMENT.matcher(s); + if (!stripComment && m.find()) + { + return "<" + m.group() + ">"; + } + + return ""; + } + + private String processParamProtocol(String s) + { + s = decodeEntities(s); + final Matcher m = P_PROTOCOL.matcher(s); + if (m.find()) + { + final String protocol = m.group(1); + if (!inArray(protocol, vAllowedProtocols)) + { + // bad protocol, turn into local anchor link instead + s = "#" + s.substring(protocol.length() + 1); + if (s.startsWith("#//")) + { + s = "#" + s.substring(3); + } + } + } + + return s; + } + + private String decodeEntities(String s) + { + StringBuffer buf = new StringBuffer(); + + Matcher m = P_ENTITY.matcher(s); + while (m.find()) + { + final String match = m.group(1); + final int decimal = Integer.decode(match).intValue(); + m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); + } + m.appendTail(buf); + s = buf.toString(); + + buf = new StringBuffer(); + m = P_ENTITY_UNICODE.matcher(s); + while (m.find()) + { + final String match = m.group(1); + final int decimal = Integer.valueOf(match, 16).intValue(); + m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); + } + m.appendTail(buf); + s = buf.toString(); + + buf = new StringBuffer(); + m = P_ENCODE.matcher(s); + while (m.find()) + { + final String match = m.group(1); + final int decimal = Integer.valueOf(match, 16).intValue(); + m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); + } + m.appendTail(buf); + s = buf.toString(); + + s = validateEntities(s); + return s; + } + + private String validateEntities(final String s) + { + StringBuffer buf = new StringBuffer(); + + // validate entities throughout the string + Matcher m = P_VALID_ENTITIES.matcher(s); + while (m.find()) + { + final String one = m.group(1); // ([^&;]*) + final String two = m.group(2); // (?=(;|&|$)) + m.appendReplacement(buf, Matcher.quoteReplacement(checkEntity(one, two))); + } + m.appendTail(buf); + + return encodeQuotes(buf.toString()); + } + + private String encodeQuotes(final String s) + { + if (encodeQuotes) + { + StringBuffer buf = new StringBuffer(); + Matcher m = P_VALID_QUOTES.matcher(s); + while (m.find()) + { + final String one = m.group(1); // (>|^) + final String two = m.group(2); // ([^<]+?) + final String three = m.group(3); // (<|$) + // 不替换双引号为",防止json格式无效 regexReplace(P_QUOTE, """, two) + m.appendReplacement(buf, Matcher.quoteReplacement(one + two + three)); + } + m.appendTail(buf); + return buf.toString(); + } + else + { + return s; + } + } + + private String checkEntity(final String preamble, final String term) + { + + return ";".equals(term) && isValidEntity(preamble) ? '&' + preamble : "&" + preamble; + } + + private boolean isValidEntity(final String entity) + { + return inArray(entity, vAllowedEntities); + } + + private static boolean inArray(final String s, final String[] array) + { + for (String item : array) + { + if (item != null && item.equals(s)) + { + return true; + } + } + return false; + } + + private boolean allowed(final String name) + { + return (vAllowed.isEmpty() || vAllowed.containsKey(name)) && !inArray(name, vDisallowed); + } + + private boolean allowedAttribute(final String name, final String paramName) + { + return allowed(name) && (vAllowed.isEmpty() || vAllowed.get(name).contains(paramName)); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/location/GetTencentLocationVO.java b/yshop-common/src/main/java/co/yixiang/utils/location/GetTencentLocationVO.java new file mode 100644 index 0000000..ce24910 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/location/GetTencentLocationVO.java @@ -0,0 +1,114 @@ +package co.yixiang.utils.location; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author :LionCity + * @date :Created in 2020-09-10 11:39 + * @description: + * @modified By: + * @version: + */ +@SuppressWarnings("ALL") +@Data +@ApiModel(value="腾讯地图返回对象") +public class GetTencentLocationVO implements Serializable { + + /** + * result : {"level":2,"similarity":0.8,"ad_info":{"adcode":"441302"},"reliability":1,"location":{"lng":114.38257,"lat":23.08464},"deviation":1000,"title":"惠城区","address_components":{"province":"广东省","city":"惠州市","street":"","district":"惠城区","street_number":""}} + * message : query ok + * status : 0 + */ + @ApiModelProperty(value = "地址解析结果") + private ResultBean result; + @ApiModelProperty(value = "状态说明") + private String message; + @ApiModelProperty(value = "状态码,0为正常") + private Integer status; + + @Data + @ApiModel(value="地址解析结果") + public static class ResultBean { + /** + * level : 2 + * similarity : 0.8 + * ad_info : {"adcode":"441302"} + * reliability : 1 + * location : {"lng":114.38257,"lat":23.08464} + * deviation : 1000 + * title : 惠城区 + * address_components : {"province":"广东省","city":"惠州市","street":"","district":"惠城区","street_number":""} + */ + + @ApiModelProperty(value = "解析到的坐标") + private LocationBean location; + @ApiModelProperty(value = "解析精度级别,分为11个级别,一般>=9即可采用(定位到点,精度较高) 也可根据实际业务需求自行调整") + private int level; + @ApiModelProperty(value = "即将下线,由reliability代替") + private double similarity; + + @ApiModelProperty(value = "行政区划信息") + private AdInfoBean ad_info; + @ApiModelProperty(value = "可信度参考") + private int reliability; + @ApiModelProperty(value = "即将下线,由level代替") + private int deviation; + @ApiModelProperty(value = "区信息") + private String title; + @ApiModelProperty(value = "行政区划信息") + private AddressComponentsBean address_components; + + + @Data + @ApiModel(value="行政区划信息") + public static class AdInfoBean { + /** + * adcode : 441302 + */ + @ApiModelProperty(value = "行政区划代码") + private String adcode; + + } + @Data + @ApiModel(value="解析到的坐标") + public static class LocationBean { + /** + * lng : 114.38257 + * lat : 23.08464 + */ + + @ApiModelProperty(value = "经度") + private double lng; + + @ApiModelProperty(value = "纬度") + private double lat; + + + } + @Data + @ApiModel(value="解析后的地址部件") + public static class AddressComponentsBean { + /** + * province : 广东省 + * city : 惠州市 + * street : + * district : 惠城区 + * street_number : + */ + @ApiModelProperty(value = "省") + private String province; + @ApiModelProperty(value = "市") + private String city; + @ApiModelProperty(value = "街道,可能为空字串") + private String street; + @ApiModelProperty(value = "区,可能为空字串") + private String district; + @ApiModelProperty(value = "门牌,可能为空字串") + private String street_number; + } + } +} diff --git a/yshop-common/src/main/java/co/yixiang/utils/location/LocationUtils.java b/yshop-common/src/main/java/co/yixiang/utils/location/LocationUtils.java new file mode 100644 index 0000000..1657508 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/utils/location/LocationUtils.java @@ -0,0 +1,68 @@ +package co.yixiang.utils.location; + +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpUtil; +import co.yixiang.exception.BadRequestException; +import co.yixiang.utils.RedisUtil; +import co.yixiang.utils.ShopKeyUtils; +import com.alibaba.fastjson.JSONObject; + +/** + * 具体查看 https://lbs.qq.com/service/webService/webServiceGuide/webServiceGeocoder + * @author :LionCity + * @date :Created in 2020-09-10 11:46 + * @description: + * @modified By: + * @version: + */ +public class LocationUtils { + + private static double EARTH_RADIUS = 6378.137; + + private static double rad(double d) { + return d * Math.PI / 180.0; + } + + /** + * 腾讯地图地址解析 + */ + private static final String QQ_MAP_URL = "https://apis.map.qq.com/ws/geocoder/v1/"; + + + /** + * 通过经纬度获取距离(单位:千米) + * + * @param lat1 + * @param lng1 + * @param lat2 + * @param lng2 + * @return + */ + public static double getDistance(double lat1, double lng1, double lat2, + double lng2) { + double radLat1 = rad(lat1); + double radLat2 = rad(lat2); + double a = radLat1 - radLat2; + double b = rad(lng1) - rad(lng2); + double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + + Math.cos(radLat1) * Math.cos(radLat2) + * Math.pow(Math.sin(b / 2), 2))); + s = s * EARTH_RADIUS; + s = Math.round(s * 10000d) / 10000d; + //s = s*1000; + return NumberUtil.round(s, 2).doubleValue(); + //return s; + } + + + public static GetTencentLocationVO getLocation(String addr) { + String key = RedisUtil.get(ShopKeyUtils.getTengXunMapKey()); + if (StrUtil.isBlank(key)) { + throw new BadRequestException("请先配置腾讯地图key"); + } + String url = StrUtil.format("?address={}&key={}", addr, key); + String json = HttpUtil.get(QQ_MAP_URL + url); + return JSONObject.parseObject(json, GetTencentLocationVO.class); + } +} diff --git a/yshop-common/src/main/java/co/yixiang/xss/XssFilter.java b/yshop-common/src/main/java/co/yixiang/xss/XssFilter.java new file mode 100644 index 0000000..35a56a7 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/xss/XssFilter.java @@ -0,0 +1,98 @@ +package co.yixiang.xss; + +import cn.hutool.core.util.StrUtil; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * 防止XSS攻击的过滤器 + * + * @author ruoyi + */ +public class XssFilter implements Filter +{ + /** + * 排除链接 + */ + public List excludes = new ArrayList<>(); + + /** + * xss过滤开关 + */ + public boolean enabled = false; + + @Override + public void init(FilterConfig filterConfig) throws ServletException + { + String tempExcludes = filterConfig.getInitParameter("excludes"); + String tempEnabled = filterConfig.getInitParameter("enabled"); + if (StrUtil.isNotEmpty(tempExcludes)) + { + String[] url = tempExcludes.split(","); + for (int i = 0; url != null && i < url.length; i++) + { + excludes.add(url[i]); + } + } + if (StrUtil.isNotEmpty(tempEnabled)) + { + enabled = Boolean.valueOf(tempEnabled); + } + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException + { + HttpServletRequest req = (HttpServletRequest) request; + HttpServletResponse resp = (HttpServletResponse) response; + if (handleExcludeURL(req, resp)) + { + chain.doFilter(request, response); + return; + } + XssHttpServletRequestWrapper xssRequest = new XssHttpServletRequestWrapper((HttpServletRequest) request); + chain.doFilter(xssRequest, response); + } + + private boolean handleExcludeURL(HttpServletRequest request, HttpServletResponse response) + { + if (!enabled) + { + return true; + } + if (excludes == null || excludes.isEmpty()) + { + return false; + } + String url = request.getServletPath(); + for (String pattern : excludes) + { + Pattern p = Pattern.compile("^" + pattern); + Matcher m = p.matcher(url); + if (m.find()) + { + return true; + } + } + return false; + } + + @Override + public void destroy() + { + + } +} diff --git a/yshop-common/src/main/java/co/yixiang/xss/XssHttpServletRequestWrapper.java b/yshop-common/src/main/java/co/yixiang/xss/XssHttpServletRequestWrapper.java new file mode 100644 index 0000000..e1062c5 --- /dev/null +++ b/yshop-common/src/main/java/co/yixiang/xss/XssHttpServletRequestWrapper.java @@ -0,0 +1,42 @@ +package co.yixiang.xss; + + + +import co.yixiang.utils.html.EscapeUtil; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; + +/** + * XSS过滤处理 + * + * @author ruoyi + */ +public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper +{ + /** + * @param request + */ + public XssHttpServletRequestWrapper(HttpServletRequest request) + { + super(request); + } + + @Override + public String[] getParameterValues(String name) + { + String[] values = super.getParameterValues(name); + if (values != null) + { + int length = values.length; + String[] escapseValues = new String[length]; + for (int i = 0; i < length; i++) + { + // 防xss攻击和过滤前后空格 + escapseValues[i] = EscapeUtil.clean(values[i]).trim(); + } + return escapseValues; + } + return super.getParameterValues(name); + } +} \ No newline at end of file diff --git a/yshop-common/src/main/java/com/github/xiaoymin/knife4j/spring/util/ArrayRefProperty.java b/yshop-common/src/main/java/com/github/xiaoymin/knife4j/spring/util/ArrayRefProperty.java new file mode 100644 index 0000000..434f63d --- /dev/null +++ b/yshop-common/src/main/java/com/github/xiaoymin/knife4j/spring/util/ArrayRefProperty.java @@ -0,0 +1,30 @@ +package com.github.xiaoymin.knife4j.spring.util; +import io.swagger.models.properties.ArrayProperty; +import io.swagger.models.properties.RefProperty; +import io.swagger.models.refs.GenericRef; +import io.swagger.models.refs.RefType; + +/** + * @author :LionCity + * @date :Created in 2019/9/24 17:17 + * @description: 同时拥有ArrayProperty和RefProperty的特性 + * @modified By: + * @version: + */ +public class ArrayRefProperty extends ArrayProperty { + private GenericRef genericRef; + + public String get$ref() { + return genericRef.getRef(); + } + + public void set$ref(String ref) { + this.genericRef = new GenericRef(RefType.DEFINITION, ref); + + // $ref + RefProperty items = new RefProperty(); + items.setType(ref); + items.set$ref(ref); + this.items(items); + } +} diff --git a/yshop-common/src/main/java/com/github/xiaoymin/knife4j/spring/util/SwaggerUtil.java b/yshop-common/src/main/java/com/github/xiaoymin/knife4j/spring/util/SwaggerUtil.java new file mode 100644 index 0000000..caf8c74 --- /dev/null +++ b/yshop-common/src/main/java/com/github/xiaoymin/knife4j/spring/util/SwaggerUtil.java @@ -0,0 +1,255 @@ +package com.github.xiaoymin.knife4j.spring.util; + +import io.swagger.models.Model; +import io.swagger.models.properties.AbstractProperty; +import io.swagger.models.properties.ArrayProperty; +import io.swagger.models.properties.BooleanProperty; +import io.swagger.models.properties.DateTimeProperty; +import io.swagger.models.properties.IntegerProperty; +import io.swagger.models.properties.LongProperty; +import io.swagger.models.properties.ObjectProperty; +import io.swagger.models.properties.Property; +import io.swagger.models.properties.PropertyBuilder; +import io.swagger.models.properties.PropertyBuilder.PropertyId; +import io.swagger.models.properties.RefProperty; +import io.swagger.models.properties.StringProperty; +import org.springframework.beans.BeanUtils; + +import java.util.HashMap; +import java.util.Map; + +/** + * + * @author LionCitys + * @modified By: + * @version: 1.0 + * @date 2020/01/07 + */ +public class SwaggerUtil { + + /** + * 判断是否Swagger基本类型 + * + * @param type 类型 + * @return boolean + */ + private static boolean isBaseType(String type) { + return SwaggerUtil.getSwaggerProperty(type) != null; + } + + /** + * 获取Swagger支持的类型 + * + * @return {@link Map} + */ + private static Map getPropMap() { + Map map = new HashMap<>(8); + map.put("integer", new IntegerProperty()); + map.put("int", new IntegerProperty()); + map.put("long", new LongProperty()); + map.put("string", new StringProperty()); + map.put("object", new ObjectProperty()); + map.put("array", new ArrayProperty()); + map.put("boolean", new BooleanProperty()); + map.put("date", new DateTimeProperty()); + return map; + } + + /** + * 通过java类型获取Swagger类型 + * @param type javaType + * @return swaggerType + */ + private static AbstractProperty getSwaggerProperty(String type) { + type = type.toLowerCase(); + return SwaggerUtil.getPropMap().get(type); + } + + private static boolean isMap(String type) { + type = type.toLowerCase(); + return type.startsWith("map"); + } + + private static boolean isIterable(String type) { + type = type.toLowerCase(); + return type.startsWith("list") || type.startsWith("set"); + } + + /** + * 获取非基本类型的T
+ * new String[] { "A>", "A", "A>>>" } + * + * @param type 类型 + * @return C1, C2, C3, C4 + */ + public static String getRef(String type) { + try { + String m = type.substring(type.lastIndexOf("«") + 1, type.indexOf("»")); + String[] cc = m.split(","); + for (String c : cc) { + if (!SwaggerUtil.isBaseType(c)) { + return c; + } + } + return type; + } catch (Exception ignored) { + + } + return "!!Unknown T!!"; + } + + /** + * 获取对象类型,主要是剥离第一层<> + * @param type JsonResult>>> + * @return Map>> + */ + public static String getRealType(String type) { + try { + return type.substring(type.indexOf("«") + 1, type.lastIndexOf("»")); + } catch (Exception ignored) { + + } + return type; + } + + /** + * 判断是否存在非基本类型<参照类型> + * + * @param type 类型 + * @return boolean + */ + private static boolean hasRef(String type) { + if (type.indexOf("»") > 0) { + try { + String m = type.substring(type.lastIndexOf("«") + 1, type.indexOf("»")); + String[] cc = m.split(","); + for (String c : cc) { + if (!SwaggerUtil.isBaseType(c)) { + return true; + } + } + return false; + } catch (Exception e) { + return false; + } + } else { + return !SwaggerUtil.isBaseType(type); + } + } + + /** + * 递归处理泛型类型
+ * JsonResult, List>>> + * + * @param dataProp 数据支撑 + * @param type 类型 + * @param definitions 定义 + * @return {@link Property} + */ + public static Property getNewProp(Property dataProp, String type, Map definitions) { + Property newProp = null; + Model model = definitions.get(type); + Map props = null; + if (null != model) { + props = model.getProperties(); + } + if (null == props) { + props = new HashMap<>(2); + } + String realType = SwaggerUtil.getRealType(type); + if (SwaggerUtil.isMap(type)) { + String[] realTypes = SwaggerUtil.splitByComma(realType); + + Map argsK = new HashMap<>(2); + argsK.put(PropertyId.DESCRIPTION, "Map的键"); + argsK.put(PropertyId.TYPE, realTypes[0].toLowerCase()); + AbstractProperty prop0 = SwaggerUtil.getSwaggerProperty(realTypes[0]); + Property propK = PropertyBuilder.build(null == prop0 ? "object" : prop0.getType(), + null == prop0 ? null : prop0.getFormat(), argsK); + propK.setName("key"); + + Map argsV = new HashMap<>(2); + argsV.put(PropertyId.DESCRIPTION, "Map的值"); + argsV.put(PropertyId.TYPE, realTypes[1].toLowerCase()); + AbstractProperty prop1 = SwaggerUtil.getSwaggerProperty(realTypes[1]); + Property propV = PropertyBuilder.build(null == prop1 ? "object" : prop1.getType(), + null == prop1 ? null : prop1.getFormat(), argsV); + propV.setName("value"); + + if (!realType.equals(type)) { + propK = SwaggerUtil.getNewProp(propK, realTypes[0], definitions); + propV = SwaggerUtil.getNewProp(propV, realTypes[1], definitions); + } + + props.put(propK.getName(), propK); + props.put(propV.getName(), propV); + + newProp = new RefProperty(); + BeanUtils.copyProperties(dataProp, newProp); + ((RefProperty) newProp).set$ref(type); + } else if (SwaggerUtil.isIterable(type)) { + String ref = SwaggerUtil.getRealType(type); + newProp = new ArrayRefProperty(); + BeanUtils.copyProperties(dataProp, newProp); + ((ArrayRefProperty) newProp).set$ref(ref); + ((ArrayRefProperty) newProp).setType(ArrayRefProperty.TYPE); + if (!realType.equals(type)) { + SwaggerUtil.getNewProp(dataProp, realType, definitions); + } + } else if (SwaggerUtil.isBaseType(type)) { + Map args = new HashMap<>(2); + args.put(PropertyId.DESCRIPTION, dataProp.getDescription()); + args.put(PropertyId.TYPE, type.toLowerCase()); + AbstractProperty prop = SwaggerUtil.getSwaggerProperty(type); + newProp = PropertyBuilder.build(prop.getType(), prop.getFormat(), args); + newProp.setName(dataProp.getName()); + } else if (SwaggerUtil.hasRef(type)) { + newProp = new RefProperty(); + BeanUtils.copyProperties(dataProp, newProp); + ((RefProperty) newProp).set$ref(type); + } + if (null != model) { + model.setProperties(props); + } + + return newProp; + } + + private static String[] splitByComma(String str) { + int index = 0; + int has = 0; + for (int i = 0; i < str.length(); i++) { + char c = str.charAt(i); + if ("«".equals(c + "")) { + has++; + } + if ("»".equals(c + "")) { + has--; + } + if (",".equals(c + "") && has == 0) { + index = i; + } + } + + String[] arr = new String[2]; + arr[0] = str.substring(0, index); + arr[1] = str.substring(index + 1); + return arr; + } + + public static void main(String[] args) { + String[] ss = new String[] { "A«List«C1»»", "A«C2»", "A«B«String,«String,List«C4»»»»" }; + for (String s : ss) { + String c = SwaggerUtil.getRealType(s); + System.out.println(c); + } + + String[] s2 = new String[] { "A,B«List«C1»»", "Map«A,B»,C«List«D»»", + "Map«Map«A,B»,C«List«D»»,Map«A,B»,C«List«D»»»,C«List«D»»" }; + for (String s : s2) { + String[] arr = SwaggerUtil.splitByComma(s); + System.out.println(arr[0]); + System.out.println(arr[1]); + } + } +} diff --git a/yshop-common/src/main/java/com/github/xiaoymin/knife4j/spring/web/Knife4jController.java b/yshop-common/src/main/java/com/github/xiaoymin/knife4j/spring/web/Knife4jController.java new file mode 100644 index 0000000..cf15c39 --- /dev/null +++ b/yshop-common/src/main/java/com/github/xiaoymin/knife4j/spring/web/Knife4jController.java @@ -0,0 +1,426 @@ +package com.github.xiaoymin.knife4j.spring.web; + +import com.github.xiaoymin.knife4j.annotations.ApiOperationSort; +import com.github.xiaoymin.knife4j.annotations.ApiSort; +import com.github.xiaoymin.knife4j.spring.common.SwaggerBootstrapUiHostNameProvider; +import com.github.xiaoymin.knife4j.spring.model.MarkdownFiles; +import com.github.xiaoymin.knife4j.spring.model.RestHandlerMapping; +import com.github.xiaoymin.knife4j.spring.model.SwaggerBootstrapUi; +import com.github.xiaoymin.knife4j.spring.model.SwaggerBootstrapUiPath; +import com.github.xiaoymin.knife4j.spring.model.SwaggerBootstrapUiTag; +import com.github.xiaoymin.knife4j.spring.model.SwaggerExt; +import com.github.xiaoymin.knife4j.spring.util.SwaggerUtil; +import com.google.common.base.Function; +import com.google.common.base.Strings; +import com.google.common.collect.FluentIterable; +import com.google.common.collect.Lists; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.models.Model; +import io.swagger.models.Swagger; +import io.swagger.models.properties.Property; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.BeanFactoryUtils; +import org.springframework.beans.factory.ObjectProvider; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.util.ClassUtils; +import org.springframework.util.StringUtils; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.HandlerMapping; +import org.springframework.web.servlet.mvc.condition.PatternsRequestCondition; +import org.springframework.web.servlet.mvc.method.RequestMappingInfo; +import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; +import org.springframework.web.util.UriComponents; +import springfox.documentation.RequestHandler; +import springfox.documentation.annotations.ApiIgnore; +import springfox.documentation.service.Documentation; +import springfox.documentation.service.Tag; +import springfox.documentation.spi.service.RequestHandlerProvider; +import springfox.documentation.spring.web.DocumentationCache; +import springfox.documentation.spring.web.WebMvcRequestHandler; +import springfox.documentation.spring.web.json.Json; +import springfox.documentation.spring.web.json.JsonSerializer; +import springfox.documentation.swagger.common.HostNameProvider; +import springfox.documentation.swagger2.mappers.ServiceModelToSwagger2Mapper; + +import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.regex.Pattern; + +import static org.springframework.util.MimeTypeUtils.APPLICATION_JSON_VALUE; + +/** + * @author LionCitys + */ +@Controller +@ApiIgnore +public class Knife4jController { + private static final String DEFAULT_SORT_URL = "/v2/api-docs-ext"; + private static final String HAL_MEDIA_TYPE = "application/hal+json"; + private static final Logger LOGGER = LoggerFactory.getLogger(Knife4jController.class); + private final ServiceModelToSwagger2Mapper mapper; + private final DocumentationCache documentationCache; + private final JsonSerializer jsonSerializer; + private final String hostNameOverride; + private final List handlerProviders; + private final MarkdownFiles markdownFiles; + private ArrayList globalHandlerMappings = new ArrayList<>(); + private final RequestMethod[] globalRequestMethods; + + @Autowired + public Knife4jController(Environment environment, ServiceModelToSwagger2Mapper mapper, DocumentationCache documentationCache, JsonSerializer jsonSerializer, List handlerProviders, ObjectProvider markdownFilesObjectProvider) { + this.globalRequestMethods = new RequestMethod[]{RequestMethod.POST, RequestMethod.GET, RequestMethod.PUT, RequestMethod.DELETE, RequestMethod.PATCH, RequestMethod.OPTIONS, RequestMethod.HEAD}; + this.mapper = mapper; + this.documentationCache = documentationCache; + this.jsonSerializer = jsonSerializer; + this.hostNameOverride = environment.getProperty("springfox.documentation.swagger.v2.host", "DEFAULT"); + this.handlerProviders = handlerProviders; + this.markdownFiles = markdownFilesObjectProvider.getIfAvailable(); + } + + private Function> handlers() { + return (Function>) input -> input.requestHandlers(); + } + + @RequestMapping(value = DEFAULT_SORT_URL, + method = RequestMethod.GET, + produces = {APPLICATION_JSON_VALUE, HAL_MEDIA_TYPE}) + @ResponseBody + public ResponseEntity apiSorts(@RequestParam(value = "group",required = false) String swaggerGroup, HttpServletRequest request) { + String groupName = Optional.ofNullable(swaggerGroup).orElse("default"); + Documentation documentation = this.documentationCache.documentationByGroup(groupName); + if (documentation == null) { + LOGGER.warn("Unable to find specification for group {},use default", groupName); + documentation = this.documentationCache.documentationByGroup("default"); + if (documentation == null) { + LOGGER.warn("Unable to find specification for group default"); + return new ResponseEntity<>(HttpStatus.NOT_FOUND); + } + } + + Swagger swagger = this.mapper.mapDocumentation(documentation); + UriComponents uriComponents = null; + + try { + uriComponents = HostNameProvider.componentsFrom(request, swagger.getBasePath()); + } catch (Throwable var9) { + LOGGER.error(var9.getClass().getName() + ":" + var9.getMessage()); + if (var9 instanceof NoClassDefFoundError) { + String msg = var9.getMessage(); + if (msg != null && !"".equals(msg) && msg.endsWith("HostNameProvider")) { + uriComponents = SwaggerBootstrapUiHostNameProvider.componentsFrom(request, swagger.getBasePath()); + } + } + } + + swagger.basePath(Strings.isNullOrEmpty(uriComponents.getPath()) ? "/" : uriComponents.getPath()); + if (Strings.isNullOrEmpty(swagger.getHost())) { + swagger.host(this.hostName(uriComponents)); + } + extend(swagger); + SwaggerExt swaggerExt = new SwaggerExt(swagger); + swaggerExt.setSwaggerBootstrapUi(this.initSwaggerBootstrapUi(request, documentation, swaggerExt)); + return new ResponseEntity<>(this.jsonSerializer.toJson(swaggerExt), HttpStatus.OK); + } + + private SwaggerBootstrapUi initSwaggerBootstrapUi(HttpServletRequest request, Documentation documentation, SwaggerExt swaggerExt) { + SwaggerBootstrapUi swaggerBootstrapUi = new SwaggerBootstrapUi(); + WebApplicationContext wc = WebApplicationContextUtils.getWebApplicationContext(request.getServletContext()); + if (wc == null) { + String msg = "WebApplicationContext is Empty~!,Enable SwaggerBootstrapUi fun fail~!"; + LOGGER.warn(msg); + swaggerBootstrapUi.setErrorMsg(msg); + return swaggerBootstrapUi; + } else { + Iterator tags = documentation.getTags().iterator(); + this.initGlobalRequestMappingArray(swaggerExt); + List targetTagLists = Lists.newArrayList(); + + ArrayList targetPathLists; + SwaggerBootstrapUiTag tag; + label64: + for(targetPathLists = Lists.newArrayList(); tags.hasNext(); targetTagLists.add(tag)) { + Tag sourceTag = tags.next(); + String tagName = sourceTag.getName(); + int order = 2147483647; + tag = new SwaggerBootstrapUiTag(order); + tag.name(tagName).description(sourceTag.getDescription()); + Api tagApi = null; + RestHandlerMapping tagMapping = null; + Iterator var15 = this.globalHandlerMappings.iterator(); + while(true) { + while(true) { + while(var15.hasNext()) { + RestHandlerMapping rhm = var15.next(); + Api api = (Api)rhm.getBeanType().getAnnotation(Api.class); + if (api != null) { + api.tags(); + if (api.tags().length > 0) { + if (Lists.newArrayList(api.tags()).contains(tagName)) { + tagApi = api; + tagMapping = rhm; + this.createPathInstance(rhm, targetPathLists); + } else { + String firstTag = api.tags()[0]; + if (StringUtils.isEmpty(firstTag) && this.checkExists(tagName, rhm.getBeanType())) { + tagApi = api; + tagMapping = rhm; + this.createPathInstance(rhm, targetPathLists); + } + } + } else if (this.checkExists(tagName, rhm.getBeanType())) { + if (!StringUtils.isEmpty(api.value())) { + tag.name(api.value()); + } + tagApi = api; + tagMapping = rhm; + this.createPathInstance(rhm, targetPathLists); + } + } else if (this.checkExists(tagName, rhm.getBeanType())) { + tagMapping = rhm; + this.createPathInstance(rhm, targetPathLists); + } + } + if (tagMapping != null) { + tag.setOrder(this.getRestTagOrder(tagMapping.getBeanType(), tagApi)); + } + continue label64; + } + } + } + + Collections.sort(targetTagLists, new Comparator() { + @Override + public int compare(SwaggerBootstrapUiTag o1, SwaggerBootstrapUiTag o2) { + return o1.getOrder().compareTo(o2.getOrder()); + } + }); + targetPathLists.sort(new Comparator() { + @Override + public int compare(SwaggerBootstrapUiPath o1, SwaggerBootstrapUiPath o2) { + return o1.getOrder().compareTo(o2.getOrder()); + } + }); + swaggerBootstrapUi.setTagSortLists(targetTagLists); + swaggerBootstrapUi.setPathSortLists(targetPathLists); + if (this.markdownFiles != null) { + swaggerBootstrapUi.setMarkdownFiles(this.markdownFiles.getMarkdownFiles()); + } + + return swaggerBootstrapUi; + } + } + + private void initGlobalRequestMappingArray(SwaggerExt swaggerExt) { + if (this.globalHandlerMappings.size() == 0) { + String parentPath = ""; + if (!StringUtils.isEmpty(swaggerExt.getBasePath()) && !"/".equals(swaggerExt.getBasePath())) { + parentPath = parentPath + swaggerExt.getBasePath(); + } + + try { + List requestHandlers = FluentIterable.from(this.handlerProviders).transformAndConcat(this.handlers()).toList(); + Iterator var4 = requestHandlers.iterator(); + + while(true) { + RequestHandler requestHandler; + do { + if (!var4.hasNext()) { + return; + } + + requestHandler = var4.next(); + } while(!(requestHandler instanceof WebMvcRequestHandler)); + + WebMvcRequestHandler webMvcRequestHandler = (WebMvcRequestHandler)requestHandler; + Set patterns = webMvcRequestHandler.getRequestMapping().getPatternsCondition().getPatterns(); + Set restMethods = webMvcRequestHandler.getRequestMapping().getMethodsCondition().getMethods(); + HandlerMethod handlerMethod = webMvcRequestHandler.getHandlerMethod(); + Class controllerClazz = ClassUtils.getUserClass(handlerMethod.getBeanType()); + Method method = ClassUtils.getMostSpecificMethod(handlerMethod.getMethod(), controllerClazz); + + String url; + for(Iterator var12 = patterns.iterator(); var12.hasNext(); this.globalHandlerMappings.add(new RestHandlerMapping(parentPath + url, controllerClazz, method, restMethods))) { + url = var12.next(); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("url:" + url + "\r\nclass:" + controllerClazz.toString() + "\r\nmethod:" + method.toString()); + } + } + } + } catch (Exception var14) { + LOGGER.error(var14.getMessage(), var14); + } + } + + } + + /** @deprecated */ + @Deprecated + private void initGlobalRequestMappingArray(WebApplicationContext wc, SwaggerExt swaggerExt) { + if (this.globalHandlerMappings.size() == 0) { + String parentPath = ""; + if (!StringUtils.isEmpty(swaggerExt.getBasePath()) && !"/".equals(swaggerExt.getBasePath())) { + parentPath = parentPath + swaggerExt.getBasePath(); + } + + Map requestMappings = BeanFactoryUtils.beansOfTypeIncludingAncestors(wc, HandlerMapping.class, true, false); + Iterator var5 = requestMappings.values().iterator(); + + while(true) { + HandlerMapping handlerMapping; + do { + if (!var5.hasNext()) { + return; + } + handlerMapping = var5.next(); + } while(!(handlerMapping instanceof RequestMappingHandlerMapping)); + RequestMappingHandlerMapping rmhMapping = (RequestMappingHandlerMapping)handlerMapping; + Map handlerMethods = rmhMapping.getHandlerMethods(); + for (RequestMappingInfo rmi : handlerMethods.keySet()) { + PatternsRequestCondition prc = rmi.getPatternsCondition(); + Set restMethods = rmi.getMethodsCondition().getMethods(); + Set patterns = prc.getPatterns(); + HandlerMethod handlerMethod = (HandlerMethod) handlerMethods.get(rmi); + + String url; + Class clazz; + Method method; + for (Iterator var15 = patterns.iterator(); var15.hasNext(); this.globalHandlerMappings.add(new RestHandlerMapping(parentPath + url, clazz, method, restMethods))) { + url = var15.next(); + clazz = ClassUtils.getUserClass(handlerMethod.getBeanType()); + method = ClassUtils.getMostSpecificMethod(handlerMethod.getMethod(), clazz); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("url:" + url + "\r\nclass:" + clazz.toString() + "\r\nmethod:" + method.toString()); + } + } + } + } + } + + } + + private void createPathInstance(RestHandlerMapping rhm, List targetPathLists) { + if (rhm.getRequestMethods() != null && rhm.getRequestMethods().size() != 0) { + Iterator var7 = rhm.getRequestMethods().iterator(); + + while(var7.hasNext()) { + RequestMethod requestMethod = var7.next(); + targetPathLists.add(new SwaggerBootstrapUiPath(rhm.getUrl(), requestMethod.name().toUpperCase(), this.getRestMethodOrder(rhm.getBeanOfMethod()))); + } + } else { + RequestMethod[] var3 = this.globalRequestMethods; + int var4 = var3.length; + + for(int var5 = 0; var5 < var4; ++var5) { + RequestMethod requestMethod = var3[var5]; + targetPathLists.add(new SwaggerBootstrapUiPath(rhm.getUrl(), requestMethod.name().toUpperCase(), this.getRestMethodOrder(rhm.getBeanOfMethod()))); + } + } + + } + + private int getRestTagOrder(Class aClass, Api api) { + int order = 2147483647; + if (api != null) { + int post = api.position(); + if (post == 0) { + if (aClass != null) { + ApiSort annotation = (ApiSort) ClassUtils.getUserClass(aClass).getAnnotation(ApiSort.class); + if (annotation != null) { + order = annotation.value(); + } + } + } else { + order = post; + } + } else if (aClass != null) { + ApiSort annotation = (ApiSort) ClassUtils.getUserClass(aClass).getAnnotation(ApiSort.class); + if (annotation != null) { + order = annotation.value(); + } + } + + return order; + } + + private int getRestMethodOrder(Method target) { + int pathOrder = 2147483647; + ApiOperation apiOperation = (ApiOperation)target.getAnnotation(ApiOperation.class); + ApiOperationSort apiOperationSort; + if (apiOperation != null) { + if (apiOperation.position() != 0) { + pathOrder = apiOperation.position(); + } else { + apiOperationSort = (ApiOperationSort)target.getAnnotation(ApiOperationSort.class); + if (apiOperationSort != null) { + pathOrder = apiOperationSort.value(); + } + } + } else { + apiOperationSort = (ApiOperationSort)target.getAnnotation(ApiOperationSort.class); + if (apiOperationSort != null) { + pathOrder = apiOperationSort.value(); + } + } + + return pathOrder; + } + + private boolean checkExists(String tagName, Class aClass) { + boolean flag = false; + if (!StringUtils.isEmpty(tagName)) { + String regexStr = tagName.replaceAll("-", ".*?"); + Pattern pattern = Pattern.compile(regexStr, 2); + if (pattern.matcher(aClass.getSimpleName()).matches()) { + flag = true; + } + } + + return flag; + } + + private String hostName(UriComponents uriComponents) { + if ("DEFAULT".equals(hostNameOverride)) { + String host = uriComponents.getHost(); + int port = uriComponents.getPort(); + if (port > -1) { + return String.format("%s:%d", host, port); + } + return host; + } + return hostNameOverride; + } + + private void extend(Swagger swagger) { + // 响应返回参数增强 + for (Map.Entry entry : swagger.getDefinitions().entrySet()) { + Model model = entry.getValue(); + String key = entry.getKey(); + if (key.contains("ApiResult") && !SwaggerUtil.getRealType(key).contains("ApiResult")) { + Map props = model.getProperties(); + Property dataProp = props.get("data"); + Property newProp = SwaggerUtil.getNewProp(dataProp, SwaggerUtil.getRealType(key), swagger.getDefinitions()); + props.put("data", newProp); + } + } + } +} diff --git a/yshop-common/src/main/java/springfox/documentation/swagger2/web/Swagger2Controller.java b/yshop-common/src/main/java/springfox/documentation/swagger2/web/Swagger2Controller.java new file mode 100644 index 0000000..936015c --- /dev/null +++ b/yshop-common/src/main/java/springfox/documentation/swagger2/web/Swagger2Controller.java @@ -0,0 +1,117 @@ +package springfox.documentation.swagger2.web; + +import com.github.xiaoymin.knife4j.spring.util.SwaggerUtil; +import com.google.common.base.Strings; +import io.swagger.models.Model; +import io.swagger.models.Swagger; +import io.swagger.models.properties.Property; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.util.UriComponents; +import springfox.documentation.annotations.ApiIgnore; +import springfox.documentation.service.Documentation; +import springfox.documentation.spring.web.DocumentationCache; +import springfox.documentation.spring.web.PropertySourcedMapping; +import springfox.documentation.spring.web.json.JsonSerializer; +import springfox.documentation.swagger.common.HostNameProvider; +import springfox.documentation.swagger2.mappers.ServiceModelToSwagger2Mapper; + +import javax.servlet.http.HttpServletRequest; +import java.util.Map; +import java.util.Optional; + +import static org.springframework.util.MimeTypeUtils.APPLICATION_JSON_VALUE; + +/** + * Swagger2控制器 + * + * @author LionCitys + * @date 2020/01/07 + */ +@Controller +@ApiIgnore +public class Swagger2Controller { + private static final String DEFAULT_URL = "/v2/api-docs"; + private static final Logger LOGGER = LoggerFactory.getLogger(Swagger2Controller.class); + private static final String HAL_MEDIA_TYPE = "application/hal+json"; + private final String hostNameOverride; + private final DocumentationCache documentationCache; + private final ServiceModelToSwagger2Mapper mapper; + private final JsonSerializer jsonSerializer; + + @Autowired + public Swagger2Controller(Environment environment, DocumentationCache documentationCache, ServiceModelToSwagger2Mapper mapper, JsonSerializer jsonSerializer) { + this.hostNameOverride = environment.getProperty("springfox.documentation.swagger.v2.host", "DEFAULT"); + this.documentationCache = documentationCache; + this.mapper = mapper; + this.jsonSerializer = jsonSerializer; + } + + @RequestMapping( + value = {DEFAULT_URL}, + method = {RequestMethod.GET}, + produces = {APPLICATION_JSON_VALUE, HAL_MEDIA_TYPE} + ) + @PropertySourcedMapping( + value = "${springfox.documentation.swagger.v2.path}", + propertyKey = "springfox.documentation.swagger.v2.path" + ) + @ResponseBody + public ResponseEntity getDocumentation(@RequestParam(value = "group",required = false) String swaggerGroup, HttpServletRequest servletRequest) { + String groupName = (String) Optional.ofNullable(swaggerGroup).orElse("default"); + Documentation documentation = this.documentationCache.documentationByGroup(groupName); + if (documentation == null) { + LOGGER.warn("Unable to find specification for group {}", groupName); + return new ResponseEntity(HttpStatus.NOT_FOUND); + } else { + Swagger swagger = this.mapper.mapDocumentation(documentation); + UriComponents uriComponents = HostNameProvider.componentsFrom(servletRequest, swagger.getBasePath()); + swagger.basePath(Strings.isNullOrEmpty(uriComponents.getPath()) ? "/" : uriComponents.getPath()); + if (Strings.isNullOrEmpty(swagger.getHost())) { + swagger.host(this.hostName(uriComponents)); + } + // 扩展 + swagger = extend(swagger); + + return new ResponseEntity(this.jsonSerializer.toJson(swagger), HttpStatus.OK); + } + } + + private String hostName(UriComponents uriComponents) { + return getString(uriComponents, this.hostNameOverride); + } + + private static String getString(UriComponents uriComponents, String hostNameOverride) { + if ("DEFAULT".equals(hostNameOverride)) { + String host = uriComponents.getHost(); + int port = uriComponents.getPort(); + return port > -1 ? String.format("%s:%d", host, port) : host; + } else { + return hostNameOverride; + } + } + + private Swagger extend(Swagger swagger) { + // 响应返回参数增强 + for (Map.Entry entry : swagger.getDefinitions().entrySet()) { + Model model = entry.getValue(); + String key = entry.getKey(); + if (key.contains("ApiResult") && !SwaggerUtil.getRealType(key).contains("ApiResult")) { + Map props = model.getProperties(); + Property dataProp = props.get("data"); + Property newProp = SwaggerUtil.getNewProp(dataProp, SwaggerUtil.getRealType(key), swagger.getDefinitions()); + props.put("data", newProp); + } + } + return swagger; + } +} diff --git a/yshop-common/src/main/resources/META-INF/spring.factories b/yshop-common/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000..69507c5 --- /dev/null +++ b/yshop-common/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ + co.yixiang.dozer.config.DozerMapperConfig \ No newline at end of file diff --git a/yshop-common/src/main/resources/dozer/bean-mappings.xml b/yshop-common/src/main/resources/dozer/bean-mappings.xml new file mode 100644 index 0000000..323a656 --- /dev/null +++ b/yshop-common/src/main/resources/dozer/bean-mappings.xml @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/yshop-common/src/main/resources/dozer/global-configuration.xml b/yshop-common/src/main/resources/dozer/global-configuration.xml new file mode 100644 index 0000000..f09f732 --- /dev/null +++ b/yshop-common/src/main/resources/dozer/global-configuration.xml @@ -0,0 +1,17 @@ + + + + yyyy-MM-dd HH:mm:ss + true + false + + + + \ No newline at end of file diff --git a/yshop-generator/pom.xml b/yshop-generator/pom.xml new file mode 100644 index 0000000..56c6ff3 --- /dev/null +++ b/yshop-generator/pom.xml @@ -0,0 +1,39 @@ + + + + yshop + co.yixiang + 3.2 + + 4.0.0 + + yshop-generator + 代码生成模块 + + + 1.9 + + + + + co.yixiang + yshop-common + 3.2 + + + + + org.springframework.boot + spring-boot-starter-freemarker + + + + + commons-configuration + commons-configuration + ${configuration.version} + + + diff --git a/yshop-generator/src/main/java/co/yixiang/gen/domain/ColumnConfig.java b/yshop-generator/src/main/java/co/yixiang/gen/domain/ColumnConfig.java new file mode 100644 index 0000000..e54ebf2 --- /dev/null +++ b/yshop-generator/src/main/java/co/yixiang/gen/domain/ColumnConfig.java @@ -0,0 +1,79 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.gen.domain; + +import co.yixiang.gen.utils.GenUtil; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 列的数据信息 + * @author Zheng Jie + * @date 2019-01-02 + */ +@Data +@NoArgsConstructor +@TableName("column_config") +public class ColumnConfig { + + @TableId + private Long id; + + private String tableName; + + /** 数据库字段名称 */ + private String columnName; + + /** 数据库字段类型 */ + private String columnType; + + /** 数据库字段键类型 */ + private String keyType; + + /** 字段额外的参数 */ + private String extra; + + /** 数据库字段描述 */ + private String remark; + + /** 必填 */ + private Boolean notNull; + + /** 是否在列表显示 */ + private Boolean listShow; + + /** 是否表单显示 */ + private Boolean formShow; + + /** 表单类型 */ + private String formType; + + /** 查询 1:模糊 2:精确 */ + private String queryType; + + /** 字典名称 */ + private String dictName; + + /** 日期注解 */ + private String dateAnnotation; + + public ColumnConfig(String tableName, String columnName, Boolean notNull, String columnType, String remark, String keyType, String extra) { + this.tableName = tableName; + this.columnName = columnName; + this.columnType = columnType; + this.keyType = keyType; + this.extra = extra; + this.notNull = notNull; + if(GenUtil.PK.equalsIgnoreCase(keyType) && GenUtil.EXTRA.equalsIgnoreCase(extra)){ + this.notNull = false; + } + this.remark = remark; + this.listShow = true; + this.formShow = true; + } +} diff --git a/yshop-generator/src/main/java/co/yixiang/gen/domain/GenConfig.java b/yshop-generator/src/main/java/co/yixiang/gen/domain/GenConfig.java new file mode 100644 index 0000000..e755e51 --- /dev/null +++ b/yshop-generator/src/main/java/co/yixiang/gen/domain/GenConfig.java @@ -0,0 +1,60 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.gen.domain; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 代码生成配置 + * @author Zheng Jie + * @date 2019-01-03 + */ +@Data +@NoArgsConstructor +@TableName("gen_config") +public class GenConfig { + + public GenConfig(String tableName) { + this.cover = false; + this.moduleName = "yshop-mall"; + this.author = "hupeng"; + this.pack = "co.yixiang.modules"; + this.tableName = tableName; + } + + @TableId + private Long id; + + /**表明**/ + private String tableName; + + /** 接口名称 **/ + private String apiAlias; + + /** 包路径 */ + private String pack; + + /** 模块名 */ + private String moduleName; + + /** 前端文件路径 */ + private String path; + + /** 前端文件路径 */ + private String apiPath; + + /** 作者 */ + private String author; + + /** 表前缀 */ + private String prefix; + + /** 是否覆盖 */ + private Boolean cover; +} diff --git a/yshop-generator/src/main/java/co/yixiang/gen/domain/vo/ColumnInfo.java b/yshop-generator/src/main/java/co/yixiang/gen/domain/vo/ColumnInfo.java new file mode 100644 index 0000000..60a0e98 --- /dev/null +++ b/yshop-generator/src/main/java/co/yixiang/gen/domain/vo/ColumnInfo.java @@ -0,0 +1,45 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.gen.domain.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 列的数据信息 + * @author Zheng Jie + * @date 2019-01-02 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ColumnInfo { + + /** 数据库字段名称 **/ + private Object columnName; + + /** 允许空值 **/ + private Object isNullable; + + /** 数据库字段类型 **/ + private Object columnType; + + /** 数据库字段注释 **/ + private Object columnComment; + + /** 数据库字段键类型 **/ + private Object columnKey; + + /** 额外的参数 **/ + private Object extra; + + /** 查询 1:模糊 2:精确 **/ + private String columnQuery; + + /** 是否在列表显示 **/ + private String columnShow; +} diff --git a/yshop-generator/src/main/java/co/yixiang/gen/domain/vo/TableInfo.java b/yshop-generator/src/main/java/co/yixiang/gen/domain/vo/TableInfo.java new file mode 100644 index 0000000..c1aa5ad --- /dev/null +++ b/yshop-generator/src/main/java/co/yixiang/gen/domain/vo/TableInfo.java @@ -0,0 +1,40 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.gen.domain.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 表的数据信息 + * @author Zheng Jie + * @date 2019-01-02 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class TableInfo { + + /** 表名称 */ + private Object tableName; + + /** 创建日期 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Object createTime; + + /** 数据库引擎 */ + private Object engine; + + /** 编码集 */ + private Object coding; + + /** 备注 */ + private Object remark; + + +} diff --git a/yshop-generator/src/main/java/co/yixiang/gen/rest/GenConfigController.java b/yshop-generator/src/main/java/co/yixiang/gen/rest/GenConfigController.java new file mode 100644 index 0000000..f116a13 --- /dev/null +++ b/yshop-generator/src/main/java/co/yixiang/gen/rest/GenConfigController.java @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.gen.rest; + +import co.yixiang.gen.domain.GenConfig; +import co.yixiang.gen.service.GenConfigService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author Zheng Jie + * @date 2019-01-14 + */ +@RestController +@RequestMapping("/api/genConfig") +@Api(tags = "系统:代码生成器配置管理") +public class GenConfigController { + + private final GenConfigService genConfigService; + + public GenConfigController(GenConfigService genConfigService) { + this.genConfigService = genConfigService; + } + + @ApiOperation("查询") + @GetMapping(value = "/{tableName}") + public ResponseEntity get(@PathVariable String tableName){ + return new ResponseEntity<>(genConfigService.find(tableName), HttpStatus.OK); + } + + @ApiOperation("修改") + @PutMapping + public ResponseEntity emailConfig(@Validated @RequestBody GenConfig genConfig){ + return new ResponseEntity<>(genConfigService.update(genConfig.getTableName(), genConfig),HttpStatus.OK); + } +} diff --git a/yshop-generator/src/main/java/co/yixiang/gen/rest/GeneratorController.java b/yshop-generator/src/main/java/co/yixiang/gen/rest/GeneratorController.java new file mode 100644 index 0000000..07dec02 --- /dev/null +++ b/yshop-generator/src/main/java/co/yixiang/gen/rest/GeneratorController.java @@ -0,0 +1,108 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.gen.rest; + +import co.yixiang.exception.BadRequestException; +import co.yixiang.gen.domain.ColumnConfig; +import co.yixiang.gen.service.GenConfigService; +import co.yixiang.gen.service.GeneratorService; +import co.yixiang.utils.PageUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * @author Zheng Jie + * @date 2019-01-02 + */ +@RestController +@RequestMapping("/api/generator") +@Api(tags = "系统:代码生成管理") +public class GeneratorController { + + private final GeneratorService generatorService; + + private final GenConfigService genConfigService; + + @Value("${generator.enabled}") + private Boolean generatorEnabled; + + public GeneratorController(GeneratorService generatorService, GenConfigService genConfigService) { + this.generatorService = generatorService; + this.genConfigService = genConfigService; + } + + @ApiOperation("查询数据库数据") + @GetMapping(value = "/tables/all") + public ResponseEntity getTables(){ + return new ResponseEntity<>(generatorService.getTables(), HttpStatus.OK); + } + + @ApiOperation("查询数据库数据") + @GetMapping(value = "/tables") + public ResponseEntity getTables(@RequestParam(defaultValue = "") String name, + @RequestParam(defaultValue = "0")Integer page, + @RequestParam(defaultValue = "10")Integer size){ + return new ResponseEntity<>(generatorService.getTables(name, page, size), HttpStatus.OK); + } + + @ApiOperation("查询字段数据") + @GetMapping(value = "/columns") + public ResponseEntity getTables(@RequestParam String tableName){ + List columnInfos = generatorService.getColumns(tableName); + return new ResponseEntity<>(PageUtil.toPage(columnInfos,columnInfos.size()), HttpStatus.OK); + } + + @ApiOperation("保存字段数据") + @PutMapping + public ResponseEntity save(@RequestBody List columnInfos){ + generatorService.save(columnInfos); + return new ResponseEntity<>(HttpStatus.OK); + } + + @ApiOperation("同步字段数据") + @PostMapping(value = "sync") + public ResponseEntity sync(@RequestBody List tables){ + for (String table : tables) { + generatorService.sync(generatorService.getColumns(table), generatorService.query(table)); + } + return new ResponseEntity<>(HttpStatus.OK); + } + + @ApiOperation("生成代码") + @PostMapping(value = "/{tableName}/{type}") + public ResponseEntity generator(@PathVariable String tableName, @PathVariable Integer type, HttpServletRequest request, HttpServletResponse response){ + if(!generatorEnabled && type == 0){ + throw new BadRequestException("此环境不允许生成代码,请选择预览或者下载查看!"); + } + switch (type){ + // 生成代码 + case 0: generatorService.generator(genConfigService.find(tableName), generatorService.getColumns(tableName)); + break; + // 预览 + case 1: return generatorService.preview(genConfigService.find(tableName), generatorService.getColumns(tableName)); + // 打包 + case 2: generatorService.download(genConfigService.find(tableName), generatorService.getColumns(tableName), request, response); + break; + default: throw new BadRequestException("没有这个选项"); + } + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-generator/src/main/java/co/yixiang/gen/service/GenConfigService.java b/yshop-generator/src/main/java/co/yixiang/gen/service/GenConfigService.java new file mode 100644 index 0000000..d1c20f0 --- /dev/null +++ b/yshop-generator/src/main/java/co/yixiang/gen/service/GenConfigService.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.gen.service; + +import co.yixiang.gen.domain.GenConfig; + +/** + * @author Zheng Jie + * @date 2019-01-14 + */ +public interface GenConfigService { + + /** + * 查询表配置 + * @param tableName 表名 + * @return 表配置 + */ + GenConfig find(String tableName); + + /** + * 更新表配置 + * @param tableName 表名 + * @param genConfig 表配置 + * @return 表配置 + */ + GenConfig update(String tableName, GenConfig genConfig); +} diff --git a/yshop-generator/src/main/java/co/yixiang/gen/service/GeneratorService.java b/yshop-generator/src/main/java/co/yixiang/gen/service/GeneratorService.java new file mode 100644 index 0000000..78224cf --- /dev/null +++ b/yshop-generator/src/main/java/co/yixiang/gen/service/GeneratorService.java @@ -0,0 +1,91 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.gen.service; + +import co.yixiang.gen.domain.ColumnConfig; +import co.yixiang.gen.domain.GenConfig; +import org.springframework.http.ResponseEntity; +import org.springframework.scheduling.annotation.Async; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * @author Zheng Jie + * @date 2019-01-02 + */ +public interface GeneratorService { + + /** + * 查询数据库元数据 + * @param name 表名 + * @param page 分页页码 + * @param size 分页大小 + * @return / + */ + Object getTables(String name, Integer page, Integer size); + + /** + * 得到数据表的元数据 + * @param name 表名 + * @return / + */ + List getColumns(String name); + + /** + * 同步表数据 + * @param columnInfos / + * @param columnInfoList + */ + @Async + void sync(List columnInfos, List columnInfoList); + + /** + * 保持数据 + * @param columnInfos / + */ + void save(List columnInfos); + + /** + * 获取所有table + * @return / + */ + Object getTables(); + + /** + * 代码生成 + * @param genConfig 配置信息 + * @param columns 字段信息 + */ + void generator(GenConfig genConfig, List columns); + + /** + * 预览 + * @param genConfig 配置信息 + * @param columns 字段信息 + * @return / + */ + ResponseEntity preview(GenConfig genConfig, List columns); + + /** + * 打包下载 + * @param genConfig 配置信息 + * @param columns 字段信息 + * @param request / + * @param response / + */ + void download(GenConfig genConfig, List columns, HttpServletRequest request, HttpServletResponse response); + + /** + * 查询数据库的表字段数据数据 + * @param table / + * @return / + */ + List query(String table); + + +} diff --git a/yshop-generator/src/main/java/co/yixiang/gen/service/impl/GenConfigServiceImpl.java b/yshop-generator/src/main/java/co/yixiang/gen/service/impl/GenConfigServiceImpl.java new file mode 100644 index 0000000..8715a22 --- /dev/null +++ b/yshop-generator/src/main/java/co/yixiang/gen/service/impl/GenConfigServiceImpl.java @@ -0,0 +1,63 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.gen.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.gen.domain.GenConfig; +import co.yixiang.gen.service.GenConfigService; +import co.yixiang.gen.service.mapper.GenConfigMapper; +import co.yixiang.utils.StringUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.springframework.stereotype.Service; + +import java.io.File; + +/** + * @author Zheng Jie + * @date 2019-01-14 + */ +@Service +//@CacheConfig(cacheNames = "genConfig") +public class GenConfigServiceImpl extends BaseServiceImpl implements GenConfigService { + + @Override +// @Cacheable(key = "#p0") + public GenConfig find(String tableName) { + GenConfig genConfig = this.getOne(new LambdaQueryWrapper().eq(GenConfig::getTableName,tableName)); + if(genConfig == null){ + return new GenConfig(tableName); + } + return genConfig; + } + + @Override +// @CachePut(key = "#p0") + public GenConfig update(String tableName, GenConfig genConfig) { + // 如果 api 路径为空,则自动生成路径 + if(StringUtils.isBlank(genConfig.getApiPath())){ + String separator = File.separator; + String[] paths; + String symbol = "\\"; + if (symbol.equals(separator)) { + paths = genConfig.getPath().split("\\\\"); + } else { + paths = genConfig.getPath().split(File.separator); + } + StringBuilder api = new StringBuilder(); + for (String path : paths) { + api.append(path); + api.append(separator); + if ("src".equals(path)) { + api.append("api"); + break; + } + } + genConfig.setApiPath(api.toString()); + } + this.saveOrUpdate(genConfig); + return genConfig; + } +} diff --git a/yshop-generator/src/main/java/co/yixiang/gen/service/impl/GeneratorServiceImpl.java b/yshop-generator/src/main/java/co/yixiang/gen/service/impl/GeneratorServiceImpl.java new file mode 100644 index 0000000..8bda68e --- /dev/null +++ b/yshop-generator/src/main/java/co/yixiang/gen/service/impl/GeneratorServiceImpl.java @@ -0,0 +1,168 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.gen.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.ZipUtil; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.exception.BadRequestException; +import co.yixiang.gen.domain.ColumnConfig; +import co.yixiang.gen.domain.GenConfig; +import co.yixiang.gen.domain.vo.TableInfo; +import co.yixiang.gen.service.GeneratorService; +import co.yixiang.gen.service.mapper.ColumnInfoMapper; +import co.yixiang.gen.utils.GenUtil; +import co.yixiang.utils.FileUtil; +import co.yixiang.utils.PageUtil; +import co.yixiang.utils.StringUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author Zheng Jie + * @date 2019-01-02 + */ +@Service +@SuppressWarnings({"unchecked","all"}) +public class GeneratorServiceImpl extends BaseServiceImpl implements GeneratorService { + + + @Override + public Object getTables() { + return baseMapper.selectTables(); + } + + @Override + public Object getTables(String name, Integer page, Integer size) { + IPage pages = null; + if(page>=0)page = page + 1; + Page pageModel = new Page<>(page, size); + pages = baseMapper.selectTablePage(pageModel,name); + Integer totalElements = 0; + return PageUtil.toPage(pages.getRecords(),pages.getTotal()); + } + + @Override + public List getColumns(String tableName) { + List columnInfos = this.list(new LambdaQueryWrapper() + .eq(ColumnConfig::getTableName,tableName).orderByAsc(ColumnConfig::getId)); + if(CollectionUtil.isNotEmpty(columnInfos)){ + return columnInfos; + } else { + columnInfos = query(tableName); + this.saveBatch(columnInfos); + return columnInfos; + } + } + + @Override + public List query(String tableName){ + List columnInfos = new ArrayList<>(); + List> result = baseMapper.queryByTableName(tableName); + for (Map map : result) { + + columnInfos.add( + new ColumnConfig( + tableName, + map.get("COLUMN_NAME").toString(), + "NO".equals(map.get("IS_NULLABLE").toString()), + map.get("DATA_TYPE").toString(), + ObjectUtil.isNotNull( map.get("COLUMN_COMMENT")) ? map.get("COLUMN_COMMENT").toString() : null, + ObjectUtil.isNotNull(map.get("COLUMN_KEY")) ? map.get("COLUMN_KEY").toString() : null, + ObjectUtil.isNotNull(map.get("EXTRA")) ? map.get("EXTRA").toString() : null) + ); + } + return columnInfos; + } + + @Override + public void sync(List columnInfos, List columnInfoList) { + // 第一种情况,数据库类字段改变或者新增字段 + for (ColumnConfig columnInfo : columnInfoList) { + // 根据字段名称查找 + List columns = new ArrayList(columnInfos.stream().filter(c-> c.getColumnName().equals(columnInfo.getColumnName())).collect(Collectors.toList())); + // 如果能找到,就修改部分可能被字段 + if(CollectionUtil.isNotEmpty(columns)){ + ColumnConfig column = columns.get(0); + column.setColumnType(columnInfo.getColumnType()); + column.setExtra(columnInfo.getExtra()); + column.setKeyType(columnInfo.getKeyType()); + if(StringUtils.isBlank(column.getRemark())){ + column.setRemark(columnInfo.getRemark()); + } + this.saveOrUpdate(column); + } else { + // 如果找不到,则保存新字段信息 + this.save(columnInfo); + } + } + // 第二种情况,数据库字段删除了 + for (ColumnConfig columnInfo : columnInfos) { + // 根据字段名称查找 + List columns = new ArrayList(columnInfoList.stream().filter(c-> c.getColumnName().equals(columnInfo.getColumnName())).collect(Collectors.toList())); + // 如果找不到,就代表字段被删除了,则需要删除该字段 + if(CollectionUtil.isEmpty(columns)){ + this.removeById(columnInfo.getId()); + } + } + } + + @Override + public void save(List columnInfos) { + this.saveOrUpdateBatch(columnInfos); + } + + @Override + public void generator(GenConfig genConfig, List columns) { + if(genConfig.getId() == null){ + throw new BadRequestException("请先配置生成器"); + } + try { + GenUtil.generatorCode(columns, genConfig); + } catch (IOException e) { + e.printStackTrace(); + throw new BadRequestException("生成失败,请手动处理已生成的文件"); + } + } + + @Override + public ResponseEntity preview(GenConfig genConfig, List columns) { + if(genConfig.getId() == null){ + throw new BadRequestException("请先配置生成器"); + } + List> genList = GenUtil.preview(columns, genConfig); + return new ResponseEntity<>(genList, HttpStatus.OK); + } + + @Override + public void download(GenConfig genConfig, List columns, HttpServletRequest request, HttpServletResponse response) { + if(genConfig.getId() == null){ + throw new BadRequestException("请先配置生成器"); + } + try { + File file = new File(GenUtil.download(columns, genConfig)); + String zipPath = file.getPath() + ".zip"; + ZipUtil.zip(file.getPath(), zipPath); + FileUtil.downloadFile(request, response, new File(zipPath), true); + } catch (IOException e) { + throw new BadRequestException("打包失败"); + } + } +} diff --git a/yshop-generator/src/main/java/co/yixiang/gen/service/mapper/ColumnInfoMapper.java b/yshop-generator/src/main/java/co/yixiang/gen/service/mapper/ColumnInfoMapper.java new file mode 100644 index 0000000..df204d2 --- /dev/null +++ b/yshop-generator/src/main/java/co/yixiang/gen/service/mapper/ColumnInfoMapper.java @@ -0,0 +1,35 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.gen.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.gen.domain.ColumnConfig; +import co.yixiang.gen.domain.vo.TableInfo; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.List; +import java.util.Map; + +@Repository +@Mapper +public interface ColumnInfoMapper extends CoreMapper { + + @Select("") + IPage selectTablePage(@Param("page") Page page, @Param("name") String name); + @Select("") + List selectTables(); + @Select("SELECT COLUMN_NAME, IS_NULLABLE, DATA_TYPE, COLUMN_COMMENT, COLUMN_KEY, EXTRA FROM INFORMATION_SCHEMA.COLUMNS " + + "WHERE TABLE_NAME = #{name} AND TABLE_SCHEMA = (SELECT DATABASE()) ORDER BY ORDINAL_POSITION") + List> queryByTableName(@Param("name") String name); + +} diff --git a/yshop-generator/src/main/java/co/yixiang/gen/service/mapper/GenConfigMapper.java b/yshop-generator/src/main/java/co/yixiang/gen/service/mapper/GenConfigMapper.java new file mode 100644 index 0000000..73c36a0 --- /dev/null +++ b/yshop-generator/src/main/java/co/yixiang/gen/service/mapper/GenConfigMapper.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.gen.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.gen.domain.GenConfig; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +@Repository +@Mapper +public interface GenConfigMapper extends CoreMapper { +} diff --git a/yshop-generator/src/main/java/co/yixiang/gen/utils/ColUtil.java b/yshop-generator/src/main/java/co/yixiang/gen/utils/ColUtil.java new file mode 100644 index 0000000..e8530f2 --- /dev/null +++ b/yshop-generator/src/main/java/co/yixiang/gen/utils/ColUtil.java @@ -0,0 +1,42 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.gen.utils; + +import org.apache.commons.configuration.Configuration; +import org.apache.commons.configuration.ConfigurationException; +import org.apache.commons.configuration.PropertiesConfiguration; + +/** + * sql字段转java + * + * @author Zheng Jie + * @date 2019-01-03 + */ +public class ColUtil { + + /** + * 转换mysql数据类型为java数据类型 + * @param type 数据库字段类型 + * @return String + */ + static String cloToJava(String type){ + Configuration config = getConfig(); + assert config != null; + return config.getString(type,"unknowType"); + } + + /** + * 获取配置信息 + */ + public static PropertiesConfiguration getConfig() { + try { + return new PropertiesConfiguration("generator.properties" ); + } catch (ConfigurationException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/yshop-generator/src/main/java/co/yixiang/gen/utils/GenUtil.java b/yshop-generator/src/main/java/co/yixiang/gen/utils/GenUtil.java new file mode 100644 index 0000000..020191a --- /dev/null +++ b/yshop-generator/src/main/java/co/yixiang/gen/utils/GenUtil.java @@ -0,0 +1,445 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.gen.utils; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.template.Template; +import cn.hutool.extra.template.TemplateConfig; +import cn.hutool.extra.template.TemplateEngine; +import cn.hutool.extra.template.TemplateException; +import cn.hutool.extra.template.TemplateUtil; +import co.yixiang.gen.domain.ColumnConfig; +import co.yixiang.gen.domain.GenConfig; +import co.yixiang.utils.FileUtil; +import co.yixiang.utils.StringUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.util.ObjectUtils; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 代码生成 + * @author Zheng Jie + * @date 2019-01-02 + */ +@Slf4j +@SuppressWarnings("all") +public class GenUtil { + + private static final String DATE = "Date"; + + private static final String BIGDECIMAL = "BigDecimal"; + + public static final String PK = "PRI"; + + public static final String EXTRA = "auto_increment"; + + /** + * 获取后端代码模板名称 + * @return List + */ + private static List getAdminTemplateNames() { + List templateNames = new ArrayList<>(); + /*templateNames.add("Entity"); + templateNames.add("Dto"); + templateNames.add("Mapper"); + templateNames.add("Controller"); + templateNames.add("QueryCriteria"); + templateNames.add("Service"); + templateNames.add("ServiceImpl"); + templateNames.add("Repository");*/ + templateNames.add("EntityP"); + templateNames.add("DtoP"); + templateNames.add("MapperP"); + templateNames.add("ControllerP"); + templateNames.add("QueryCriteriaP"); + templateNames.add("ServiceP"); + templateNames.add("ServiceImplP"); + //templateNames.add("Repository"); + return templateNames; + } + + /** + * 获取前端代码模板名称 + * @return List + */ + private static List getFrontTemplateNames() { + List templateNames = new ArrayList<>(); + templateNames.add("index"); + templateNames.add("api"); + return templateNames; + } + + public static List> preview(List columns, GenConfig genConfig) { + Map genMap = getGenMap(columns, genConfig); + List> genList = new ArrayList<>(); + // 获取后端模版 + List templates = getAdminTemplateNames(); + TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH)); + for (String templateName : templates) { + Map map = new HashMap<>(1); + Template template = engine.getTemplate("generator/admin/"+templateName+".ftl"); + map.put("content", template.render(genMap)); + map.put("name", templateName); + genList.add(map); + } + // 获取前端模版 + templates = getFrontTemplateNames(); + for (String templateName : templates) { + Map map = new HashMap<>(1); + Template template = engine.getTemplate("generator/front/"+templateName+".ftl"); + map.put(templateName, template.render(genMap)); + map.put("content", template.render(genMap)); + map.put("name", templateName); + genList.add(map); + } + return genList; + } + + public static String download(List columns, GenConfig genConfig) throws IOException { + String tempPath =System.getProperty("java.io.tmpdir") + "yshop-gen-temp" + File.separator + genConfig.getTableName() + File.separator; + Map genMap = getGenMap(columns, genConfig); + TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH)); + // 生成后端代码 + List templates = getAdminTemplateNames(); + for (String templateName : templates) { + Template template = engine.getTemplate("generator/admin/"+templateName+".ftl"); + String filePath = getAdminFilePath(templateName,genConfig,genMap.get("className").toString(),tempPath + "yshop" + File.separator); + assert filePath != null; + File file = new File(filePath); + // 如果非覆盖生成 + if(!genConfig.getCover() && FileUtil.exist(file)){ + continue; + } + // 生成代码 + genFile(file, template, genMap); + } + // 生成前端代码 + templates = getFrontTemplateNames(); + for (String templateName : templates) { + Template template = engine.getTemplate("generator/front/"+templateName+".ftl"); + String path = tempPath + "yshop-rest" + File.separator; + String apiPath = path + "src" + File.separator + "api" + File.separator; + String srcPath = path + "src" + File.separator + "views" + File.separator + genMap.get("changeClassName").toString() + File.separator; + String filePath = getFrontFilePath(templateName, apiPath, srcPath, genMap.get("changeClassName").toString()); + assert filePath != null; + File file = new File(filePath); + // 如果非覆盖生成 + if(!genConfig.getCover() && FileUtil.exist(file)){ + continue; + } + // 生成代码 + genFile(file, template, genMap); + } + return tempPath; + } + + public static void generatorCode(List columnInfos, GenConfig genConfig) throws IOException { + Map genMap = getGenMap(columnInfos, genConfig); + TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH)); + // 生成后端代码 + List templates = getAdminTemplateNames(); + for (String templateName : templates) { + Template template = engine.getTemplate("generator/admin/"+templateName+".ftl"); + String filePath = getAdminFilePath(templateName,genConfig,genMap.get("className").toString(),System.getProperty("user.dir")); + + assert filePath != null; + File file = new File(filePath); + + // 如果非覆盖生成 + if(!genConfig.getCover() && FileUtil.exist(file)){ + continue; + } + // 生成代码 + genFile(file, template, genMap); + } + + // 生成前端代码 + templates = getFrontTemplateNames(); + for (String templateName : templates) { + Template template = engine.getTemplate("generator/front/"+templateName+".ftl"); + String filePath = getFrontFilePath(templateName,genConfig.getApiPath(),genConfig.getPath(),genMap.get("changeClassName").toString()); + + assert filePath != null; + File file = new File(filePath); + + // 如果非覆盖生成 + if(!genConfig.getCover() && FileUtil.exist(file)){ + continue; + } + // 生成代码 + genFile(file, template, genMap); + } + } + + // 获取模版数据 + private static Map getGenMap(List columnInfos, GenConfig genConfig) { + // 存储模版字段数据 + Map genMap = new HashMap<>(16); + // 接口别名 + genMap.put("apiAlias",genConfig.getApiAlias()); + // 包名称 + genMap.put("package",genConfig.getPack()); + // 模块名称 + genMap.put("moduleName",genConfig.getModuleName()); + // 作者 + genMap.put("author",genConfig.getAuthor()); + // 创建日期 + genMap.put("date", LocalDate.now().toString()); + // 表名 + genMap.put("tableName",genConfig.getTableName()); + // 大写开头的类名 + String className = StringUtils.toCapitalizeCamelCase(genConfig.getTableName()); + // 小写开头的类名 + String changeClassName = StringUtils.toCamelCase(genConfig.getTableName()); + // 判断是否去除表前缀 + if (StringUtils.isNotEmpty(genConfig.getPrefix())) { + className = StringUtils.toCapitalizeCamelCase(StrUtil.removePrefix(genConfig.getTableName(),genConfig.getPrefix())); + changeClassName = StringUtils.toCamelCase(StrUtil.removePrefix(genConfig.getTableName(),genConfig.getPrefix())); + } + // 保存类名 + genMap.put("className", className); + // 保存小写开头的类名 + genMap.put("changeClassName", changeClassName); + // 存在 Timestamp 字段 + genMap.put("hasDateTime",false); + // 存在 Images 字段 + genMap.put("hasImages",false); + // 查询类中存在 Timestamp 字段 + genMap.put("queryHasDateTime",false); + // 存在 BigDecimal 字段 + genMap.put("hasBigDecimal",false); + // 查询类中存在 BigDecimal 字段 + genMap.put("queryHasBigDecimal",false); + // 是否需要创建查询 + genMap.put("hasQuery",false); + // 自增主键 + genMap.put("auto",false); + // 存在字典 + genMap.put("hasDict",false); + // 存在日期注解 + genMap.put("hasDateAnnotation",false); + // 保存字段信息 + List> columns = new ArrayList<>(); + // 保存查询字段的信息 + List> queryColumns = new ArrayList<>(); + // 存储字典信息 + List dicts = new ArrayList<>(); + // 存储 between 信息 + List> betweens = new ArrayList<>(); + // 存储不为空的字段信息 + List> isNotNullColumns = new ArrayList<>(); + + for (ColumnConfig column : columnInfos) { + Map listMap = new HashMap<>(16); + // 字段描述 + listMap.put("remark",column.getRemark()); + // 字段类型 + listMap.put("columnKey",column.getKeyType()); + // 主键类型 + String colType = ColUtil.cloToJava(column.getColumnType()); + // 小写开头的字段名 + String changeColumnName = StringUtils.toCamelCase(column.getColumnName().toString()); + // 大写开头的字段名 + String capitalColumnName = StringUtils.toCapitalizeCamelCase(column.getColumnName().toString()); + if(PK.equals(column.getKeyType())){ + // 存储主键类型 + genMap.put("pkColumnType",colType); + // 存储小写开头的字段名 + genMap.put("pkChangeColName",changeColumnName); + // 存储大写开头的字段名 + genMap.put("pkCapitalColName",capitalColumnName); + } + if("Images".equals(column.getFormType())){ + // 存在 Images 字段 + genMap.put("hasImages",true); + } + // 是否存在 Timestamp 类型的字段 + if(DATE.equals(colType)){ + genMap.put("hasDateTime",true); + } + // 是否存在 BigDecimal 类型的字段 + if(BIGDECIMAL.equals(colType)){ + genMap.put("hasBigDecimal",true); + } + // 主键是否自增 + if(EXTRA.equals(column.getExtra())){ + genMap.put("auto",true); + } + // 主键存在字典 + if(StringUtils.isNotBlank(column.getDictName())){ + genMap.put("hasDict",true); + dicts.add(column.getDictName()); + } + + // 存储字段类型 + listMap.put("columnType",colType); + // 存储字原始段名称 + listMap.put("columnName",column.getColumnName()); + // 不为空 + listMap.put("istNotNull",column.getNotNull()); + // 字段列表显示 + listMap.put("columnShow",column.getListShow()); + // 表单显示 + listMap.put("formShow",column.getFormShow()); + // 表单组件类型 + listMap.put("formType", StringUtils.isNotBlank(column.getFormType()) ? column.getFormType() : "Input"); + // 小写开头的字段名称 + listMap.put("changeColumnName",changeColumnName); + //大写开头的字段名称 + listMap.put("capitalColumnName",capitalColumnName); + // 字典名称 + listMap.put("dictName",column.getDictName()); + // 日期注解 + listMap.put("dateAnnotation",column.getDateAnnotation()); + if(StringUtils.isNotBlank(column.getDateAnnotation())){ + genMap.put("hasDateAnnotation",true); + } + // 添加非空字段信息 + if(column.getNotNull()){ + isNotNullColumns.add(listMap); + } + // 判断是否有查询,如有则把查询的字段set进columnQuery + if(!StringUtils.isBlank(column.getQueryType())){ + // 查询类型 + listMap.put("queryType",column.getQueryType()); + // 是否存在查询 + genMap.put("hasQuery",true); + if(DATE.equals(colType)){ + // 查询中存储 Timestamp 类型 + genMap.put("queryHasDateTime",true); + } + if(BIGDECIMAL.equals(colType)){ + // 查询中存储 BigDecimal 类型 + genMap.put("queryHasBigDecimal",true); + } + if("between".equalsIgnoreCase(column.getQueryType())){ + betweens.add(listMap); + } else { + // 添加到查询列表中 + queryColumns.add(listMap); + } + } + // 添加到字段列表中 + columns.add(listMap); + } + // 保存字段列表 + genMap.put("columns",columns); + // 保存查询列表 + genMap.put("queryColumns",queryColumns); + // 保存字段列表 + genMap.put("dicts",dicts); + // 保存查询列表 + genMap.put("betweens",betweens); + // 保存非空字段信息 + genMap.put("isNotNullColumns",isNotNullColumns); + return genMap; + } + + /** + * 定义后端文件路径以及名称 + */ + private static String getAdminFilePath(String templateName, GenConfig genConfig, String className, String rootPath) { + String projectPath = rootPath + File.separator + genConfig.getModuleName(); + String packagePath = projectPath + File.separator + "src" +File.separator+ "main" + File.separator + "java" + File.separator; + if (!ObjectUtils.isEmpty(genConfig.getPack())) { + packagePath += genConfig.getPack().replace(".", File.separator) + File.separator; + } + + if ("Entity".equals(templateName)) { + return packagePath + "domain" + File.separator + className + ".java"; + } + if ("EntityP".equals(templateName)) { + return packagePath + "domain" + File.separator + className + ".java"; + } + if ("Controller".equals(templateName)) { + return packagePath + "rest" + File.separator + className + "Controller.java"; + } + if ("ControllerP".equals(templateName)) { + return packagePath + "rest" + File.separator + className + "Controller.java"; + } + if ("Service".equals(templateName)) { + return packagePath + "service" + File.separator + className + "Service.java"; + } + if ("ServiceP".equals(templateName)) { + return packagePath + "service" + File.separator + className + "Service.java"; + } + + if ("ServiceImpl".equals(templateName)) { + return packagePath + "service" + File.separator + "impl" + File.separator + className + "ServiceImpl.java"; + } + if ("ServiceImplP".equals(templateName)) { + return packagePath + "service" + File.separator + "impl" + File.separator + className + "ServiceImpl.java"; + } + + if ("Dto".equals(templateName)) { + return packagePath + "service" + File.separator + "dto" + File.separator + className + "Dto.java"; + } + if ("DtoP".equals(templateName)) { + return packagePath + "service" + File.separator + "dto" + File.separator + className + "Dto.java"; + } + + + if ("QueryCriteria".equals(templateName)) { + return packagePath + "service" + File.separator + "dto" + File.separator + className + "QueryCriteria.java"; + } + if ("QueryCriteriaP".equals(templateName)) { + return packagePath + "service" + File.separator + "dto" + File.separator + className + "QueryCriteria.java"; + } + + if ("Mapper".equals(templateName)) { + return packagePath + "service" + File.separator + "mapper" + File.separator + className + "Mapper.java"; + } + if ("MapperP".equals(templateName)) { + return packagePath + "service" + File.separator + "mapper" + File.separator + className + "Mapper.java"; + } + + if ("Repository".equals(templateName)) { + return packagePath + "repository" + File.separator + className + "Repository.java"; + } + + return null; + } + + /** + * 定义前端文件路径以及名称 + */ + private static String getFrontFilePath(String templateName, String apiPath, String path, String apiName) { + + if ("api".equals(templateName)) { + return apiPath + File.separator + apiName + ".js"; + } + + if ("index".equals(templateName)) { + return path + File.separator + "index.vue"; + } + + return null; + } + + private static void genFile(File file, Template template, Map map) throws IOException { + // 生成目标文件 + Writer writer = null; + try { + FileUtil.touch(file); + writer = new FileWriter(file); + template.render(map, writer); + } catch (TemplateException | IOException e) { + throw new RuntimeException(e); + } finally { + assert writer != null; + writer.close(); + } + } +} diff --git a/yshop-logging/pom.xml b/yshop-logging/pom.xml new file mode 100644 index 0000000..7b556ba --- /dev/null +++ b/yshop-logging/pom.xml @@ -0,0 +1,28 @@ + + + + yshop + co.yixiang + 3.2 + + 4.0.0 + + yshop-logging + 日志模块 + + + + co.yixiang + yshop-common + 3.2 + + + co.yixiang + yshop-mproot + 3.2 + compile + + + diff --git a/yshop-logging/src/main/java/co/yixiang/logging/aop/log/AppLog.java b/yshop-logging/src/main/java/co/yixiang/logging/aop/log/AppLog.java new file mode 100644 index 0000000..1a53239 --- /dev/null +++ b/yshop-logging/src/main/java/co/yixiang/logging/aop/log/AppLog.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.logging.aop.log; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author hupeng + * @date 2018-11-24 + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface AppLog { + String value() default ""; + int type() default 0; +} diff --git a/yshop-logging/src/main/java/co/yixiang/logging/aop/log/Log.java b/yshop-logging/src/main/java/co/yixiang/logging/aop/log/Log.java new file mode 100644 index 0000000..b8e5340 --- /dev/null +++ b/yshop-logging/src/main/java/co/yixiang/logging/aop/log/Log.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.logging.aop.log; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author hupeng + * @date 2018-11-24 + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Log { + String value() default ""; + int type() default 0; +} diff --git a/yshop-logging/src/main/java/co/yixiang/logging/aspect/LogAspect.java b/yshop-logging/src/main/java/co/yixiang/logging/aspect/LogAspect.java new file mode 100644 index 0000000..eff2a00 --- /dev/null +++ b/yshop-logging/src/main/java/co/yixiang/logging/aspect/LogAspect.java @@ -0,0 +1,101 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.logging.aspect; + +import co.yixiang.logging.domain.Log; +import co.yixiang.logging.service.LogService; +import co.yixiang.utils.RequestHolder; +import co.yixiang.utils.SecurityUtils; +import co.yixiang.utils.StringUtils; +import co.yixiang.utils.ThrowableUtil; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.AfterThrowing; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; + +/** + * @author hupeng + * @date 2018-11-24 + */ +@Component +@Aspect +@Slf4j +public class LogAspect { + + private final LogService logService; + + ThreadLocal currentTime = new ThreadLocal<>(); + + public LogAspect(LogService logService) { + this.logService = logService; + } + + /** + * 配置切入点 + */ + @Pointcut("@annotation(co.yixiang.logging.aop.log.Log)") + public void logPointcut() { + // 该方法无方法体,主要为了让同类中其他方法使用此切入点 + } + + /** + * 配置环绕通知,使用在方法logPointcut()上注册的切入点 + * + * @param joinPoint join point for advice + */ + @Around("logPointcut()") + public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable { + Object result; + currentTime.set(System.currentTimeMillis()); + result = joinPoint.proceed(); + Log log = new Log("INFO",System.currentTimeMillis() - currentTime.get()); + currentTime.remove(); + HttpServletRequest request = RequestHolder.getHttpServletRequest(); + logService.save(getUsername(), + StringUtils.getIp(RequestHolder.getHttpServletRequest()),joinPoint, + log,getUid()); + return result; + } + + /** + * 配置异常通知 + * + * @param joinPoint join point for advice + * @param e exception + */ + @AfterThrowing(pointcut = "logPointcut()", throwing = "e") + public void logAfterThrowing(JoinPoint joinPoint, Throwable e) { + Log log = new Log("ERROR",System.currentTimeMillis() - currentTime.get()); + currentTime.remove(); + log.setExceptionDetail(ThrowableUtil.getStackTrace(e).getBytes()); + HttpServletRequest request = RequestHolder.getHttpServletRequest(); + logService.save(getUsername(), + StringUtils.getIp(RequestHolder.getHttpServletRequest()), + (ProceedingJoinPoint)joinPoint, log,getUid()); + } + + public String getUsername() { + try { + return SecurityUtils.getUsername(); + }catch (Exception e){ + return ""; + } + } + + public Long getUid(){ + try { + return SecurityUtils.getUserId(); + }catch (Exception e){ + return 0L; + } + } +} diff --git a/yshop-logging/src/main/java/co/yixiang/logging/domain/Log.java b/yshop-logging/src/main/java/co/yixiang/logging/domain/Log.java new file mode 100644 index 0000000..edf80e1 --- /dev/null +++ b/yshop-logging/src/main/java/co/yixiang/logging/domain/Log.java @@ -0,0 +1,71 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.logging.domain; + +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * @author hupeng + * @date 2018-11-24 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("log") +@NoArgsConstructor +public class Log extends BaseDomain { + + @TableId + private Long id; + + /** 操作用户 */ + private String username; + + @TableField(exist = false) + private String nickname; + + /** 描述 */ + private String description; + + /** 方法名 */ + private String method; + + private Long uid; + + private Integer type; + + /** 参数 */ + private String params; + + /** 日志类型 */ + private String logType; + + /** 请求ip */ + private String requestIp; + + /** 地址 */ + private String address; + + /** 浏览器 */ + private String browser; + + /** 请求耗时 */ + private Long time; + + /** 异常详细 */ + private byte[] exceptionDetail; + + + public Log(String logType, Long time) { + this.logType = logType; + this.time = time; + } +} diff --git a/yshop-logging/src/main/java/co/yixiang/logging/rest/LogController.java b/yshop-logging/src/main/java/co/yixiang/logging/rest/LogController.java new file mode 100644 index 0000000..1270d58 --- /dev/null +++ b/yshop-logging/src/main/java/co/yixiang/logging/rest/LogController.java @@ -0,0 +1,114 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.logging.rest; + +import co.yixiang.logging.aop.log.Log; +import co.yixiang.logging.service.LogService; +import co.yixiang.logging.service.dto.LogQueryCriteria; +import co.yixiang.utils.SecurityUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @author hupeng + * @date 2018-11-24 + */ +@RestController +@RequestMapping("/api/logs") +@Api(tags = "监控:日志管理") +@SuppressWarnings("unchecked") +public class LogController { + + private final LogService logService; + + public LogController(LogService logService) { + this.logService = logService; + } + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('admin','log:list')") + public void download(HttpServletResponse response, LogQueryCriteria criteria) throws IOException { + criteria.setLogType("INFO"); + logService.download(logService.queryAll(criteria), response); + } + + @Log("导出错误数据") + @ApiOperation("导出错误数据") + @GetMapping(value = "/error/download") + @PreAuthorize("@el.check('admin','log:list')") + public void errorDownload(HttpServletResponse response, LogQueryCriteria criteria) throws IOException { + criteria.setLogType("ERROR"); + logService.download(logService.queryAll(criteria), response); + } + @GetMapping + @ApiOperation("日志查询") + @PreAuthorize("@el.check('admin','log:list')") + public ResponseEntity getLogs(LogQueryCriteria criteria, Pageable pageable){ + criteria.setLogType("INFO"); + criteria.setType(0); + return new ResponseEntity<>(logService.queryAll(criteria,pageable), HttpStatus.OK); + } + @GetMapping(value = "/mlogs") + @PreAuthorize("@el.check('admin','log:list')") + public ResponseEntity getApiLogs(LogQueryCriteria criteria, Pageable pageable){ + criteria.setLogType("INFO"); + criteria.setType(1); + return new ResponseEntity(logService.findAllByPageable(criteria.getBlurry(),pageable), HttpStatus.OK); + } + @GetMapping(value = "/user") + @ApiOperation("用户日志查询") + public ResponseEntity getUserLogs(LogQueryCriteria criteria, Pageable pageable){ + criteria.setLogType("INFO"); + criteria.setBlurry(SecurityUtils.getUsername()); + return new ResponseEntity<>(logService.queryAllByUser(criteria,pageable), HttpStatus.OK); + } + + @GetMapping(value = "/error") + @ApiOperation("错误日志查询") + @PreAuthorize("@el.check('admin','logError:list')") + public ResponseEntity getErrorLogs(LogQueryCriteria criteria, Pageable pageable){ + criteria.setLogType("ERROR"); + return new ResponseEntity<>(logService.queryAll(criteria,pageable), HttpStatus.OK); + } + + @GetMapping(value = "/error/{id}") + @ApiOperation("日志异常详情查询") + @PreAuthorize("@el.check('admin','logError:detail')") + public ResponseEntity getErrorLogs(@PathVariable Long id){ + return new ResponseEntity<>(logService.findByErrDetail(id), HttpStatus.OK); + } + @DeleteMapping(value = "/del/error") + @Log("删除所有ERROR日志") + @ApiOperation("删除所有ERROR日志") + @PreAuthorize("@el.check('admin','logError:remove')") + public ResponseEntity delAllByError(){ + logService.delAllByError(); + return new ResponseEntity<>(HttpStatus.OK); + } + + @DeleteMapping(value = "/del/info") + @Log("删除所有INFO日志") + @ApiOperation("删除所有INFO日志") + @PreAuthorize("@el.check('admin','logInfo:remove')") + public ResponseEntity delAllByInfo(){ + logService.delAllByInfo(); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-logging/src/main/java/co/yixiang/logging/service/LogService.java b/yshop-logging/src/main/java/co/yixiang/logging/service/LogService.java new file mode 100644 index 0000000..a8485ed --- /dev/null +++ b/yshop-logging/src/main/java/co/yixiang/logging/service/LogService.java @@ -0,0 +1,94 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.logging.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.logging.domain.Log; +import co.yixiang.logging.service.dto.LogQueryCriteria; +import org.aspectj.lang.ProceedingJoinPoint; +import org.springframework.data.domain.Pageable; +import org.springframework.scheduling.annotation.Async; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + * @author hupeng + * @date 2018-11-24 + */ +public interface LogService extends BaseService { + + + + Object findAllByPageable(String nickname, Pageable pageable); + /** + * 分页查询 + * @param criteria 查询条件 + * @param pageable 分页参数 + * @return / + */ + Object queryAll(LogQueryCriteria criteria, Pageable pageable); + + /** + * 查询全部数据 + * @param criteria 查询条件 + * @return / + */ + List queryAll(LogQueryCriteria criteria); + + /** + * 查询用户日志 + * @param criteria 查询条件 + * @param pageable 分页参数 + * @return - + */ + Object queryAllByUser(LogQueryCriteria criteria, Pageable pageable); + + /** + * 保存日志数据 + * @param username 用户 + * @param ip 请求IP + * @param joinPoint / + * @param log 日志实体 + */ + @Async + void save(String username, String ip, ProceedingJoinPoint joinPoint, Log log,Long uid); + + /** + * 保存app日志数据 + * @param username 用户 + * @param ip 请求IP + * @param joinPoint / + * @param log 日志实体 + */ + @Async + void saveApp(String username, String ip, ProceedingJoinPoint joinPoint, Log log,Long uid); + /** + * 查询异常详情 + * @param id 日志ID + * @return Object + */ + Object findByErrDetail(Long id); + + /** + * 导出日志 + * @param logs 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List logs, HttpServletResponse response) throws IOException; + + /** + * 删除所有错误日志 + */ + void delAllByError(); + + /** + * 删除所有INFO日志 + */ + void delAllByInfo(); +} diff --git a/yshop-logging/src/main/java/co/yixiang/logging/service/dto/LogErrorDTO.java b/yshop-logging/src/main/java/co/yixiang/logging/service/dto/LogErrorDTO.java new file mode 100644 index 0000000..799d9df --- /dev/null +++ b/yshop-logging/src/main/java/co/yixiang/logging/service/dto/LogErrorDTO.java @@ -0,0 +1,37 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.logging.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @author hupeng +* @date 2019-5-22 +*/ +@Data +public class LogErrorDTO implements Serializable { + + private Long id; + + private String username; + + private String description; + + private String method; + + private String params; + + private String browser; + + private String requestIp; + + private String address; + + private Timestamp createTime; +} diff --git a/yshop-logging/src/main/java/co/yixiang/logging/service/dto/LogQueryCriteria.java b/yshop-logging/src/main/java/co/yixiang/logging/service/dto/LogQueryCriteria.java new file mode 100644 index 0000000..fdec194 --- /dev/null +++ b/yshop-logging/src/main/java/co/yixiang/logging/service/dto/LogQueryCriteria.java @@ -0,0 +1,34 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.logging.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +import java.sql.Timestamp; +import java.util.List; + +/** + * 日志查询类 + * @author hupeng + * @date 2019-6-4 09:23:07 + */ +@Data +public class LogQueryCriteria { + + @Query(blurry = "username,description,address,requestIp,method,params") + private String blurry; + + @Query + private String logType; + + @Query(type = Query.Type.BETWEEN) + private List createTime; + + + @Query + private Integer type; +} diff --git a/yshop-logging/src/main/java/co/yixiang/logging/service/dto/LogSmallDTO.java b/yshop-logging/src/main/java/co/yixiang/logging/service/dto/LogSmallDTO.java new file mode 100644 index 0000000..a1f0526 --- /dev/null +++ b/yshop-logging/src/main/java/co/yixiang/logging/service/dto/LogSmallDTO.java @@ -0,0 +1,31 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.logging.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * @author hupeng + * @date 2019-5-22 + */ +@Data +public class LogSmallDTO implements Serializable { + + private String description; + + private String requestIp; + + private Long time; + + private String address; + + private String browser; + + private Timestamp createTime; +} diff --git a/yshop-logging/src/main/java/co/yixiang/logging/service/impl/LogServiceImpl.java b/yshop-logging/src/main/java/co/yixiang/logging/service/impl/LogServiceImpl.java new file mode 100644 index 0000000..6f50a07 --- /dev/null +++ b/yshop-logging/src/main/java/co/yixiang/logging/service/impl/LogServiceImpl.java @@ -0,0 +1,238 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.logging.service.impl; + +import cn.hutool.core.lang.Dict; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.json.JSONObject; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.logging.aop.log.AppLog; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.logging.service.LogService; +import co.yixiang.logging.service.dto.LogErrorDTO; +import co.yixiang.logging.service.dto.LogQueryCriteria; +import co.yixiang.logging.service.dto.LogSmallDTO; +import co.yixiang.logging.service.mapper.LogMapper; +import co.yixiang.utils.FileUtil; +import co.yixiang.utils.StringUtils; +import co.yixiang.utils.ValidationUtil; +import com.github.pagehelper.PageInfo; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * @author hupeng + * @date 2018-11-24 + */ +@SuppressWarnings("unchecked") +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class LogServiceImpl extends BaseServiceImpl implements LogService { + + + private final LogMapper logMapper; + + private final IGenerator generator; + + public LogServiceImpl(LogMapper logMapper, IGenerator generator) { + this.logMapper = logMapper; + this.generator = generator; + } + + @Override + public Object findAllByPageable(String nickname, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(logMapper.findAllByPageable(nickname)); + Map map = new LinkedHashMap<>(2); + map.put("content",page.getList()); + map.put("totalElements",page.getTotal()); + return map; + } + + + @Override + public Object queryAll(LogQueryCriteria criteria, Pageable pageable){ + + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + String status = "ERROR"; + if(status.equals(criteria.getLogType())){ + map.put("content", generator.convert(page.getList(), LogErrorDTO.class)); + map.put("totalElements", page.getTotal()); + } + map.put("content", page.getList()); + map.put("totalElements", page.getTotal()); + return map; + } + + @Override + public List queryAll(LogQueryCriteria criteria) { + return baseMapper.selectList(QueryHelpPlus.getPredicate(co.yixiang.logging.domain.Log.class, criteria)); + } + + @Override + public Object queryAllByUser(LogQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), LogSmallDTO.class)); + map.put("totalElements", page.getTotal()); + return map; + + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(String username, String ip, ProceedingJoinPoint joinPoint, + co.yixiang.logging.domain.Log log, Long uid){ + + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + Method method = signature.getMethod(); + Log aopLog = method.getAnnotation(Log.class); + + // 方法路径 + String methodName = joinPoint.getTarget().getClass().getName()+"."+signature.getName()+"()"; + + StringBuilder params = new StringBuilder("{"); + //参数值 + Object[] argValues = joinPoint.getArgs(); + //参数名称 + String[] argNames = ((MethodSignature)joinPoint.getSignature()).getParameterNames(); + if(argValues != null){ + for (int i = 0; i < argValues.length; i++) { + params.append(" ").append(argNames[i]).append(": ").append(argValues[i]); + } + } + // 描述 + if (log != null) { + log.setDescription(aopLog.value()); + } + //类型 0-后台 1-前台 + log.setType(aopLog.type()); + if(uid != null) { + log.setUid(uid); + } + assert log != null; + log.setRequestIp(ip); + + String loginPath = "login"; + if(loginPath.equals(signature.getName())){ + try { + assert argValues != null; + username = new JSONObject(argValues[0]).get("username").toString(); + }catch (Exception e){ + e.printStackTrace(); + } + } + log.setAddress(StringUtils.getCityInfo(log.getRequestIp())); + log.setMethod(methodName); + log.setUsername(username); + log.setParams(params.toString() + " }"); + this.save(log); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void saveApp(String username, String ip, ProceedingJoinPoint joinPoint, + co.yixiang.logging.domain.Log log, Long uid){ + + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + Method method = signature.getMethod(); + AppLog aopLog = method.getAnnotation(AppLog.class); + + // 方法路径 + String methodName = joinPoint.getTarget().getClass().getName()+"."+signature.getName()+"()"; + + StringBuilder params = new StringBuilder("{"); + //参数值 + Object[] argValues = joinPoint.getArgs(); + //参数名称 + String[] argNames = ((MethodSignature)joinPoint.getSignature()).getParameterNames(); + if(argValues != null){ + for (int i = 0; i < argValues.length; i++) { + params.append(" ").append(argNames[i]).append(": ").append(argValues[i]); + } + } + // 描述 + if (log != null) { + log.setDescription(aopLog.value()); + } + //类型 0-后台 1-前台 + log.setType(aopLog.type()); + if(uid != null) { + log.setUid(uid); + } + assert log != null; + log.setRequestIp(ip); + + String loginPath = "login"; + if(loginPath.equals(signature.getName())){ + try { + assert argValues != null; + username = new JSONObject(argValues[0]).get("username").toString(); + }catch (Exception e){ + e.printStackTrace(); + } + } + log.setAddress(StringUtils.getCityInfo(log.getRequestIp())); + log.setMethod(methodName); + log.setUsername(username); + log.setParams(params.toString() + " }"); + this.save(log); + } + @Override + public Object findByErrDetail(Long id) { + co.yixiang.logging.domain.Log log = this.getById(id); + ValidationUtil.isNull( log.getId(),"Log","id", id); + byte[] details = log.getExceptionDetail(); + return Dict.create().set("exception",new String(ObjectUtil.isNotNull(details) ? details : "".getBytes())); + } + + @Override + public void download(List logs, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (co.yixiang.logging.domain.Log log : logs) { + Map map = new LinkedHashMap<>(); + map.put("用户名", log.getUsername()); + map.put("IP", log.getRequestIp()); + map.put("IP来源", log.getAddress()); + map.put("描述", log.getDescription()); + map.put("浏览器", log.getBrowser()); + map.put("请求耗时/毫秒", log.getTime()); + map.put("异常详情", new String(ObjectUtil.isNotNull(log.getExceptionDetail()) ? log.getExceptionDetail() : "".getBytes())); + map.put("创建日期", log.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delAllByError() { + logMapper.deleteByLogType("ERROR"); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delAllByInfo() { + logMapper.deleteByLogType("INFO"); + } +} diff --git a/yshop-logging/src/main/java/co/yixiang/logging/service/mapper/LogMapper.java b/yshop-logging/src/main/java/co/yixiang/logging/service/mapper/LogMapper.java new file mode 100644 index 0000000..da2f7c7 --- /dev/null +++ b/yshop-logging/src/main/java/co/yixiang/logging/service/mapper/LogMapper.java @@ -0,0 +1,34 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.logging.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.logging.domain.Log; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * @author hupeng + * @date 2019-5-22 + */ +@Repository +@Mapper +public interface LogMapper extends CoreMapper { + + @Delete("delete from log where log_type = #{logType}") + void deleteByLogType(@Param("logType") String logType); + @Select("") + List findAllByPageable(@Param("nickname") String nickname); + @Select( "select count(*) FROM (select request_ip FROM log where create_time between #{date1} and #{date2} GROUP BY request_ip) as s") + long findIp(@Param("date1") String date1, @Param("date2")String date2); +} diff --git a/yshop-mall/pom.xml b/yshop-mall/pom.xml new file mode 100644 index 0000000..3b00a34 --- /dev/null +++ b/yshop-mall/pom.xml @@ -0,0 +1,24 @@ + + + + yshop + co.yixiang + 3.2 + + 4.0.0 + + yshop-mall + 商城公共数据模块 + + + + co.yixiang + yshop-tools + 3.2 + + + + + diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreBargain.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreBargain.java new file mode 100644 index 0000000..1a4f848 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreBargain.java @@ -0,0 +1,210 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.DecimalMax; +import javax.validation.constraints.DecimalMin; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName(value="yx_store_bargain") +public class YxStoreBargain extends BaseDomain { + + /** 砍价产品ID */ + @TableId + @ApiModelProperty(value = "砍价产品ID") + private Long id; + + + /** 关联产品ID */ + @ApiModelProperty(value = "关联产品ID") + private Long productId; + + + /** 砍价活动名称 */ + @NotBlank(message = "请填写砍价名称") + @ApiModelProperty(value = "砍价产品名称") + private String title; + + + /** 砍价活动图片 */ + @NotBlank(message = "请上传商品图片") + @ApiModelProperty(value = "砍价产品图片") + private String image; + + + /** 单位名称 */ + @ApiModelProperty(value = "砍价产品单位名称") + private String unitName; + + + /** 库存 */ + @NotNull(message = "请输入库存") + @Min(message = "库存不能小于0",value = 1) + @ApiModelProperty(value = "砍价产品库存") + private Integer stock; + + + /** 销量 */ + @ApiModelProperty(value = "砍价产品销量") + private Integer sales; + + + /** 砍价产品轮播图 */ + @NotBlank(message = "请上传商品轮播图") + @ApiModelProperty(value = "砍价产品轮播图") + private String images; + + + /** 砍价开启时间 */ + @NotNull(message = "请选择开始时间") + @ApiModelProperty(value = "砍价产品开始时间") + private Date startTime; + + + /** 砍价结束时间 */ + @NotNull(message = "请选择结束时间") + @ApiModelProperty(value = "砍价产品结束时间") + private Date stopTime; + + + /** 砍价产品名称 */ + @ApiModelProperty(value = "砍价产品名称") + private String storeName; + + + /** 砍价金额 */ + @NotNull(message = "请输入砍价金额") + @DecimalMin(value="0.00", message = "砍价金额不在合法范围内" ) + @DecimalMax(value="99999999.99", message = "砍价金额不在合法范围内") + @ApiModelProperty(value = "砍价产品砍价金额") + private BigDecimal price; + + + /** 砍价商品最低价 */ + @NotNull(message = "请输入砍到最低价") + @DecimalMin(value="0.00", message = "砍到最低价不在合法范围内" ) + @DecimalMax(value="99999999.99", message = "砍到最低价不在合法范围内") + @ApiModelProperty(value = "砍价商品最低价") + private BigDecimal minPrice; + + + /** 每次购买的砍价产品数量 */ + @NotNull(message = "请输入限购数量") + @Min(message = "限购不能小于0",value = 1) + @ApiModelProperty(value = "每次购买的砍价产品数量") + private Integer num; + + + /** 用户每次砍价的最大金额 */ + @NotNull(message = "请输入单次砍最高价") + @DecimalMin(value="0.00", message = "单次砍最高价不在合法范围内" ) + @DecimalMax(value="99999999.99", message = "单次砍最高价不在合法范围内") + @ApiModelProperty(value = "用户每次砍价的最大金额") + private BigDecimal bargainMaxPrice; + + + /** 用户每次砍价的最小金额 */ + @NotNull(message = "请输入单次砍最低价") + @DecimalMin(value="0.00", message = "单次砍最低价不在合法范围内" ) + @DecimalMax(value="99999999.99", message = "单次砍最低价小金额不在合法范围内") + @ApiModelProperty(value = "用户每次砍价的最小金额") + private BigDecimal bargainMinPrice; + + + /** 用户每次砍价的次数 */ + @NotNull(message = "请输入砍价的次数") + @Min(message = "砍价的次数不能小于0",value = 1) + @ApiModelProperty(value = "用户每次砍价的次数") + private Integer bargainNum; + + + /** 砍价状态 0(到砍价时间不自动开启) 1(到砍价时间自动开启时间) */ + @ApiModelProperty(value = "砍价状态 0(到砍价时间不自动开启) 1(到砍价时间自动开启时间)") + private Integer status; + + + /** 砍价详情 */ + @NotBlank(message = "请填写详情") + @ApiModelProperty(value = "砍价详情") + private String description; + + + /** 返多少积分 */ + @ApiModelProperty(value = "返多少积分") + private BigDecimal giveIntegral; + + + /** 砍价活动简介 */ + @ApiModelProperty(value = "砍价产品简介") + private String info; + + + /** 成本价 */ + @ApiModelProperty(value = "成本价") + private BigDecimal cost; + + + /** 排序 */ + @ApiModelProperty(value = "排序") + private Integer sort; + + + /** 是否推荐0不推荐1推荐 */ + @ApiModelProperty(value = "是否推荐0不推荐1推荐") + private Integer isHot; + + + + /** 是否包邮 0不包邮 1包邮 */ + @ApiModelProperty(value = "是否包邮 0不包邮 1包邮") + private Integer isPostage; + + + /** 邮费 */ + @ApiModelProperty(value = "邮费") + private BigDecimal postage; + + + /** 砍价规则 */ + @NotBlank(message = "请填写砍价规则") + @ApiModelProperty(value = "砍价规则描述") + private String rule; + + + /** 砍价产品浏览量 */ + @ApiModelProperty(value = "砍价产品浏览量") + private Integer look; + + + /** 砍价产品分享量 */ + @ApiModelProperty(value = "砍价产品分享量") + private Integer share; + + + + public void copy(YxStoreBargain source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreBargainUser.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreBargainUser.java new file mode 100644 index 0000000..fa537d3 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreBargainUser.java @@ -0,0 +1,58 @@ +package co.yixiang.modules.activity.domain; + + +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +/** + *

+ * 用户参与砍价表 + *

+ * + * @author hupeng + * @since 2019-12-21 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel(value = "YxStoreBargainUser对象", description = "用户参与砍价表") +public class YxStoreBargainUser extends BaseDomain { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "用户参与砍价表ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty(value = "用户ID") + private Long uid; + + @ApiModelProperty(value = "砍价产品id") + private Long bargainId; + + @ApiModelProperty(value = "砍价的最低价") + private BigDecimal bargainPriceMin; + + @ApiModelProperty(value = "砍价金额") + private BigDecimal bargainPrice; + + @ApiModelProperty(value = "砍掉的价格") + private BigDecimal price; + + @ApiModelProperty(value = "状态 1参与中 2 活动结束参与失败 3活动结束参与成功") + private Integer status; + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreBargainUserHelp.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreBargainUserHelp.java new file mode 100644 index 0000000..19b4123 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreBargainUserHelp.java @@ -0,0 +1,51 @@ +package co.yixiang.modules.activity.domain; + + +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +/** + *

+ * 砍价用户帮助表 + *

+ * + * @author hupeng + * @since 2019-12-21 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel(value = "YxStoreBargainUserHelp对象", description = "砍价用户帮助表") +public class YxStoreBargainUserHelp extends BaseDomain { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "砍价用户帮助表ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty(value = "帮助的用户id") + private Long uid; + + @ApiModelProperty(value = "砍价产品ID") + private Long bargainId; + + @ApiModelProperty(value = "用户参与砍价表id") + private Long bargainUserId; + + @ApiModelProperty(value = "帮助砍价多少金额") + private BigDecimal price; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreCombination.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreCombination.java new file mode 100644 index 0000000..e193124 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreCombination.java @@ -0,0 +1,195 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import co.yixiang.modules.product.service.dto.FromatDetailDto; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.DecimalMax; +import javax.validation.constraints.DecimalMin; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("yx_store_combination") +public class YxStoreCombination extends BaseDomain { + + @TableId + @ApiModelProperty(value = "拼团产品ID") + private Long id; + + + /** 商品id */ + @ApiModelProperty(value = "关联产品ID") + private Long productId; + + + /** 商户id */ + @ApiModelProperty(value = "商户id 预留字段") + private Integer merId; + + + /** 推荐图 */ + @NotBlank(message = "请上传商品图片") + @ApiModelProperty(value = "推荐图") + private String image; + + + /** 轮播图 */ + @NotBlank(message = "请上传商品轮播") + @ApiModelProperty(value = "轮播图") + private String images; + + + /** 活动标题 */ + @NotBlank(message = "请填写拼团名称") + @ApiModelProperty(value = "拼团产品名称") + private String title; + + + + /** 参团人数 */ + @NotNull(message = "请输入拼团人数") + @Min(message = "拼团人数小于0",value = 1) + @ApiModelProperty(value = "拼团产品拼团人数") + private Integer people; + + + /** 简介 */ + @ApiModelProperty(value = "拼团产品简介") + private String info; + + + /** 价格 */ + @NotNull(message = "请输入拼团价") + @DecimalMin(value="0.00", message = "拼团价不在合法范围内" ) + @DecimalMax(value="99999999.99", message = "拼团价不在合法范围内") + @ApiModelProperty(value = "拼团产品拼团价") + private BigDecimal price; + + private BigDecimal productPrice; + + + /** 排序 */ + @ApiModelProperty(value = "排序") + private Integer sort; + + + /** 销量 */ + @ApiModelProperty(value = "销量") + private Integer sales; + + + /** 库存 */ + @NotNull(message = "请输入库存") + @Min(message = "库存不能小于0",value = 1) + private Integer stock; + + + /** 推荐 */ + @ApiModelProperty(value = "是否推荐0不推荐1推荐") + private Integer isHost; + + + /** 产品状态 */ + @ApiModelProperty(value = "拼团产品状态0不显示 1显示") + private Integer isShow; + + + private Integer combination; + + + /** 商户是否可用1可用0不可用 */ + @ApiModelProperty(value = "商户是否可用1可用0不可用 预留字段") + private Integer merUse; + + + /** 拼团内容 */ + @NotBlank(message = "请填写详情") + @ApiModelProperty(value = "拼团产品详情") + private String description; + + + /** 拼团开始时间 */ + @NotNull(message = "请选择结束时间") + @ApiModelProperty(value = "拼团产品结束时间") + private Date startTime; + + + /** 拼团结束时间 */ + @NotNull(message = "请选择开始时间") + @ApiModelProperty(value = "拼团产品开始时间") + private Date stopTime; + + + /** 拼团订单有效时间 */ + @NotNull(message = "请输入拼团时效") + @Min(message = "拼团时效不能小于0",value = 1) + @ApiModelProperty(value = "拼团订单有效时间") + private Integer effectiveTime; + + + /** 拼团产品成本价 */ + @ApiModelProperty(value = "拼团产品成本价") + private Integer cost; + + + /** 浏览量 */ + @ApiModelProperty(value = "拼团产品浏览量") + private Integer browse; + + + /** 单位名 */ + @ApiModelProperty(value = "拼团产品单位名") + private String unitName; + + /** + * 规格 0单 1多 + */ + @ApiModelProperty(value = "拼团产品规格 0单规格 1多规格") + private Integer specType; + + /** 运费模板ID */ + @JsonProperty("temp_id") + @ApiModelProperty(value = "运费模板ID") + private Long tempId; + + + /** 属性项目 */ + @TableField(exist = false) + @ApiModelProperty(value = "属性项目") + private List items; + + /** sku结果集 */ + @TableField(exist = false) + private List> attrs; + + + + public void copy(YxStoreCombination source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreCoupon.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreCoupon.java new file mode 100644 index 0000000..5ed8595 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreCoupon.java @@ -0,0 +1,91 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.DecimalMax; +import javax.validation.constraints.DecimalMin; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("yx_store_coupon") +public class YxStoreCoupon extends BaseDomain { + + /** 优惠券表ID */ + @TableId + @ApiModelProperty(value = "优惠券ID") + private Integer id; + + + /** 优惠券名称 */ + @NotBlank(message = "请填写优惠券名称") + @ApiModelProperty(value = "优惠券名称") + private String title; + + + /** 兑换消耗积分值 */ + @ApiModelProperty(value = "兑换消耗积分值") + private Integer integral; + + + /** 兑换的优惠券面值 */ + @DecimalMin(value="0.00", message = "优惠券面值不在合法范围内" ) + @DecimalMax(value="99999999.99", message = "优惠券面值不在合法范围内") + @ApiModelProperty(value = "兑换的优惠券面值") + private BigDecimal couponPrice; + + + /** 最低消费多少金额可用优惠券 */ + @DecimalMin(value="0.00", message = "最低消费不在合法范围内" ) + @DecimalMax(value="99999999.99", message = "最低消费不在合法范围内") + @ApiModelProperty(value = "最低消费多少金额可用优惠券") + private BigDecimal useMinPrice; + + + /** 优惠券有效期限(单位:天) */ + @NotNull(message = "请输入有效期限") + @ApiModelProperty(value = "优惠券有效期限(单位:天)") + private Integer couponTime; + + + /** 排序 */ + @ApiModelProperty(value = "排序") + private Integer sort; + + + /** 状态(0:关闭,1:开启) */ + @ApiModelProperty(value = "优惠券状态(0:关闭,1:开启) ") + private Integer status; + + /** 优惠券类型(0:通用券,1:商品券,2:内部券) */ + @ApiModelProperty(value = "优惠券类型(0:通用券,1:商品券,2:内部券) ") + private Integer type; + + /** 优惠券绑定产品ID */ + @ApiModelProperty(value = "优惠券绑定产品ID ") + private String productId; + + + + public void copy(YxStoreCoupon source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreCouponIssue.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreCouponIssue.java new file mode 100644 index 0000000..0c09b69 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreCouponIssue.java @@ -0,0 +1,83 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotNull; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("yx_store_coupon_issue") +public class YxStoreCouponIssue extends BaseDomain { + + private static final long serialVersionUID = 1L; + + @TableId + @ApiModelProperty(value = "优惠券前台领取ID") + private Integer id; + + @ApiModelProperty(value = "前台显示优惠券名称") + private String cname; + + + /** 优惠券ID */ + @ApiModelProperty(value = "优惠券ID") + private Integer cid; + + @ApiModelProperty(value = "优惠券类型 0-通用 1-商品券") + private Integer ctype; + + + /** 优惠券领取开启时间 */ + @NotNull(message = "请选择开启时间") + @ApiModelProperty(value = "优惠券领取开启时间") + private Date startTime; + + + /** 优惠券领取结束时间 */ + @NotNull(message = "请选择结束时间") + @ApiModelProperty(value = "优惠券领取结束时间") + private Date endTime; + + + /** 优惠券领取数量 */ + @ApiModelProperty(value = "优惠券领取数量") + private Integer totalCount; + + + /** 优惠券剩余领取数量 */ + @ApiModelProperty(value = "优惠券剩余领取数量") + private Integer remainCount; + + + /** 是否无限张数 */ + @ApiModelProperty(value = "是否无限张数1:是 0:否") + private Integer isPermanent; + + + /** 1 正常 0 未开启 -1 已无效 */ + @ApiModelProperty(value = "前台领取优惠券状态1 正常 0 未开启 -1 已无效") + private Integer status; + + + + public void copy(YxStoreCouponIssue source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreCouponIssueUser.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreCouponIssueUser.java new file mode 100644 index 0000000..0b63ac4 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreCouponIssueUser.java @@ -0,0 +1,46 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("yx_store_coupon_issue_user") +public class YxStoreCouponIssueUser extends BaseDomain { + + @TableId + @ApiModelProperty(value = "优惠券前台用户领取记录ID") + private Long id; + + + /** 领取优惠券用户ID */ + @ApiModelProperty(value = "领取优惠券用户ID") + private Long uid; + + + /** 优惠券前台领取ID */ + @ApiModelProperty(value = "优惠券前台领取ID") + private Integer issueCouponId; + + + + + public void copy(YxStoreCouponIssueUser source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreCouponUser.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreCouponUser.java new file mode 100644 index 0000000..12ab159 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreCouponUser.java @@ -0,0 +1,94 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName("yx_store_coupon_user") +public class YxStoreCouponUser extends BaseDomain { + + /** 优惠券发放记录id */ + @TableId + @ApiModelProperty(value = "优惠券发放记录id") + private Long id; + + + /** 兑换的项目id */ + @ApiModelProperty(value = "兑换的项目id") + private Integer cid; + + + /** 优惠券所属用户 */ + @ApiModelProperty(value = "优惠券所属用户") + private Long uid; + + + /** 优惠券名称 */ + @ApiModelProperty(value = "优惠券名称") + private String couponTitle; + + + /** 优惠券的面值 */ + @ApiModelProperty(value = "优惠券的面值") + private BigDecimal couponPrice; + + + /** 最低消费多少金额可用优惠券 */ + @ApiModelProperty(value = "最低消费多少金额可用优惠券") + private BigDecimal useMinPrice; + + + /** 优惠券结束时间 */ + @ApiModelProperty(value = "优惠券结束时间") + private Date endTime; + + + /** 使用时间 */ + @ApiModelProperty(value = "使用时间") + private Date useTime; + + + /** 获取方式 */ + @ApiModelProperty(value = "获取方式:get领取 send派送") + private String type; + + + /** 状态(0:未使用,1:已使用, 2:已过期) */ + @ApiModelProperty(value = "状态(0:未使用,1:已使用, 2:已过期)") + private Integer status; + + + /** 是否有效 */ + @ApiModelProperty(value = "是否有效1是 0否") + private Integer isFail; + + + public void copy(YxStoreCouponUser source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStorePink.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStorePink.java new file mode 100644 index 0000000..347b58c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStorePink.java @@ -0,0 +1,114 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@AllArgsConstructor +@NoArgsConstructor +@Builder +@TableName("yx_store_pink") +public class YxStorePink extends BaseDomain { + + @TableId + @ApiModelProperty(value = "拼团产品ID") + private Long id; + + + /** 用户id */ + @ApiModelProperty(value = "拼团产品用户ID") + private Long uid; + + + /** 订单id 生成 */ + @ApiModelProperty(value = "拼团产品订单ID 生成") + private String orderId; + + + /** 订单id 数据库 */ + @ApiModelProperty(value = "拼团产品订单id 数据库") + private Long orderIdKey; + + + /** 购买商品个数 */ + @ApiModelProperty(value = "购买商品个数") + private Integer totalNum; + + + /** 购买总金额 */ + @ApiModelProperty(value = "购买总金额") + private BigDecimal totalPrice; + + + /** 拼团产品id */ + @ApiModelProperty(value = "拼团产品id") + private Long cid; + + + /** 产品id */ + @ApiModelProperty(value = "产品id") + private Long pid; + + + /** 拼团总人数 */ + @ApiModelProperty(value = "拼团总人数") + private Integer people; + + + /** 拼团产品单价 */ + @ApiModelProperty(value = "拼团产品单价") + private BigDecimal price; + + /** 拼团产品停止时间 */ + @ApiModelProperty(value = "拼团产品停止时间") + private Date stopTime; + + + /** 团长id 0为团长 */ + @ApiModelProperty(value = "拼团产品团长id 0为团长") + private Long kId; + + + /** 是否发送模板消息0未发送1已发送 */ + @ApiModelProperty(value = "是否发送模板消息0未发送1已发送") + private Integer isTpl; + + + /** 是否退款 0未退款 1已退款 */ + @ApiModelProperty(value = "是否退款 0未退款 1已退款") + private Integer isRefund; + + + /** 状态1进行中2已完成3未完成 */ + @ApiModelProperty(value = "状态1进行中2已完成3未完成") + private Integer status; + + @ApiModelProperty(value = "库存唯一值") + private String uniqueId; + + public void copy(YxStorePink source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreSeckill.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreSeckill.java new file mode 100644 index 0000000..bf42c79 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreSeckill.java @@ -0,0 +1,193 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import co.yixiang.modules.product.service.dto.FromatDetailDto; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.DecimalMax; +import javax.validation.constraints.DecimalMin; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * 商品秒杀产品表 +* @author hupeng +* @date 2020-05-13 +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("yx_store_seckill") +public class YxStoreSeckill extends BaseDomain { + + /** 商品秒杀产品表id */ + @TableId + @ApiModelProperty(value = "商品秒杀产品表id") + private Long id; + + + /** 商品id */ + @ApiModelProperty(value = "商品id") + private Long productId; + + + /** 推荐图 */ + @NotBlank(message = "请上传商品图片") + @ApiModelProperty(value = "推荐图") + private String image; + + + /** 轮播图 */ + @NotBlank(message = "请上传商品轮播") + @ApiModelProperty(value = "轮播图") + private String images; + + + /** 活动标题 */ + @NotBlank(message = "请填写秒杀名称") + @ApiModelProperty(value = "秒杀名称") + private String title; + + + /** 简介 */ + @ApiModelProperty(value = "简介") + private String info; + + + /** 返多少积分 */ + @ApiModelProperty(value = "返多少积分") + private BigDecimal giveIntegral; + + + /** 排序 */ + @ApiModelProperty(value = "排序") + private Integer sort; + + + /** 库存 */ + @ApiModelProperty(value = "秒杀库存") + private Integer stock; + + /** 秒杀价 */ + @ApiModelProperty(value = "秒杀价") + private BigDecimal price; + + /** 原价 */ + @ApiModelProperty(value = "原价") + private BigDecimal otPrice; + + /** 成本 */ + @ApiModelProperty(value = "成本") + private BigDecimal cost; + /** 销量 */ + @ApiModelProperty(value = "秒杀销量") + private Integer sales; + + + /** 单位名 */ + @ApiModelProperty(value = "单位名") + private String unitName; + + + /** 邮费 */ + @ApiModelProperty(value = "邮费") + private BigDecimal postage; + + + + + /** 内容 */ + @NotBlank(message = "请填写详情") + @ApiModelProperty(value = "详细内容") + private String description; + + + /** 开始时间 */ + @NotNull(message = "请选择秒杀开始时间") + @ApiModelProperty(value = "秒杀开始时间") + private Date startTime; + + + /** 结束时间 */ + @NotNull(message = "请选择秒杀结束时间") + @ApiModelProperty(value = "秒杀结束时间") + private Date stopTime; + + + + /** 产品状态 */ + @ApiModelProperty(value = "产品状态") + private Integer status; + + + /** 是否包邮 */ + @ApiModelProperty(value = "是否包邮") + private Integer isPostage; + + + /** 热门推荐 */ + @ApiModelProperty(value = "是否热门推荐") + private Integer isHot; + + + + /** 最多秒杀几个 */ + @NotNull(message = "请输入限购") + @Min(message = "限购不能小于0",value = 1) + @ApiModelProperty(value = "最多秒杀几个商品") + private Integer num; + + + /** 显示 */ + @ApiModelProperty(value = "是否显示 0否 1显示") + private Integer isShow; + + + /** 时间段id */ + @NotNull(message = "请选择开始时间") + @ApiModelProperty(value = "时间段id") + private Integer timeId; + + /** + * 规格 0单规格 1多规格 + */ + @ApiModelProperty(value = "规格 0单规格 1多规格") + private Integer specType; + + /** 运费模板ID */ + @JsonProperty("temp_id") + @ApiModelProperty(value = "运费模板ID") + private Long tempId; + + + /** 属性项目 */ + @TableField(exist = false) + @ApiModelProperty(value = "属性项目") + private List items; + + /** sku结果集 */ + @TableField(exist = false) + @ApiModelProperty(value = "sku结果集") + private List> attrs; + + public void copy(YxStoreSeckill source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreVisit.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreVisit.java new file mode 100644 index 0000000..709c204 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxStoreVisit.java @@ -0,0 +1,76 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +@EqualsAndHashCode(callSuper = false) +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName("yx_store_visit") +public class YxStoreVisit implements Serializable { + + @TableId + private Long id; + + + /** 产品ID */ + private Long productId; + + + /** 产品类型 */ + private String productType; + + + /** 产品分类ID */ + private Integer cateId; + + + /** 产品类型 */ + private String type; + + + /** 用户ID */ + private Long uid; + + + /** 访问次数 */ + private Integer count; + + + /** 备注描述 */ + private String content; + + + /** 添加时间 */ + @TableField(fill= FieldFill.INSERT) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Integer addTime; + + + public void copy(YxStoreVisit source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxUserExtract.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxUserExtract.java new file mode 100644 index 0000000..5bbd151 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/domain/YxUserExtract.java @@ -0,0 +1,83 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("yx_user_extract") +public class YxUserExtract extends BaseDomain { + + @TableId + private Long id; + + + private Long uid; + + + /** 名称 */ + private String realName; + + + /** bank = 银行卡 alipay = 支付宝wx=微信 */ + private String extractType; + + + /** 银行卡 */ + private String bankCode; + + + /** 开户地址 */ + private String bankAddress; + + + /** 支付宝账号 */ + private String alipayCode; + + + /** 提现金额 */ + private BigDecimal extractPrice; + + + private String mark; + + + private BigDecimal balance; + + + /** 无效原因 */ + private String failMsg; + + + private Date failTime; + + + /** -1 未通过 0 审核中 1 已提现 */ + private Integer status; + + + /** 微信号 */ + private String wechat; + + + public void copy(YxUserExtract source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/param/UserExtParam.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/param/UserExtParam.java new file mode 100644 index 0000000..9dd5a0c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/param/UserExtParam.java @@ -0,0 +1,33 @@ +package co.yixiang.modules.activity.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @ClassName UserExtParam + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/13 + **/ +@Data +public class UserExtParam implements Serializable { + + @ApiModelProperty(value = "提现支付宝用户名") + private String alipayCode; + + @NotBlank(message = "体现类型不能为空") + @ApiModelProperty(value = "提现类型 weixin alipay") + private String extractType; + + @NotBlank(message = "金额不能为空") + @ApiModelProperty(value = "提现金额") + private String money; + + @ApiModelProperty(value = "微信号") + private String weixin; + + @ApiModelProperty(value = "支付宝账号") + private String name; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreBargainService.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreBargainService.java new file mode 100644 index 0000000..be12696 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreBargainService.java @@ -0,0 +1,125 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.activity.domain.YxStoreBargain; +import co.yixiang.modules.activity.service.dto.YxStoreBargainDto; +import co.yixiang.modules.activity.service.dto.YxStoreBargainQueryCriteria; +import co.yixiang.modules.activity.vo.BargainCountVo; +import co.yixiang.modules.activity.vo.BargainVo; +import co.yixiang.modules.activity.vo.TopCountVo; +import co.yixiang.modules.activity.vo.YxStoreBargainQueryVo; +import co.yixiang.modules.user.domain.YxUser; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +public interface YxStoreBargainService extends BaseService{ + + /** + * 退回库存销量 + * @param num 数量 + * @param bargainId 砍价产品id + */ + void incStockDecSales(int num,Long bargainId); + + /** + * 增加销量 减少库存 + * @param num 数量 + * @param bargainId 砍价id + */ + void decStockIncSales(int num,Long bargainId); + + //YxStoreBargain getBargain(int bargainId); + + /** + * 开始帮助好友砍价 + * @param bargainId 砍价产品id + * @param bargainUserUid 开启砍价用户id + * @param uid 当前用户id + */ + void doHelp(Long bargainId,Long bargainUserUid,Long uid); + + /** + * 顶部统计 + * @param bargainId 砍价商品id + * @return TopCountVo + */ + TopCountVo topCount(Long bargainId); + + /** + * 砍价 砍价帮总人数、剩余金额、进度条、已经砍掉的价格 + * @param bargainId 砍价商品id + * @param uid 砍价用户id + * @param myUid 当前用户id + * @return BargainCountVo + */ + BargainCountVo helpCount(Long bargainId, Long uid, Long myUid); + + //int getBargainPayCount(int bargainId); + + //void addBargainShare(int id); + + //void addBargainLook(int id); + + /** + * 砍价详情 + * @param id 砍价id + * @param yxUser 用户 + * @return BargainVo + */ + BargainVo getDetail(Long id, YxUser yxUser); + + + /** + * 获取砍价商品列表 + * @param page page + * @param limit limit + * @return List + */ + List getList(int page, int limit); + + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxStoreBargainQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxStoreBargainQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + /** + * 删除砍价海报 + * @param id + */ + void deleteBargainImg(String id); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreBargainUserHelpService.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreBargainUserHelpService.java new file mode 100644 index 0000000..92f2087 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreBargainUserHelpService.java @@ -0,0 +1,47 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service; + + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.activity.domain.YxStoreBargainUserHelp; +import co.yixiang.modules.activity.vo.YxStoreBargainUserHelpQueryVo; + +import java.util.List; + +/** + *

+ * 砍价用户帮助表 服务类 + *

+ * + * @author hupeng + * @since 2019-12-21 + */ +public interface YxStoreBargainUserHelpService extends BaseService { + + /** + * 获取砍价帮 + * @param bargainId 砍价商品id + * @param bargainUserUid 砍价用户id + * @param page page + * @param limit limit + * @return list + */ + List getList(Long bargainId, Long bargainUserUid, int page, int limit); + + /** + * 获取砍价帮总人数 + * @param bargainId 砍价产品ID + * @param bargainUserUid 用户参与砍价表id + * @return int + */ + int getBargainUserHelpPeopleCount(Long bargainId,Long bargainUserUid); + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreBargainUserService.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreBargainUserService.java new file mode 100644 index 0000000..872c181 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreBargainUserService.java @@ -0,0 +1,89 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service; + + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.activity.domain.YxStoreBargainUser; +import co.yixiang.modules.activity.vo.YxStoreBargainUserQueryVo; + +import java.util.List; + +/** + *

+ * 用户参与砍价表 服务类 + *

+ * + * @author hupeng + * @since 2019-12-21 + */ +public interface YxStoreBargainUserService extends BaseService { + + /** + * 修改用户砍价状态 + * @param bargainId 砍价产品id + * @param uid 用户id + */ + void setBargainUserStatus(Long bargainId, Long uid); + + /** + * 砍价取消 + * @param bargainId 砍价商品id + * @param uid uid + */ + void bargainCancel(Long bargainId,Long uid); + + /** + * 获取用户的砍价产品 + * @param bargainUserUid 用户id + * @param page page + * @param limit limit + * @return List + */ + List bargainUserList(Long bargainUserUid, int page, int limit); + + /** + * 判断用户是否还可以砍价 + * @param bargainId 砍价产品id + * @param bargainUserUid 开启砍价用户id + * @param uid 当前用户id + * @return false=NO true=YES + */ + boolean isBargainUserHelp(Long bargainId,Long bargainUserUid,Long uid); + + /** + * 添加砍价记录 + * @param bargainId 砍价商品id + * @param uid 用户id + */ + void setBargain(Long bargainId,Long uid); + + //double getBargainUserDiffPrice(int id); + + + /** + * 获取某个用户参与砍价信息 + * @param bargainId 砍价id + * @param uid 用户id + * @return YxStoreBargainUser + */ + YxStoreBargainUser getBargainUserInfo(Long bargainId, Long uid); + + //List getBargainUserList(int bargainId,int status); + + /** + * 获取参与砍价的用户数量 + * @param bargainId 砍价id + * @param status 状态 OrderInfoEnum 1 进行中 2 结束失败 3结束成功 + * @return int + */ + int getBargainUserCount(Long bargainId,Integer status); + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreCombinationService.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreCombinationService.java new file mode 100644 index 0000000..bb7f3ff --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreCombinationService.java @@ -0,0 +1,80 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.activity.domain.YxStoreCombination; +import co.yixiang.modules.activity.service.dto.YxStoreCombinationDto; +import co.yixiang.modules.activity.service.dto.YxStoreCombinationQueryCriteria; +import co.yixiang.modules.activity.vo.CombinationQueryVo; +import co.yixiang.modules.activity.vo.StoreCombinationVo; +import co.yixiang.modules.activity.vo.YxStoreCombinationQueryVo; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +public interface YxStoreCombinationService extends BaseService{ + + + + /** + * 拼团列表 + * @param page page + * @param limit limit + * @return list + */ + CombinationQueryVo getList(int page, int limit); + + /** + * 获取拼团详情 + * @param id 拼团产品id + * @param uid uid + * @return StoreCombinationVo + */ + StoreCombinationVo getDetail(Long id, Long uid); + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxStoreCombinationQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxStoreCombinationQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + /** + * 修改状态 + * @param id 拼团产品id + * @param status ShopCommonEnum + */ + void onSale(Long id, Integer status); + + boolean saveCombination(YxStoreCombinationDto resources); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreCouponIssueService.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreCouponIssueService.java new file mode 100644 index 0000000..fa520ba --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreCouponIssueService.java @@ -0,0 +1,69 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.activity.domain.YxStoreCouponIssue; +import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueDto; +import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueQueryCriteria; +import co.yixiang.modules.activity.vo.YxStoreCouponIssueQueryVo; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +public interface YxStoreCouponIssueService extends BaseService{ + + /** + * 领取优惠券 + * @param id id 优惠券id + * @param uid uid + */ + void issueUserCoupon(Integer id, Long uid); + + /** + * 优惠券列表 + * @param page page + * @param limit limit + * @param uid 用户id + * @return list + */ + List getCouponList(int page, int limit, Long uid,Long productId,Integer type); + + //int couponCount(int id, int uid); + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxStoreCouponIssueQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxStoreCouponIssueQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreCouponIssueUserService.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreCouponIssueUserService.java new file mode 100644 index 0000000..96cebec --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreCouponIssueUserService.java @@ -0,0 +1,57 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.activity.domain.YxStoreCouponIssueUser; +import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueUserDto; +import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueUserQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +public interface YxStoreCouponIssueUserService extends BaseService{ + + /** + * 添加优惠券领取记录 + * @param uid 用户id + * @param id 前台优惠券id + */ + void addUserIssue(Long uid, Integer id); + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxStoreCouponIssueUserQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxStoreCouponIssueUserQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreCouponService.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreCouponService.java new file mode 100644 index 0000000..7294afc --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreCouponService.java @@ -0,0 +1,50 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.activity.domain.YxStoreCoupon; +import co.yixiang.modules.activity.service.dto.YxStoreCouponDto; +import co.yixiang.modules.activity.service.dto.YxStoreCouponQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +public interface YxStoreCouponService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxStoreCouponQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxStoreCouponQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreCouponUserService.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreCouponUserService.java new file mode 100644 index 0000000..0214ccb --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreCouponUserService.java @@ -0,0 +1,121 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.activity.domain.YxStoreCouponUser; +import co.yixiang.modules.activity.service.dto.YxStoreCouponUserDto; +import co.yixiang.modules.activity.service.dto.YxStoreCouponUserQueryCriteria; +import co.yixiang.modules.activity.vo.StoreCouponUserVo; +import co.yixiang.modules.activity.vo.YxStoreCouponUserQueryVo; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * @author hupeng + * @date 2020-05-13 + */ +public interface YxStoreCouponUserService extends BaseService { + + /** + * 获取当前用户优惠券数量 + * + * @param uid uid + * @return int + */ + int getUserValidCouponCount(Long uid); + + void useCoupon(int id); + + /** + * 获取用户优惠券 + * + * @param id 优惠券id + * @param uid 用户id + * @return YxStoreCouponUser + */ + YxStoreCouponUser getCoupon(Integer id, Long uid); + + + /** + * 获取满足条件的可用优惠券 + * + * @param cartIds 购物车ids + * @return list + */ + List beUsableCouponList(Long uid, String cartIds); + + /** + * 获取下单时候满足的优惠券 + * + * @param uid uid + * @param price 总价格 + * @param productIds list + * @return list + */ + List getUsableCouponList(Long uid, double price, List productIds); + + + /** + * 获取用户优惠券 + * + * @param uid uid + * @return list + */ + List getUserCoupon(Long uid); + + /** + * 添加优惠券记录 + * + * @param uid 用户id + * @param cid 优惠券id + */ + void addUserCoupon(Long uid, Integer cid); + + /** + * 查询数据分页 + * + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxStoreCouponUserQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxStoreCouponUserQueryCriteria criteria); + + /** + * 导出数据 + * + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + /** + * pc端查询优惠券 + * + * @param uid 用户id + * @param page 当前页码 + * @param limit 一页多少 + * @param type + * @return / + */ + Map getUserPCCoupon(Long uid, int page, int limit, Integer type); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStorePinkService.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStorePinkService.java new file mode 100644 index 0000000..cbf8958 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStorePinkService.java @@ -0,0 +1,121 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.activity.domain.YxStorePink; +import co.yixiang.modules.activity.service.dto.PinkAllDto; +import co.yixiang.modules.activity.service.dto.YxStorePinkDto; +import co.yixiang.modules.activity.service.dto.YxStorePinkQueryCriteria; +import co.yixiang.modules.activity.vo.PinkInfoVo; +import co.yixiang.modules.order.vo.YxStoreOrderQueryVo; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxStorePinkService extends BaseService{ + + + /** + * 取消拼团 + * @param uid 用户id + * @param cid 团购产品id + * @param pinkId 拼团id + */ + void removePink(Long uid, Long cid, Long pinkId); + + /** + * 计算还差几人拼团 + * @param pink 拼团信息 + * @return int + */ + int surplusPeople(YxStorePink pink); + + + /** + * 拼团明细 + * @param id 拼团id + * @param uid 用户id + */ + PinkInfoVo pinkInfo(Long id, Long uid); + + + /** + * 返回正在拼团的人数 + * @param id 拼团id + * @return int + */ + int pinkIngCount(Long id); + + /** + * 创建拼团 + * @param order 订单 + */ + void createPink(YxStoreOrderQueryVo order); + + /** + * 判断用户是否在团内 + * @param id 拼团id + * @param uid 用户id + * @return boolean true=在 + */ + boolean getIsPinkUid(Long id,Long uid); + + /** + * 获取拼团完成的商品总件数 + * @return int + */ + int getPinkOkSumTotalNum(); + + /** + * 获取拼团成功的用户 + * @param uid uid + * @return list + */ + List getPinkOkList(Long uid); + + + + /** + * 获取团长拼团数据 + * @param cid 拼团产品id + * @return PinkAllDto pindAll-参与的拼团的id 集合 list-团长参与的列表 + */ + PinkAllDto getPinkAll(Long cid); + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxStorePinkQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxStorePinkQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreSeckillService.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreSeckillService.java new file mode 100644 index 0000000..26e4fa8 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreSeckillService.java @@ -0,0 +1,84 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.activity.domain.YxStoreSeckill; +import co.yixiang.modules.activity.service.dto.YxStoreSeckillDto; +import co.yixiang.modules.activity.service.dto.YxStoreSeckillQueryCriteria; +import co.yixiang.modules.activity.vo.StoreSeckillVo; +import co.yixiang.modules.activity.vo.YxStoreSeckillQueryVo; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * @author hupeng + * @date 2020-05-13 + */ +public interface YxStoreSeckillService extends BaseService { + + + /** + * 产品详情 + * + * @param id 秒杀商品id + * @return StoreSeckillVo + */ + StoreSeckillVo getDetail(Long id); + + /** + * 秒杀产品列表 + * + * @param page page + * @param limit limit + * @return list + */ + List getList(int page, int limit, int time); + + /** + * 秒杀产品列表(首页用) + * + * @param page page + * @param limit limit + * @return list + */ + List getList(int page, int limit); + + /** + * 查询数据分页 + * + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxStoreSeckillQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxStoreSeckillQueryCriteria criteria); + + /** + * 导出数据 + * + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + boolean saveSeckill(YxStoreSeckillDto resources); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreVisitService.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreVisitService.java new file mode 100644 index 0000000..9ee993e --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxStoreVisitService.java @@ -0,0 +1,57 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.activity.domain.YxStoreVisit; +import co.yixiang.modules.activity.service.dto.YxStoreVisitDto; +import co.yixiang.modules.activity.service.dto.YxStoreVisitQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +public interface YxStoreVisitService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxStoreVisitQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxStoreVisitQueryCriteria criteria); + + /** + * 添加用户访问拼团记录 + * @param uid 用户id + * @param productId 产品id + */ + void addStoreVisit(Long uid,Long productId); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxUserExtractService.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxUserExtractService.java new file mode 100644 index 0000000..c94705e --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/YxUserExtractService.java @@ -0,0 +1,74 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.activity.domain.YxUserExtract; +import co.yixiang.modules.activity.param.UserExtParam; +import co.yixiang.modules.activity.service.dto.YxUserExtractDto; +import co.yixiang.modules.activity.service.dto.YxUserExtractQueryCriteria; +import co.yixiang.modules.user.domain.YxUser; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +public interface YxUserExtractService extends BaseService{ + + /** + * 开始提现 + * @param userInfo 用户 + * @param param UserExtParam + */ + void userExtract(YxUser userInfo, UserExtParam param); + + /** + * 累计提现金额 + * @param uid uid + * @return double + */ + double extractSum(Long uid); + + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxUserExtractQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxUserExtractQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + + /** + * 操作提现 + * @param resources YxUserExtract + */ + void doExtract(YxUserExtract resources); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/PinkAllDto.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/PinkAllDto.java new file mode 100644 index 0000000..9b26cf7 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/PinkAllDto.java @@ -0,0 +1,20 @@ +package co.yixiang.modules.activity.service.dto; + +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +/** + * @ClassName 团长拼团数据PinkAllDto + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/20 + **/ +@Getter +@Setter +@Builder +public class PinkAllDto { + List list; // list-团长参与的列表 + List pindAll; //pindAll-参与的拼团的id 集合 +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/PinkDto.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/PinkDto.java new file mode 100644 index 0000000..7dfd030 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/PinkDto.java @@ -0,0 +1,51 @@ +package co.yixiang.modules.activity.service.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @ClassName PinkDto + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/19 + **/ +@Data +public class PinkDto implements Serializable { + + @ApiModelProperty(value = "拼团ID") + private Long id; + + @ApiModelProperty(value = "用户ID") + private Long uid; + + @ApiModelProperty(value = "拼团总人数") + private Integer people; + + @ApiModelProperty(value = "拼团产品单价") + private Double price; + + @ApiModelProperty(value = "拼团结束时间") + private Date stopTime; + + @ApiModelProperty(value = "拼团用户昵称") + private String nickname; + + @ApiModelProperty(value = "拼团用户头像") + private String avatar; + + @ApiModelProperty(value = "参与的拼团的id集合") + private String count; + + @ApiModelProperty(value = "拼团时效:小时") + private String h; + + @ApiModelProperty(value = "拼团时效:分钟") + private String i; + + @ApiModelProperty(value = "拼团时效:秒") + private String s; + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/PinkUserDto.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/PinkUserDto.java new file mode 100644 index 0000000..ea50ef6 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/PinkUserDto.java @@ -0,0 +1,44 @@ +package co.yixiang.modules.activity.service.dto; + +import co.yixiang.modules.activity.domain.YxStorePink; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.List; + +/** + * @ClassName PinkUserDto + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/22 + **/ +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class PinkUserDto { + + /**拼团的团员*/ + @ApiModelProperty(value = "拼团的团员信息") + private List pinkAll; + + /**单个拼团信息*/ + @ApiModelProperty(value = "单个拼团信息") + private YxStorePink pinkT; + + /**拼团id集合*/ + @ApiModelProperty(value = "拼团id集合") + private List idAll; + + /**拼团用户id集合*/ + @ApiModelProperty(value = "拼团用户id集合") + private List uidAll; + + /**还差几人成团*/ + @ApiModelProperty(value = "还差几人成团") + private Integer count; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/SeckillTimeDto.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/SeckillTimeDto.java new file mode 100644 index 0000000..1999b24 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/SeckillTimeDto.java @@ -0,0 +1,27 @@ +package co.yixiang.modules.activity.service.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SeckillTimeDto { + + private Integer id; + /** + * 00:00 + */ + @ApiModelProperty(value = "秒杀产品时间:00:00") + private String time; + + /** + *状态 + */ + @ApiModelProperty(value = "秒杀产品状态显示中文值") + private String state; + + @ApiModelProperty(value = "秒杀产品状态") + private Integer status; + + @ApiModelProperty(value = "秒杀产品停止时间") + private Integer stop; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreBargainDto.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreBargainDto.java new file mode 100644 index 0000000..aded33b --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreBargainDto.java @@ -0,0 +1,113 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class YxStoreBargainDto implements Serializable { + + /** 砍价产品ID */ + private Long id; + + /** 关联产品ID */ + private Long productId; + + /** 砍价活动名称 */ + private String title; + + /** 砍价活动图片 */ + private String image; + + /** 单位名称 */ + private String unitName; + + /** 库存 */ + private Integer stock; + + /** 销量 */ + private Integer sales; + + /** 砍价产品轮播图 */ + private String images; + + /** 砍价开启时间 */ + private Date startTime; + + /** 砍价结束时间 */ + private Date stopTime; + + /** 砍价产品名称 */ + private String storeName; + + /** 砍价金额 */ + private BigDecimal price; + + /** 砍价商品最低价 */ + private BigDecimal minPrice; + + /** 每次购买的砍价产品数量 */ + private Integer num; + + /** 用户每次砍价的最大金额 */ + private BigDecimal bargainMaxPrice; + + /** 用户每次砍价的最小金额 */ + private BigDecimal bargainMinPrice; + + /** 用户每次砍价的次数 */ + private Integer bargainNum; + + /** 砍价状态 0(到砍价时间不自动开启) 1(到砍价时间自动开启时间) */ + private Integer status; + + /** 砍价详情 */ + private String description; + + /** 反多少积分 */ + private BigDecimal giveIntegral; + + /** 砍价活动简介 */ + private String info; + + /** 成本价 */ + private BigDecimal cost; + + /** 排序 */ + private Integer sort; + + /** 是否推荐0不推荐1推荐 */ + private Integer isHot; + + /** 添加时间 */ + private Date createTime; + + /** 是否包邮 0不包邮 1包邮 */ + private Integer isPostage; + + /** 邮费 */ + private BigDecimal postage; + + /** 砍价规则 */ + private String rule; + + /** 砍价产品浏览量 */ + private Integer look; + + /** 砍价产品分享量 */ + private Integer share; + + + private String statusStr; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreBargainQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreBargainQueryCriteria.java new file mode 100644 index 0000000..6d75904 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreBargainQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class YxStoreBargainQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCombinationDto.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCombinationDto.java new file mode 100644 index 0000000..903d8b4 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCombinationDto.java @@ -0,0 +1,139 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.dto; + +import co.yixiang.modules.product.service.dto.FromatDetailDto; +import co.yixiang.modules.product.service.dto.ProductFormatDto; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Getter +@Setter +@ToString +public class YxStoreCombinationDto implements Serializable { + + private Long id; + + // 商品id + private Long productId; + + // 商户id + private Integer merId; + + // 推荐图 + private String image; + + private String images; + + /** 轮播图 */ + @JsonProperty("slider_image") + private List sliderImage; + + //参与人数 + private Integer countPeopleAll; + + //成团人数 + private Integer countPeoplePink; + + //访问人数 + private Integer countPeopleBrowse; + + // 活动标题 + private String title; + + // 参团人数 + private Integer people; + + // 简介 + private String info; + + // 价格 + private BigDecimal price; + + // 排序 + private Integer sort; + + // 销量 + private Integer sales; + + // 库存 + private Integer stock; + + // 添加时间 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date createTime; + + // 推荐 + private Integer isHost; + + // 产品状态 + private Integer isShow; + + + private Integer combination; + + // 商户是否可用1可用0不可用 + private Integer merUse; + + // 是否包邮1是0否 + private Integer isPostage; + + // 邮费 + private BigDecimal postage; + + // 拼团内容 + private String description; + + // 拼团开始时间 + private Date startTime; + + // 拼团结束时间 + private Date stopTime; + + // 拼团订单有效时间 + private Integer effectiveTime; + + // 拼团产品成本 + private Integer cost; + + // 浏览量 + private Integer browse; + + // 单位名 + private String unitName; + + /** 规格 0单 1多 */ + @JsonProperty("spec_type") + private Integer specType; + // 模板id + @JsonProperty("temp_id") + private Integer tempId; + + /** 是否单独分佣 */ + @JsonProperty("is_sub") + private Integer isSub; + + private ProductFormatDto attr; + //属性项目 + private List items; + + //sku结果集 + private List attrs; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCombinationQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCombinationQueryCriteria.java new file mode 100644 index 0000000..090efc3 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCombinationQueryCriteria.java @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class YxStoreCombinationQueryCriteria{ + + // 模糊 + @Query(type = Query.Type.INNER_LIKE) + private String title; + + @Query + private Integer isDel; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponDto.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponDto.java new file mode 100644 index 0000000..4eae802 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponDto.java @@ -0,0 +1,59 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.dto; + +import co.yixiang.modules.product.domain.YxStoreProduct; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class YxStoreCouponDto implements Serializable { + + // 优惠券表ID + private Integer id; + + // 优惠券名称 + private String title; + + // 兑换消耗积分值 + private Integer integral; + + // 兑换的优惠券面值 + private BigDecimal couponPrice; + + // 最低消费多少金额可用优惠券 + private BigDecimal useMinPrice; + + // 优惠券有效期限(单位:天) + private Integer couponTime; + + // 排序 + private Integer sort; + + // 状态(0:关闭,1:开启) + private Integer status; + + private Integer type; + + private String productId; + + private List product; + + // 兑换项目添加时间 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date createTime; + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponIssueDto.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponIssueDto.java new file mode 100644 index 0000000..49a77d8 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponIssueDto.java @@ -0,0 +1,53 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class YxStoreCouponIssueDto implements Serializable { + + private Integer id; + + private String cname; + + /** 优惠券ID */ + private Integer cid; + + private Integer ctype; + + /** 优惠券领取开启时间 */ + private Date startTime; + + /** 优惠券领取结束时间 */ + private Date endTime; + + /** 优惠券领取数量 */ + private Integer totalCount; + + /** 优惠券剩余领取数量 */ + private Integer remainCount; + + /** 是否无限张数 */ + private Integer isPermanent; + + /** 1 正常 0 未开启 -1 已无效 */ + private Integer status; + + + /** 优惠券添加时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date createTime; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponIssueQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponIssueQueryCriteria.java new file mode 100644 index 0000000..28de06e --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponIssueQueryCriteria.java @@ -0,0 +1,21 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class YxStoreCouponIssueQueryCriteria{ + + @Query + private Integer isDel; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponIssueUserDto.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponIssueUserDto.java new file mode 100644 index 0000000..8ee9dba --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponIssueUserDto.java @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class YxStoreCouponIssueUserDto implements Serializable { + + private Integer id; + + /** 领取优惠券用户ID */ + private Integer uid; + + /** 优惠券前台领取ID */ + private Integer issueCouponId; + + /** 领取时间 */ + private Integer addTime; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponIssueUserQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponIssueUserQueryCriteria.java new file mode 100644 index 0000000..28bf5e2 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponIssueUserQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class YxStoreCouponIssueUserQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponQueryCriteria.java new file mode 100644 index 0000000..a932e40 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponQueryCriteria.java @@ -0,0 +1,20 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class YxStoreCouponQueryCriteria{ + + @Query + private Integer isDel; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponUserDto.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponUserDto.java new file mode 100644 index 0000000..7517562 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponUserDto.java @@ -0,0 +1,59 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class YxStoreCouponUserDto implements Serializable { + + // 优惠券发放记录id + private Long id; + + // 兑换的项目id + private Integer cid; + + // 优惠券所属用户 + private Long uid; + + private String nickname; + + // 优惠券名称 + private String couponTitle; + + // 优惠券的面值 + private BigDecimal couponPrice; + + // 最低消费多少金额可用优惠券 + private BigDecimal useMinPrice; + + // 优惠券创建时间 + private Date addTime; + + // 优惠券结束时间 + private Date endTime; + + // 使用时间 + private Date useTime; + + // 获取方式 + private String type; + + // 状态(0:未使用,1:已使用, 2:已过期) + private Integer status; + + // 是否有效 + private Integer isFail; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponUserQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponUserQueryCriteria.java new file mode 100644 index 0000000..a40cb7f --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCouponUserQueryCriteria.java @@ -0,0 +1,21 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class YxStoreCouponUserQueryCriteria{ + + // 模糊 + @Query(type = Query.Type.INNER_LIKE) + private String couponTitle; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStorePinkDto.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStorePinkDto.java new file mode 100644 index 0000000..e23ae1b --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStorePinkDto.java @@ -0,0 +1,85 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxStorePinkDto implements Serializable { + + private Long id; + + /** 用户id */ + private Long uid; + + /** 订单id 生成 */ + private String orderId; + + /** 订单id 数据库 */ + private Long orderIdKey; + + /** 购买商品个数 */ + private Integer totalNum; + + /** 购买总金额 */ + private BigDecimal totalPrice; + + /** 拼团产品id */ + private Long cid; + + /** 产品id */ + private Long pid; + + /** 拼团总人数 */ + private Integer people; + + /** 拼团产品单价 */ + private BigDecimal price; + + /** 开始时间 */ + @JsonFormat( + pattern = "yyyy年MM月dd日HH时mm分", + timezone = "GMT+8" + ) + private Date createTime; + + private String stopTime; + + /** 团长id 0为团长 */ + private Long kId; + + /** 是否发送模板消息0未发送1已发送 */ + private Integer isTpl; + + /** 是否退款 0未退款 1已退款 */ + private Integer isRefund; + + /** 状态1进行中2已完成3未完成 */ + private Integer status; + + private String nickname; + + private String phone; + + private String userImg; + + private String product; + + private String image; + /** + * 参团人数 + */ + private int countPeople; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStorePinkQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStorePinkQueryCriteria.java new file mode 100644 index 0000000..b86dc88 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStorePinkQueryCriteria.java @@ -0,0 +1,19 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxStorePinkQueryCriteria{ + @Query + private Integer cid; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreSeckillDto.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreSeckillDto.java new file mode 100644 index 0000000..199ac48 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreSeckillDto.java @@ -0,0 +1,136 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.dto; + +import co.yixiang.modules.product.service.dto.FromatDetailDto; +import co.yixiang.modules.product.service.dto.ProductFormatDto; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Getter +@Setter +@ToString +public class YxStoreSeckillDto implements Serializable { + + + // 商品秒杀产品表id + private Long id; + + // 商品id + private Long productId; + + // 推荐图 + private String image; + + // 轮播图 + private String images; + + /** 轮播图 */ + @JsonProperty("slider_image") + private List sliderImage; + + // 活动标题 + private String title; + + // 简介 + private String info; + + // 返多少积分 + private BigDecimal giveIntegral; + + /** 秒杀价 */ + @ApiModelProperty(value = "秒杀价") + private BigDecimal price; + + /** 原价 */ + @ApiModelProperty(value = "原价") + private BigDecimal otPrice; + + /** 成本 */ + @ApiModelProperty(value = "成本") + private BigDecimal cost; + + /** 销量 */ + @ApiModelProperty(value = "秒杀销量") + private Integer sales; + + // 排序 + private Integer sort; + + // 库存 + private Integer stock; + + // 单位名 + private String unitName; + + // 邮费 + private BigDecimal postage; + + // 内容 + private String description; + + // 开始时间 + private Date startTime; + + // 结束时间 + private Date stopTime; + + // 添加时间 + private Date createTime; + + // 产品状态 + private Integer status; + + // 是否包邮 + private Integer isPostage; + + // 热门推荐 + private Integer isHot; + + + // 最多秒杀几个 + private Integer num; + + // 显示 + private Integer isShow; + + + private String statusStr; + + private Integer timeId; + // 模板id + @JsonProperty("temp_id") + private Integer tempId; + /** 规格 0单 1多 */ + @JsonProperty("spec_type") + private Integer specType; + + /** 是否单独分佣 */ + @JsonProperty("is_sub") + private Integer isSub; + + private ProductFormatDto attr; + //属性项目 + private List items; + + //sku结果集 + private List attrs; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreSeckillQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreSeckillQueryCriteria.java new file mode 100644 index 0000000..49a9f98 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreSeckillQueryCriteria.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class YxStoreSeckillQueryCriteria{ + + + // 模糊 + @Query(type = Query.Type.INNER_LIKE) + private String title; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreVisitDto.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreVisitDto.java new file mode 100644 index 0000000..f974187 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreVisitDto.java @@ -0,0 +1,44 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class YxStoreVisitDto implements Serializable { + + private Integer id; + + /** 产品ID */ + private Integer productId; + + /** 产品类型 */ + private String productType; + + /** 产品分类ID */ + private Integer cateId; + + /** 产品类型 */ + private String type; + + /** 用户ID */ + private Integer uid; + + /** 访问次数 */ + private Integer count; + + /** 备注描述 */ + private String content; + + /** 添加时间 */ + private Integer addTime; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreVisitQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreVisitQueryCriteria.java new file mode 100644 index 0000000..b19d25d --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreVisitQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class YxStoreVisitQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxUserExtractDto.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxUserExtractDto.java new file mode 100644 index 0000000..46e349d --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxUserExtractDto.java @@ -0,0 +1,61 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class YxUserExtractDto implements Serializable { + + + private Long id; + + private Long uid; + + // 名称 + private String realName; + + // bank = 银行卡 alipay = 支付宝wx=微信 + private String extractType; + + // 银行卡 + private String bankCode; + + // 开户地址 + private String bankAddress; + + // 支付宝账号 + private String alipayCode; + + // 提现金额 + private BigDecimal extractPrice; + + private String mark; + + private BigDecimal balance; + + // 无效原因 + private String failMsg; + + private Date failTime; + + // 添加时间 + private Date createTime; + + // -1 未通过 0 审核中 1 已提现 + private Integer status; + + // 微信号 + private String wechat; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxUserExtractQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxUserExtractQueryCriteria.java new file mode 100644 index 0000000..6491570 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/dto/YxUserExtractQueryCriteria.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class YxUserExtractQueryCriteria{ + + + // 模糊 + @Query(type = Query.Type.INNER_LIKE) + private String realName; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainServiceImpl.java new file mode 100644 index 0000000..58332fb --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainServiceImpl.java @@ -0,0 +1,431 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.impl; + +import cn.hutool.core.util.NumberUtil; +import co.yixiang.api.YshopException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.OrderInfoEnum; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.modules.activity.domain.YxStoreBargain; +import co.yixiang.modules.activity.domain.YxStoreBargainUser; +import co.yixiang.modules.activity.domain.YxStoreBargainUserHelp; +import co.yixiang.modules.activity.service.YxStoreBargainService; +import co.yixiang.modules.activity.service.YxStoreBargainUserHelpService; +import co.yixiang.modules.activity.service.YxStoreBargainUserService; +import co.yixiang.modules.activity.service.dto.YxStoreBargainDto; +import co.yixiang.modules.activity.service.dto.YxStoreBargainQueryCriteria; +import co.yixiang.modules.activity.service.mapper.YxStoreBargainMapper; +import co.yixiang.modules.activity.vo.BargainCountVo; +import co.yixiang.modules.activity.vo.BargainVo; +import co.yixiang.modules.activity.vo.TopCountVo; +import co.yixiang.modules.activity.vo.YxStoreBargainQueryVo; +import co.yixiang.modules.order.domain.YxStoreOrder; +import co.yixiang.modules.order.service.YxStoreOrderService; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.vo.YxUserQueryVo; +import co.yixiang.utils.FileUtil; +import co.yixiang.utils.OrderUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + + +/** + * @author hupeng + * @date 2020-05-13 + */ +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxStoreBargainServiceImpl extends BaseServiceImpl implements YxStoreBargainService { + + @Autowired + private IGenerator generator; + + @Autowired + private YxStoreBargainMapper yxStoreBargainMapper; + + + @Autowired + private YxStoreBargainUserService storeBargainUserService; + @Autowired + private YxStoreOrderService storeOrderService; + @Autowired + private YxStoreBargainUserHelpService storeBargainUserHelpService; + + + + /** + * 退回库存销量 + * @param num 数量 + * @param bargainId 砍价产品id + */ + @Override + public void incStockDecSales(int num, Long bargainId) { + yxStoreBargainMapper.incStockDecSales(num,bargainId); + } + + /** + * 增加销量 减少库存 + * @param num 数量 + * @param bargainId 砍价id + */ + @Override + public void decStockIncSales(int num, Long bargainId) { + int res = yxStoreBargainMapper.decStockIncSales(num,bargainId); + if(res == 0) { + throw new YshopException("砍价产品库存不足"); + } + } + +// @Override +// public YxStoreBargain getBargain(int bargainId) { +// QueryWrapper wrapper = new QueryWrapper<>(); +// int nowTime = OrderUtil.getSecondTimestampTwo(); +// wrapper.eq("id",bargainId).eq("is_del",0).eq("status",1) +// .le("start_time",nowTime).ge("stop_time",nowTime); +// return yxStoreBargainMapper.selectOne(wrapper); +// } + + + + /** + * 开始帮助好友砍价 + * @param bargainId 砍价产品id + * @param bargainUserUid 开启砍价用户id + * @param uid 当前用户id + */ + @Override + public void doHelp(Long bargainId, Long bargainUserUid, Long uid) { + //开始真正的砍价 + YxStoreBargainUser storeBargainUser = storeBargainUserService + .getBargainUserInfo(bargainId,bargainUserUid); + + + YxStoreBargain storeBargain = this.getById(bargainId); + //用户可以砍掉的金额 好友砍价之前获取可以砍价金额 + double coverPrice = NumberUtil.sub(storeBargainUser.getBargainPrice() + ,storeBargainUser.getBargainPriceMin()).doubleValue(); + + double random = 0d; + if(coverPrice > 0 ){ + //用户剩余要砍掉的价格 + double surplusPrice = NumberUtil.sub(coverPrice, + storeBargainUser.getPrice()).doubleValue(); + if(surplusPrice == 0) { + return; + } + + + //生成一个区间随机数 + random = OrderUtil.randomNumber( + storeBargain.getBargainMinPrice().doubleValue(), + storeBargain.getBargainMaxPrice().doubleValue()); + if(random > surplusPrice) { + random = surplusPrice; + } + } + + + //添加砍价帮助表 + YxStoreBargainUserHelp storeBargainUserHelp = YxStoreBargainUserHelp + .builder() + .uid(uid) + .bargainId(bargainId) + .bargainUserId(storeBargainUser.getId()) + .price(BigDecimal.valueOf(random)) + .build(); + storeBargainUserHelpService.save(storeBargainUserHelp); + + //累计砍掉的金额 + double totalPrice = NumberUtil.add(storeBargainUser.getPrice().doubleValue(),random); + + //更新砍价参与表 + YxStoreBargainUser bargainUser = YxStoreBargainUser + .builder() + .id(storeBargainUser.getId()) + .price(BigDecimal.valueOf(totalPrice)) + .build(); + + storeBargainUserService.updateById(bargainUser); + } + + /** + * 顶部统计 + * @param bargainId 砍价商品id + * @return TopCountVo + */ + @Override + public TopCountVo topCount(Long bargainId) { + if(bargainId != null) { + this.addBargainShare(bargainId); + } + return TopCountVo.builder() + .lookCount(yxStoreBargainMapper.lookCount()) + .shareCount(yxStoreBargainMapper.shareCount()) + .userCount(storeBargainUserService.count()) + .build(); + } + + /** + * 砍价 砍价帮总人数、剩余金额、进度条、已经砍掉的价格 + * @param bargainId 砍价商品id + * @param uid 砍价用户id + * @param myUid 当前用户id + * @return BargainCountVo + */ + @Override + public BargainCountVo helpCount(Long bargainId, Long uid, Long myUid) { + YxStoreBargainUser storeBargainUser = storeBargainUserService + .getBargainUserInfo(bargainId,uid); + // 是否帮别人砍,没砍是true,砍了false + boolean userBargainStatus = true; + if(storeBargainUser == null) { + return BargainCountVo + .builder() + .count(0) + .alreadyPrice(0d) + .status(0) + .pricePercent(0) + .price(0d) + .userBargainStatus(userBargainStatus) + .build(); + } + + + int helpCount = storeBargainUserHelpService.lambdaQuery() + .eq(YxStoreBargainUserHelp::getBargainUserId,storeBargainUser.getId()) + .eq(YxStoreBargainUserHelp::getBargainId,bargainId) + .eq(YxStoreBargainUserHelp::getUid,myUid) + .count(); + + if(helpCount > 0) { + userBargainStatus = false; + } + + + int count = storeBargainUserHelpService + .getBargainUserHelpPeopleCount(bargainId,storeBargainUser.getId()); + //用户可以砍掉的价格 + double diffPrice = NumberUtil.sub(storeBargainUser.getBargainPrice() + ,storeBargainUser.getBargainPriceMin()).doubleValue(); + //砍价进度条百分比 + int pricePercent = 0; + if(diffPrice <= 0) { + pricePercent = 100; + }else{ + pricePercent = NumberUtil.round(NumberUtil.mul(NumberUtil.div( + storeBargainUser.getPrice(),diffPrice),100) + ,0).intValue(); + } + + + + //剩余的砍价金额 + double surplusPrice = NumberUtil.sub(diffPrice,storeBargainUser.getPrice()).doubleValue(); + + return BargainCountVo + .builder() + .count(count) + .alreadyPrice(storeBargainUser.getPrice().doubleValue()) + .status(storeBargainUser.getStatus()) + .pricePercent(pricePercent) + .price(surplusPrice) + .userBargainStatus(userBargainStatus) + .build(); + } + + + + + + /** + * 砍价详情 + * @param id 砍价id + * @param yxUser 用户 + * @return BargainVo + */ + @Override + public BargainVo getDetail(Long id, YxUser yxUser) { + + Date now = new Date(); + YxStoreBargain storeBargain = this.lambdaQuery().eq(YxStoreBargain::getId,id) + .eq(YxStoreBargain::getStatus, ShopCommonEnum.IS_STATUS_1.getValue()) + .le(YxStoreBargain::getStartTime,now) + .ge(YxStoreBargain::getStopTime,now) + .one(); + + if(storeBargain == null) { + throw new YshopException("砍价已结束"); + } + + this.addBargainLook(id); + + YxStoreBargainQueryVo storeBargainQueryVo = generator.convert(storeBargain, + YxStoreBargainQueryVo.class); + + return BargainVo + .builder() + .bargain(storeBargainQueryVo) + .userInfo(generator.convert(yxUser, YxUserQueryVo.class)) + .bargainSumCount(this.getBargainPayCount(id)) + .build(); + } + + /** + * 获取砍价商品列表 + * @param page page + * @param limit limit + * @return List + */ + @Override + public List getList(int page, int limit) { + Page pageModel = new Page<>(page, limit); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + Date nowTime = new Date(); + wrapper.eq(YxStoreBargain::getStatus, ShopCommonEnum.IS_STATUS_1.getValue()) + .lt(YxStoreBargain::getStartTime,nowTime) + .gt(YxStoreBargain::getStopTime,nowTime); + + List yxStoreBargainQueryVos = generator.convert( + yxStoreBargainMapper.selectPage(pageModel,wrapper).getRecords(), + YxStoreBargainQueryVo.class); + + yxStoreBargainQueryVos.forEach(item->{ + item.setPeople(storeBargainUserService.getBargainUserCount(item.getId(), + OrderInfoEnum.BARGAIN_STATUS_1.getValue())); + }); + + return yxStoreBargainQueryVos; + } + + + /** + * 增加分享次数 + * @param id 砍价商品id + */ + private void addBargainShare(Long id) { + yxStoreBargainMapper.addBargainShare(id); + } + + /** + * 增加浏览次数 + * @param id 砍价商品id + */ + private void addBargainLook(Long id) { + yxStoreBargainMapper.addBargainLook(id); + } + + + /** + * 砍价支付成功订单数量 + * @param bargainId 砍价id + * @return int + */ + private int getBargainPayCount(Long bargainId) { + return storeOrderService.lambdaQuery().eq(YxStoreOrder::getBargainId,bargainId) + .eq(YxStoreOrder::getPaid,OrderInfoEnum.PAY_STATUS_1.getValue()) + .eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue()) + .count(); + } + + + //===================================================================// + + @Override + //@Cacheable + public Map queryAll(YxStoreBargainQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + List storeBargainDtoList = generator.convert(page.getList(), YxStoreBargainDto.class); + for (YxStoreBargainDto storeBargainDto : storeBargainDtoList) { + + String statusStr = OrderUtil.checkActivityStatus(storeBargainDto.getStartTime(), + storeBargainDto.getStopTime(), storeBargainDto.getStatus()); + storeBargainDto.setStatusStr(statusStr); + } + map.put("content", storeBargainDtoList); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxStoreBargainQueryCriteria criteria) { + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreBargain.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxStoreBargainDto yxStoreBargain : all) { + Map map = new LinkedHashMap<>(); + map.put("关联产品ID", yxStoreBargain.getProductId()); + map.put("砍价活动名称", yxStoreBargain.getTitle()); + map.put("砍价活动图片", yxStoreBargain.getImage()); + map.put("单位名称", yxStoreBargain.getUnitName()); + map.put("库存", yxStoreBargain.getStock()); + map.put("销量", yxStoreBargain.getSales()); + map.put("砍价产品轮播图", yxStoreBargain.getImages()); + map.put("砍价开启时间", yxStoreBargain.getStartTime()); + map.put("砍价结束时间", yxStoreBargain.getStopTime()); + map.put("砍价产品名称", yxStoreBargain.getStoreName()); + map.put("砍价金额", yxStoreBargain.getPrice()); + map.put("砍价商品最低价", yxStoreBargain.getMinPrice()); + map.put("每次购买的砍价产品数量", yxStoreBargain.getNum()); + map.put("用户每次砍价的最大金额", yxStoreBargain.getBargainMaxPrice()); + map.put("用户每次砍价的最小金额", yxStoreBargain.getBargainMinPrice()); + map.put("用户每次砍价的次数", yxStoreBargain.getBargainNum()); + map.put("砍价状态 0(到砍价时间不自动开启) 1(到砍价时间自动开启时间)", yxStoreBargain.getStatus()); + map.put("砍价详情", yxStoreBargain.getDescription()); + map.put("反多少积分", yxStoreBargain.getGiveIntegral()); + map.put("砍价活动简介", yxStoreBargain.getInfo()); + map.put("成本价", yxStoreBargain.getCost()); + map.put("排序", yxStoreBargain.getSort()); + map.put("是否推荐0不推荐1推荐", yxStoreBargain.getIsHot()); + map.put("是否包邮 0不包邮 1包邮", yxStoreBargain.getIsPostage()); + map.put("邮费", yxStoreBargain.getPostage()); + map.put("砍价规则", yxStoreBargain.getRule()); + map.put("砍价产品浏览量", yxStoreBargain.getLook()); + map.put("砍价产品分享量", yxStoreBargain.getShare()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + /** + * 删除砍价海报 + * + * @param name + */ + @Override + public void deleteBargainImg(String name) { + baseMapper.deleteBargainImg(name); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainUserHelpServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainUserHelpServiceImpl.java new file mode 100644 index 0000000..0e6fc4c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainUserHelpServiceImpl.java @@ -0,0 +1,111 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.activity.domain.YxStoreBargainUser; +import co.yixiang.modules.activity.domain.YxStoreBargainUserHelp; +import co.yixiang.modules.activity.service.YxStoreBargainUserHelpService; +import co.yixiang.modules.activity.service.YxStoreBargainUserService; +import co.yixiang.modules.activity.service.mapper.YxStoreBargainUserHelpMapper; +import co.yixiang.modules.activity.vo.YxStoreBargainUserHelpQueryVo; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.service.YxUserService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Collections; +import java.util.List; + + +/** + *

+ * 砍价用户帮助表 服务实现类 + *

+ * + * @author hupeng + * @since 2019-12-21 + */ +@Slf4j +@Service +@Transactional(rollbackFor = Exception.class) +public class YxStoreBargainUserHelpServiceImpl extends BaseServiceImpl implements YxStoreBargainUserHelpService { + + @Autowired + private IGenerator generator; + + @Autowired + private YxStoreBargainUserHelpMapper yxStoreBargainUserHelpMapper; + + @Autowired + private YxStoreBargainUserService storeBargainUserService; + @Autowired + private YxUserService userService; + + + + + /** + * 获取砍价帮 + * @param bargainId 砍价商品id + * @param bargainUserUid 砍价用户id + * @param page page + * @param limit limit + * @return list + */ + @Override + public List getList(Long bargainId, Long bargainUserUid, + int page, int limit) { + YxStoreBargainUser storeBargainUser = storeBargainUserService + .getBargainUserInfo(bargainId,bargainUserUid); + if(ObjectUtil.isNull(storeBargainUser)) { + return Collections.emptyList(); + } + Page pageModel = new Page<>(page, limit); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreBargainUserHelp::getBargainUserId,storeBargainUser.getId()) + .orderByDesc(YxStoreBargainUserHelp::getId); + List storeBargainUserHelpQueryVos = generator + .convert(yxStoreBargainUserHelpMapper.selectPage(pageModel,wrapper).getRecords(), + YxStoreBargainUserHelpQueryVo.class); + + storeBargainUserHelpQueryVos.forEach(item->{ + YxUser yxUser = userService.getById(item.getUid()); + item.setAvatar(yxUser.getAvatar()); + item.setNickname(yxUser.getNickname()); + }); + + return storeBargainUserHelpQueryVos; + } + + /** + * 获取砍价帮总人数 + * @param bargainId 砍价产品ID + * @param bargainUserUid 用户参与砍价表id + * @return int + */ + @Override + public int getBargainUserHelpPeopleCount(Long bargainId, Long bargainUserUid) { + return this.lambdaQuery() + .eq(YxStoreBargainUserHelp::getBargainUserId,bargainUserUid) + .eq(YxStoreBargainUserHelp::getBargainId,bargainId) + .count(); + } + + + + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainUserServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainUserServiceImpl.java new file mode 100644 index 0000000..7a20f8b --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainUserServiceImpl.java @@ -0,0 +1,229 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.impl; + +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import co.yixiang.api.YshopException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.OrderInfoEnum; +import co.yixiang.modules.activity.domain.YxStoreBargain; +import co.yixiang.modules.activity.domain.YxStoreBargainUser; +import co.yixiang.modules.activity.domain.YxStoreBargainUserHelp; +import co.yixiang.modules.activity.service.YxStoreBargainService; +import co.yixiang.modules.activity.service.YxStoreBargainUserHelpService; +import co.yixiang.modules.activity.service.YxStoreBargainUserService; +import co.yixiang.modules.activity.service.mapper.YxStoreBargainUserMapper; +import co.yixiang.modules.activity.vo.YxStoreBargainUserQueryVo; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.List; + + +/** + *

+ * 用户参与砍价表 服务实现类 + *

+ * + * @author hupeng + * @since 2019-12-21 + */ +@Slf4j +@Service +public class YxStoreBargainUserServiceImpl extends BaseServiceImpl implements YxStoreBargainUserService { + + + @Autowired + private IGenerator generator; + + @Autowired + private YxStoreBargainUserMapper yxStoreBargainUserMapper; + + @Autowired + private YxStoreBargainService storeBargainService; + @Autowired + private YxStoreBargainUserHelpService storeBargainUserHelpService; + + + /** + * 修改用户砍价状态 + * @param bargainId 砍价产品id + * @param uid 用户id + */ + @Override + public void setBargainUserStatus(Long bargainId, Long uid) { + YxStoreBargainUser storeBargainUser = getBargainUserInfo(bargainId.longValue(),uid); + if(ObjectUtil.isNull(storeBargainUser)) { + return; + } + + if(storeBargainUser.getStatus() != 1) { + return; + } + double price = NumberUtil.sub(NumberUtil.sub(storeBargainUser.getBargainPrice(), + storeBargainUser.getBargainPriceMin()),storeBargainUser.getPrice()).doubleValue(); + if(price > 0) { + return; + } + + storeBargainUser.setStatus(3); + + yxStoreBargainUserMapper.updateById(storeBargainUser); + } + + /** + * 砍价取消 + * @param bargainId 砍价商品id + * @param uid uid + */ + @Override + public void bargainCancel(Long bargainId, Long uid) { + YxStoreBargainUser storeBargainUser = this.getBargainUserInfo(bargainId,uid); + if(ObjectUtil.isNull(storeBargainUser)) { + throw new YshopException("数据不存在"); + } + if(!OrderInfoEnum.BARGAIN_STATUS_1.getValue().equals(storeBargainUser.getStatus())){ + throw new YshopException("状态错误"); + } + yxStoreBargainUserMapper.deleteById(storeBargainUser.getId()); + } + + /** + * 获取用户的砍价产品 + * @param bargainUserUid 用户id + * @param page page + * @param limit limit + * @return List + */ + @Override + public List bargainUserList(Long bargainUserUid, int page, int limit) { + Page pageModel = new Page<>(page, limit); + return yxStoreBargainUserMapper.getBargainUserList(bargainUserUid,pageModel); + } + + /** + * 判断用户是否还可以砍价 + * @param bargainId 砍价产品id + * @param bargainUserUid 开启砍价用户id + * @param uid 当前用户id + * @return false=NO true=YES + */ + @Override + public boolean isBargainUserHelp(Long bargainId, Long bargainUserUid, Long uid) { + YxStoreBargainUser storeBargainUser = this.getBargainUserInfo(bargainId, bargainUserUid); + YxStoreBargain storeBargain = storeBargainService + .getById(bargainId); + if(ObjectUtil.isNull(storeBargainUser) || ObjectUtil.isNull(storeBargain)){ + return false; + } + int count = storeBargainUserHelpService.lambdaQuery() + .eq(YxStoreBargainUserHelp::getBargainId,bargainId) + .eq(YxStoreBargainUserHelp::getBargainUserId,storeBargainUser.getId()) + .eq(YxStoreBargainUserHelp::getUid,uid) + .count(); + if(count == 0) { + return true; + } + return false; + } + + /** + * 添加砍价记录 + * @param bargainId 砍价商品id + * @param uid 用户id + */ + @Override + public void setBargain(Long bargainId, Long uid) { + YxStoreBargainUser storeBargainUser = this.getBargainUserInfo(bargainId,uid); + if(storeBargainUser != null) { + throw new YshopException("你已经参与了"); + } + YxStoreBargain storeBargain = storeBargainService.getById(bargainId); + if(storeBargain == null) { + throw new YshopException("砍价商品不存在"); + } + YxStoreBargainUser yxStoreBargainUser = YxStoreBargainUser + .builder() + .bargainId(bargainId) + .uid(uid) + .bargainPrice(storeBargain.getPrice()) + .bargainPriceMin(storeBargain.getMinPrice()) + .price(BigDecimal.ZERO) + .status(OrderInfoEnum.BARGAIN_STATUS_1.getValue()) + .build(); + yxStoreBargainUserMapper.insert(yxStoreBargainUser); + } + +// /** +// * 获取用户可以砍掉的价格 +// * @param id +// * @return +// */ +// @Override +// public double getBargainUserDiffPrice(int id) { +// YxStoreBargainUser storeBargainUserQueryVo = this.getById(id); +// return NumberUtil.sub(storeBargainUserQueryVo.getBargainPrice() +// ,storeBargainUserQueryVo.getBargainPriceMin()).doubleValue(); +// } + + + + /** + * 获取某个用户参与砍价信息 + * @param bargainId 砍价id + * @param uid 用户id + * @return YxStoreBargainUser + */ + @Override + public YxStoreBargainUser getBargainUserInfo(Long bargainId, Long uid) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreBargainUser::getBargainId,bargainId) + .eq(YxStoreBargainUser::getUid,uid) + .last("limit 1"); + return yxStoreBargainUserMapper.selectOne(wrapper); + } + + /** + * 获取参与砍价的用户数量 + * @param bargainId 砍价id + * @param status 状态 OrderInfoEnum 1 进行中 2 结束失败 3结束成功 + * @return int + */ + @Override + public int getBargainUserCount(Long bargainId, Integer status) { + return this.lambdaQuery().eq(YxStoreBargainUser::getBargainId,bargainId) + .eq(YxStoreBargainUser::getStatus,status).count(); + } + + +// +// /** +// * 获取参与砍价的用户列表 +// * @param bargainId 砍价id +// * @param status 状态 1 进行中 2 结束失败 3结束成功 +// * @return +// */ +// @Override +// public List getBargainUserList(int bargainId, int status) { +// LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); +// wrapper.eq("bargain_id",bargainId).eq("status",status); +// return generator.convert(yxStoreBargainUserMapper.selectList(wrapper), +// YxStoreBargainUserQueryVo.class); +// } + + + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCombinationServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCombinationServiceImpl.java new file mode 100644 index 0000000..39dc731 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCombinationServiceImpl.java @@ -0,0 +1,388 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.ListUtil; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.YshopException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.ProductTypeEnum; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.enums.SpecTypeEnum; +import co.yixiang.exception.BadRequestException; +import co.yixiang.modules.activity.domain.YxStoreCombination; +import co.yixiang.modules.activity.domain.YxStorePink; +import co.yixiang.modules.activity.domain.YxStoreSeckill; +import co.yixiang.modules.activity.domain.YxStoreVisit; +import co.yixiang.modules.activity.service.YxStoreCombinationService; +import co.yixiang.modules.activity.service.YxStorePinkService; +import co.yixiang.modules.activity.service.dto.PinkAllDto; +import co.yixiang.modules.activity.service.dto.YxStoreCombinationDto; +import co.yixiang.modules.activity.service.dto.YxStoreCombinationQueryCriteria; +import co.yixiang.modules.activity.service.mapper.YxStoreCombinationMapper; +import co.yixiang.modules.activity.service.mapper.YxStorePinkMapper; +import co.yixiang.modules.activity.service.mapper.YxStoreVisitMapper; +import co.yixiang.modules.activity.vo.CombinationQueryVo; +import co.yixiang.modules.activity.vo.StoreCombinationVo; +import co.yixiang.modules.activity.vo.YxStoreCombinationQueryVo; +import co.yixiang.modules.product.domain.YxStoreProduct; +import co.yixiang.modules.product.domain.YxStoreProductAttrValue; +import co.yixiang.modules.product.service.YxStoreProductAttrService; +import co.yixiang.modules.product.service.YxStoreProductAttrValueService; +import co.yixiang.modules.product.service.YxStoreProductReplyService; +import co.yixiang.modules.product.service.YxStoreProductService; +import co.yixiang.modules.product.service.dto.FromatDetailDto; +import co.yixiang.modules.product.service.dto.ProductFormatDto; +import co.yixiang.modules.product.service.dto.ProductResultDto; +import co.yixiang.modules.product.vo.YxStoreProductAttrQueryVo; +import co.yixiang.modules.template.domain.YxShippingTemplates; +import co.yixiang.modules.template.service.YxShippingTemplatesService; +import co.yixiang.utils.FileUtil; +import co.yixiang.utils.RedisUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Service +@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) +public class YxStoreCombinationServiceImpl extends BaseServiceImpl implements YxStoreCombinationService { + + @Autowired + private IGenerator generator; + + @Autowired + private YxStorePinkMapper yxStorePinkMapper; + @Autowired + private YxStoreVisitMapper yxStoreVisitMapper; + + @Autowired + private YxStoreCombinationMapper yxStoreCombinationMapper; + @Autowired + private YxStoreProductReplyService replyService; + @Autowired + private YxStorePinkService storePinkService; + @Autowired + private YxStoreProductAttrService yxStoreProductAttrService; + @Autowired + private YxStoreProductAttrValueService yxStoreProductAttrValueService; + @Autowired + private YxShippingTemplatesService shippingTemplatesService; + + @Autowired + private YxStoreProductService storeProductService; + + + + /** + * 获取拼团详情 + * @param id 拼团产品id + * @param uid uid + * @return StoreCombinationVo + */ + @Override + public StoreCombinationVo getDetail(Long id, Long uid) { + Date now = new Date(); + YxStoreCombination storeCombination = this + .lambdaQuery().eq(YxStoreCombination::getId,id) + .eq(YxStoreCombination::getIsShow, ShopCommonEnum.SHOW_1.getValue()) + .le(YxStoreCombination::getStartTime,now) + .ge(YxStoreCombination::getStopTime,now) + .one(); + if(storeCombination == null){ + throw new YshopException("拼团不存在或已下架"); + } + //获取商品sku + Map returnMap = yxStoreProductAttrService.getProductAttrDetail(storeCombination.getProductId()); + + YxStoreCombinationQueryVo storeCombinationQueryVo = generator.convert(storeCombination, + YxStoreCombinationQueryVo.class); + + StoreCombinationVo storeCombinationVo = new StoreCombinationVo(); + + storeCombinationVo.setStoreInfo(storeCombinationQueryVo); + + //评价 + storeCombinationVo.setReply(replyService + .getReply(storeCombinationQueryVo.getProductId())); + int replyCount = replyService.productReplyCount(storeCombinationQueryVo.getProductId()); + //总条数 + storeCombinationVo.setReplyCount(replyCount); + //好评比例 + storeCombinationVo.setReplyChance(replyService.replyPer(storeCombinationQueryVo.getProductId())); + + //获取运费模板名称 + String storeFreePostage = RedisUtil.get("store_free_postage"); + String tempName = ""; + if(StrUtil.isBlank(storeFreePostage) + || !NumberUtil.isNumber(storeFreePostage) + || Integer.valueOf(storeFreePostage) == 0){ + tempName = "全国包邮"; + }else{ + YxShippingTemplates shippingTemplates = shippingTemplatesService.getById(storeCombination.getTempId()); + if(ObjectUtil.isNotNull(shippingTemplates)){ + tempName = shippingTemplates.getName(); + }else { + throw new BadRequestException("请配置运费模板"); + } + + } + storeCombinationVo.setTempName(tempName); + + PinkAllDto pinkAllDto = storePinkService.getPinkAll(id); + storeCombinationVo.setPindAll(pinkAllDto.getPindAll()); + storeCombinationVo.setPink(pinkAllDto.getList()); + storeCombinationVo.setPinkOkList(storePinkService.getPinkOkList(uid)); + storeCombinationVo.setPinkOkSum(storePinkService.getPinkOkSumTotalNum()); + storeCombinationVo.setProductAttr((List)returnMap.get("productAttr")); + storeCombinationVo.setProductValue((Map)returnMap.get("productValue")); + return storeCombinationVo; + } + + /** + * 拼团列表 + * @param page page + * @param limit limit + * @return list + */ + @Override + public CombinationQueryVo getList(int page, int limit) { + CombinationQueryVo combinationQueryVo = new CombinationQueryVo(); + Date nowTime = new Date(); + Page pageModel = new Page<>(page, limit); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper + .eq(YxStoreCombination::getIsShow,1) + .le(YxStoreCombination::getStartTime,nowTime) + .ge(YxStoreCombination::getStopTime,nowTime) + .orderByDesc(YxStoreCombination::getSort); + IPage yxStoreCombinationIPage = yxStoreCombinationMapper.selectPage(pageModel, wrapper); + + List collect = yxStoreCombinationIPage.getRecords().stream().map(i -> { + YxStoreCombinationQueryVo yxStoreCombinationQueryVo = new YxStoreCombinationQueryVo(); + BeanUtils.copyProperties(i, yxStoreCombinationQueryVo); + return yxStoreCombinationQueryVo; + }).collect(Collectors.toList()); + combinationQueryVo.setStoreCombinationQueryVos(collect); + combinationQueryVo.setLastPage(yxStoreCombinationIPage.getPages()); + return combinationQueryVo; + } + + + //=======================================// + + @Override + //@Cacheable + public Map queryAll(YxStoreCombinationQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + + List combinationDTOS = generator.convert(page.getList(),YxStoreCombinationDto.class); + for (YxStoreCombinationDto combinationDTO : combinationDTOS) { + //参与人数 + combinationDTO.setCountPeopleAll(yxStorePinkMapper.selectCount(new LambdaQueryWrapper() + .eq(YxStorePink::getCid,combinationDTO.getId()))); + + //成团人数 + combinationDTO.setCountPeoplePink(yxStorePinkMapper.selectCount(new LambdaQueryWrapper() + .eq(YxStorePink::getCid,combinationDTO.getId()) + .eq(YxStorePink::getKId,0)));//团长 + //获取查看拼团产品人数 + combinationDTO.setCountPeopleBrowse(yxStoreVisitMapper.selectCount(new LambdaQueryWrapper() + .eq(YxStoreVisit::getProductId,combinationDTO.getId()) + .eq(YxStoreVisit::getProductType, ProductTypeEnum.COMBINATION.getValue()))); + } + Map map = new LinkedHashMap<>(2); + map.put("content",combinationDTOS); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxStoreCombinationQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreCombination.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxStoreCombinationDto yxStoreCombination : all) { + Map map = new LinkedHashMap<>(); + map.put("商品id", yxStoreCombination.getProductId()); + map.put("推荐图", yxStoreCombination.getImage()); + map.put("轮播图", yxStoreCombination.getImages()); + map.put("活动标题", yxStoreCombination.getTitle()); + map.put("参团人数", yxStoreCombination.getPeople()); + map.put("简介", yxStoreCombination.getInfo()); + map.put("价格", yxStoreCombination.getPrice()); + map.put("排序", yxStoreCombination.getSort()); + map.put("销量", yxStoreCombination.getSales()); + map.put("库存", yxStoreCombination.getStock()); + map.put("推荐", yxStoreCombination.getIsHost()); + map.put("产品状态", yxStoreCombination.getIsShow()); + map.put(" combination", yxStoreCombination.getCombination()); + map.put("商户是否可用1可用0不可用", yxStoreCombination.getMerUse()); + map.put("是否包邮1是0否", yxStoreCombination.getIsPostage()); + map.put("邮费", yxStoreCombination.getPostage()); + map.put("拼团内容", yxStoreCombination.getDescription()); + map.put("拼团开始时间", yxStoreCombination.getStartTime()); + map.put("拼团结束时间", yxStoreCombination.getStopTime()); + map.put("拼团订单有效时间", yxStoreCombination.getEffectiveTime()); + map.put("拼团产品成本", yxStoreCombination.getCost()); + map.put("浏览量", yxStoreCombination.getBrowse()); + map.put("单位名", yxStoreCombination.getUnitName()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + /** + * 修改状态 + * @param id 拼团产品id + * @param status ShopCommonEnum + */ + @Override + public void onSale(Long id, Integer status) { + if(ShopCommonEnum.SHOW_1.getValue().equals(status)){ + status = ShopCommonEnum.SHOW_0.getValue(); + }else{ + status = ShopCommonEnum.SHOW_1.getValue(); + } + YxStoreCombination yxStoreCombination = new YxStoreCombination(); + yxStoreCombination.setIsShow(status); + yxStoreCombination.setId(id); + this.saveOrUpdate(yxStoreCombination); + } + + @Override + public boolean saveCombination(YxStoreCombinationDto resources) { + ProductResultDto resultDTO = this.computedProduct(resources.getAttrs()); + + //添加商品 + YxStoreCombination yxStoreCombination = new YxStoreCombination(); + BeanUtil.copyProperties(resources,yxStoreCombination,"images"); + if(resources.getImages().isEmpty()) { + throw new YshopException("请上传轮播图"); + } + + yxStoreCombination.setPrice(BigDecimal.valueOf(resultDTO.getMinPrice())); + yxStoreCombination.setProductPrice(BigDecimal.valueOf(resultDTO.getMinOtPrice())); + yxStoreCombination.setCost(resultDTO.getMinCost().intValue()); + yxStoreCombination.setStock(resultDTO.getStock()); + yxStoreCombination.setImages(String.join(",", resources.getImages())); + this.saveOrUpdate(yxStoreCombination); + + //属性处理 + //处理单sKu + if(SpecTypeEnum.TYPE_0.getValue().equals(resources.getSpecType())){ + FromatDetailDto fromatDetailDto = FromatDetailDto.builder() + .value("规格") + .detailValue("") + .attrHidden("") + .detail(ListUtil.toList("默认")) + .build(); + List attrs = resources.getAttrs(); + ProductFormatDto productFormatDto = attrs.get(0); + productFormatDto.setValue1("规格"); + Map map = new HashMap<>(); + map.put("规格","默认"); + productFormatDto.setDetail(map); + yxStoreProductAttrService.insertYxStoreProductAttr(ListUtil.toList(fromatDetailDto), + ListUtil.toList(productFormatDto),resources.getProductId()); + }else{ + yxStoreProductAttrService.insertYxStoreProductAttr(resources.getItems(), + resources.getAttrs(),resources.getProductId()); + } + return true; + } + + + /** + * 计算产品数据 + * @param attrs attrs + * @return ProductResultDto + */ + private ProductResultDto computedProduct(List attrs){ + //取最小价格 + Double minPrice = attrs + .stream() + .map(ProductFormatDto::getPinkPrice) + .min(Comparator.naturalOrder()) + .orElse(0d); + + Double minOtPrice = attrs + .stream() + .map(ProductFormatDto::getOtPrice) + .min(Comparator.naturalOrder()) + .orElse(0d); + + Double minCost = attrs + .stream() + .map(ProductFormatDto::getCost) + .min(Comparator.naturalOrder()) + .orElse(0d); + //计算库存 + Integer stock = attrs + .stream() + .map(ProductFormatDto::getPinkStock) + .reduce(Integer::sum) + .orElse(0); + + if(stock <= 0) { + throw new YshopException("库存不能低于0"); + } + + return ProductResultDto.builder() + .minPrice(minPrice) + .minOtPrice(minOtPrice) + .minCost(minCost) + .stock(stock) + .build(); + } + + /** + * mapTobean + * @param listMap listMap + * @return list + */ + private List ListMapToListBean(List> listMap){ + List list = new ArrayList<>(); + // 循环遍历出map对象 + for (Map m : listMap) { + list.add(BeanUtil.mapToBean(m,ProductFormatDto.class,true)); + } + return list; + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponIssueServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponIssueServiceImpl.java new file mode 100644 index 0000000..691994a --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponIssueServiceImpl.java @@ -0,0 +1,177 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import co.yixiang.api.YshopException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.CouponEnum; +import co.yixiang.modules.activity.domain.YxStoreCouponIssue; +import co.yixiang.modules.activity.domain.YxStoreCouponIssueUser; +import co.yixiang.modules.activity.service.YxStoreCouponIssueService; +import co.yixiang.modules.activity.service.YxStoreCouponIssueUserService; +import co.yixiang.modules.activity.service.YxStoreCouponUserService; +import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueDto; +import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueQueryCriteria; +import co.yixiang.modules.activity.service.mapper.YxStoreCouponIssueMapper; +import co.yixiang.modules.activity.vo.YxStoreCouponIssueQueryVo; +import co.yixiang.utils.FileUtil; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxStoreCouponIssueServiceImpl extends BaseServiceImpl implements YxStoreCouponIssueService { + + private final IGenerator generator; + + private final YxStoreCouponIssueMapper yxStoreCouponIssueMapper; + + + private final YxStoreCouponUserService storeCouponUserService; + private final YxStoreCouponIssueUserService storeCouponIssueUserService; + + + /** + * 领取优惠券 + * @param id id 优惠券id + * @param uid uid + */ + @Override + public void issueUserCoupon(Integer id, Long uid) { + YxStoreCouponIssueQueryVo couponIssueQueryVo = yxStoreCouponIssueMapper + .selectOne(id); + if(ObjectUtil.isNull(couponIssueQueryVo)) { + throw new YshopException("领取的优惠劵已领完或已过期"); + } + + int count = this.couponCount(id,uid); + if(count > 0) { + throw new YshopException("已领取过该优惠劵"); + } + + if(couponIssueQueryVo.getRemainCount() <= 0 + && CouponEnum.PERMANENT_0.getValue().equals(couponIssueQueryVo.getIsPermanent())){ + throw new YshopException("抱歉优惠卷已经领取完了"); + } + + storeCouponUserService.addUserCoupon(uid,couponIssueQueryVo.getCid()); + + storeCouponIssueUserService.addUserIssue(uid,id); + + if(couponIssueQueryVo.getTotalCount() > 0){ + yxStoreCouponIssueMapper.decCount(id); + } + + } + + + /** + * 优惠券列表 + * @param page page + * @param limit limit + * @param uid 用户id + * @return list + */ + @Override + public List getCouponList(int page, int limit, Long uid,Long productId,Integer type) { + Page pageModel = new Page<>(page, limit); + + if(type == null) { + type = CouponEnum.TYPE_0.getValue(); + } + List list = yxStoreCouponIssueMapper + .selecCoupontList(pageModel,type,productId); + for (YxStoreCouponIssueQueryVo couponIssue : list) { + int count = this.couponCount(couponIssue.getId(),uid); + if(count > 0){ + couponIssue.setIsUse(true); + }else{ + couponIssue.setIsUse(false); + } + + } + return list; + } + + + /** + * 获取用户领取优惠券数量 + * @param id 前台优惠券id + * @param uid 用户id + * @return int + */ + private int couponCount(Integer id, Long uid) { + return storeCouponIssueUserService.lambdaQuery() + .eq(YxStoreCouponIssueUser::getUid,uid) + .eq(YxStoreCouponIssueUser::getIssueCouponId,id) + .count(); + } + + //============================================================// + + + @Override + //@Cacheable + public Map queryAll(YxStoreCouponIssueQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxStoreCouponIssueDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxStoreCouponIssueQueryCriteria criteria){ + return this.list(QueryHelpPlus.getPredicate(YxStoreCouponIssue.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxStoreCouponIssueDto yxStoreCouponIssue : all) { + Map map = new LinkedHashMap<>(); + map.put(" cname", yxStoreCouponIssue.getCname()); + map.put("优惠券ID", yxStoreCouponIssue.getCid()); + map.put("优惠券领取开启时间", yxStoreCouponIssue.getStartTime()); + map.put("优惠券领取结束时间", yxStoreCouponIssue.getEndTime()); + map.put("优惠券领取数量", yxStoreCouponIssue.getTotalCount()); + map.put("优惠券剩余领取数量", yxStoreCouponIssue.getRemainCount()); + map.put("是否无限张数", yxStoreCouponIssue.getIsPermanent()); + map.put("1 正常 0 未开启 -1 已无效", yxStoreCouponIssue.getStatus()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponIssueUserServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponIssueUserServiceImpl.java new file mode 100644 index 0000000..3884dea --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponIssueUserServiceImpl.java @@ -0,0 +1,92 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.activity.domain.YxStoreCouponIssueUser; +import co.yixiang.modules.activity.service.YxStoreCouponIssueUserService; +import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueUserDto; +import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueUserQueryCriteria; +import co.yixiang.modules.activity.service.mapper.YxStoreCouponIssueUserMapper; +import co.yixiang.utils.FileUtil; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxStoreCouponIssueUserServiceImpl extends BaseServiceImpl implements YxStoreCouponIssueUserService { + + private final IGenerator generator; + + /** + * 添加优惠券领取记录 + * @param uid 用户id + * @param id 前台优惠券id + */ + @Override + public void addUserIssue(Long uid, Integer id) { + YxStoreCouponIssueUser couponIssueUser = new YxStoreCouponIssueUser(); + couponIssueUser.setIssueCouponId(id); + couponIssueUser.setUid(uid); + this.save(couponIssueUser); + } + + + @Override + //@Cacheable + public Map queryAll(YxStoreCouponIssueUserQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxStoreCouponIssueUserDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxStoreCouponIssueUserQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreCouponIssueUser.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxStoreCouponIssueUserDto yxStoreCouponIssueUser : all) { + Map map = new LinkedHashMap<>(); + map.put("领取优惠券用户ID", yxStoreCouponIssueUser.getUid()); + map.put("优惠券前台领取ID", yxStoreCouponIssueUser.getIssueCouponId()); + map.put("领取时间", yxStoreCouponIssueUser.getAddTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponServiceImpl.java new file mode 100644 index 0000000..6c5ff8f --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponServiceImpl.java @@ -0,0 +1,95 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.impl; + +import cn.hutool.core.util.StrUtil; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.activity.domain.YxStoreCoupon; +import co.yixiang.modules.activity.service.YxStoreCouponService; +import co.yixiang.modules.activity.service.dto.YxStoreCouponDto; +import co.yixiang.modules.activity.service.dto.YxStoreCouponQueryCriteria; +import co.yixiang.modules.activity.service.mapper.YxStoreCouponMapper; +import co.yixiang.modules.product.domain.YxStoreProduct; +import co.yixiang.modules.product.service.YxStoreProductService; +import co.yixiang.utils.FileUtil; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxStoreCouponServiceImpl extends BaseServiceImpl implements YxStoreCouponService { + + private final IGenerator generator; + private final YxStoreProductService storeProductService; + + @Override + //@Cacheable + public Map queryAll(YxStoreCouponQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + List storeCouponDtos = generator.convert(page.getList(), YxStoreCouponDto.class); + for (YxStoreCouponDto storeCouponDto : storeCouponDtos) { + if(StrUtil.isNotBlank(storeCouponDto.getProductId())){ + List storeProducts = storeProductService.lambdaQuery() + .in(YxStoreProduct::getId, Arrays.asList(storeCouponDto.getProductId().split(","))) + .list(); + storeCouponDto.setProduct(storeProducts); + } + } + map.put("content", storeCouponDtos); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxStoreCouponQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreCoupon.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxStoreCouponDto yxStoreCoupon : all) { + Map map = new LinkedHashMap<>(); + map.put("优惠券名称", yxStoreCoupon.getTitle()); + map.put("兑换消耗积分值", yxStoreCoupon.getIntegral()); + map.put("兑换的优惠券面值", yxStoreCoupon.getCouponPrice()); + map.put("最低消费多少金额可用优惠券", yxStoreCoupon.getUseMinPrice()); + map.put("优惠券有效期限(单位:天)", yxStoreCoupon.getCouponTime()); + map.put("排序", yxStoreCoupon.getSort()); + map.put("状态(0:关闭,1:开启)", yxStoreCoupon.getStatus()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponUserServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponUserServiceImpl.java new file mode 100644 index 0000000..701aa6c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponUserServiceImpl.java @@ -0,0 +1,353 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.NumberUtil; +import co.yixiang.api.YshopException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.constant.ShopConstants; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.CouponEnum; +import co.yixiang.enums.CouponGetEnum; +import co.yixiang.modules.activity.domain.YxStoreCoupon; +import co.yixiang.modules.activity.domain.YxStoreCouponUser; +import co.yixiang.modules.activity.service.YxStoreCouponService; +import co.yixiang.modules.activity.service.YxStoreCouponUserService; +import co.yixiang.modules.activity.service.dto.YxStoreCouponUserDto; +import co.yixiang.modules.activity.service.dto.YxStoreCouponUserQueryCriteria; +import co.yixiang.modules.activity.service.mapper.YxStoreCouponUserMapper; +import co.yixiang.modules.activity.vo.StoreCouponUserVo; +import co.yixiang.modules.activity.vo.YxStoreCouponUserQueryVo; +import co.yixiang.modules.cart.service.YxStoreCartService; +import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.service.YxUserService; +import co.yixiang.utils.FileUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxStoreCouponUserServiceImpl extends BaseServiceImpl implements YxStoreCouponUserService { + + @Autowired + private IGenerator generator; + + + @Autowired + private YxStoreCouponUserMapper yxStoreCouponUserMapper; + + @Autowired + private YxUserService userService; + @Autowired + private YxStoreCouponService storeCouponService; + @Autowired + private YxStoreCartService yxStoreCartService; + + /** + * 获取当前用户优惠券数量 + * @param uid uid + * @return int + */ + @Override + public int getUserValidCouponCount(Long uid) { + this.checkInvalidCoupon(); + return this.lambdaQuery() + .eq(YxStoreCouponUser::getStatus, CouponEnum.STATUS_0.getValue()) + .eq(YxStoreCouponUser::getUid,uid) + .count(); + } + + /** + * 获取满足条件的可用优惠券 + * @param cartIds 购物车ids + * @return list + */ + @Override + public List beUsableCouponList(Long uid,String cartIds) { + + Map cartGroup = yxStoreCartService.getUserProductCartList(uid, + cartIds, ShopConstants.YSHOP_ONE_NUM); + + List cartInfo = (List)cartGroup.get("valid"); + + BigDecimal sumPrice = BigDecimal.ZERO; + for (YxStoreCartQueryVo storeCart : cartInfo) { + sumPrice = NumberUtil.add(sumPrice,NumberUtil.mul(storeCart.getCartNum(),storeCart.getTruePrice())); + } + + List productIds = cartInfo.stream() + .map(YxStoreCartQueryVo::getProductId) + .map(Object::toString) + .collect(Collectors.toList()); + + + return this.getUsableCouponList(uid, sumPrice.doubleValue(), productIds); + } + + /** + * 获取下单时候满足的优惠券 + * @param uid uid + * @param price 总价格 + * @param productIds list + * @return list + */ + @Override + public List getUsableCouponList(Long uid, double price, List productIds) { + Date now = new Date(); + List storeCouponUsers = yxStoreCouponUserMapper.selectCouponList(now, price, uid); + return storeCouponUsers.stream() + .filter(coupon -> + CouponEnum.TYPE_2.getValue().equals(coupon.getType()) || + CouponEnum.TYPE_0.getValue().equals(coupon.getType()) + || (CouponEnum.TYPE_1.getValue().equals(coupon.getType()) + && isSame(Arrays.asList(coupon.getProductId().split(",")),productIds))) + .collect(Collectors.toList()); + + } + + + + + /** + * 获取用户优惠券 + * @param id 优惠券id + * @param uid 用户id + * @return YxStoreCouponUser + */ + @Override + public YxStoreCouponUser getCoupon(Integer id,Long uid) { + return this.lambdaQuery() + .eq(YxStoreCouponUser::getIsFail, CouponEnum.FALI_0.getValue()) + .eq(YxStoreCouponUser::getStatus,CouponEnum.STATUS_0.getValue()) + .eq(YxStoreCouponUser::getUid,uid) + .eq(YxStoreCouponUser::getId,id) + .one(); + } + + @Override + public void useCoupon(int id) { + YxStoreCouponUser couponUser = new YxStoreCouponUser(); + couponUser.setId((long)id); + couponUser.setStatus(1); + couponUser.setUseTime(new Date()); + yxStoreCouponUserMapper.updateById(couponUser); + } + + + + /** + * 获取用户优惠券 + * @param uid uid + * @return list + */ + @Override + public List getUserCoupon(Long uid) { + //this.checkInvalidCoupon(); + List storeCouponUsers = yxStoreCouponUserMapper + .selectList(Wrappers.lambdaQuery() + .eq(YxStoreCouponUser::getUid,uid)); + List storeCouponUserQueryVoList = new ArrayList<>(); + long nowTime = System.currentTimeMillis(); + for (YxStoreCouponUser couponUser : storeCouponUsers) { + YxStoreCouponUserQueryVo queryVo = generator.convert(couponUser,YxStoreCouponUserQueryVo.class); + if(couponUser.getIsFail() == 1){ + queryVo.set_type(CouponEnum.USE_0.getValue()); + queryVo.set_msg("已失效"); + }else if (couponUser.getStatus() == 1){ + queryVo.set_type(CouponEnum.USE_0.getValue()); + queryVo.set_msg("已使用"); + }else if (couponUser.getStatus() == 2){ + queryVo.set_type(CouponEnum.USE_0.getValue()); + queryVo.set_msg("已过期"); + }else if(couponUser.getCreateTime().getTime() > nowTime || couponUser.getEndTime().getTime() < nowTime){ + queryVo.set_type(CouponEnum.USE_0.getValue()); + queryVo.set_msg("已过期"); + }else{ + queryVo.set_type(CouponEnum.USE_1.getValue()); + queryVo.set_msg("可使用"); + } + + storeCouponUserQueryVoList.add(queryVo); + } + return storeCouponUserQueryVoList; + } + + /** + * 添加优惠券记录 + * @param uid 用户id + * @param cid 优惠券id + */ + @Override + public void addUserCoupon(Long uid, Integer cid) { + YxStoreCoupon storeCoupon = storeCouponService.getById(cid); + if(storeCoupon == null) { + throw new YshopException("优惠劵不存在"); + } + + Date now = new Date(); + + Date endTime = DateUtil.offsetDay(now,storeCoupon.getCouponTime()); + + YxStoreCouponUser storeCouponUser = YxStoreCouponUser.builder() + .cid(storeCoupon.getId()) + .uid(uid) + .couponPrice(storeCoupon.getCouponPrice()) + .couponTitle(storeCoupon.getTitle()) + .useMinPrice(storeCoupon.getUseMinPrice()) + .endTime(endTime) + .type(CouponGetEnum.GET.getValue()) + .build(); + + this.save(storeCouponUser); + + } + + + /** + * 判断两个list是否有相同值 + * @param list1 list + * @param list2 list + * @return boolean + */ + private boolean isSame(List list1,List list2){ + if(list2.isEmpty()) { + return true; + } + list1 = new ArrayList<>(list1); + list2 = new ArrayList<>(list2); + list1.addAll(list2); + int total = list1.size(); + + List newList = new ArrayList<>(new HashSet<>(list1)); + + int newTotal = newList.size(); + + + return total > newTotal; + } + + + /** + * 检查优惠券状态 + */ + private void checkInvalidCoupon() { + Date nowTime = new Date(); + LambdaQueryWrapper wrapper= new LambdaQueryWrapper<>(); + wrapper.lt(YxStoreCouponUser::getEndTime,nowTime) + .eq(YxStoreCouponUser::getStatus,CouponEnum.STATUS_0.getValue()); + YxStoreCouponUser couponUser = new YxStoreCouponUser(); + couponUser.setStatus(CouponEnum.STATUS_2.getValue()); + yxStoreCouponUserMapper.update(couponUser,wrapper); + + } + + + + //=========================================================================================================// + + @Override + //@Cacheable + public Map queryAll(YxStoreCouponUserQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + List storeOrderDTOS = generator.convert(page.getList(),YxStoreCouponUserDto.class); + for (YxStoreCouponUserDto couponUserDTO : storeOrderDTOS) { + couponUserDTO.setNickname(userService.getOne(new LambdaQueryWrapper() + .eq(YxUser::getUid,couponUserDTO.getUid())).getNickname()); + } + Map map = new LinkedHashMap<>(2); + map.put("content",storeOrderDTOS); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxStoreCouponUserQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreCouponUser.class, criteria)); + } + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxStoreCouponUserDto yxStoreCouponUser : all) { + Map map = new LinkedHashMap<>(); + map.put("兑换的项目id", yxStoreCouponUser.getCid()); + map.put("优惠券所属用户", yxStoreCouponUser.getUid()); + map.put("优惠券名称", yxStoreCouponUser.getCouponTitle()); + map.put("优惠券的面值", yxStoreCouponUser.getCouponPrice()); + map.put("最低消费多少金额可用优惠券", yxStoreCouponUser.getUseMinPrice()); + map.put("优惠券创建时间", yxStoreCouponUser.getAddTime()); + map.put("优惠券结束时间", yxStoreCouponUser.getEndTime()); + map.put("使用时间", yxStoreCouponUser.getUseTime()); + map.put("获取方式", yxStoreCouponUser.getType()); + map.put("状态(0:未使用,1:已使用, 2:已过期)", yxStoreCouponUser.getStatus()); + map.put("是否有效", yxStoreCouponUser.getIsFail()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + public Map getUserPCCoupon(Long uid, int page, int limit, Integer type) { + Page yxStoreCouponUserPage = new Page<>(page, limit); + yxStoreCouponUserMapper.selectPage(yxStoreCouponUserPage,Wrappers.lambdaQuery() + .eq(YxStoreCouponUser::getUid,uid).eq(YxStoreCouponUser::getStatus,type)); + + List storeCouponUserQueryVoList = new ArrayList<>(); + long nowTime = System.currentTimeMillis(); + for (YxStoreCouponUser couponUser : yxStoreCouponUserPage.getRecords()) { + YxStoreCouponUserQueryVo queryVo = generator.convert(couponUser,YxStoreCouponUserQueryVo.class); + if(couponUser.getIsFail() == 1){ + queryVo.set_type(CouponEnum.USE_0.getValue()); + queryVo.set_msg("已失效"); + }else if (couponUser.getStatus() == 1){ + queryVo.set_type(CouponEnum.USE_0.getValue()); + queryVo.set_msg("已使用"); + }else if (couponUser.getStatus() == 2){ + queryVo.set_type(CouponEnum.USE_0.getValue()); + queryVo.set_msg("已过期"); + }else if(couponUser.getCreateTime().getTime() > nowTime || couponUser.getEndTime().getTime() < nowTime){ + queryVo.set_type(CouponEnum.USE_0.getValue()); + queryVo.set_msg("已过期"); + }else{ + queryVo.set_type(CouponEnum.USE_1.getValue()); + queryVo.set_msg("可使用"); + } + + storeCouponUserQueryVoList.add(queryVo); + } + Map map = new HashMap<>(); + map.put("list",storeCouponUserQueryVoList); + map.put("total",yxStoreCouponUserPage.getTotal()); + map.put("totalPage",yxStoreCouponUserPage.getPages()); + return map; + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStorePinkServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStorePinkServiceImpl.java new file mode 100644 index 0000000..b4c2f8c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStorePinkServiceImpl.java @@ -0,0 +1,698 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.YshopException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.constant.ShopConstants; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.OrderInfoEnum; +import co.yixiang.enums.PinkEnum; +import co.yixiang.modules.activity.domain.YxStoreCombination; +import co.yixiang.modules.activity.domain.YxStorePink; +import co.yixiang.modules.activity.service.YxStoreCombinationService; +import co.yixiang.modules.activity.service.YxStorePinkService; +import co.yixiang.modules.activity.service.YxStoreVisitService; +import co.yixiang.modules.activity.service.dto.PinkAllDto; +import co.yixiang.modules.activity.service.dto.PinkDto; +import co.yixiang.modules.activity.service.dto.PinkUserDto; +import co.yixiang.modules.activity.service.dto.YxStorePinkDto; +import co.yixiang.modules.activity.service.dto.YxStorePinkQueryCriteria; +import co.yixiang.modules.activity.service.mapper.YxStoreCombinationMapper; +import co.yixiang.modules.activity.service.mapper.YxStorePinkMapper; +import co.yixiang.modules.activity.vo.PinkInfoVo; +import co.yixiang.modules.activity.vo.YxStoreCombinationQueryVo; +import co.yixiang.modules.activity.vo.YxStorePinkQueryVo; +import co.yixiang.modules.cart.domain.YxStoreCart; +import co.yixiang.modules.cart.service.YxStoreCartService; +import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; +import co.yixiang.modules.order.domain.YxStoreOrder; +import co.yixiang.modules.order.service.YxStoreOrderService; +import co.yixiang.modules.order.vo.YxStoreOrderQueryVo; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.service.YxUserService; +import co.yixiang.modules.user.vo.YxUserQueryVo; +import co.yixiang.utils.FileUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxStorePinkServiceImpl extends BaseServiceImpl implements YxStorePinkService { + + @Autowired + private IGenerator generator; + @Autowired + private YxStorePinkMapper yxStorePinkMapper; + @Autowired + private YxStoreCombinationMapper yxStoreCombinationMapper; + @Autowired + private YxStoreCombinationService combinationService; + @Autowired + private YxStoreOrderService storeOrderService; + @Autowired + private YxUserService userService; + @Autowired + private RedisTemplate redisTemplate; + @Autowired + private YxUserService yxUserService; + + @Autowired + private YxStoreCartService yxStoreCartService; + + @Autowired + private YxStoreVisitService yxStoreVisitService; + + + /** + * 取消拼团 + * @param uid 用户id + * @param cid 团购产品id + * @param pinkId 拼团id + */ + @Override + public void removePink(Long uid, Long cid, Long pinkId) { + YxStorePink pink = this.lambdaQuery().eq(YxStorePink::getId,pinkId) + .eq(YxStorePink::getUid,uid) + .eq(YxStorePink::getCid,cid) + .eq(YxStorePink::getKId,0) //团长 + .eq(YxStorePink::getIsRefund,OrderInfoEnum.PINK_REFUND_STATUS_0.getValue()) + .eq(YxStorePink::getStatus,OrderInfoEnum.REFUND_STATUS_1.getValue()) + .gt(YxStorePink::getStopTime,new Date()) + .one(); + if(pink == null) { + throw new YshopException("拼团不存在或已经取消"); + } + + PinkUserDto pinkUserDto = this.getPinkMemberAndPinK(pink); + List pinkAll = pinkUserDto.getPinkAll(); + YxStorePink pinkT = pinkUserDto.getPinkT(); + List idAll = pinkUserDto.getIdAll(); + List uidAll = pinkUserDto.getUidAll(); + int count = pinkUserDto.getCount(); + if(count < 1){ + this.pinkComplete(uidAll,idAll,uid,pinkT); + throw new YshopException("拼团已完成,无法取消"); + } + //如果团长取消拼团,团队还有人,就把后面的人作为下一任团长 + YxStorePink nextPinkT = null; + if(pinkAll.size() > 0){ + nextPinkT = pinkAll.get(0); + } + + //先退团长的money + storeOrderService.orderApplyRefund("","","拼团取消开团",pinkT.getOrderId(),pinkT.getUid()); + this.orderPinkFailAfter(pinkT.getUid(),pinkT.getId()); + + //把团长下个人设置为团长 + if(ObjectUtil.isNotNull(nextPinkT)){ + LambdaQueryWrapper wrapperO = new LambdaQueryWrapper<>(); + YxStorePink storePinkO = new YxStorePink(); + storePinkO.setKId(0L); //设置团长 + storePinkO.setStatus(OrderInfoEnum.PINK_STATUS_1.getValue()); + storePinkO.setStopTime(pinkT.getStopTime()); + storePinkO.setId(nextPinkT.getId()); + yxStorePinkMapper.updateById(storePinkO); + + //原有团长的数据变更成新团长下面 + wrapperO.eq(YxStorePink::getKId,pinkT.getId()); + YxStorePink storePinkT = new YxStorePink(); + storePinkT.setKId(nextPinkT.getId()); + yxStorePinkMapper.update(storePinkT,wrapperO); + + //update order + YxStoreOrder storeOrder = new YxStoreOrder(); + storeOrder.setPinkId(nextPinkT.getId()); + storeOrder.setId(nextPinkT.getId()); + storeOrderService.updateById(storeOrder); + + } + } + + /** + * 计算还差几人拼团 + * @param pink 拼团信息 + * @return int + */ + @Override + public int surplusPeople(YxStorePink pink) { + List listT = new ArrayList<>(); + if(pink.getKId() > 0){ //团长存在 + listT = this.getPinkMember(pink.getKId()); + }else{ + listT = this.getPinkMember(pink.getId()); + } + + return pink.getPeople() - (listT.size() + 1); + } + + + + + /** + * 拼团明细 + * @param id 拼团id + * @param uid 用户id + */ + @Override + public PinkInfoVo pinkInfo(Long id, Long uid) { + YxStorePink pink = this.getPinkUserOne(id); + if(ObjectUtil.isNull(pink)) { + throw new YshopException("拼团不存在"); + } + if( OrderInfoEnum.PINK_REFUND_STATUS_1.getValue().equals(pink.getIsRefund())){ + throw new YshopException("订单已退款"); + } + + int isOk = 0;//判断拼团是否完成 + int userBool = 0;//判断当前用户是否在团内 0未在 1在 + int pinkBool = 0;//判断拼团是否成功 0未 1是 -1结束 + + PinkUserDto pinkUserDto = this.getPinkMemberAndPinK(pink); + YxStorePink pinkT = pinkUserDto.getPinkT(); + List pinkAll = pinkUserDto.getPinkAll(); + List idAll = pinkUserDto.getIdAll(); + List uidAll = pinkUserDto.getUidAll(); + int count = pinkUserDto.getCount(); + + if(count < 0) { + count = 0; + } + if(OrderInfoEnum.PINK_STATUS_2.getValue().equals(pinkT.getStatus())){ + pinkBool = PinkEnum.PINK_BOOL_1.getValue(); + isOk = PinkEnum.IS_OK_1.getValue(); + }else if(pinkT.getStatus() == 3){ + pinkBool = PinkEnum.PINK_BOOL_MINUS_1.getValue(); + isOk = PinkEnum.IS_OK_0.getValue(); + }else{ + //组团完成 + if(count < 1){ + isOk = PinkEnum.IS_OK_1.getValue(); + pinkBool = this.pinkComplete(uidAll,idAll,uid,pinkT); + }else{ + pinkBool = this.pinkFail(pinkAll,pinkT,pinkBool); + } + } + + //团员是否在团 + if(ObjectUtil.isNotNull(pinkAll)){ + for (YxStorePink storePink : pinkAll) { + if(storePink.getUid().equals(uid)) { + userBool = PinkEnum.USER_BOOL_1.getValue(); + } + } + } + //团长 + if(pinkT.getUid().equals(uid)) { + userBool = PinkEnum.USER_BOOL_1.getValue(); + } + + YxStoreCombinationQueryVo storeCombinationQueryVo = yxStoreCombinationMapper.getCombDetail(pink.getCid()); + if(ObjectUtil.isNull(storeCombinationQueryVo)) { + throw new YshopException("拼团不存在或已下架"); + } + + YxUserQueryVo userInfo = userService.getYxUserById(uid); + YxStoreOrder yxStoreOrder = storeOrderService.getById(pink.getOrderIdKey()); + YxStoreCart yxStoreCart = yxStoreCartService.getById(yxStoreOrder.getCartId()); + //拼团访问量 + yxStoreCombinationMapper.incBrowseNum(pink.getPid()); + //拼团访客人数 + yxStoreVisitService.addStoreVisit(uid, pink.getPid()); + return PinkInfoVo.builder() + .count(count) + .currentPinkOrder(this.getCurrentPinkOrderId(id,uid)) + .isOk(isOk) + .pinkAll(this.handPinkAll(pinkAll)) + .pinkBool(pinkBool) + .pinkT(this.handPinkT(pinkT)) + .storeCombination(storeCombinationQueryVo) + .userBool(userBool) + .userInfo(userInfo) + .uniqueId(yxStoreCart.getProductAttrUnique()) + .build(); + + } + + + + /** + * 返回正在拼团的人数 + * @param id 拼团id + * @return int + */ + @Override + public int pinkIngCount(Long id) { + return this.lambdaQuery() + .eq(YxStorePink::getId,id) + .eq(YxStorePink::getStatus,OrderInfoEnum.PINK_STATUS_1.getValue()) + .count(); + } + + + /** + * 创建拼团 + * @param order 订单 + */ + @Override + public void createPink(YxStoreOrderQueryVo order) { + YxStoreCombination storeCombination = combinationService.getById(order.getCombinationId()); + order = storeOrderService.handleOrder(order); + YxStoreCart storeCart = yxStoreCartService.getById(order.getCartId()); + int pinkCount = yxStorePinkMapper.selectCount(Wrappers.lambdaQuery() + .eq(YxStorePink::getOrderId,order.getOrderId())); + if(pinkCount > 0) { + return; + } + if(storeCombination != null){ + YxStorePink storePink = YxStorePink.builder() + .uid(order.getUid()) + .orderId(order.getOrderId()) + .orderIdKey(order.getId()) + .totalNum(order.getTotalNum()) + .totalPrice(order.getPayPrice()) + .build(); + List cartInfo = order.getCartInfo(); + for (YxStoreCartQueryVo queryVo : cartInfo) { + storePink.setCid(queryVo.getCombinationId()); + storePink.setPid(queryVo.getProductId()); + storePink.setPrice(queryVo.getProductInfo().getPrice()); + } + + Date stopTime = DateUtil.offsetHour(new Date(), storeCombination.getEffectiveTime()); + storePink.setPeople(storeCombination.getPeople()); + storePink.setStopTime(stopTime); + storePink.setUniqueId(storeCart.getProductAttrUnique()); + if(order.getPinkId() > 0){ //其他成员入团 + if(this.getIsPinkUid(order.getPinkId(),order.getUid())) { + return; + } + storePink.setKId(order.getPinkId()); + storePink.setStopTime(null); + this.save(storePink); + + //处理拼团完成 + PinkUserDto pinkUserDto = this.getPinkMemberAndPinK(storePink); + YxStorePink pinkT = pinkUserDto.getPinkT(); + if( OrderInfoEnum.PINK_STATUS_1.getValue().equals(pinkT.getStatus())){ + //int count = (int)map.get("count"); + if(pinkUserDto.getCount() == 0){//处理成功 + this.pinkComplete(pinkUserDto.getUidAll(),pinkUserDto.getIdAll(),order.getUid(), pinkT); + }else{ + this.pinkFail(pinkUserDto.getPinkAll(),pinkT,PinkEnum.PINK_BOOL_0.getValue()); + } + } + + }else{//开团 + this.save(storePink); + //pink_id更新到order表 + YxStoreOrder yxStoreOrder = new YxStoreOrder(); + yxStoreOrder.setPinkId(storePink.getId()); + yxStoreOrder.setId(order.getId()); + storeOrderService.updateById(yxStoreOrder); + + //开团加入队列 + String redisKey = String.valueOf(StrUtil.format("{}{}", + ShopConstants.REDIS_PINK_CANCEL_KEY, storePink.getId())); + long expireTime = storeCombination.getEffectiveTime().longValue() * 3600; + redisTemplate.opsForValue().set(redisKey, "1" , expireTime, TimeUnit.SECONDS); + + } + + + } + } + + /** + * 判断用户是否在团内 + * @param id 拼团id + * @param uid 用户id + * @return boolean true=在 + */ + @Override + public boolean getIsPinkUid(Long id, Long uid) { + int count = this.lambdaQuery() + .eq(YxStorePink::getIsRefund, OrderInfoEnum.PINK_REFUND_STATUS_0.getValue()) + .eq(YxStorePink::getUid,uid) + .and(i->i.eq(YxStorePink::getKId,id).or().eq(YxStorePink::getId,id)) + .count(); + return count > 0; + } + + /** + * 获取拼团完成的商品总件数 + * @return int + */ + @Override + public int getPinkOkSumTotalNum() { + return yxStorePinkMapper.sumNum(); + } + + /** + * 获取拼团成功的用户 + * @param uid uid + * @return list + */ + @Override + public List getPinkOkList(Long uid) { + List list = new ArrayList<>(); + List pinkDTOList = yxStorePinkMapper.getPinkOkList(uid); + for (PinkDto pinkDTO : pinkDTOList) { + list.add(pinkDTO.getNickname()+"拼团成功"); + } + return list; + } + + + /** + * 获取团长拼团数据 + * @param cid 拼团产品id + * @return PinkAllDto pindAll-参与的拼团的id 集合 list-团长参与的列表 + */ + @Override + public PinkAllDto getPinkAll(Long cid) { + Map map = new LinkedHashMap<>(2); + List list = yxStorePinkMapper.getPinks(cid); + List pindAll = new ArrayList<>();//参与的拼团的id 集合 + for (PinkDto pinkDto : list) { + pinkDto.setCount(String.valueOf(this.getPinkPeople(pinkDto.getId() + ,pinkDto.getPeople()))); + Date date = pinkDto.getStopTime(); + pinkDto.setH(String.valueOf(DateUtil.hour(date,true))); + pinkDto.setI(String.valueOf(DateUtil.minute(date))); + pinkDto.setS(String.valueOf(DateUtil.second(date))); + pindAll.add(pinkDto.getId()); + } + + + return PinkAllDto.builder() + .list(list) + .pindAll(pindAll) + .build(); + } + + + /** + * 处理团员 + * @param pinkAll 拼团数据 + * @return list + */ + private List handPinkAll(List pinkAll) { + + List list = generator.convert(pinkAll,YxStorePinkQueryVo.class); + for (YxStorePinkQueryVo queryVo : list) { + YxUserQueryVo userQueryVo = userService.getYxUserById(queryVo.getUid().longValue()); + queryVo.setAvatar(userQueryVo.getAvatar()); + queryVo.setNickname(userQueryVo.getNickname()); + } + return list; + } + + /** + * 处理团长 + * @param pinkT 拼团 + * @return YxStorePinkQueryVo + */ + private YxStorePinkQueryVo handPinkT(YxStorePink pinkT) { + YxStorePinkQueryVo pinkQueryVo = generator.convert(pinkT,YxStorePinkQueryVo.class); + YxUserQueryVo userQueryVo = userService.getYxUserById(pinkQueryVo.getUid().longValue()); + pinkQueryVo.setAvatar(userQueryVo.getAvatar()); + pinkQueryVo.setNickname(userQueryVo.getNickname()); + + return pinkQueryVo; + } + + + /** + * 获取当前拼团数据返回订单编号 + * @param id 拼团id + * @param uid uid + * @return string + */ + private String getCurrentPinkOrderId(Long id, Long uid) { + YxStorePink pink = yxStorePinkMapper.selectOne(Wrappers.lambdaQuery() + .eq(YxStorePink::getId,id).eq(YxStorePink::getUid,uid)); + if(pink == null){ + pink = yxStorePinkMapper.selectOne(Wrappers.lambdaQuery() + .eq(YxStorePink::getKId,id).eq(YxStorePink::getUid,uid)); + if(pink == null) { + return ""; + } + } + return pink.getOrderId(); + } + + + /** + * 获取拼团的团员 + * @param kid 团长id + * @return list + */ + private List getPinkMember(Long kid) { + return this.lambdaQuery().eq(YxStorePink::getKId,kid) + .eq(YxStorePink::getIsRefund,OrderInfoEnum.PINK_REFUND_STATUS_0.getValue()) + .orderByAsc(YxStorePink::getId) + .list(); + } + + + + /** + * 获取一条拼团数据 + * @param id 拼团id + * @return YxStorePink + */ + private YxStorePink getPinkUserOne(Long id) { + return this.lambdaQuery().eq(YxStorePink::getId,id).one(); + } + + /** + * 拼团人数完成时,判断全部人都是未退款状态 + * @return boolean + */ + private boolean getPinkStatus(List idAll) { + int count = this.lambdaQuery().in(YxStorePink::getId,idAll) + .eq(YxStorePink::getIsRefund,OrderInfoEnum.PINK_REFUND_STATUS_1.getValue()) + .count(); + if(count == 0) { + return true; + } + return false; + } + + + /** + * 拼团完成更改数据写入内容 + * @param uidAll 用户id集合 + * @param idAll 拼团id集合 + * @param uid uid + * @param pinkT 团长 + */ + private int pinkComplete(List uidAll,List idAll,Long uid, + YxStorePink pinkT) { + boolean pinkStatus = this.getPinkStatus(idAll);//判断是否有退款的 + int pinkBool = PinkEnum.PINK_BOOL_0.getValue(); + if(pinkStatus){ + //更改状态 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(YxStorePink::getId,idAll); + + YxStorePink storePink = new YxStorePink(); + storePink.setStopTime(new Date()); + storePink.setStatus(OrderInfoEnum.PINK_STATUS_2.getValue()); + + this.update(storePink,wrapper); + + if(uidAll.contains(uid)){ + pinkBool = PinkEnum.PINK_BOOL_1.getValue(); + } + + //todo 模板消息 + } + + return pinkBool; + + } + + /** + * 拼团失败退款之后 + * @param uid 用户id + * @param pid 团长id + */ + private void orderPinkFailAfter(Long uid, Long pid) { + YxStorePink yxStorePink = new YxStorePink(); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStorePink::getId,pid); + yxStorePink.setStatus(OrderInfoEnum.PINK_STATUS_3.getValue()); + yxStorePink.setStopTime(new Date()); + yxStorePinkMapper.update(yxStorePink,wrapper); + + LambdaQueryWrapper wrapperT = new LambdaQueryWrapper<>(); + wrapperT.eq(YxStorePink::getKId,pid); + yxStorePinkMapper.update(yxStorePink,wrapperT); + //todo 模板消息 + } + + + /** + * 拼团失败 退款 + * @param pinkAll 拼团数据,不包括团长 + * @param pinkT 团长数据 + * @param pinkBool PinkEnum + */ + private int pinkFail(List pinkAll, YxStorePink pinkT,int pinkBool) { + Date now = new Date(); + //拼团时间超时 退款 + if(DateUtil.compare(pinkT.getStopTime(),now) < 0){ + pinkBool = PinkEnum.PINK_BOOL_MINUS_1.getValue(); + pinkAll.add(pinkT); + //处理退款 + for (YxStorePink storePink : pinkAll) { + storeOrderService.orderApplyRefund("","","拼团时间超时",storePink.getOrderId(),storePink.getUid()); + this.orderPinkFailAfter(pinkT.getUid(),storePink.getId()); + } + } + + return pinkBool; + } + + /** + * 获取参团人和团长和拼团总人数 + * @param pink 拼团 + * @return PinkUserDto + */ + private PinkUserDto getPinkMemberAndPinK(YxStorePink pink) { + //查找拼团团员和团长 + List pinkAll = null; + YxStorePink pinkT = null; + //查找拼团团员和团长 + if(pink.getKId() > 0){ //团长存在 + pinkAll = this.getPinkMember(pink.getKId()); + pinkT = this.getPinkUserOne(pink.getKId()); + }else{ + pinkAll = this.getPinkMember(pink.getId()); + pinkT = pink; + } + //收集拼团用户id和拼团id + List idAll = pinkAll.stream().map(YxStorePink::getId).collect(Collectors.toList()); + List uidAll = pinkAll.stream().map(YxStorePink::getUid).collect(Collectors.toList()); + + idAll.add(pinkT.getId()); + uidAll.add(pinkT.getUid()); + //还差几人 + int count = pinkT.getPeople() - (pinkAll.size() + 1); + + + return PinkUserDto.builder() + .pinkAll(pinkAll) + .pinkT(pinkT) + .idAll(idAll) + .uidAll(uidAll) + .count(count) + .build(); + } + + + /** + * 计算获取团长还差多少人拼团成功 + * @param kid 团长参与拼团id + * @param people 当前满足拼团的人数 + * @return int + */ + private int getPinkPeople(Long kid, int people) { + LambdaQueryWrapper wrapper= new LambdaQueryWrapper<>(); + wrapper.eq(YxStorePink::getKId,kid) + .eq(YxStorePink::getIsRefund, OrderInfoEnum.PINK_REFUND_STATUS_0.getValue()); + //加上团长自己 + int count = yxStorePinkMapper.selectCount(wrapper) + 1; + return people - count; + } + + //=================================================// + + @Override + //@Cacheable + public Map queryAll(YxStorePinkQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + List yxStorePinkDtos = generator.convert(page.getList(), YxStorePinkDto.class); + yxStorePinkDtos.forEach(i ->{ + YxUser yxUser = yxUserService.getById(i.getUid()); + YxStoreCombination storeCombination = combinationService.getById(i.getCid()); + i.setNickname(yxUser.getNickname()); + i.setPhone(yxUser.getPhone()); + i.setUserImg(yxUser.getAvatar()); + i.setProduct(storeCombination.getTitle()); + i.setImage(storeCombination.getImage()); + i.setCountPeople( this.count(new LambdaQueryWrapper().eq(YxStorePink::getCid,i.getCid()))); + }); + map.put("content", yxStorePinkDtos); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxStorePinkQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStorePink.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxStorePinkDto yxStorePink : all) { + Map map = new LinkedHashMap<>(); + map.put("用户id", yxStorePink.getUid()); + map.put("订单id 生成", yxStorePink.getOrderId()); + map.put("订单id 数据库", yxStorePink.getOrderIdKey()); + map.put("购买商品个数", yxStorePink.getTotalNum()); + map.put("购买总金额", yxStorePink.getTotalPrice()); + map.put("拼团产品id", yxStorePink.getCid()); + map.put("产品id", yxStorePink.getPid()); + map.put("拼团总人数", yxStorePink.getPeople()); + map.put("拼团产品单价", yxStorePink.getPrice()); + map.put(" stopTime", yxStorePink.getStopTime()); + map.put("团长id 0为团长", yxStorePink.getKId()); + map.put("是否发送模板消息0未发送1已发送", yxStorePink.getIsTpl()); + map.put("是否退款 0未退款 1已退款", yxStorePink.getIsRefund()); + map.put("状态1进行中2已完成3未完成", yxStorePink.getStatus()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreSeckillServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreSeckillServiceImpl.java new file mode 100644 index 0000000..2d23687 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreSeckillServiceImpl.java @@ -0,0 +1,320 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.ListUtil; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.YshopException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.enums.SpecTypeEnum; +import co.yixiang.exception.BadRequestException; +import co.yixiang.modules.activity.domain.YxStoreSeckill; +import co.yixiang.modules.activity.domain.YxStoreSeckill; +import co.yixiang.modules.activity.service.YxStoreSeckillService; +import co.yixiang.modules.activity.service.dto.YxStoreSeckillDto; +import co.yixiang.modules.activity.service.dto.YxStoreSeckillQueryCriteria; +import co.yixiang.modules.activity.service.mapper.YxStoreSeckillMapper; +import co.yixiang.modules.activity.vo.StoreSeckillVo; +import co.yixiang.modules.activity.vo.YxStoreSeckillQueryVo; +import co.yixiang.modules.product.domain.YxStoreProductAttrValue; +import co.yixiang.modules.product.service.YxStoreProductAttrService; +import co.yixiang.modules.product.service.YxStoreProductReplyService; +import co.yixiang.modules.product.service.dto.FromatDetailDto; +import co.yixiang.modules.product.service.dto.ProductFormatDto; +import co.yixiang.modules.product.service.dto.ProductResultDto; +import co.yixiang.modules.product.vo.YxStoreProductAttrQueryVo; +import co.yixiang.modules.template.domain.YxShippingTemplates; +import co.yixiang.modules.template.service.YxShippingTemplatesService; +import co.yixiang.utils.FileUtil; +import co.yixiang.utils.OrderUtil; +import co.yixiang.utils.RedisUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.*; + + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxStoreSeckillServiceImpl extends BaseServiceImpl implements YxStoreSeckillService { + + @Autowired + private IGenerator generator; + + @Autowired + private YxStoreSeckillMapper yxStoreSeckillMapper; + + @Autowired + private YxStoreProductReplyService replyService; + + @Autowired + private YxStoreProductAttrService yxStoreProductAttrService; + + @Autowired + private YxShippingTemplatesService shippingTemplatesService; + + /** + * 产品详情 + * @param id 砍价商品id + * @return StoreSeckillVo + */ + @Override + public StoreSeckillVo getDetail(Long id){ + Date now = new Date(); + YxStoreSeckill storeSeckill = this.lambdaQuery().eq(YxStoreSeckill::getId,id) + .eq(YxStoreSeckill::getStatus, ShopCommonEnum.IS_STATUS_1.getValue()) + .eq(YxStoreSeckill::getIsShow,ShopCommonEnum.SHOW_1.getValue()) + .le(YxStoreSeckill::getStartTime,now) + .ge(YxStoreSeckill::getStopTime,now) + .one(); + + if(storeSeckill == null){ + throw new YshopException("秒杀产品不存在或已下架"); + } + //获取商品sku + Map returnMap = yxStoreProductAttrService.getProductAttrDetail(storeSeckill.getProductId()); + //获取运费模板名称 + String storeFreePostage = RedisUtil.get("store_free_postage"); + String tempName = ""; + if(StrUtil.isBlank(storeFreePostage) + || !NumberUtil.isNumber(storeFreePostage) + || Integer.parseInt(storeFreePostage) == 0){ + tempName = "全国包邮"; + }else{ + YxShippingTemplates shippingTemplates = shippingTemplatesService.getById(storeSeckill.getTempId()); + if(ObjectUtil.isNotNull(shippingTemplates)){ + tempName = shippingTemplates.getName(); + }else { + throw new BadRequestException("请配置运费模板"); + } + + } + return StoreSeckillVo.builder() + .productAttr((List)returnMap.get("productAttr")) + .productValue((Map)returnMap.get("productValue")) + .storeInfo(generator.convert(storeSeckill, YxStoreSeckillQueryVo.class)) + .reply(replyService.getReply(storeSeckill.getProductId())) + .replyCount(replyService.productReplyCount(storeSeckill.getProductId())) + .tempName(tempName) + .build(); + } + + /** + * 秒杀产品列表 + * @param page page + * @param limit limit + * @return list + */ + @Override + public List getList(int page, int limit, int time) { + Date nowTime = new Date(); + Page pageModel = new Page<>(page, limit); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreSeckill::getStatus, ShopCommonEnum.IS_STATUS_1.getValue()) + .eq(YxStoreSeckill::getTimeId,time) + .le(YxStoreSeckill::getStartTime,nowTime) + .ge(YxStoreSeckill::getStopTime,nowTime) + .orderByDesc(YxStoreSeckill::getSort); + List yxStoreSeckillQueryVos = generator.convert + (yxStoreSeckillMapper.selectPage(pageModel,wrapper).getRecords(), + YxStoreSeckillQueryVo.class); + yxStoreSeckillQueryVos.forEach(item->{ + Integer sum = item.getSales() + item.getStock(); + item.setPercent(NumberUtil.round(NumberUtil.mul(NumberUtil.div(item.getSales(),sum), + 100),0).intValue()); + }); + return yxStoreSeckillQueryVos; + } + /** + * 秒杀产品列表(首页用) + * @param page page + * @param limit limit + * @return list + */ + @Override + public List getList(int page, int limit) { + Date nowTime = new Date(); + Page pageModel = new Page<>(page, limit); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreSeckill::getStatus, ShopCommonEnum.IS_STATUS_1.getValue()) + .eq(YxStoreSeckill::getIsHot,1) + .le(YxStoreSeckill::getStartTime,nowTime) + .ge(YxStoreSeckill::getStopTime,nowTime) + .orderByDesc(YxStoreSeckill::getSort); + List yxStoreSeckillQueryVos = generator.convert + (yxStoreSeckillMapper.selectPage(pageModel,wrapper).getRecords(), + YxStoreSeckillQueryVo.class); + yxStoreSeckillQueryVos.forEach(item->{ + Integer sum = item.getSales() + item.getStock(); + item.setPercent(NumberUtil.round(NumberUtil.mul(NumberUtil.div(item.getSales(),sum), + 100),0).intValue()); + }); + return yxStoreSeckillQueryVos; + } + @Override + //@Cacheable + public Map queryAll(YxStoreSeckillQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + List storeSeckillDTOS = generator.convert(page.getList(),YxStoreSeckillDto.class); + for (YxStoreSeckillDto storeSeckillDTO : storeSeckillDTOS){ + String statusStr = OrderUtil.checkActivityStatus(storeSeckillDTO.getStartTime(), + storeSeckillDTO.getStopTime(), storeSeckillDTO.getStatus()); + storeSeckillDTO.setStatusStr(statusStr); + } + Map map = new LinkedHashMap<>(2); + map.put("content",storeSeckillDTOS); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxStoreSeckillQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreSeckill.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxStoreSeckillDto yxStoreSeckill : all) { + Map map = new LinkedHashMap<>(); + map.put("推荐图", yxStoreSeckill.getImage()); + map.put("轮播图", yxStoreSeckill.getImages()); + map.put("活动标题", yxStoreSeckill.getTitle()); + map.put("简介", yxStoreSeckill.getInfo()); + map.put("返多少积分", yxStoreSeckill.getGiveIntegral()); + map.put("排序", yxStoreSeckill.getSort()); + map.put("库存", yxStoreSeckill.getStock()); + map.put("销量", yxStoreSeckill.getSales()); + map.put("单位名", yxStoreSeckill.getUnitName()); + map.put("邮费", yxStoreSeckill.getPostage()); + map.put("内容", yxStoreSeckill.getDescription()); + map.put("开始时间", yxStoreSeckill.getStartTime()); + map.put("结束时间", yxStoreSeckill.getStopTime()); + map.put("产品状态", yxStoreSeckill.getStatus()); + map.put("是否包邮", yxStoreSeckill.getIsPostage()); + map.put("热门推荐", yxStoreSeckill.getIsHot()); + map.put("最多秒杀几个", yxStoreSeckill.getNum()); + map.put("显示", yxStoreSeckill.getIsShow()); + map.put("时间段id", yxStoreSeckill.getTimeId()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + public boolean saveSeckill(YxStoreSeckillDto resources) { + ProductResultDto resultDTO = this.computedProduct(resources.getAttrs()); + + //添加商品 + YxStoreSeckill yxStoreSeckill = new YxStoreSeckill(); + BeanUtil.copyProperties(resources,yxStoreSeckill,"images"); + if(resources.getImages().isEmpty()) { + throw new YshopException("请上传轮播图"); + } + + yxStoreSeckill.setStock(resultDTO.getStock()); + yxStoreSeckill.setOtPrice(BigDecimal.valueOf(resultDTO.getMinOtPrice())); + yxStoreSeckill.setPrice(BigDecimal.valueOf(resultDTO.getMinPrice())); + yxStoreSeckill.setCost(BigDecimal.valueOf(resultDTO.getMinCost())); + yxStoreSeckill.setStock(resultDTO.getStock()); + yxStoreSeckill.setImages(String.join(",", resources.getImages())); + this.saveOrUpdate(yxStoreSeckill); + + //属性处理 + //处理单sKu + if(SpecTypeEnum.TYPE_0.getValue().equals(resources.getSpecType())){ + FromatDetailDto fromatDetailDto = FromatDetailDto.builder() + .value("规格") + .detailValue("") + .attrHidden("") + .detail(ListUtil.toList("默认")) + .build(); + List attrs = resources.getAttrs(); + ProductFormatDto productFormatDto = attrs.get(0); + productFormatDto.setValue1("规格"); + Map map = new HashMap<>(); + map.put("规格","默认"); + productFormatDto.setDetail(map); + yxStoreProductAttrService.insertYxStoreProductAttr(ListUtil.toList(fromatDetailDto), + ListUtil.toList(productFormatDto),resources.getProductId()); + }else{ + yxStoreProductAttrService.insertYxStoreProductAttr(resources.getItems(), + resources.getAttrs(),resources.getProductId()); + } + return true; + } + + /** + * 计算产品数据 + * @param attrs attrs + * @return ProductResultDto + */ + private ProductResultDto computedProduct(List attrs){ + //取最小价格 + Double minPrice = attrs + .stream() + .map(ProductFormatDto::getSeckillPrice) + .min(Comparator.naturalOrder()) + .orElse(0d); + + Double minOtPrice = attrs + .stream() + .map(ProductFormatDto::getOtPrice) + .min(Comparator.naturalOrder()) + .orElse(0d); + + Double minCost = attrs + .stream() + .map(ProductFormatDto::getCost) + .min(Comparator.naturalOrder()) + .orElse(0d); + //计算库存 + Integer stock = attrs + .stream() + .map(ProductFormatDto::getSeckillStock) + .reduce(Integer::sum) + .orElse(0); + + if(stock <= 0) { + throw new YshopException("库存不能低于0"); + } + + return ProductResultDto.builder() + .minPrice(minPrice) + .minOtPrice(minOtPrice) + .minCost(minCost) + .stock(stock) + .build(); + } + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreVisitServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreVisitServiceImpl.java new file mode 100644 index 0000000..3b176fe --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreVisitServiceImpl.java @@ -0,0 +1,115 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.ProductTypeEnum; +import co.yixiang.modules.activity.domain.YxStoreVisit; +import co.yixiang.modules.activity.service.YxStoreVisitService; +import co.yixiang.modules.activity.service.dto.YxStoreVisitDto; +import co.yixiang.modules.activity.service.dto.YxStoreVisitQueryCriteria; +import co.yixiang.modules.activity.service.mapper.YxStoreVisitMapper; +import co.yixiang.modules.product.domain.YxStoreProduct; +import co.yixiang.modules.product.service.YxStoreProductService; +import co.yixiang.utils.FileUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxStoreVisitServiceImpl extends BaseServiceImpl implements YxStoreVisitService { + + private final IGenerator generator; + private final YxStoreProductService yxStoreProductService; + private final YxStoreVisitMapper yxStoreVisitMapper; + + @Override + //@Cacheable + public Map queryAll(YxStoreVisitQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxStoreVisitDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxStoreVisitQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreVisit.class, criteria)); + } + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxStoreVisitDto yxStoreVisit : all) { + Map map = new LinkedHashMap<>(); + map.put("产品ID", yxStoreVisit.getProductId()); + map.put("产品类型", yxStoreVisit.getProductType()); + map.put("产品分类ID", yxStoreVisit.getCateId()); + map.put("产品类型", yxStoreVisit.getType()); + map.put("用户ID", yxStoreVisit.getUid()); + map.put("访问次数", yxStoreVisit.getCount()); + map.put("备注描述", yxStoreVisit.getContent()); + map.put("添加时间", yxStoreVisit.getAddTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + /** + * 添加用户访问拼团记录 + * @param uid 用户id + * @param productId 产品id + */ + @Override + public void addStoreVisit(Long uid, Long productId) { + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreVisit::getUid, uid).eq(YxStoreVisit::getProductId, productId); + YxStoreVisit storeVisit = this.baseMapper.selectOne(wrapper); + + if (ObjectUtil.isNull(storeVisit)) { + //查询产品分类 + YxStoreProduct yxStoreProduct = yxStoreProductService.getProductInfo(productId); + + YxStoreVisit yxStoreVisit = YxStoreVisit.builder() + .productId(productId) + .productType(ProductTypeEnum.COMBINATION.getValue()) + .cateId(Integer.valueOf(yxStoreProduct.getCateId())) + .type(ProductTypeEnum.COMBINATION.getValue()) + .uid(uid) + .count(1) + .build(); + this.save(yxStoreVisit); + } + + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxUserExtractServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxUserExtractServiceImpl.java new file mode 100644 index 0000000..01e5009 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/impl/YxUserExtractServiceImpl.java @@ -0,0 +1,245 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.impl; + +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.YshopException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.BillDetailEnum; +import co.yixiang.enums.PayTypeEnum; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.event.TemplateBean; +import co.yixiang.event.TemplateEvent; +import co.yixiang.event.TemplateListenEnum; +import co.yixiang.exception.BadRequestException; +import co.yixiang.modules.activity.domain.YxUserExtract; +import co.yixiang.modules.activity.param.UserExtParam; +import co.yixiang.modules.activity.service.YxUserExtractService; +import co.yixiang.modules.activity.service.dto.YxUserExtractDto; +import co.yixiang.modules.activity.service.dto.YxUserExtractQueryCriteria; +import co.yixiang.modules.activity.service.mapper.YxUserExtractMapper; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.service.YxUserBillService; +import co.yixiang.modules.user.service.YxUserService; +import co.yixiang.modules.user.service.dto.WechatUserDto; +import co.yixiang.modules.user.service.dto.YxWechatUserDto; +import co.yixiang.utils.FileUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxUserExtractServiceImpl extends BaseServiceImpl implements YxUserExtractService { + + private final IGenerator generator; + private final YxUserExtractMapper yxUserExtractMapper; + private final YxUserService userService; + private final YxUserBillService billService; + private final ApplicationEventPublisher publisher; + + /** + * 开始提现 + * @param userInfo 用户 + * @param param UserExtParam + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void userExtract(YxUser userInfo, UserExtParam param) { + BigDecimal extractPrice = userInfo.getBrokeragePrice(); + if(extractPrice.compareTo(BigDecimal.ZERO) <= 0) { + throw new YshopException("提现佣金不足"); + } + + double money = Double.valueOf(param.getMoney()); + if( extractPrice.compareTo(BigDecimal.valueOf(money)) < 0) { + throw new YshopException("提现佣金不足"); + } + + if(money <= 0) { + throw new YshopException("提现佣金大于0"); + } + + double balance = NumberUtil.sub(extractPrice.doubleValue(),money); + if(balance < 0) { + balance = 0; + } + + YxUserExtract userExtract = new YxUserExtract(); + userExtract.setUid(userInfo.getUid()); + userExtract.setExtractType(param.getExtractType()); + userExtract.setExtractPrice(new BigDecimal(param.getMoney())); + userExtract.setBalance(BigDecimal.valueOf(balance)); + + if(StrUtil.isNotEmpty(param.getName())){ + userExtract.setRealName(param.getName()); + }else { + userExtract.setRealName(userInfo.getNickname()); + } + + if(StrUtil.isNotEmpty(param.getWeixin())){ + userExtract.setWechat(param.getWeixin()); + }else { + userExtract.setWechat(userInfo.getNickname()); + } + + String mark = ""; + + if(PayTypeEnum.ALI.getValue().equals(param.getExtractType())){ + if(StrUtil.isEmpty(param.getAlipayCode())){ + throw new YshopException("请输入支付宝账号"); + } + userExtract.setAlipayCode(param.getAlipayCode()); + mark = "使用支付宝提现"+param.getMoney()+"元"; + }else if(PayTypeEnum.WEIXIN.getValue().equals(param.getExtractType())){ + if(StrUtil.isEmpty(param.getWeixin())){ + throw new YshopException("请输入微信账号"); + } + mark = "使用微信提现"+param.getMoney()+"元"; + } + + yxUserExtractMapper.insert(userExtract); + + //更新佣金 + YxUser yxUser = new YxUser(); + yxUser.setBrokeragePrice(BigDecimal.valueOf(balance)); + yxUser.setUid(userInfo.getUid()); + userService.updateById(yxUser); + + //插入流水 + billService.expend(userInfo.getUid(),"佣金提现", BillDetailEnum.CATEGORY_1.getValue(), + BillDetailEnum.TYPE_4.getValue(),money,balance, mark); + + } + + /** + * 累计提现金额 + * @param uid uid + * @return double + */ + @Override + public double extractSum(Long uid) { + return yxUserExtractMapper.sumPrice(uid); + } + + + //==============================================================// + + @Override + //@Cacheable + public Map queryAll(YxUserExtractQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxUserExtractDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxUserExtractQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxUserExtract.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxUserExtractDto yxUserExtract : all) { + Map map = new LinkedHashMap<>(); + map.put(" uid", yxUserExtract.getUid()); + map.put("名称", yxUserExtract.getRealName()); + map.put("bank = 银行卡 alipay = 支付宝wx=微信", yxUserExtract.getExtractType()); + map.put("银行卡", yxUserExtract.getBankCode()); + map.put("开户地址", yxUserExtract.getBankAddress()); + map.put("支付宝账号", yxUserExtract.getAlipayCode()); + map.put("提现金额", yxUserExtract.getExtractPrice()); + map.put(" mark", yxUserExtract.getMark()); + map.put(" balance", yxUserExtract.getBalance()); + map.put("无效原因", yxUserExtract.getFailMsg()); + map.put(" failTime", yxUserExtract.getFailTime()); + map.put("-1 未通过 0 审核中 1 已提现", yxUserExtract.getStatus()); + map.put("微信号", yxUserExtract.getWechat()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + /** + * 操作提现 + * @param resources YxUserExtract + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void doExtract(YxUserExtract resources){ + if(resources.getStatus() == null){ + throw new BadRequestException("请选择审核状态"); + } + + if(ShopCommonEnum.EXTRACT_0.getValue().equals(resources.getStatus())){ + throw new BadRequestException("请选择审核状态"); + } + YxUserExtract userExtract = this.getById(resources.getId()); + if(!ShopCommonEnum.EXTRACT_0.getValue().equals(userExtract.getStatus())){ + throw new BadRequestException("该申请已经处理过啦!"); + } + if(ShopCommonEnum.EXTRACT_MINUS_1.getValue().equals(resources.getStatus())){ + if(StrUtil.isEmpty(resources.getFailMsg())){ + throw new BadRequestException("请填写失败原因"); + } + String mark = "提现失败,退回佣金"+resources.getExtractPrice()+"元"; + YxUser yxUser = userService.getById(resources.getUid()); + + double balance = NumberUtil.add(yxUser.getBrokeragePrice(),resources.getExtractPrice()).doubleValue(); + //插入流水 + billService.income(resources.getUid(),"提现失败", BillDetailEnum.CATEGORY_1.getValue(), + BillDetailEnum.TYPE_4.getValue(),resources.getExtractPrice().doubleValue(),balance, + mark,resources.getId().toString()); + + //返回提现金额 + userService.incBrokeragePrice(resources.getExtractPrice(),resources.getUid()); + + resources.setFailTime(new Date()); + }else{ + //模板消息支付成功发布事件 + TemplateBean templateBean = TemplateBean.builder() + .extractId( resources.getId()) + .templateType(TemplateListenEnum.TYPE_8.getValue()) + .build(); + publisher.publishEvent(new TemplateEvent(this,templateBean)); + } + this.saveOrUpdate(resources); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreBargainMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreBargainMapper.java new file mode 100644 index 0000000..e441a7a --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreBargainMapper.java @@ -0,0 +1,59 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.activity.domain.YxStoreBargain; +import co.yixiang.modules.product.vo.YxStoreProductQueryVo; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Repository +public interface YxStoreBargainMapper extends CoreMapper { + @Update("update yx_store_bargain set stock=stock+#{num}, sales=sales-#{num}" + + " where id=#{bargainId}") + int incStockDecSales(@Param("num") int num, @Param("bargainId") Long bargainId); + + @Update("update yx_store_bargain set stock=stock-#{num}, sales=sales+#{num}" + + " where id=#{bargainId} and stock >= #{num}") + int decStockIncSales(@Param("num") int num,@Param("bargainId") Long bargainId); + + @Select("SELECT c.id,c.image,c.min_price as price,c.price as otPrice," + + "c.title as storeName,c.status as isShow,c.cost," + + "c.is_postage as isPostage,c.postage,c.sales,c.stock,c.is_del as isDel" + + " FROM yx_store_bargain c " + + " WHERE c.id = #{id} and c.is_del = 0") + YxStoreProductQueryVo bargainInfo(Long id); + + @Select("select IFNULL(sum(look),0)" + + "from yx_store_bargain") + int lookCount(); + + @Select("select IFNULL(sum(share),0) as shareCount " + + "from yx_store_bargain") + int shareCount(); + + @Update("update yx_store_bargain set share=share+1" + + " where id=#{id}") + void addBargainShare(@Param("id") Long id); + + @Update("update yx_store_bargain set look=look+1" + + " where id=#{id}") + void addBargainLook(@Param("id") Long id); + + @Delete("delete from yx_system_attachment where name = #{name}") + void deleteBargainImg(@Param("name") String name); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreBargainUserHelpMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreBargainUserHelpMapper.java new file mode 100644 index 0000000..79f00df --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreBargainUserHelpMapper.java @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.mapper; + + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.activity.domain.YxStoreBargainUserHelp; +import org.springframework.stereotype.Repository; + +/** + *

+ * 砍价用户帮助表 Mapper 接口 + *

+ * + * @author hupeng + * @since 2019-12-21 + */ +@Repository +public interface YxStoreBargainUserHelpMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreBargainUserMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreBargainUserMapper.java new file mode 100644 index 0000000..e0d1f09 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreBargainUserMapper.java @@ -0,0 +1,43 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.mapper; + + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.activity.domain.YxStoreBargainUser; +import co.yixiang.modules.activity.vo.YxStoreBargainUserQueryVo; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * 用户参与砍价表 Mapper 接口 + *

+ * + * @author hupeng + * @since 2019-12-21 + */ +@Repository +public interface YxStoreBargainUserMapper extends CoreMapper { + + + @Select("SELECT u.uid,u.is_del as isDel,u.bargain_price - u.price as residuePrice,u.id," + + "u.bargain_id as bargainId,u.bargain_price as bargainPrice," + + "u.bargain_price_min as bargainPriceMin,u.price,u.status,b.title," + + "b.image,b.stop_time as datatime FROM yx_store_bargain_user u INNER JOIN " + + "yx_store_bargain b ON b.id=u.bargain_id WHERE u.uid = #{uid} AND u.is_del = 0 " + + "ORDER BY u.id DESC ") + List getBargainUserList(@Param("uid") Long uid, Page page); + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCombinationMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCombinationMapper.java new file mode 100644 index 0000000..06f712b --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCombinationMapper.java @@ -0,0 +1,66 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.activity.domain.YxStoreCombination; +import co.yixiang.modules.activity.vo.YxStoreCombinationQueryVo; +import co.yixiang.modules.product.vo.YxStoreProductQueryVo; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Repository +public interface YxStoreCombinationMapper extends CoreMapper { + + @Select("SELECT c.id,c.effective_time as effectiveTime,c.info,c.image,c.people,c.price, s.sales as sales," + + "c.title,c.unit_name as unitName,s.price as productPrice FROM yx_store_combination c " + + "INNER JOIN yx_store_product s ON s.id=c.product_id " + + " WHERE c.is_show = 1 AND c.is_del = 0 AND c.start_time < now() " + + " AND c.stop_time > now() ORDER BY c.sort desc,c.id desc") + List getCombList(Page page); + + @Override + > E selectPage(E page, @Param(Constants.WRAPPER) Wrapper queryWrapper); + + @Select("SELECT c.id,c.effective_time as effectiveTime,c.image,c.people,c.price,c.browse," + + "c.description,c.image,c.images,c.info," + + "c.product_id as productId,c.sales,c.start_time as startTime" + + ",c.stock,c.stop_time stopTime," + + "c.title,c.unit_name as unitName,s.price as productPrice FROM yx_store_combination c " + + "INNER JOIN yx_store_product s ON s.id=c.product_id " + + " WHERE c.is_show = 1 AND c.is_del = 0 AND c.id = #{id} ") + YxStoreCombinationQueryVo getCombDetail(Long id); + + @Select("SELECT c.id,c.image,c.price,c.title as storeName,c.is_show as isShow,c.cost," + + "c.sales,c.stock,c.is_del as isDel" + + " FROM yx_store_combination c " + + " WHERE c.id = #{id} and c.is_del = 0 ") + YxStoreProductQueryVo combinatiionInfo(Long id); + + /** + * 商品浏览量 + * @param productId + * @return + */ + @Update("update yx_store_combination set browse=browse+1 " + + "where id=#{productId}") + int incBrowseNum(@Param("productId") Long productId); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCouponIssueMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCouponIssueMapper.java new file mode 100644 index 0000000..d660435 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCouponIssueMapper.java @@ -0,0 +1,55 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.activity.domain.YxStoreCouponIssue; +import co.yixiang.modules.activity.vo.YxStoreCouponIssueQueryVo; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Repository +public interface YxStoreCouponIssueMapper extends CoreMapper { + @Select("") + List selecCoupontList(Page page,@Param("type") Integer type, + @Param("productId") Long productId); + + @Select("select A.cid,A.end_time as endTime,A.start_time as startTime," + + "A.is_permanent as isPermanent,A.remain_count as remainCount," + + "A.total_count as totalCount,A.id" + + " from yx_store_coupon_issue A" + + " where A.status =1 and A.id=#{id}" + + " AND ( A.start_time < now() AND A.end_time > now() ) " + + " AND A.is_del = 0 AND " + + "( A.remain_count > 0 OR A.is_permanent = 1 )") + YxStoreCouponIssueQueryVo selectOne(Integer id); + + @Update("update yx_store_coupon_issue set remain_count=remain_count-1" + + " where id=#{id}") + int decCount(@Param("id") int id); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCouponIssueUserMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCouponIssueUserMapper.java new file mode 100644 index 0000000..5eb1921 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCouponIssueUserMapper.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.activity.domain.YxStoreCouponIssueUser; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Repository +public interface YxStoreCouponIssueUserMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCouponMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCouponMapper.java new file mode 100644 index 0000000..ac928fd --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCouponMapper.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.activity.domain.YxStoreCoupon; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Repository +public interface YxStoreCouponMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCouponUserMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCouponUserMapper.java new file mode 100644 index 0000000..f4e25b8 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCouponUserMapper.java @@ -0,0 +1,38 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.activity.domain.YxStoreCouponUser; +import co.yixiang.modules.activity.vo.StoreCouponUserVo; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.Date; +import java.util.List; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Repository +public interface YxStoreCouponUserMapper extends CoreMapper { + @Select("select A.id,A.coupon_title as couponTitle,A.coupon_price as couponPrice," + + "A.end_time as endTime,B.use_min_price as useMinPrice,B.type," + + "B.product_id as productId" + + " from yx_store_coupon_user A left join yx_store_coupon B " + + "on A.cid = B.id " + + "where A.status = 0" + + " AND A.end_time > #{now} " + + " AND A.uid = #{uid} AND A.use_min_price <= #{price} " + + " ORDER BY B.id DESC") + List selectCouponList(@Param("now") Date now, @Param("price") double price, + @Param("uid") Long uid); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStorePinkMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStorePinkMapper.java new file mode 100644 index 0000000..f6530f1 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStorePinkMapper.java @@ -0,0 +1,52 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.activity.domain.YxStorePink; +import co.yixiang.modules.activity.service.dto.PinkDto; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface YxStorePinkMapper extends CoreMapper { + @Select("SELECT p.id,p.uid,p.people,p.price,p.stop_time as stopTime,u.nickname,u.avatar" + + " FROM yx_store_pink p INNER JOIN yx_user u ON u.uid=p.uid" + + " WHERE stop_time > now() AND p.cid = #{cid} AND p.k_id = 0 " + + "AND p.is_refund = 0 ORDER BY p.create_time DESC") + List getPinks(Long cid); + + //= ]]> + @Select("SELECT p.id,u.nickname,u.avatar" + + " FROM yx_store_pink p RIGHT JOIN yx_user u ON u.uid=p.uid" + + " where p.status= 2 AND p.uid <> ${uid} " + + "AND p.is_refund = 0") + List getPinkOkList(Long uid); + + @Select("SELECT p.id,p.uid,p.people,p.price,p.stop_time as stopTime,u.nickname,u.avatar" + + " FROM yx_store_pink p LEFT JOIN yx_user u ON u.uid=p.uid" + + " where p.k_id= ${kid} " + + "AND p.is_refund = 0") + List getPinkMember(int kid); + + @Select("SELECT p.id,p.uid,p.people,p.price,p.stop_time as stopTime,u.nickname,u.avatar" + + " FROM yx_store_pink p LEFT JOIN yx_user u ON u.uid=p.uid" + + " where p.id= ${id} ") + PinkDto getPinkUserOne(int id); + + @Select("select IFNULL(sum(total_num),0) from yx_store_pink " + + "where status=2 and is_refund=0") + int sumNum(); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreSeckillMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreSeckillMapper.java new file mode 100644 index 0000000..508915a --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreSeckillMapper.java @@ -0,0 +1,31 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.activity.domain.YxStoreSeckill; +import co.yixiang.modules.product.vo.YxStoreProductQueryVo; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Repository +public interface YxStoreSeckillMapper extends CoreMapper { + + @Select("SELECT c.id,c.image,c.price,c.title as storeName,c.is_show as isShow,c.cost," + + "c.is_postage as isPostage,c.postage,c.sales,c.stock,c.is_del as isDel" + + " FROM yx_store_seckill c " + + " WHERE c.id = #{id} and c.is_del = 0 ") + YxStoreProductQueryVo seckillInfo(Long id); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreVisitMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreVisitMapper.java new file mode 100644 index 0000000..6b32a13 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreVisitMapper.java @@ -0,0 +1,32 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.activity.domain.YxStoreVisit; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Update; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Repository +public interface YxStoreVisitMapper extends CoreMapper { + + /** + * 拼团浏览量 + * @param productId + * @return + */ + @Update("update yx_store_visit set count=count+1 " + + "where uid=#{uid} AND id=#{productId}") + int incBrowseNum(@Param("uid") Long uid,@Param("productId") Long productId); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxUserExtractMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxUserExtractMapper.java new file mode 100644 index 0000000..95ed2ec --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/service/mapper/YxUserExtractMapper.java @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.activity.domain.YxUserExtract; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Repository +public interface YxUserExtractMapper extends CoreMapper { + @Select("select IFNULL(sum(extract_price),0) from yx_user_extract " + + "where status=1 " + + "and uid=#{uid}") + double sumPrice(@Param("uid") Long uid); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/BargainCountVo.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/BargainCountVo.java new file mode 100644 index 0000000..a8f7432 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/BargainCountVo.java @@ -0,0 +1,24 @@ +package co.yixiang.modules.activity.vo; + +import lombok.Builder; +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName BargainCountVo + * @Author hupeng <610796224@qq.com> + * @Date 2019/12/21 + **/ +@Data +@Builder +public class BargainCountVo implements Serializable { + private Double alreadyPrice; + private Integer count; + private Integer pricePercent; + private Integer status; + private Double price; //剩余的砍价金额 + private Boolean userBargainStatus; // 是否帮别人砍,没砍是true,砍了false + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/BargainVo.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/BargainVo.java new file mode 100644 index 0000000..baec17e --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/BargainVo.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.activity.vo; + + +import co.yixiang.modules.user.vo.YxUserQueryVo; +import lombok.Builder; +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName BargainVo + * @Author hupeng <610796224@qq.com> + * @Date 2019/12/21 + **/ +@Data +@Builder +public class BargainVo implements Serializable { + private YxStoreBargainQueryVo bargain; + private YxUserQueryVo userInfo; + private Integer bargainSumCount;//砍价支付成功订单数量 +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/CombinationQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/CombinationQueryVo.java new file mode 100644 index 0000000..5202a3c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/CombinationQueryVo.java @@ -0,0 +1,14 @@ +package co.yixiang.modules.activity.vo; + +import lombok.Data; + +import java.util.List; + +@Data +public class CombinationQueryVo { + + private List storeCombinationQueryVos; + + private Long lastPage; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/PinkInfoVo.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/PinkInfoVo.java new file mode 100644 index 0000000..ebfa6f4 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/PinkInfoVo.java @@ -0,0 +1,53 @@ +package co.yixiang.modules.activity.vo; + + +import co.yixiang.modules.user.vo.YxUserQueryVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @ClassName PinkInfoVo + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/20 + **/ +@Data +@Builder +public class PinkInfoVo implements Serializable { + + @ApiModelProperty(value = "还差几人成团") + private Integer count; + + @ApiModelProperty(value = "当前拼团数据返回订单编号") + private String currentPinkOrder; + + @ApiModelProperty(value = "是否完成 0未完成 1完成") + private Integer isOk = 0; + + @ApiModelProperty(value = "拼团信息列表") + private List pinkAll; + + @ApiModelProperty(value = "拼团状态 0未成功,进行中 1已成功 -1拼团失败") + private Integer pinkBool = 0; + + @ApiModelProperty(value = "拼团信息") + private YxStorePinkQueryVo pinkT; + + @ApiModelProperty(value = "拼团内容信息") + private YxStoreCombinationQueryVo storeCombination; + + @ApiModelProperty(value = "拼团内容") + private String storeCombinationHost; + + @ApiModelProperty(value = "是否在团内 0不在 1在") + private Integer userBool = 0; + + @ApiModelProperty(value = "拼团用户信息") + private YxUserQueryVo userInfo; + + @ApiModelProperty(value = "库存唯一值") + private String uniqueId; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/SeckillConfigVo.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/SeckillConfigVo.java new file mode 100644 index 0000000..34b2071 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/SeckillConfigVo.java @@ -0,0 +1,20 @@ +package co.yixiang.modules.activity.vo; + + +import co.yixiang.modules.activity.service.dto.SeckillTimeDto; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +public class SeckillConfigVo { + + @ApiModelProperty(value = "秒杀产品时间信息") + private List seckillTime; + + private String lovely; + + @ApiModelProperty(value = "秒杀产品时间索引") + private Integer seckillTimeIndex; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/StoreCombinationVo.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/StoreCombinationVo.java new file mode 100644 index 0000000..cdb4161 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/StoreCombinationVo.java @@ -0,0 +1,64 @@ +package co.yixiang.modules.activity.vo; + +import co.yixiang.modules.activity.service.dto.PinkDto; +import co.yixiang.modules.product.domain.YxStoreProductAttrValue; +import co.yixiang.modules.product.vo.YxStoreProductAttrQueryVo; +import co.yixiang.modules.product.vo.YxStoreProductReplyQueryVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + *

+ * 拼团产品表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-11-19 + */ +@Data +public class StoreCombinationVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "拼团详情") + private List pink; + + @ApiModelProperty(value = "参与的拼团的id 集合") + private List pindAll; + + @ApiModelProperty(value = "拼团成功的用户信息") + private List pinkOkList; + + @ApiModelProperty(value = "拼团完成的商品总件数") + private Integer pinkOkSum; + + @ApiModelProperty(value = "拼团评论信息") + private YxStoreProductReplyQueryVo reply; + + @ApiModelProperty(value = "拼团评论总条数") + private Integer replyCount = 0; + + @ApiModelProperty(value = "拼团好评比例") + private String replyChance; + + @ApiModelProperty(value = "拼团产品表信息") + private YxStoreCombinationQueryVo storeInfo; + + @ApiModelProperty(value = "拼团产品用户是否收藏") + private Boolean userCollect = false; + + @ApiModelProperty(value = "拼团产品运费模板名称") + private String tempName; + + @ApiModelProperty(value = "拼团产品属性信息") + private List productAttr = new ArrayList(); + + @ApiModelProperty(value = "拼团产品属性值") + private Map productValue = new LinkedHashMap<>(); + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/StoreCouponUserVo.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/StoreCouponUserVo.java new file mode 100644 index 0000000..a3c7da3 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/StoreCouponUserVo.java @@ -0,0 +1,54 @@ +package co.yixiang.modules.activity.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + * 优惠券发放记录对象StoreCouponUserVO + * + * @author hupeng + * @date 2020-05-06 + */ +@Getter +@Setter +public class StoreCouponUserVo implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 优惠券发放记录id */ + @ApiModelProperty(value = "优惠券发放记录ID") + private Long id; + + /** 优惠券名称 */ + @ApiModelProperty(value = "优惠券名称") + private String couponTitle; + + /** 优惠券的面值 */ + @ApiModelProperty(value = "优惠券的面值") + private Double couponPrice; + + /** 最低消费多少金额可用优惠券 */ + @ApiModelProperty(value = "最低消费多少金额可用优惠券") + private Double useMinPrice; + + /** 优惠券结束时间 */ + @JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8") + @ApiModelProperty(value = "优惠券结束时间") + private Date endTime; + + /** 优惠券类型 0通用券 1商品券 2内部券*/ + @ApiModelProperty(value = "优惠券类型 0通用券 1商品券 2内部券") + private Integer type; + + /**优惠产品ID*/ + @ApiModelProperty(value = "优惠产品ID") + private String productId; + + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/StoreSeckillVo.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/StoreSeckillVo.java new file mode 100644 index 0000000..a86b295 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/StoreSeckillVo.java @@ -0,0 +1,50 @@ +package co.yixiang.modules.activity.vo; + + +import co.yixiang.modules.product.domain.YxStoreProductAttrValue; +import co.yixiang.modules.product.vo.YxStoreProductAttrQueryVo; +import co.yixiang.modules.product.vo.YxStoreProductReplyQueryVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + *

+ * 秒杀产品表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-12-17 + */ +@Data +@Builder +public class StoreSeckillVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "秒杀产品评论信息") + private YxStoreProductReplyQueryVo reply; + + @ApiModelProperty(value = "秒杀产品评论数量") + private Integer replyCount; + + @ApiModelProperty(value = "秒杀产品信息") + private YxStoreSeckillQueryVo storeInfo; + + @Builder.Default + @ApiModelProperty(value = "秒杀产品用户是否收藏") + private Boolean userCollect = false; + + @ApiModelProperty(value = "模板名称") + private String tempName; + + private List productAttr = new ArrayList(); + + private Map productValue = new LinkedHashMap<>(); + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/TopCountVo.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/TopCountVo.java new file mode 100644 index 0000000..27de98f --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/TopCountVo.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.activity.vo; + +import lombok.Builder; +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName TopCountVo + * @Author hupeng <610796224@qq.com> + * @Date 2019/12/21 + **/ +@Data +@Builder +public class TopCountVo implements Serializable { + private Integer lookCount; + private Integer shareCount; + private Integer userCount; + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreBargainQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreBargainQueryVo.java new file mode 100644 index 0000000..57e606e --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreBargainQueryVo.java @@ -0,0 +1,117 @@ +package co.yixiang.modules.activity.vo; + +import co.yixiang.serializer.BigDecimalSerializer; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + *

+ * 砍价表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-12-21 + */ +@Data +@ApiModel(value = "YxStoreBargainQueryVo对象", description = "砍价表查询参数") +public class YxStoreBargainQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "砍价产品ID") + private Long id; + + @ApiModelProperty(value = "关联产品ID") + private Long productId; + + @ApiModelProperty(value = "砍价活动名称") + private String title; + + @ApiModelProperty(value = "砍价活动图片") + private String image; + + @ApiModelProperty(value = "单位名称") + private String unitName; + + @ApiModelProperty(value = "库存") + private Integer stock; + + @ApiModelProperty(value = "销量") + private Integer sales; + + @ApiModelProperty(value = "砍价产品轮播图") + private String images; + + @ApiModelProperty(value = "砍价开启时间") + private Date startTime; + + @ApiModelProperty(value = "砍价结束时间") + private Date stopTime; + + @ApiModelProperty(value = "砍价产品名称") + private String storeName; + + @JsonSerialize(using = BigDecimalSerializer.class) + @ApiModelProperty(value = "砍价金额") + private BigDecimal price; + + @JsonSerialize(using = BigDecimalSerializer.class) + @ApiModelProperty(value = "砍价商品最低价") + private BigDecimal minPrice; + + @ApiModelProperty(value = "每次购买的砍价产品数量") + private Integer num; + + @JsonSerialize(using = BigDecimalSerializer.class) + @ApiModelProperty(value = "用户每次砍价的最大金额") + private BigDecimal bargainMaxPrice; + + @JsonSerialize(using = BigDecimalSerializer.class) + @ApiModelProperty(value = "用户每次砍价的最小金额") + private BigDecimal bargainMinPrice; + + @ApiModelProperty(value = "用户每次砍价的次数") + private Integer bargainNum; + + @ApiModelProperty(value = "砍价状态 0(到砍价时间不自动开启) 1(到砍价时间自动开启时间)") + private Integer status; + + @ApiModelProperty(value = "砍价详情") + private String description; + + @ApiModelProperty(value = "反多少积分") + private BigDecimal giveIntegral; + + @ApiModelProperty(value = "砍价活动简介") + private String info; + + @JsonSerialize(using = BigDecimalSerializer.class) + @ApiModelProperty(value = "成本价") + private BigDecimal cost; + + @ApiModelProperty(value = "排序") + private Integer sort; + + @JsonSerialize(using = BigDecimalSerializer.class) + @ApiModelProperty(value = "邮费") + private BigDecimal postage; + + @ApiModelProperty(value = "砍价规则") + private String rule; + + @ApiModelProperty(value = "砍价产品浏览量") + private Integer look; + + @ApiModelProperty(value = "砍价产品分享量") + private Integer share; + + @ApiModelProperty(value = "砍价产品参与人数") + private Integer people; + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreBargainUserHelpQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreBargainUserHelpQueryVo.java new file mode 100644 index 0000000..b76b58d --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreBargainUserHelpQueryVo.java @@ -0,0 +1,42 @@ +package co.yixiang.modules.activity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + *

+ * 砍价用户帮助表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-12-21 + */ +@Data +@ApiModel(value = "YxStoreBargainUserHelpQueryVo对象", description = "砍价用户帮助表查询参数") +public class YxStoreBargainUserHelpQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "砍价用户帮助表ID") + private Long id; + + @ApiModelProperty(value = "帮助的用户id") + private Long uid; + + @ApiModelProperty(value = "砍价产品ID") + private Long bargainId; + + @ApiModelProperty(value = "用户参与砍价表id") + private Long bargainUserId; + + @ApiModelProperty(value = "帮助砍价多少金额") + private BigDecimal price; + + private String nickname; + + private String avatar; + +} \ No newline at end of file diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreBargainUserQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreBargainUserQueryVo.java new file mode 100644 index 0000000..16a49c7 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreBargainUserQueryVo.java @@ -0,0 +1,54 @@ +package co.yixiang.modules.activity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + *

+ * 用户参与砍价表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-12-21 + */ +@Data +@ApiModel(value = "YxStoreBargainUserQueryVo对象", description = "用户参与砍价表查询参数") +public class YxStoreBargainUserQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "用户参与砍价表ID") + private Long id; + + @ApiModelProperty(value = "用户ID") + private Long uid; + + @ApiModelProperty(value = "砍价产品id") + private Long bargainId; + + @ApiModelProperty(value = "砍价的最低价") + private BigDecimal bargainPriceMin; + + @ApiModelProperty(value = "砍价金额") + private BigDecimal bargainPrice; + + @ApiModelProperty(value = "砍掉的价格") + private BigDecimal price; + + @ApiModelProperty(value = "状态 1参与中 2 活动结束参与失败 3活动结束参与成功") + private Integer status; + + + private Double residuePrice; + + private String title; + + private String image; + + private Date datatime; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreCombinationQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreCombinationQueryVo.java new file mode 100644 index 0000000..17a60aa --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreCombinationQueryVo.java @@ -0,0 +1,106 @@ +package co.yixiang.modules.activity.vo; + +import cn.hutool.core.util.StrUtil; +import co.yixiang.serializer.BigDecimalSerializer; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + *

+ * 拼团产品表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-11-19 + */ +@Data +@ApiModel(value = "YxStoreCombinationQueryVo对象", description = "拼团产品表查询参数") +public class YxStoreCombinationQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + private Long id; + + @ApiModelProperty(value = "商品id") + private Long productId; + + @ApiModelProperty(value = "商户id") + private Integer merId; + + @ApiModelProperty(value = "推荐图") + private String image; + + @ApiModelProperty(value = "轮播图") + private String images; + + private List sliderImageArr; + + public List getSliderImageArr() { + if(StrUtil.isNotEmpty(images)){ + return Arrays.asList(images.split(",")); + }else { + return new ArrayList<>(); + } + + } + + @ApiModelProperty(value = "活动标题") + private String title; + + + @ApiModelProperty(value = "参团人数") + private Integer people; + + @ApiModelProperty(value = "简介") + private String info; + + @JsonSerialize(using = BigDecimalSerializer.class) + @ApiModelProperty(value = "价格") + private BigDecimal price; + + @JsonSerialize(using = BigDecimalSerializer.class) + @ApiModelProperty(value = "商品价格") + private BigDecimal productPrice; + + + @ApiModelProperty(value = "销量") + private Integer sales; + + @ApiModelProperty(value = "库存") + private Integer stock; + + private Integer combination; + + @ApiModelProperty(value = "是否包邮1是0否") + private Integer isPostage; + + @JsonSerialize(using = BigDecimalSerializer.class) + @ApiModelProperty(value = "邮费") + private BigDecimal postage; + + @ApiModelProperty(value = "拼团内容") + private String description; + + @ApiModelProperty(value = "拼团订单有效时间") + private Integer effectiveTime; + + @ApiModelProperty(value = "浏览量") + private Integer browse; + + @ApiModelProperty(value = "单位名") + private String unitName; + + /** 是否单独分佣 */ + @JsonProperty("is_sub") + private Integer isSub; + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreCouponIssueQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreCouponIssueQueryVo.java new file mode 100644 index 0000000..54313ff --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreCouponIssueQueryVo.java @@ -0,0 +1,64 @@ +package co.yixiang.modules.activity.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 优惠券前台领取表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-10-27 + */ +@Data +@ApiModel(value = "YxStoreCouponIssueQueryVo对象", description = "优惠券前台领取表查询参数") +public class YxStoreCouponIssueQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + private Integer id; + + @ApiModelProperty(value = "优惠券ID") + private Integer cid; + + @ApiModelProperty(value = "优惠券名称") + private String cname; + + @ApiModelProperty(value = "优惠券类别") + private Integer ctype; + + @ApiModelProperty(value = "优惠券领取开启时间") + @JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8") + private Date startTime; + + @ApiModelProperty(value = "优惠券领取结束时间") + @JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8") + private Date endTime; + + @ApiModelProperty(value = "优惠券领取数量") + private Integer totalCount; + + @ApiModelProperty(value = "优惠券剩余领取数量") + private Integer remainCount; + + @ApiModelProperty(value = "是否无限张数") + private Integer isPermanent; + + @ApiModelProperty(value = "1 正常 0 未开启 -1 已无效") + private Integer status; + + @ApiModelProperty(value = "优惠券价格") + private Double couponPrice; + + @ApiModelProperty(value = "优惠券最低满多少能使用") + private Double useMinPrice; + + @ApiModelProperty(value = "优惠券是否使用") + private Boolean isUse; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreCouponQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreCouponQueryVo.java new file mode 100644 index 0000000..8d79969 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreCouponQueryVo.java @@ -0,0 +1,53 @@ +package co.yixiang.modules.activity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + *

+ * 优惠券表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-10-27 + */ +@Data +@ApiModel(value = "YxStoreCouponQueryVo对象", description = "优惠券表查询参数") +public class YxStoreCouponQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "优惠券表ID") + private Integer id; + + @ApiModelProperty(value = "优惠券名称") + private String title; + + @ApiModelProperty(value = "兑换消耗积分值") + private Integer integral; + + @ApiModelProperty(value = "兑换的优惠券面值") + private BigDecimal couponPrice; + + @ApiModelProperty(value = "最低消费多少金额可用优惠券") + private BigDecimal useMinPrice; + + @ApiModelProperty(value = "优惠券有效期限(单位:天)") + private Integer couponTime; + + @ApiModelProperty(value = "排序") + private Integer sort; + + @ApiModelProperty(value = "状态(0:关闭,1:开启)") + private Boolean status; + + @ApiModelProperty(value = "兑换项目添加时间") + private Integer addTime; + + @ApiModelProperty(value = "是否删除") + private Boolean isDel; + +} \ No newline at end of file diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreCouponUserQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreCouponUserQueryVo.java new file mode 100644 index 0000000..366bf8f --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreCouponUserQueryVo.java @@ -0,0 +1,69 @@ +package co.yixiang.modules.activity.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + *

+ * 优惠券发放记录表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-10-27 + */ +@Data +@ApiModel(value = "YxStoreCouponUserQueryVo对象", description = "优惠券发放记录表查询参数") +public class YxStoreCouponUserQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "优惠券发放记录id") + private Long id; + + @ApiModelProperty(value = "兑换的项目id") + private Integer cid; + + @ApiModelProperty(value = "优惠券所属用户") + private Long uid; + + @ApiModelProperty(value = "优惠券名称") + private String couponTitle; + + @ApiModelProperty(value = "优惠券的面值") + private BigDecimal couponPrice; + + @ApiModelProperty(value = "最低消费多少金额可用优惠券") + private BigDecimal useMinPrice; + + @JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8") + @ApiModelProperty(value = "优惠券创建时间") + private Date createTime; + + @ApiModelProperty(value = "优惠券结束时间") + @JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8") + private Date endTime; + + @ApiModelProperty(value = "使用时间") + private Date useTime; + + @ApiModelProperty(value = "获取方式") + private String type; + + @ApiModelProperty(value = "状态(0:未使用,1:已使用, 2:已过期)") + private Integer status; + + @ApiModelProperty(value = "是否有效") + private Integer isFail; + + @ApiModelProperty(value = "优惠券发放类型 0可用 1不可用") + private Integer _type; + + @ApiModelProperty(value = "优惠券发放显示文字") + private String _msg; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStorePinkQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStorePinkQueryVo.java new file mode 100644 index 0000000..5c82a33 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStorePinkQueryVo.java @@ -0,0 +1,72 @@ +package co.yixiang.modules.activity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + *

+ * 拼团表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-11-19 + */ +@Data +@ApiModel(value = "YxStorePinkQueryVo对象", description = "拼团表查询参数") +public class YxStorePinkQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + private Long id; + + @ApiModelProperty(value = "用户id") + private Long uid; + + @ApiModelProperty(value = "用户昵称") + private String nickname; + + @ApiModelProperty(value = "用户头像") + private String avatar; + + @ApiModelProperty(value = "订单id 生成") + private String orderId; + + @ApiModelProperty(value = "订单id 数据库") + private Integer orderIdKey; + + @ApiModelProperty(value = "购买商品个数") + private Integer totalNum; + + @ApiModelProperty(value = "购买总金额") + private BigDecimal totalPrice; + + @ApiModelProperty(value = "拼团产品id") + private Long cid; + + @ApiModelProperty(value = "产品id") + private Long pid; + + @ApiModelProperty(value = "拼团总人数") + private Integer people; + + @ApiModelProperty(value = "拼团产品单价") + private BigDecimal price; + + @ApiModelProperty(value = "开始时间") + private Date createTime; + + @ApiModelProperty(value = "结束时间") + private Date stopTime; + + @ApiModelProperty(value = "团长id 0为团长") + private Long kId; + + + @ApiModelProperty(value = "状态1进行中2已完成3未完成") + private Integer status; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreSeckillQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreSeckillQueryVo.java new file mode 100644 index 0000000..50102cd --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/activity/vo/YxStoreSeckillQueryVo.java @@ -0,0 +1,119 @@ +package co.yixiang.modules.activity.vo; + +import cn.hutool.core.util.StrUtil; +import co.yixiang.serializer.BigDecimalSerializer; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +/** + *

+ * 商品秒杀产品表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-12-14 + */ +@Data +@ApiModel(value="YxStoreSeckillQueryVo对象", description="商品秒杀产品表查询参数") +public class YxStoreSeckillQueryVo implements Serializable{ + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "商品秒杀产品表id") + private Long id; + + @ApiModelProperty(value = "商品id") + private Long productId; + + @ApiModelProperty(value = "推荐图") + private String image; + + @ApiModelProperty(value = "轮播图") + private String images; + + private List sliderImageArr; + + public List getSliderImageArr() { + if(StrUtil.isNotEmpty(images)){ + return Arrays.asList(images.split(",")); + }else { + return new ArrayList<>(); + } + + } + + @JsonSerialize(using = BigDecimalSerializer.class) + @ApiModelProperty(value = "价格") + private BigDecimal price; + + @JsonSerialize(using = BigDecimalSerializer.class) + @ApiModelProperty(value = "成本") + private BigDecimal cost; + + @JsonSerialize(using = BigDecimalSerializer.class) + @ApiModelProperty(value = "原价") + private BigDecimal otPrice; + + @ApiModelProperty(value = "轮播图") + private String[] pics; + @ApiModelProperty(value = "活动标题") + private String title; + + @ApiModelProperty(value = "简介") + private String info; + + @ApiModelProperty(value = "返多少积分") + private BigDecimal giveIntegral; + + @ApiModelProperty(value = "排序") + private Integer sort; + + @ApiModelProperty(value = "库存") + private Integer stock; + + @ApiModelProperty(value = "销量") + private Integer sales; + + @ApiModelProperty(value = "单位名") + private String unitName; + + @ApiModelProperty(value = "邮费") + private BigDecimal postage; + + @ApiModelProperty(value = "内容") + private String description; + + @ApiModelProperty(value = "开始时间") + private Date startTime; + + @ApiModelProperty(value = "结束时间") + private Date stopTime; + + @ApiModelProperty(value = "产品状态") + private Integer status; + + @ApiModelProperty(value = "最多秒杀几个") + private Integer num; + + @ApiModelProperty(value = "显示") + private Integer isShow; + + @ApiModelProperty(value = "百分比") + private Integer percent; + + /** 是否单独分佣 */ + @JsonProperty("is_sub") + private Integer isSub; + + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/canvas/domain/StoreCanvas.java b/yshop-mall/src/main/java/co/yixiang/modules/canvas/domain/StoreCanvas.java new file mode 100644 index 0000000..3f5c3fb --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/canvas/domain/StoreCanvas.java @@ -0,0 +1,52 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.canvas.domain; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import com.baomidou.mybatisplus.annotation.TableName; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.validation.constraints.*; +import co.yixiang.domain.BaseDomain; + +/** +* @author yshop +* @date 2021-02-01 +*/ +@Data +@TableName("yx_store_canvas") +public class StoreCanvas extends BaseDomain { + /** 画布id */ + @TableId + private Long canvasId; + + /** 终端 1-小程序 2-H5 3-APP 4-PC */ + @NotNull + private Integer terminal; + + /** 画布json数据 */ + private String json; + + /** 类型 1-系统画布 2-自定义页面 3-商家店铺装修 */ + private Integer type; + + /** 名称 */ + @NotBlank + private String name; + + /** 店铺id,当type=3的时候,值为具体的店铺id,其它情况为0 */ + private Long shopId; + + + + + public void copy(StoreCanvas source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/canvas/service/StoreCanvasService.java b/yshop-mall/src/main/java/co/yixiang/modules/canvas/service/StoreCanvasService.java new file mode 100644 index 0000000..5bb5e93 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/canvas/service/StoreCanvasService.java @@ -0,0 +1,48 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.canvas.service; +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.canvas.domain.StoreCanvas; +import co.yixiang.modules.canvas.service.dto.StoreCanvasDto; +import co.yixiang.modules.canvas.service.dto.StoreCanvasQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import co.yixiang.domain.PageResult; +/** +* @author yshop +* @date 2021-02-01 +*/ +public interface StoreCanvasService extends BaseService{ + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + PageResult queryAll(StoreCanvasQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(StoreCanvasQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/canvas/service/dto/StoreCanvasDto.java b/yshop-mall/src/main/java/co/yixiang/modules/canvas/service/dto/StoreCanvasDto.java new file mode 100644 index 0000000..c70c19a --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/canvas/service/dto/StoreCanvasDto.java @@ -0,0 +1,44 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.canvas.service.dto; + +import lombok.Data; +import java.io.Serializable; + +/** +* @author yshop +* @date 2021-02-01 +*/ +@Data +public class StoreCanvasDto implements Serializable { + + /** 画布id */ + private Long canvasId; + + /** 终端 1-小程序 2-H5 3-APP 4-PC */ + private Integer terminal; + + /** 画布json数据 */ + private String json; + + /** 类型 1-系统画布 2-自定义页面 3-商家店铺装修 */ + private Integer type; + + /** 名称 */ + private String name; + + /** 店铺id,当type=3的时候,值为具体的店铺id,其它情况为0 */ + private Long shopId; + + /** 创建时间 */ + private String createTime; + + /** 修改时间 */ + private String updateTime; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/canvas/service/dto/StoreCanvasQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/canvas/service/dto/StoreCanvasQueryCriteria.java new file mode 100644 index 0000000..0b4f2cd --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/canvas/service/dto/StoreCanvasQueryCriteria.java @@ -0,0 +1,21 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.canvas.service.dto; + +import lombok.Data; +import java.util.List; +import co.yixiang.annotation.Query; + +/** +* @author yshop +* @date 2021-02-01 +*/ +@Data +public class StoreCanvasQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/canvas/service/impl/StoreCanvasServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/canvas/service/impl/StoreCanvasServiceImpl.java new file mode 100644 index 0000000..37518fd --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/canvas/service/impl/StoreCanvasServiceImpl.java @@ -0,0 +1,84 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.canvas.service.impl; + +import co.yixiang.modules.canvas.domain.StoreCanvas; +import co.yixiang.common.service.impl.BaseServiceImpl; +import lombok.AllArgsConstructor; +import co.yixiang.dozer.service.IGenerator; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.utils.ValidationUtil; +import co.yixiang.utils.FileUtil; +import co.yixiang.modules.canvas.service.StoreCanvasService; +import co.yixiang.modules.canvas.service.dto.StoreCanvasDto; +import co.yixiang.modules.canvas.service.dto.StoreCanvasQueryCriteria; +import co.yixiang.modules.canvas.service.mapper.StoreCanvasMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import co.yixiang.domain.PageResult; +/** +* @author yshop +* @date 2021-02-01 +*/ +@Service +@AllArgsConstructor +//@CacheConfig(cacheNames = "storeCanvas") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class StoreCanvasServiceImpl extends BaseServiceImpl implements StoreCanvasService { + + private final IGenerator generator; + + @Override + //@Cacheable + public PageResult queryAll(StoreCanvasQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + return generator.convertPageInfo(page,StoreCanvasDto.class); + } + + + @Override + //@Cacheable + public List queryAll(StoreCanvasQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(StoreCanvas.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (StoreCanvasDto storeCanvas : all) { + Map map = new LinkedHashMap<>(); + map.put("终端 1-小程序 2-H5 3-APP 4-PC", storeCanvas.getTerminal()); + map.put("画布json数据", storeCanvas.getJson()); + map.put("类型 1-系统画布 2-自定义页面 3-商家店铺装修", storeCanvas.getType()); + map.put("名称", storeCanvas.getName()); + map.put("店铺id,当type=3的时候,值为具体的店铺id,其它情况为0", storeCanvas.getShopId()); + map.put("创建时间", storeCanvas.getCreateTime()); + map.put("修改时间", storeCanvas.getUpdateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/canvas/service/mapper/StoreCanvasMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/canvas/service/mapper/StoreCanvasMapper.java new file mode 100644 index 0000000..1d447fb --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/canvas/service/mapper/StoreCanvasMapper.java @@ -0,0 +1,23 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.canvas.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.canvas.domain.StoreCanvas; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** +* @author yshop +* @date 2021-02-01 +*/ +@Repository +public interface StoreCanvasMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/cart/domain/YxStoreCart.java b/yshop-mall/src/main/java/co/yixiang/modules/cart/domain/YxStoreCart.java new file mode 100644 index 0000000..e577dee --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/cart/domain/YxStoreCart.java @@ -0,0 +1,84 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.cart.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +@TableName("yx_store_cart") +public class YxStoreCart extends BaseDomain { + + /** 购物车表ID */ + @TableId + private Long id; + + + /** 用户ID */ + private Long uid; + + + /** 类型 */ + private String type; + + + /** 商品ID */ + private Long productId; + + + /** 商品属性 */ + private String productAttrUnique; + + + /** 商品数量 */ + private Integer cartNum; + + + + + /** 0 = 未购买 1 = 已购买 */ + private Integer isPay; + + + + /** 是否为立即购买 */ + private Integer isNew; + + + /** 拼团id */ + //@Column(name = "combination_id") + private Long combinationId; + + + /** 秒杀产品ID */ + private Long seckillId; + + + /** 砍价id */ + private Long bargainId; + + + public void copy(YxStoreCart source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/cart/service/YxStoreCartService.java b/yshop-mall/src/main/java/co/yixiang/modules/cart/service/YxStoreCartService.java new file mode 100644 index 0000000..d107d50 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/cart/service/YxStoreCartService.java @@ -0,0 +1,112 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.cart.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.cart.domain.YxStoreCart; +import co.yixiang.modules.cart.service.dto.YxStoreCartDto; +import co.yixiang.modules.cart.service.dto.YxStoreCartQueryCriteria; +import co.yixiang.modules.order.service.dto.CountDto; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxStoreCartService extends BaseService{ + + /** + * 删除购物车 + * @param uid uid + * @param ids 购物车id集合 + */ + void removeUserCart(Long uid, List ids); + + /** + * 改购物车数量 + * @param cartId 购物车id + * @param cartNum 数量 + * @param uid uid + */ + void changeUserCartNum(Long cartId,int cartNum,Long uid); + + /** + * 购物车列表 + * @param uid 用户id + * @param cartIds 购物车id,多个逗号隔开 + * @param status 0-购购物车列表 + * @return map valid-有效购物车 invalid-失效购物车 + */ + Map getUserProductCartList(Long uid,String cartIds,Integer status); + + /** + * 返回当前用户购物车总数量 + * @param uid 用户id + * @return int + */ + int getUserCartNum(Long uid); + + /** + * 添加购物车 + * @param uid 用户id + * @param productId 普通产品编号 + * @param cartNum 购物车数量 + * @param productAttrUnique 属性唯一值 + * @param isNew 1 加入购物车直接购买 0 加入购物车 + * @param combinationId 拼团id + * @param seckillId 秒杀id + * @param bargainId 砍价id + * @return 购物车id + */ + long addCart(Long uid,Long productId,Integer cartNum, String productAttrUnique, + Integer isNew,Long combinationId,Long seckillId,Long bargainId); + + /** + * 检测商品/秒杀/砍价/拼团库存 + * @param uid 用户ID + * @param productId 产品ID + * @param cartNum 购买数量 + * @param productAttrUnique 商品属性Unique + * @param combinationId 拼团产品ID + * @param seckillId 秒杀产品ID + * @param bargainId 砍价产品ID + */ + void checkProductStock(Long uid, Long productId, Integer cartNum, String productAttrUnique, + Long combinationId, Long seckillId, Long bargainId); + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxStoreCartQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxStoreCartQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + List findCateName(); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/cart/service/dto/YxStoreCartDto.java b/yshop-mall/src/main/java/co/yixiang/modules/cart/service/dto/YxStoreCartDto.java new file mode 100644 index 0000000..374cb42 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/cart/service/dto/YxStoreCartDto.java @@ -0,0 +1,57 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.cart.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxStoreCartDto implements Serializable { + + /** 购物车表ID */ + private Long id; + + /** 用户ID */ + private Integer uid; + + /** 类型 */ + private String type; + + /** 商品ID */ + private Integer productId; + + /** 商品属性 */ + private String productAttrUnique; + + /** 商品数量 */ + private Integer cartNum; + + /** 添加时间 */ + private Integer addTime; + + /** 0 = 未购买 1 = 已购买 */ + private Integer isPay; + + /** 是否删除 */ + private Integer isDel; + + /** 是否为立即购买 */ + private Integer isNew; + + /** 拼团id */ + private Integer combinationId; + + /** 秒杀产品ID */ + private Integer seckillId; + + /** 砍价id */ + private Integer bargainId; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/cart/service/dto/YxStoreCartQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/cart/service/dto/YxStoreCartQueryCriteria.java new file mode 100644 index 0000000..81bd6e0 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/cart/service/dto/YxStoreCartQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.cart.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxStoreCartQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/cart/service/impl/YxStoreCartServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/cart/service/impl/YxStoreCartServiceImpl.java new file mode 100644 index 0000000..6cbe0a7 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/cart/service/impl/YxStoreCartServiceImpl.java @@ -0,0 +1,452 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.cart.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.YshopException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.CartTypeEnum; +import co.yixiang.enums.OrderInfoEnum; +import co.yixiang.enums.ProductTypeEnum; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.modules.activity.domain.YxStoreBargain; +import co.yixiang.modules.activity.service.YxStoreBargainService; +import co.yixiang.modules.activity.service.mapper.YxStoreBargainMapper; +import co.yixiang.modules.activity.service.mapper.YxStoreCombinationMapper; +import co.yixiang.modules.activity.service.mapper.YxStoreSeckillMapper; +import co.yixiang.modules.cart.domain.YxStoreCart; +import co.yixiang.modules.cart.service.YxStoreCartService; +import co.yixiang.modules.cart.service.dto.YxStoreCartDto; +import co.yixiang.modules.cart.service.dto.YxStoreCartQueryCriteria; +import co.yixiang.modules.cart.service.mapper.StoreCartMapper; +import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; +import co.yixiang.modules.order.service.dto.CountDto; +import co.yixiang.modules.product.domain.YxStoreProduct; +import co.yixiang.modules.product.domain.YxStoreProductAttrValue; +import co.yixiang.modules.product.service.YxStoreProductAttrService; +import co.yixiang.modules.product.service.YxStoreProductService; +import co.yixiang.modules.product.vo.YxStoreProductQueryVo; +import co.yixiang.modules.user.service.YxUserService; +import co.yixiang.utils.FileUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + + +/** + * @author hupeng + * @date 2020-05-12 + */ +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxStoreCartServiceImpl extends BaseServiceImpl implements YxStoreCartService { + + @Autowired + private IGenerator generator; + + @Autowired + private StoreCartMapper yxStoreCartMapper; + @Autowired + private YxStoreSeckillMapper storeSeckillMapper; + @Autowired + private YxStoreBargainMapper yxStoreBargainMapper; + @Autowired + private YxStoreCombinationMapper storeCombinationMapper; + @Autowired + private YxStoreProductService productService; + @Autowired + private YxStoreProductAttrService productAttrService; + @Autowired + private YxStoreBargainService storeBargainService; + @Autowired + private YxUserService userService; + + + /** + * 删除购物车 + * + * @param uid uid + * @param ids 购物车id集合 + */ + @Override + public void removeUserCart(Long uid, List ids) { + List newids = ids.stream().map(Long::new).collect(Collectors.toList()); + yxStoreCartMapper.delete(Wrappers.lambdaQuery() + .eq(YxStoreCart::getUid, uid) + .in(YxStoreCart::getId, newids)); + } + + /** + * 改购物车数量 + * + * @param cartId 购物车id + * @param cartNum 数量 + * @param uid uid + */ + @Override + public void changeUserCartNum(Long cartId, int cartNum, Long uid) { + YxStoreCart cart = this.lambdaQuery() + .eq(YxStoreCart::getUid, uid) + .eq(YxStoreCart::getId, cartId) + .one(); + if (cart == null) { + throw new YshopException("购物车不存在"); + } + + if (cartNum <= 0) { + throw new YshopException("库存错误"); + } + + //普通商品库存 + int stock = productService.getProductStock(cart.getProductId() + , cart.getProductAttrUnique(), ""); + if (stock < cartNum) { + throw new YshopException("该产品库存不足" + cartNum); + } + + if (cartNum == cart.getCartNum()) { + return; + } + + YxStoreCart storeCart = new YxStoreCart(); + storeCart.setCartNum(cartNum); + storeCart.setId(cartId); + + yxStoreCartMapper.updateById(storeCart); + + + } + + /** + * 购物车列表 + * + * @param uid 用户id + * @param cartIds 购物车id,多个逗号隔开 + * @param status 0-购购物车列表 + * @return map valid-有效购物车 invalid-失效购物车 + */ + @Override + public Map getUserProductCartList(Long uid, String cartIds, Integer status) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreCart::getUid, uid) + .eq(YxStoreCart::getIsPay, OrderInfoEnum.PAY_STATUS_0.getValue()) + .orderByDesc(YxStoreCart::getId); + if (status == null) { + wrapper.eq(YxStoreCart::getIsNew, CartTypeEnum.NEW_0.getValue()); + } + if (StrUtil.isNotEmpty(cartIds)) { + wrapper.in(YxStoreCart::getId, Arrays.asList(cartIds.split(","))); + } + List carts = yxStoreCartMapper.selectList(wrapper); + + List valid = new ArrayList<>(); + List invalid = new ArrayList<>(); + + for (YxStoreCart storeCart : carts) { + YxStoreProductQueryVo storeProduct = null; + if (storeCart.getCombinationId() != null && storeCart.getCombinationId() > 0) { + storeProduct = ObjectUtil.clone(storeCombinationMapper.combinatiionInfo(storeCart.getCombinationId())); + } else if (storeCart.getSeckillId() != null && storeCart.getSeckillId() > 0) { + storeProduct = ObjectUtil.clone(storeSeckillMapper.seckillInfo(storeCart.getSeckillId())); + } else if (storeCart.getBargainId() != null && storeCart.getBargainId() > 0) { + storeProduct = ObjectUtil.clone(yxStoreBargainMapper.bargainInfo(storeCart.getBargainId())); + } else { + //必须得重新克隆创建一个新对象 + storeProduct = ObjectUtil.clone(productService + .getStoreProductById(storeCart.getProductId())); + } + + YxStoreCartQueryVo storeCartQueryVo = generator.convert(storeCart, YxStoreCartQueryVo.class); + + if (ObjectUtil.isNull(storeProduct)) { + this.removeById(storeCart.getId()); + } else if (ShopCommonEnum.SHOW_0.getValue().equals(storeProduct.getIsShow()) || (storeProduct.getStock() == 0 && StrUtil.isEmpty(storeCart.getProductAttrUnique()))) { + storeCartQueryVo.setProductInfo(storeProduct); + invalid.add(storeCartQueryVo); + } else { + if (StrUtil.isNotEmpty(storeCart.getProductAttrUnique())) { + YxStoreProductAttrValue productAttrValue = productAttrService + .uniqueByAttrInfo(storeCart.getProductAttrUnique()); + if (ObjectUtil.isNull(productAttrValue) || productAttrValue.getStock() == 0) { + storeCartQueryVo.setProductInfo(storeProduct); + invalid.add(storeCartQueryVo); + } else { + storeProduct.setAttrInfo(productAttrValue); + storeCartQueryVo.setProductInfo(storeProduct); + + //设置真实价格 + //设置VIP价格 + double vipPrice = userService.setLevelPrice( + productAttrValue.getPrice().doubleValue(), uid); + //砍价金额 + if ( storeCart.getBargainId() > 0 + ) { + vipPrice = storeProduct.getPrice().doubleValue(); + } + //设置拼团价格 + if(storeCart.getCombinationId() > 0 ){ + vipPrice = productAttrValue.getPinkPrice().doubleValue(); + } + //设置秒杀价格 + if( storeCart.getSeckillId() > 0){ + vipPrice = productAttrValue.getSeckillPrice().doubleValue(); + } + storeCartQueryVo.setTruePrice(vipPrice); + //设置会员价 + storeCartQueryVo.setVipTruePrice(productAttrValue.getPrice() + .doubleValue()); + storeCartQueryVo.setCostPrice(productAttrValue.getCost() + .doubleValue()); + storeCartQueryVo.setTrueStock(productAttrValue.getStock()); + + valid.add(storeCartQueryVo); + + } + } else { + //设置VIP价格,营销商品不参与 + double vipPrice = userService.setLevelPrice( + storeProduct.getPrice().doubleValue(), uid); + if (storeCart.getCombinationId() > 0 || storeCart.getSeckillId() > 0 + || storeCart.getBargainId() > 0) { + vipPrice = storeProduct.getPrice().doubleValue(); + } + + storeCartQueryVo.setTruePrice(vipPrice); + // 设置会员价 + storeCartQueryVo.setVipTruePrice(0d); + storeCartQueryVo.setCostPrice(storeProduct.getCost() + .doubleValue()); + storeCartQueryVo.setTrueStock(storeProduct.getStock()); + storeCartQueryVo.setProductInfo(storeProduct); + + valid.add(storeCartQueryVo); + } + } + + } + + Map map = new LinkedHashMap<>(); + map.put("valid", valid); + map.put("invalid", invalid); + return map; + } + + /** + * 添加购物车 + * @param uid 用户id + * @param productId 普通产品编号 + * @param cartNum 购物车数量 + * @param productAttrUnique 属性唯一值 + * @param isNew 1 加入购物车直接购买 0 加入购物车 + * @param combinationId 拼团id + * @param seckillId 秒杀id + * @param bargainId 砍价id + * @return 购物车id + */ + @Override + public long addCart(Long uid, Long productId, Integer cartNum, String productAttrUnique, + Integer isNew, Long combinationId, Long seckillId, Long bargainId) { + + this.checkProductStock(uid, productId, cartNum, productAttrUnique, combinationId, seckillId, bargainId); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreCart::getUid, uid) + .eq(YxStoreCart::getIsPay, OrderInfoEnum.PAY_STATUS_0.getValue()) + .eq(YxStoreCart::getProductId, productId) + .eq(YxStoreCart::getIsNew, isNew) + .eq(YxStoreCart::getProductAttrUnique, productAttrUnique) + .eq(YxStoreCart::getBargainId, bargainId) + .eq(YxStoreCart::getCombinationId, combinationId) + .eq(YxStoreCart::getSeckillId, seckillId) + .orderByDesc(YxStoreCart::getId) + .last("limit 1"); + + YxStoreCart cart = yxStoreCartMapper.selectOne(wrapper); + + YxStoreCart storeCart = YxStoreCart.builder() + .cartNum(cartNum) + .productAttrUnique(productAttrUnique) + .productId(productId) + .bargainId(bargainId) + .combinationId(combinationId) + .seckillId(seckillId) + .isNew(isNew) + .uid(uid) + .build(); + if (cart != null) { + if (CartTypeEnum.NEW_0.getValue().equals(isNew)) { + storeCart.setCartNum(cartNum + cart.getCartNum()); + } + storeCart.setId(cart.getId()); + yxStoreCartMapper.updateById(storeCart); + } else { + yxStoreCartMapper.insert(storeCart); + } + + return storeCart.getId(); + } + + /** + * 返回当前用户购物车总数量 + * + * @param uid 用户id + * @return int + */ + @Override + public int getUserCartNum(Long uid) { + return yxStoreCartMapper.cartSum(uid); + } + +// @Override +// public YxStoreCartQueryVo getYxStoreCartById(Serializable id){ +// return yxStoreCartMapper.getYxStoreCartById(id); +// } + + /** + * 检测商品/秒杀/砍价/拼团库存 + * + * @param uid 用户ID + * @param productId 产品ID + * @param cartNum 购买数量 + * @param productAttrUnique 商品属性Unique + * @param combinationId 拼团产品ID + * @param seckillId 秒杀产品ID + * @param bargainId 砍价产品ID + */ + @Override + public void checkProductStock(Long uid, Long productId, Integer cartNum, String productAttrUnique, + Long combinationId, Long seckillId, Long bargainId) { + Date now = new Date(); + //拼团 + if (combinationId != null && combinationId > 0) { + YxStoreProduct product = productService + .lambdaQuery().eq(YxStoreProduct::getId, productId) + .eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue()) + .one(); + if (product == null) { + throw new YshopException("该产品已下架或删除"); + } + + int stock = productService.getProductStock(productId, productAttrUnique, ProductTypeEnum.PINK.getValue()); + if (stock < cartNum) { + throw new YshopException(product.getStoreName() + "库存不足" + cartNum); + } + //秒杀 + } else if (seckillId != null && seckillId > 0) { + YxStoreProduct product = productService + .lambdaQuery().eq(YxStoreProduct::getId, productId) + .eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue()) + .one(); + if (product == null) { + throw new YshopException("该产品已下架或删除"); + } + + int stock = productService.getProductStock(productId, productAttrUnique, ProductTypeEnum.SECKILL.getValue()); + if (stock < cartNum) { + throw new YshopException(product.getStoreName() + "库存不足" + cartNum); + } + //砍价 + } else if (bargainId != null && bargainId > 0) { + YxStoreBargain yxStoreBargain = storeBargainService + .lambdaQuery().eq(YxStoreBargain::getId, bargainId) + .eq(YxStoreBargain::getStatus, ShopCommonEnum.IS_STATUS_1.getValue()) + .le(YxStoreBargain::getStartTime, now) + .ge(YxStoreBargain::getStopTime, now) + .one(); + if (yxStoreBargain == null) { + throw new YshopException("该产品已下架或删除"); + } + if (yxStoreBargain.getStock() < cartNum) { + throw new YshopException("该产品库存不足"); + } + + } else { + YxStoreProduct product = productService + .lambdaQuery().eq(YxStoreProduct::getId, productId) + .eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue()) + .one(); + if (product == null) { + throw new YshopException("该产品已下架或删除"); + } + + int stock = productService.getProductStock(productId, productAttrUnique, ""); + if (stock < cartNum) { + throw new YshopException(product.getStoreName() + "库存不足" + cartNum); + } + } + + } + + + //====================================================================// + + + @Override + //@Cacheable + public Map queryAll(YxStoreCartQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxStoreCartDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxStoreCartQueryCriteria criteria) { + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreCart.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxStoreCartDto yxStoreCart : all) { + Map map = new LinkedHashMap<>(); + map.put("用户ID", yxStoreCart.getUid()); + map.put("类型", yxStoreCart.getType()); + map.put("商品ID", yxStoreCart.getProductId()); + map.put("商品属性", yxStoreCart.getProductAttrUnique()); + map.put("商品数量", yxStoreCart.getCartNum()); + map.put("添加时间", yxStoreCart.getAddTime()); + map.put("0 = 未购买 1 = 已购买", yxStoreCart.getIsPay()); + map.put("是否删除", yxStoreCart.getIsDel()); + map.put("是否为立即购买", yxStoreCart.getIsNew()); + map.put("拼团id", yxStoreCart.getCombinationId()); + map.put("秒杀产品ID", yxStoreCart.getSeckillId()); + map.put("砍价id", yxStoreCart.getBargainId()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + public List findCateName() { + return yxStoreCartMapper.findCateName(); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/cart/service/mapper/StoreCartMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/cart/service/mapper/StoreCartMapper.java new file mode 100644 index 0000000..f3dffec --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/cart/service/mapper/StoreCartMapper.java @@ -0,0 +1,37 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.cart.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.cart.domain.YxStoreCart; +import co.yixiang.modules.order.service.dto.CountDto; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface StoreCartMapper extends CoreMapper { + + @Select("select IFNULL(sum(cart_num),0) from yx_store_cart " + + "where is_pay=0 and is_del=0 and is_new=0 and uid=#{uid}") + int cartSum(@Param("uid") Long uid); + + + @Select("SELECT t.cate_name as catename from yx_store_cart c " + + "LEFT JOIN yx_store_product p on c.product_id = p.id " + + "LEFT JOIN yx_store_category t on p.cate_id = t.id " + + "WHERE c.is_pay = 1") + List findCateName(); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/cart/vo/YxStoreCartQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/cart/vo/YxStoreCartQueryVo.java new file mode 100644 index 0000000..b3d0e6b --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/cart/vo/YxStoreCartQueryVo.java @@ -0,0 +1,77 @@ +package co.yixiang.modules.cart.vo; + +import co.yixiang.modules.product.vo.YxStoreProductQueryVo; +import co.yixiang.serializer.DoubleSerializer; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 购物车表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-10-25 + */ +@Data +@ApiModel(value = "YxStoreCartQueryVo对象", description = "购物车表查询参数") +public class YxStoreCartQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "购物车表ID") + private Long id; + + @ApiModelProperty(value = "用户ID") + private Long uid; + + @ApiModelProperty(value = "类型") + private String type; + + @ApiModelProperty(value = "商品ID") + private Long productId; + + @ApiModelProperty(value = "商品属性") + private String productAttrUnique; + + @ApiModelProperty(value = "商品数量") + private Integer cartNum; + + + @ApiModelProperty(value = "拼团id") + private Long combinationId; + + @ApiModelProperty(value = "秒杀产品ID") + private Long seckillId; + + @ApiModelProperty(value = "砍价id") + private Long bargainId; + + @ApiModelProperty(value = "商品信息") + private YxStoreProductQueryVo productInfo; + + @ApiModelProperty(value = "成本价") + @JsonSerialize(using = DoubleSerializer.class) + private Double costPrice; + + @ApiModelProperty(value = "真实价格") + @JsonSerialize(using = DoubleSerializer.class) + private Double truePrice; + + @ApiModelProperty(value = "真实库存") + private Integer trueStock; + + @JsonSerialize(using = DoubleSerializer.class) + @ApiModelProperty(value = "vip真实价格") + private Double vipTruePrice; + + @ApiModelProperty(value = "唯一id") + private String unique; + + @ApiModelProperty(value = "是否评价") + private Integer isReply; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/category/domain/YxStoreCategory.java b/yshop-mall/src/main/java/co/yixiang/modules/category/domain/YxStoreCategory.java new file mode 100644 index 0000000..970c421 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/category/domain/YxStoreCategory.java @@ -0,0 +1,58 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.category.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("yx_store_category") +public class YxStoreCategory extends BaseDomain { + + /** 商品分类表ID */ + @TableId + private Integer id; + + + /** 父id */ + private Integer pid; + + + /** 分类名称 */ + @NotBlank(message = "分类名称必填") + private String cateName; + + + /** 排序 */ + private Integer sort; + + + /** 图标 */ + private String pic; + + + /** 是否推荐 */ + private Integer isShow; + + + + + public void copy(YxStoreCategory source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/category/service/YxStoreCategoryService.java b/yshop-mall/src/main/java/co/yixiang/modules/category/service/YxStoreCategoryService.java new file mode 100644 index 0000000..390357a --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/category/service/YxStoreCategoryService.java @@ -0,0 +1,74 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.category.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.category.domain.YxStoreCategory; +import co.yixiang.modules.category.service.dto.YxStoreCategoryDto; +import co.yixiang.modules.category.service.dto.YxStoreCategoryQueryCriteria; +import co.yixiang.utils.CateDTO; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxStoreCategoryService extends BaseService{ + + List getList(); + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxStoreCategoryQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxStoreCategoryQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + /** + * 构建树形 + * @param categoryDTOS 分类列表 + * @return map + */ + Map buildTree(List categoryDTOS); + + /** + * 检测分类是否操过二级 + * @param pid 父级id + * @return boolean + */ + boolean checkCategory(int pid); + + /** + * 检测商品分类必选选择二级 + * @param id 分类id + * @return boolean + */ + boolean checkProductCategory(int id); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/category/service/dto/YxStoreCategoryDto.java b/yshop-mall/src/main/java/co/yixiang/modules/category/service/dto/YxStoreCategoryDto.java new file mode 100644 index 0000000..767c33b --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/category/service/dto/YxStoreCategoryDto.java @@ -0,0 +1,46 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.category.service.dto; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxStoreCategoryDto implements Serializable { + + /** 商品分类表ID */ + private Integer id; + + /** 父id */ + private Integer pid; + + /** 分类名称 */ + private String cateName; + + /** 排序 */ + private Integer sort; + + /** 图标 */ + private String pic; + + /** 是否推荐 */ + private Integer isShow; + + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private List children; + + public String getLabel() { + return cateName; + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/category/service/dto/YxStoreCategoryQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/category/service/dto/YxStoreCategoryQueryCriteria.java new file mode 100644 index 0000000..9a4442c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/category/service/dto/YxStoreCategoryQueryCriteria.java @@ -0,0 +1,19 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.category.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxStoreCategoryQueryCriteria{ + @Query + private String cateName; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/category/service/dto/YxStoreCategorySmallDto.java b/yshop-mall/src/main/java/co/yixiang/modules/category/service/dto/YxStoreCategorySmallDto.java new file mode 100644 index 0000000..cbe014d --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/category/service/dto/YxStoreCategorySmallDto.java @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.category.service.dto; + +import lombok.Data; + +import java.io.Serializable; + + +/** +* @author hupeng +* @date 2019-10-03 +*/ +@Data +public class YxStoreCategorySmallDto implements Serializable { + + // 商品分类表ID + private Integer id; + + + // 分类名称 + private String cateName; + + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/category/service/impl/YxStoreCategoryServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/category/service/impl/YxStoreCategoryServiceImpl.java new file mode 100644 index 0000000..fc2dd9e --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/category/service/impl/YxStoreCategoryServiceImpl.java @@ -0,0 +1,185 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.category.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.modules.category.domain.YxStoreCategory; +import co.yixiang.modules.category.service.YxStoreCategoryService; +import co.yixiang.modules.category.service.dto.YxStoreCategoryDto; +import co.yixiang.modules.category.service.dto.YxStoreCategoryQueryCriteria; +import co.yixiang.modules.category.service.mapper.StoreCategoryMapper; +import co.yixiang.utils.CateDTO; +import co.yixiang.utils.FileUtil; +import co.yixiang.utils.TreeUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.google.common.collect.Maps; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxStoreCategoryServiceImpl extends BaseServiceImpl implements YxStoreCategoryService { + + private final IGenerator generator; + + /** + * 获取分类列表树形列表 + * @return List + */ + @Override + public List getList() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreCategory::getIsShow, ShopCommonEnum.SHOW_1.getValue()) + .orderByAsc(YxStoreCategory::getSort); + List list = generator.convert(baseMapper.selectList(wrapper),CateDTO.class); + return TreeUtil.list2TreeConverter(list,0); + } + + //===============================// + + @Override + public Map queryAll(YxStoreCategoryQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", page.getList()); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + public List queryAll(YxStoreCategoryQueryCriteria criteria){ + return generator.convert(this.baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreCategory.class, criteria)), + YxStoreCategoryDto.class); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxStoreCategoryDto yxStoreCategory : all) { + Map map = new LinkedHashMap<>(); + map.put("父id", yxStoreCategory.getPid()); + map.put("分类名称", yxStoreCategory.getCateName()); + map.put("排序", yxStoreCategory.getSort()); + map.put("图标", yxStoreCategory.getPic()); + map.put("是否推荐", yxStoreCategory.getIsShow()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + /** + * 构建树形 + * @param categoryDTOS 分类列表 + * @return map + */ + @Override + public Map buildTree(List categoryDTOS) { + Set trees = new LinkedHashSet<>(); + Set cates = new LinkedHashSet<>(); + List deptNames = categoryDTOS.stream().map(YxStoreCategoryDto::getCateName) + .collect(Collectors.toList()); + + //YxStoreCategoryDto categoryDTO = new YxStoreCategoryDto(); + Boolean isChild; + List categories = this.list(); + for (YxStoreCategoryDto deptDTO : categoryDTOS) { + isChild = false; + if ("0".equals(deptDTO.getPid().toString())) { + trees.add(deptDTO); + } + for (YxStoreCategoryDto it : categoryDTOS) { + if (it.getPid().equals(deptDTO.getId())) { + isChild = true; + if (deptDTO.getChildren() == null) { + deptDTO.setChildren(new ArrayList()); + } + deptDTO.getChildren().add(it); + } + } + if (isChild) { + cates.add(deptDTO); + } + for (YxStoreCategory category : categories) { + if (category.getId().equals(deptDTO.getPid()) && !deptNames.contains(category.getCateName())) { + cates.add(deptDTO); + } + } + } + + + if (CollectionUtils.isEmpty(trees)) { + trees = cates; + } + + + Integer totalElements = categoryDTOS != null ? categoryDTOS.size() : 0; + + Map map = Maps.newHashMap(); + map.put("totalElements", totalElements); + map.put("content", CollectionUtils.isEmpty(trees) ? categoryDTOS : trees); + return map; + } + + + /** + * 检测分类是否操过二级 + * @param pid 父级id + * @return boolean + */ + @Override + public boolean checkCategory(int pid){ + if(pid == 0) { + return true; + } + YxStoreCategory yxStoreCategory = this.getOne(Wrappers.lambdaQuery() + .eq(YxStoreCategory::getId,pid)); + return yxStoreCategory.getPid() <= 0; + } + + /** + * 检测商品分类必选选择二级 + * @param id 分类id + * @return boolean + */ + @Override + public boolean checkProductCategory(int id){ + YxStoreCategory yxStoreCategory = this.getOne(Wrappers.lambdaQuery() + .eq(YxStoreCategory::getId,id)); + return yxStoreCategory.getPid() != 0; + } + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/category/service/mapper/StoreCategoryMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/category/service/mapper/StoreCategoryMapper.java new file mode 100644 index 0000000..e74f2dd --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/category/service/mapper/StoreCategoryMapper.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.category.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.category.domain.YxStoreCategory; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface StoreCategoryMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/customer/domain/YxStoreCustomer.java b/yshop-mall/src/main/java/co/yixiang/modules/customer/domain/YxStoreCustomer.java new file mode 100644 index 0000000..1f72629 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/customer/domain/YxStoreCustomer.java @@ -0,0 +1,50 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.customer.domain; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import com.baomidou.mybatisplus.annotation.TableName; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.validation.constraints.*; +import java.util.Date; +import co.yixiang.domain.BaseDomain; + +/** +* @author Bug +* @date 2020-12-10 +*/ +@Data +@TableName("yx_store_customer") +public class YxStoreCustomer extends BaseDomain { + /** id */ + @TableId + private Long id; + + /** 用户昵称 */ + private String nickName; + + /** openId */ + @NotBlank(message = "请用户扫码后提交") + private String openId; + + /** 备注 */ + private String remark; + + + + + /** 是否启用 */ + private Integer isEnable; + + + public void copy(YxStoreCustomer source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/customer/service/YxStoreCustomerService.java b/yshop-mall/src/main/java/co/yixiang/modules/customer/service/YxStoreCustomerService.java new file mode 100644 index 0000000..f820fce --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/customer/service/YxStoreCustomerService.java @@ -0,0 +1,48 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.customer.service; +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.customer.domain.YxStoreCustomer; +import co.yixiang.modules.customer.service.dto.YxStoreCustomerDto; +import co.yixiang.modules.customer.service.dto.YxStoreCustomerQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import co.yixiang.domain.PageResult; +/** +* @author Bug +* @date 2020-12-10 +*/ +public interface YxStoreCustomerService extends BaseService{ + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + PageResult queryAll(YxStoreCustomerQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxStoreCustomerQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/customer/service/dto/YxStoreCustomerDto.java b/yshop-mall/src/main/java/co/yixiang/modules/customer/service/dto/YxStoreCustomerDto.java new file mode 100644 index 0000000..1b7e3db --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/customer/service/dto/YxStoreCustomerDto.java @@ -0,0 +1,44 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.customer.service.dto; + +import lombok.Data; +import java.util.Date; +import java.io.Serializable; + +/** +* @author Bug +* @date 2020-12-10 +*/ +@Data +public class YxStoreCustomerDto implements Serializable { + + /** id */ + private Long id; + + /** 用户昵称 */ + private String nickName; + + /** openId */ + private String openId; + + /** 备注 */ + private String remark; + + /** 添加时间 */ + private Date createTime; + + /** 修改时间 */ + private Date updateTime; + + private Integer isDel; + + /** 是否启用 */ + private Integer isEnable; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/customer/service/dto/YxStoreCustomerQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/customer/service/dto/YxStoreCustomerQueryCriteria.java new file mode 100644 index 0000000..c92b6be --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/customer/service/dto/YxStoreCustomerQueryCriteria.java @@ -0,0 +1,21 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.customer.service.dto; + +import lombok.Data; +import java.util.List; +import co.yixiang.annotation.Query; + +/** +* @author Bug +* @date 2020-12-10 +*/ +@Data +public class YxStoreCustomerQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/customer/service/impl/YxStoreCustomerServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/customer/service/impl/YxStoreCustomerServiceImpl.java new file mode 100644 index 0000000..66b38ef --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/customer/service/impl/YxStoreCustomerServiceImpl.java @@ -0,0 +1,84 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.customer.service.impl; + +import co.yixiang.modules.customer.domain.YxStoreCustomer; +import co.yixiang.common.service.impl.BaseServiceImpl; +import lombok.AllArgsConstructor; +import co.yixiang.dozer.service.IGenerator; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.utils.ValidationUtil; +import co.yixiang.utils.FileUtil; +import co.yixiang.modules.customer.service.YxStoreCustomerService; +import co.yixiang.modules.customer.service.dto.YxStoreCustomerDto; +import co.yixiang.modules.customer.service.dto.YxStoreCustomerQueryCriteria; +import co.yixiang.modules.customer.service.mapper.YxStoreCustomerMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import co.yixiang.domain.PageResult; +/** +* @author Bug +* @date 2020-12-10 +*/ +@Service +@AllArgsConstructor +//@CacheConfig(cacheNames = "yxStoreCustomer") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxStoreCustomerServiceImpl extends BaseServiceImpl implements YxStoreCustomerService { + + private final IGenerator generator; + + @Override + //@Cacheable + public PageResult queryAll(YxStoreCustomerQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + return generator.convertPageInfo(page,YxStoreCustomerDto.class); + } + + + @Override + //@Cacheable + public List queryAll(YxStoreCustomerQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreCustomer.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxStoreCustomerDto yxStoreCustomer : all) { + Map map = new LinkedHashMap<>(); + map.put("用户昵称", yxStoreCustomer.getNickName()); + map.put("openId", yxStoreCustomer.getOpenId()); + map.put("备注", yxStoreCustomer.getRemark()); + map.put("添加时间", yxStoreCustomer.getCreateTime()); + map.put("修改时间", yxStoreCustomer.getUpdateTime()); + map.put(" isDel", yxStoreCustomer.getIsDel()); + map.put("是否启用", yxStoreCustomer.getIsEnable()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/customer/service/mapper/YxStoreCustomerMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/customer/service/mapper/YxStoreCustomerMapper.java new file mode 100644 index 0000000..f17fa44 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/customer/service/mapper/YxStoreCustomerMapper.java @@ -0,0 +1,23 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.customer.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.customer.domain.YxStoreCustomer; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** +* @author Bug +* @date 2020-12-10 +*/ +@Repository +public interface YxStoreCustomerMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/customer/vo/YzCustomerVo.java b/yshop-mall/src/main/java/co/yixiang/modules/customer/vo/YzCustomerVo.java new file mode 100644 index 0000000..6a254bf --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/customer/vo/YzCustomerVo.java @@ -0,0 +1,43 @@ +package co.yixiang.modules.customer.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 订单通知用户表 接收订单通知的用户 查询结果对象 + *

+ * + * @author LionCity + * @date 2020-04-02 + */ +@Data +@ApiModel(description = "订单通知用户表") +public class YzCustomerVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id") + private Long id; + + @ApiModelProperty(value = "用户昵称") + private String nickName; + + @ApiModelProperty(value = "openId") + private String openId; + + @ApiModelProperty(value = "备注") + private String remark; + + + @ApiModelProperty(value = "创建时间 创建时间") + private Date createTime; + + @ApiModelProperty(value = "更新时间 最后更新时间") + private Date updateTime; + +} \ No newline at end of file diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/domain/YxExpress.java b/yshop-mall/src/main/java/co/yixiang/modules/order/domain/YxExpress.java new file mode 100644 index 0000000..e3f4f42 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/domain/YxExpress.java @@ -0,0 +1,54 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("yx_express") +public class YxExpress extends BaseDomain { + + /** 快递公司id */ + @TableId + private Integer id; + + + /** 快递公司简称 */ + @NotBlank(message = "请输入快递公司编号") + private String code; + + + /** 快递公司全称 */ + @NotBlank(message = "请输入快递公司名称") + private String name; + + + /** 排序 */ + private Integer sort; + + + /** 是否显示 */ + private Integer isShow; + + + public void copy(YxExpress source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/domain/YxStoreOrder.java b/yshop-mall/src/main/java/co/yixiang/modules/order/domain/YxStoreOrder.java new file mode 100644 index 0000000..a81c07c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/domain/YxStoreOrder.java @@ -0,0 +1,246 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +@TableName("yx_store_order") +public class YxStoreOrder extends BaseDomain { + + /** 订单ID */ + @TableId + private Long id; + + + /** 订单号 */ + private String orderId; + + + /** 额外订单号 */ + private String extendOrderId; + + + /** 用户id */ + private Long uid; + + + /** 用户姓名 */ + private String realName; + + + /** 用户电话 */ + private String userPhone; + + + /** 详细地址 */ + private String userAddress; + + + /** 购物车id */ + private String cartId; + + + /** 运费金额 */ + private BigDecimal freightPrice; + + + /** 订单商品总数 */ + private Integer totalNum; + + + /** 订单总价 */ + private BigDecimal totalPrice; + + + /** 邮费 */ + private BigDecimal totalPostage; + + + /** 实际支付金额 */ + private BigDecimal payPrice; + + + /** 支付邮费 */ + private BigDecimal payPostage; + + + /** 抵扣金额 */ + private BigDecimal deductionPrice; + + + /** 优惠券id */ + private Integer couponId; + + + /** 优惠券金额 */ + private BigDecimal couponPrice; + + + /** 支付状态 */ + private Integer paid; + + + /** 支付时间 */ + private Date payTime; + + + /** 支付方式 */ + private String payType; + + + /** 订单状态(-1 : 申请退款 -2 : 退货成功 0:待发货;1:待收货;2:已收货;3:待评价;-1:已退款) */ + private Integer status; + + + /** 0 未退款 1 申请中 2 已退款 */ + private Integer refundStatus; + + + /** 退款图片 */ + private String refundReasonWapImg; + + + /** 退款用户说明 */ + private String refundReasonWapExplain; + + + /** 退款时间 */ + private Date refundReasonTime; + + + /** 前台退款原因 */ + private String refundReasonWap; + + + /** 不退款的理由 */ + private String refundReason; + + + /** 退款金额 */ + private BigDecimal refundPrice; + + + /** 快递公司编号 */ + private String deliverySn; + + + /** 快递名称/送货人姓名 */ + private String deliveryName; + + + /** 发货类型 */ + private String deliveryType; + + + /** 快递单号/手机号 */ + private String deliveryId; + + + /** 消费赚取积分 */ + private BigDecimal gainIntegral; + + + /** 使用积分 */ + private BigDecimal useIntegral; + + + /** 给用户退了多少积分 */ + private BigDecimal backIntegral; + + + /** 备注 */ + private String mark; + + + + /** 唯一id(md5加密)类似id */ + @TableField(value = "`unique`") + private String unique; + + + /** 管理员备注 */ + private String remark; + + + /** 商户ID */ + private Integer merId; + + + private Integer isMerCheck; + + + /** 拼团产品id0一般产品 */ + private Long combinationId; + + + /** 拼团id 0没有拼团 */ + private Long pinkId; + + + /** 成本价 */ + private BigDecimal cost; + + + /** 秒杀产品ID */ + private Long seckillId; + + + /** 砍价id */ + private Long bargainId; + + + /** 核销码 */ + private String verifyCode; + + + /** 门店id */ + private Integer storeId; + + + /** 配送方式 1=快递 ,2=门店自提 */ + private Integer shippingType; + + + /** 支付渠道(0微信公众号1微信小程序) */ + private Integer isChannel; + + + private Integer isRemind; + + + private Integer isSystemDel; + + @ApiModelProperty(value = "实际支付积分") + private BigDecimal payIntegral; + + public void copy(YxStoreOrder source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/domain/YxStoreOrderCartInfo.java b/yshop-mall/src/main/java/co/yixiang/modules/order/domain/YxStoreOrderCartInfo.java new file mode 100644 index 0000000..468209e --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/domain/YxStoreOrderCartInfo.java @@ -0,0 +1,57 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Data +@TableName("yx_store_order_cart_info") +public class YxStoreOrderCartInfo implements Serializable { + + @TableId + private Long id; + + + /** 订单id */ + private Long oid; + + + /** 购物车id */ + private Long cartId; + + + /** 商品ID */ + private Long productId; + + + /** 购买东西的详细信息 */ + private String cartInfo; + + + /** 唯一id */ + @TableField(value = "`unique`") + private String unique; + + /** 是否能售后0不能1能 */ + private Integer isAfterSales; + + + public void copy(YxStoreOrderCartInfo source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/domain/YxStoreOrderStatus.java b/yshop-mall/src/main/java/co/yixiang/modules/order/domain/YxStoreOrderStatus.java new file mode 100644 index 0000000..96ca7c3 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/domain/YxStoreOrderStatus.java @@ -0,0 +1,49 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Data +@TableName("yx_store_order_status") +public class YxStoreOrderStatus implements Serializable { + + @TableId + private Long id; + + + /** 订单id */ + private Long oid; + + + /** 操作类型 */ + private String changeType; + + + /** 操作备注 */ + private String changeMessage; + + + /** 操作时间 */ + private Date changeTime; + + + public void copy(YxStoreOrderStatus source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/param/ExpressParam.java b/yshop-mall/src/main/java/co/yixiang/modules/order/param/ExpressParam.java new file mode 100644 index 0000000..126cd3e --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/param/ExpressParam.java @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName ExpressParam + * @Author hupeng <610796224@qq.com> + * @Date 2019/12/9 + **/ +@Data +public class ExpressParam implements Serializable { + + @ApiModelProperty(value = "订单编号") + private String orderCode; + + @ApiModelProperty(value = "快递公司编码") + private String shipperCode; + + @ApiModelProperty(value = "物流单号") + private String logisticCode; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/param/OrderParam.java b/yshop-mall/src/main/java/co/yixiang/modules/order/param/OrderParam.java new file mode 100644 index 0000000..64aa34c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/param/OrderParam.java @@ -0,0 +1,65 @@ +package co.yixiang.modules.order.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import java.io.Serializable; + +/** + * @ClassName OrderParam + * @Author hupeng <610796224@qq.com> + * @Date 2019/10/28 + **/ +@Data +public class OrderParam implements Serializable { + + @ApiModelProperty(value = "地址ID") + private String addressId; + + @ApiModelProperty(value = "砍价产品ID") + private String bargainId; + + @ApiModelProperty(value = "拼团ID") + private String combinationId; + + @ApiModelProperty(value = "优惠券ID") + private String couponId; + + @ApiModelProperty(value = "来源") + private String from; + + @Size(max = 200,message = "长度超过了限制") + @ApiModelProperty(value = "备注") + private String mark; + + @NotBlank(message="请选择支付方式") + @ApiModelProperty(value = "支付方式") + private String payType; + + @ApiModelProperty(value = "门店电话") + private String phone; + + @ApiModelProperty(value = "拼团id 0没有拼团") + private String pinkId; + + @ApiModelProperty(value = "门店联系人") + private String realName; + + @ApiModelProperty(value = "秒杀产品ID") + private String seckillId; + + @ApiModelProperty(value = "配送方式 1=快递 ,2=门店自提") + private String shippingType; + + @ApiModelProperty(value = "使用积分 1-表示使用") + private String useIntegral; + + @ApiModelProperty(value = "支付渠道(0微信公众号1微信小程序) ") + private String isChannel; + + @ApiModelProperty(value = "门店ID") + private String storeId; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/YxExpressService.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/YxExpressService.java new file mode 100644 index 0000000..2e7aa51 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/YxExpressService.java @@ -0,0 +1,47 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.order.domain.YxExpress; +import co.yixiang.modules.order.service.dto.YxExpressDto; +import co.yixiang.modules.order.service.dto.YxExpressQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxExpressService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxExpressQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxExpressQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/YxStoreOrderCartInfoService.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/YxStoreOrderCartInfoService.java new file mode 100644 index 0000000..fa27cbb --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/YxStoreOrderCartInfoService.java @@ -0,0 +1,58 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; +import co.yixiang.modules.order.domain.YxStoreOrderCartInfo; +import co.yixiang.modules.order.service.dto.YxStoreOrderCartInfoDto; +import co.yixiang.modules.order.service.dto.YxStoreOrderCartInfoQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxStoreOrderCartInfoService extends BaseService{ + + /** + * 添加购物车商品信息 + * @param oid 订单id + * @param cartInfo 购物车信息 + */ + void saveCartInfo(Long oid, List cartInfo); + + YxStoreOrderCartInfo findByUni(String unique); + + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxStoreOrderCartInfoQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxStoreOrderCartInfoQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/YxStoreOrderService.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/YxStoreOrderService.java new file mode 100644 index 0000000..08b1ef1 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/YxStoreOrderService.java @@ -0,0 +1,302 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.order.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.order.domain.YxStoreOrder; +import co.yixiang.modules.order.domain.YxStoreOrderCartInfo; +import co.yixiang.modules.order.param.OrderParam; +import co.yixiang.modules.order.service.dto.OrderCountDto; +import co.yixiang.modules.order.service.dto.OrderTimeDataDto; +import co.yixiang.modules.order.service.dto.YxStoreOrderDto; +import co.yixiang.modules.order.service.dto.YxStoreOrderQueryCriteria; +import co.yixiang.modules.order.vo.ComputeVo; +import co.yixiang.modules.order.vo.ConfirmOrderVo; +import co.yixiang.modules.order.vo.OrderDataVo; +import co.yixiang.modules.order.vo.ShoperOrderTimeDataVo; +import co.yixiang.modules.order.vo.UserOrderCountVo; +import co.yixiang.modules.order.vo.YxStoreOrderQueryVo; +import co.yixiang.modules.user.domain.YxUser; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxStoreOrderService extends BaseService{ + + /** + * 订单评价 + * @param orderCartInfo + * @param user user + * @param unique 订单orderCart唯一值 + * @param comment 评论内容 + * @param pics 图片 + * @param productScore 评分 + * @param serviceScore 评分 + */ + void orderComment(YxStoreOrderCartInfo orderCartInfo, YxUser user, String unique, String comment, String pics, String productScore, + String serviceScore); + + /** + * 返回订单确认数据 + * @param yxUser yxUser + * @param cartIds 购物车id + * @return ConfirmOrderVO + */ + ConfirmOrderVo confirmOrder(YxUser yxUser, String cartIds); + + + + /** + * 确认订单退款 + * @param orderId 单号 + * @param price 金额 + * @param type ShopCommonEnum + */ + void orderRefund(String orderId, BigDecimal price, Integer type); + + /** + * 订单发货 + * @param orderId 单号 + * @param deliveryId 快递单号 + * @param deliveryName 快递公司code + * @param deliveryType 快递方式 + */ + void orderDelivery(String orderId,String deliveryId,String deliveryName,String deliveryType); + + /** + * 修改快递单号 + * @param orderId 单号 + * @param deliveryId 快递单号 + * @param deliveryName 快递公司code + * @param deliveryType 快递方式 + */ + void updateDelivery(String orderId,String deliveryId,String deliveryName,String deliveryType); + /** + * 修改订单价格 + * @param orderId 单号 + * @param price 价格 + */ + void editOrderPrice(String orderId,String price); + + /** + * 订单每月统计数据 + * @param page page + * @param limit list + * @return List + */ + List getOrderDataPriceCount(int page, int limit); + + /** + * 获取 今日 昨日 本月 订单金额 + * @return ShoperOrderTimeDataVo + */ + ShoperOrderTimeDataVo getShoperOrderTimeData(); + + /** + * 获取拼团订单 + * @param pid 拼团id + * @param uid 用户id + * @return YxStoreOrder + */ + YxStoreOrder getOrderPink(Long pid,Long uid); + + + /** + * 未付款取消订单 + * @param orderId 订单号 + * @param uid 用户id + */ + void cancelOrder(String orderId,Long uid); + + + /** + * 申请退款 + * @param explain 退款备注 + * @param Img 图片 + * @param text 理由 + * @param orderId 订单号 + * @param uid uid + */ + void orderApplyRefund(String explain,String Img,String text,String orderId, Long uid); + + /** + * 删除订单 + * @param orderId 单号 + * @param uid uid + */ + void removeOrder(String orderId,Long uid); + + + + /** + * 订单确认收货 + * @param orderId 单号 + * @param uid uid + */ + void takeOrder(String orderId,Long uid); + + /** + * 核销订单 + * @param verifyCode 核销码 + * @param isConfirm OrderInfoEnum + * @param uid uid + * @return YxStoreOrderQueryVo + */ + YxStoreOrderQueryVo verifyOrder(String verifyCode, Integer isConfirm , Long uid); + + /** + * 订单列表 + * @param uid 用户id + * @param type OrderStatusEnum + * @param page page + * @param limit limit + * @return list + */ + Map orderList(Long uid,int type,int page,int limit); + + /** + * 获取某个用户的订单统计数据 + * @param uid uid>0 取用户 否则取所有 + * @return UserOrderCountVo + */ + UserOrderCountVo orderData(Long uid); + + /** + * 处理订单返回的状态 + * @param order order + * @return YxStoreOrderQueryVo + */ + YxStoreOrderQueryVo handleOrder(YxStoreOrderQueryVo order); + + /** + * 支付成功后操作 + * @param orderId 订单号 + * @param payType 支付方式 + */ + void paySuccess(String orderId,String payType); + + /** + * 余额支付 + * @param orderId 订单号 + * @param uid 用户id + */ + void yuePay(String orderId,Long uid); + + /** + * 积分兑换 + * @param orderId 订单号 + * @param uid 用户id + */ + void integralPay(String orderId,Long uid); + + + String aliPay(String orderId) throws Exception; + + + /** + * 创建订单 + * @param userInfo 用户信息 + * @param key key + * @param param param + * @return YxStoreOrder + */ + YxStoreOrder createOrder(YxUser userInfo, String key, OrderParam param); + + /** + *计算订单价格 + * @param userInfo 用户 + * @param key 订单缓存key + * @param couponId 优惠券id + * @param useIntegral 使用积分 1-表示使用 + * @param shippingType 发货类型 OrderInfoEnum + * @return ComputeVo + */ + ComputeVo computedOrder(YxUser userInfo, String key, String couponId, + String useIntegral, String shippingType,String addressId); + + /** + * 订单信息 + * @param unique 唯一值或者单号 + * @param uid 用户id + * @return YxStoreOrderQueryVo + */ + YxStoreOrderQueryVo getOrderInfo(String unique, Long uid); + + + + + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxStoreOrderQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxStoreOrderQueryCriteria criteria); + + + //YxStoreOrderDto create(YxStoreOrder resources); + + void update(YxStoreOrder resources); + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + /** + * 获取订单详情 + * @param orderId + * @return + */ + YxStoreOrderDto getOrderDetail(Long orderId); + + Map queryAll(List ids); + + + + + /** + * 根据商品分类统计订单占比 + * @return OrderCountDto + */ + OrderCountDto getOrderCount(); + + /** + * 首页订单/用户等统计 + * @return OrderTimeDataDto + */ + OrderTimeDataDto getOrderTimeData(); + + /** + * 返回本月订单金额与数量 + * @return map + */ + Map chartCount(); + + + void retrunStock(String orderId); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/YxStoreOrderStatusService.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/YxStoreOrderStatusService.java new file mode 100644 index 0000000..267b05d --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/YxStoreOrderStatusService.java @@ -0,0 +1,58 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.order.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.order.domain.YxStoreOrderStatus; +import co.yixiang.modules.order.service.dto.YxStoreOrderStatusDto; +import co.yixiang.modules.order.service.dto.YxStoreOrderStatusQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxStoreOrderStatusService extends BaseService{ + + /** + * 添加订单操作记录 + * @param oid 订单id + * @param changetype 操作状态 + * @param changeMessage 操作内容 + */ + void create(Long oid,String changetype,String changeMessage); + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxStoreOrderStatusQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxStoreOrderStatusQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/CacheDto.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/CacheDto.java new file mode 100644 index 0000000..ac9a505 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/CacheDto.java @@ -0,0 +1,19 @@ +package co.yixiang.modules.order.service.dto; + +import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @ClassName CacheDto + * @Author hupeng <610796224@qq.com> + * @Date 2019/10/27 + **/ +@Data +public class CacheDto implements Serializable { + private List cartInfo; + private PriceGroupDto priceGroup; + private OtherDto other; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/ChartDataDto.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/ChartDataDto.java new file mode 100644 index 0000000..0e389e0 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/ChartDataDto.java @@ -0,0 +1,21 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.service.dto; + +import lombok.Data; + +/** + * @ClassName ChartDataDTO + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/25 + **/ +@Data +public class ChartDataDto { + + // @Value("#{target.adminCount}") + private Double num; + private String time; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/CountDto.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/CountDto.java new file mode 100644 index 0000000..215cedb --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/CountDto.java @@ -0,0 +1,14 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.service.dto; + +import lombok.Data; + +@Data +public class CountDto { + + private String catename; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/OrderCountDto.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/OrderCountDto.java new file mode 100644 index 0000000..9446bb4 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/OrderCountDto.java @@ -0,0 +1,26 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.service.dto; + + +import lombok.Data; + +import java.util.List; + +@Data +public class OrderCountDto { + + private List column; + + private List orderCountDatas; + + @Data + public static class OrderCountData{ + private String name; + + private Integer value; + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/OrderTimeDataDto.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/OrderTimeDataDto.java new file mode 100644 index 0000000..29587eb --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/OrderTimeDataDto.java @@ -0,0 +1,33 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName OrderTimeDataDTO + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/25 + **/ +@Data +public class OrderTimeDataDto implements Serializable { + private Double todayPrice; //今日成交额 + private Integer todayCount; //今日订单数 + private Double proPrice; //昨日成交额 + private Integer proCount;//昨日订单数 + private Double monthPrice;//本月成交额 + private Integer monthCount;//本月订单数 + + private Integer lastWeekCount;//上周 + private Double lastWeekPrice; //上周 + + private Integer userCount; + private Integer orderCount; + private Double priceCount; + private Integer goodsCount; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/OtherDto.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/OtherDto.java new file mode 100644 index 0000000..d6cbe5b --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/OtherDto.java @@ -0,0 +1,25 @@ +package co.yixiang.modules.order.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName OtherDto + * @Author hupeng <610796224@qq.com> + * @Date 2019/10/27 + **/ +@Data +public class OtherDto implements Serializable { + //线下包邮 + private String offlinePostage; + //积分抵扣 + private String integralRatio; + + //最大 + private String integralMax; + + //满多少 + private String integralFull; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/PriceGroupDto.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/PriceGroupDto.java new file mode 100644 index 0000000..bbce372 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/PriceGroupDto.java @@ -0,0 +1,34 @@ +package co.yixiang.modules.order.service.dto; + +import co.yixiang.serializer.BigDecimalSerializer; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @ClassName PriceGroup + * @Author hupeng <610796224@qq.com> + * @Date 2019/10/27 + **/ +@Data +public class PriceGroupDto { + + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal costPrice; + + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal storeFreePostage; + + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal storePostage; + + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal totalPrice; + + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal vipPrice; + + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal payIntegral; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/ProductAttrDto.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/ProductAttrDto.java new file mode 100644 index 0000000..a6820d7 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/ProductAttrDto.java @@ -0,0 +1,27 @@ +package co.yixiang.modules.order.service.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName ProductAttrDto + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/3 + **/ +@Data +public class ProductAttrDto implements Serializable { + + @ApiModelProperty(value = "产品属性ID") + private Long productId; + + @ApiModelProperty(value = "产品属性sku") + private String sku; + + @ApiModelProperty(value = "产品属性价格") + private Double price; + + @ApiModelProperty(value = "产品属性图片") + private String image; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/ProductDto.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/ProductDto.java new file mode 100644 index 0000000..2aadda9 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/ProductDto.java @@ -0,0 +1,28 @@ +package co.yixiang.modules.order.service.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName ProductVo + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/3 + **/ +@Data +public class ProductDto implements Serializable { + + @ApiModelProperty(value = "产品图片") + private String image; + + @ApiModelProperty(value = "产品价格") + private Double price; + + @ApiModelProperty(value = "产品名称") + private String storeName; + + @ApiModelProperty(value = "产品属性信息") + private ProductAttrDto attrInfo; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/StatusDto.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/StatusDto.java new file mode 100644 index 0000000..0c00316 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/StatusDto.java @@ -0,0 +1,19 @@ +package co.yixiang.modules.order.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName StatusDto + * @Author hupeng <610796224@qq.com> + * @Date 2019/10/30 + **/ +@Data +public class StatusDto implements Serializable { + private String _class; + private String _msg; + private String _payType; + private String _title; + private String _type; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/StoreOrderCartInfoDto.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/StoreOrderCartInfoDto.java new file mode 100644 index 0000000..8b32774 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/StoreOrderCartInfoDto.java @@ -0,0 +1,40 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.service.dto; + +import lombok.Data; + +import java.util.Map; + +/** + * @ClassName StoreOrderCartInfo + * @Author hupeng <610796224@qq.com> + * @Date 2019/10/14 + **/ + + +@Data +public class StoreOrderCartInfoDto { + + + private Integer id; + + + private Integer oid; + + + private Integer cartId; + + + private String cartInfo; + + + private String unique; + + private Map cartInfoMap; + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/TemplateDto.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/TemplateDto.java new file mode 100644 index 0000000..6e699f2 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/TemplateDto.java @@ -0,0 +1,30 @@ +package co.yixiang.modules.order.service.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.math.BigDecimal; + +/** + * @ClassName TemplateDTO + * @Author hupeng <610796224@qq.com> + * @Date 2020/5/28 + **/ +@Getter +@Setter +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class TemplateDto { + private Double number; + private BigDecimal price; + private Double first; + private BigDecimal firstPrice; + private Double _continue; + private BigDecimal continuePrice; + private Integer tempId; + private Integer cityId; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxExpressDto.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxExpressDto.java new file mode 100644 index 0000000..7243f5c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxExpressDto.java @@ -0,0 +1,33 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxExpressDto implements Serializable { + + /** 快递公司id */ + private Integer id; + + /** 快递公司简称 */ + private String code; + + /** 快递公司全称 */ + private String name; + + /** 排序 */ + private Integer sort; + + /** 是否显示 */ + private Integer isShow; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxExpressQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxExpressQueryCriteria.java new file mode 100644 index 0000000..9bbd7f1 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxExpressQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxExpressQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxOrderNowOrderStatusDto.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxOrderNowOrderStatusDto.java new file mode 100644 index 0000000..5ea6746 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxOrderNowOrderStatusDto.java @@ -0,0 +1,36 @@ +package co.yixiang.modules.order.service.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author :LionCity + * @date :Created in 2020-05-29 11:16 + * @description: + * @modified By: + * @version: + */ +@Data +public class YxOrderNowOrderStatusDto implements Serializable { + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date cacheKeyCreateOrder; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date paySuccess; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date deliveryGoods; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date orderVerific; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date userTakeDelivery; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date checkOrderOver; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date applyRefund; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date refundOrderSuccess; + private int size; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxStoreOrderCartInfoDto.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxStoreOrderCartInfoDto.java new file mode 100644 index 0000000..a71a3a9 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxStoreOrderCartInfoDto.java @@ -0,0 +1,35 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxStoreOrderCartInfoDto implements Serializable { + + private Integer id; + + /** 订单id */ + private Integer oid; + + /** 购物车id */ + private Integer cartId; + + /** 商品ID */ + private Integer productId; + + /** 购买东西的详细信息 */ + private String cartInfo; + + /** 唯一id */ + private String unique; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxStoreOrderCartInfoQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxStoreOrderCartInfoQueryCriteria.java new file mode 100644 index 0000000..86331cf --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxStoreOrderCartInfoQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxStoreOrderCartInfoQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxStoreOrderDto.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxStoreOrderDto.java new file mode 100644 index 0000000..9374de5 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxStoreOrderDto.java @@ -0,0 +1,197 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.service.dto; + +import co.yixiang.modules.user.service.dto.YxUserDto; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxStoreOrderDto implements Serializable { + // 订单ID + private Long id; + + //支付类型 + private String payTypeName; + + //状态名称 + private String statusName; + + private Integer _status; + + //订单类型 + private String pinkName; + + private List cartInfoList; + + /** + * 订单状态列表 + */ + private List storeOrderStatusList; + + // 订单号 + private String orderId; + + // 用户id + private Long uid; + + private YxUserDto userDTO; + + // 用户姓名 + private String realName; + + // 用户电话 + private String userPhone; + + // 详细地址 + private String userAddress; + + // 购物车id + private String cartId; + + // 运费金额 + private BigDecimal freightPrice; + + // 订单商品总数 + private Integer totalNum; + + // 订单总价 + private BigDecimal totalPrice; + + // 邮费 + private BigDecimal totalPostage; + + // 实际支付金额 + private BigDecimal payPrice; + + // 支付邮费 + private BigDecimal payPostage; + + // 抵扣金额 + private BigDecimal deductionPrice; + + // 优惠券id + private Integer couponId; + + // 优惠券金额 + private BigDecimal couponPrice; + + // 支付状态 + private Integer paid; + + // 支付时间 + private Date payTime; + + // 支付方式 + private String payType; + + // 创建时间 + private Date createTime; + + // 订单状态(-1 : 申请退款 -2 : 退货成功 0:待发货;1:待收货;2:已收货;3:待评价;-1:已退款) + private Integer status; + + // 0 未退款 1 申请中 2 已退款 + private Integer refundStatus; + + // 退款图片 + private String refundReasonWapImg; + + // 退款用户说明 + private String refundReasonWapExplain; + + // 退款时间 + private Date refundReasonTime; + + // 前台退款原因 + private String refundReasonWap; + + // 不退款的理由 + private String refundReason; + + // 退款金额 + private BigDecimal refundPrice; + + // 快递名称/送货人姓名 + private String deliveryName; + + private String deliverySn; + + // 发货类型 + private String deliveryType; + + // 快递单号/手机号 + private String deliveryId; + + // 消费赚取积分 + private BigDecimal gainIntegral; + + // 使用积分 + private BigDecimal useIntegral; + + // 给用户退了多少积分 + private BigDecimal backIntegral; + + // 备注 + private String mark; + + + // 唯一id(md5加密)类似id + private String unique; + + // 管理员备注 + private String remark; + + // 商户ID + private Integer merId; + + private Integer isMerCheck; + + // 拼团产品id0一般产品 + private Long combinationId; + + // 拼团id 0没有拼团 + private Long pinkId; + + // 成本价 + private BigDecimal cost; + + // 秒杀产品ID + private Long seckillId; + + // 砍价id + private Long bargainId; + + // 核销码 + private String verifyCode; + + // 门店id + private Integer storeId; + + private String storeName; + + // 配送方式 1=快递 ,2=门店自提 + private Integer shippingType; + + // 支付渠道(0微信公众号1微信小程序) + private Integer isChannel; + + private Integer isRemind; + + @ApiModelProperty(value = "实际支付积分") + private BigDecimal payIntegral; + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxStoreOrderQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxStoreOrderQueryCriteria.java new file mode 100644 index 0000000..7640791 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxStoreOrderQueryCriteria.java @@ -0,0 +1,76 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxStoreOrderQueryCriteria{ + + // 模糊 + @Query(type = Query.Type.UNIX_TIMESTAMP) + private List createTime; + + + // 模糊 + @Query(type = Query.Type.INNER_LIKE) + private String orderId; + + // 模糊 + @Query(type = Query.Type.INNER_LIKE) + private String realName; + + // 模糊 + @Query(type = Query.Type.INNER_LIKE) + private String userPhone; + + @Query + private Integer paid; + + @Query + private Integer status; + + @Query + private Integer refundStatus; + + @Query + private Integer isDel; + + @Query + private Integer combinationId; + + @Query + private Integer seckillId; + + @Query + private Integer bargainId; + + @Query(propName="combinationId",type = Query.Type.NOT_EQUAL) + private Integer newCombinationId; + + @Query(propName="seckillId",type = Query.Type.NOT_EQUAL) + private Integer newSeckillId; + + @Query(propName="bargainId",type = Query.Type.NOT_EQUAL) + private Integer newBargainId; + + @Query + private Integer shippingType; + + @Query(type = Query.Type.GREATER_THAN_NQ) + private BigDecimal payIntegral; + + @Query + private Integer storeId; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxStoreOrderStatusDto.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxStoreOrderStatusDto.java new file mode 100644 index 0000000..bf3cd24 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxStoreOrderStatusDto.java @@ -0,0 +1,37 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.service.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxStoreOrderStatusDto implements Serializable { + + private Integer id; + + /** 订单id */ + private Integer oid; + + /** 操作类型 */ + private String changeType; + + /** 操作备注 */ + private String changeMessage; + + /** 操作时间 */ + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date changeTime; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxStoreOrderStatusQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxStoreOrderStatusQueryCriteria.java new file mode 100644 index 0000000..392e2d9 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/dto/YxStoreOrderStatusQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxStoreOrderStatusQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/impl/YxExpressServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/impl/YxExpressServiceImpl.java new file mode 100644 index 0000000..c208cdf --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/impl/YxExpressServiceImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.order.domain.YxExpress; +import co.yixiang.modules.order.service.YxExpressService; +import co.yixiang.modules.order.service.dto.YxExpressDto; +import co.yixiang.modules.order.service.dto.YxExpressQueryCriteria; +import co.yixiang.modules.order.service.mapper.ExpressMapper; +import co.yixiang.utils.FileUtil; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxExpressServiceImpl extends BaseServiceImpl implements YxExpressService { + + private final IGenerator generator; + + @Override + //@Cacheable + public Map queryAll(YxExpressQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxExpressDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxExpressQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxExpress.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxExpressDto yxExpress : all) { + Map map = new LinkedHashMap<>(); + map.put("快递公司简称", yxExpress.getCode()); + map.put("快递公司全称", yxExpress.getName()); + map.put("排序", yxExpress.getSort()); + map.put("是否显示", yxExpress.getIsShow()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderCartInfoServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderCartInfoServiceImpl.java new file mode 100644 index 0000000..cbb584b --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderCartInfoServiceImpl.java @@ -0,0 +1,112 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.service.impl; + +import cn.hutool.core.util.IdUtil; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; +import co.yixiang.modules.order.domain.YxStoreOrderCartInfo; +import co.yixiang.modules.order.service.YxStoreOrderCartInfoService; +import co.yixiang.modules.order.service.dto.YxStoreOrderCartInfoDto; +import co.yixiang.modules.order.service.dto.YxStoreOrderCartInfoQueryCriteria; +import co.yixiang.modules.order.service.mapper.StoreOrderCartInfoMapper; +import co.yixiang.utils.FileUtil; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxStoreOrderCartInfoServiceImpl extends BaseServiceImpl implements YxStoreOrderCartInfoService { + + private final IGenerator generator; + + @Override + public YxStoreOrderCartInfo findByUni(String unique) { + LambdaQueryWrapper wrapper= new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreOrderCartInfo::getUnique,unique); + return this.baseMapper.selectOne(wrapper); + } + + /** + * 添加购物车商品信息 + * @param oid 订单id + * @param cartInfo 购物车信息 + */ + @Override + public void saveCartInfo(Long oid, List cartInfo) { + + List list = new ArrayList<>(); + for (YxStoreCartQueryVo cart : cartInfo) { + YxStoreOrderCartInfo info = new YxStoreOrderCartInfo(); + info.setOid(oid); + info.setCartId(cart.getId()); + info.setProductId(cart.getProductId()); + info.setCartInfo(JSONObject.toJSON(cart).toString()); + info.setUnique(IdUtil.simpleUUID()); + info.setIsAfterSales(1); + list.add(info); + } + + this.saveBatch(list); + } + + + @Override + //@Cacheable + public Map queryAll(YxStoreOrderCartInfoQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxStoreOrderCartInfoDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxStoreOrderCartInfoQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreOrderCartInfo.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxStoreOrderCartInfoDto yxStoreOrderCartInfo : all) { + Map map = new LinkedHashMap<>(); + map.put("订单id", yxStoreOrderCartInfo.getOid()); + map.put("购物车id", yxStoreOrderCartInfo.getCartId()); + map.put("商品ID", yxStoreOrderCartInfo.getProductId()); + map.put("购买东西的详细信息", yxStoreOrderCartInfo.getCartInfo()); + map.put("唯一id", yxStoreOrderCartInfo.getUnique()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java new file mode 100644 index 0000000..5bd614e --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java @@ -0,0 +1,2533 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.order.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.BusinessException; +import co.yixiang.api.YshopException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.constant.ShopConstants; +import co.yixiang.constant.SystemConfigConstants; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.*; +import co.yixiang.event.TemplateBean; +import co.yixiang.event.TemplateEvent; +import co.yixiang.event.TemplateListenEnum; +import co.yixiang.exception.BadRequestException; +import co.yixiang.exception.EntityExistException; +import co.yixiang.exception.ErrorRequestException; +import co.yixiang.modules.activity.domain.YxStoreCouponUser; +import co.yixiang.modules.activity.domain.YxStorePink; +import co.yixiang.modules.activity.service.YxStoreBargainService; +import co.yixiang.modules.activity.service.YxStoreBargainUserService; +import co.yixiang.modules.activity.service.YxStoreCouponUserService; +import co.yixiang.modules.activity.service.YxStorePinkService; +import co.yixiang.modules.activity.vo.StoreCouponUserVo; +import co.yixiang.modules.cart.domain.YxStoreCart; +import co.yixiang.modules.cart.service.YxStoreCartService; +import co.yixiang.modules.cart.service.mapper.StoreCartMapper; +import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; +import co.yixiang.modules.order.domain.YxExpress; +import co.yixiang.modules.order.domain.YxStoreOrder; +import co.yixiang.modules.order.domain.YxStoreOrderCartInfo; +import co.yixiang.modules.order.domain.YxStoreOrderStatus; +import co.yixiang.modules.order.param.OrderParam; +import co.yixiang.modules.order.service.YxExpressService; +import co.yixiang.modules.order.service.YxStoreOrderCartInfoService; +import co.yixiang.modules.order.service.YxStoreOrderService; +import co.yixiang.modules.order.service.YxStoreOrderStatusService; +import co.yixiang.modules.order.service.dto.*; +import co.yixiang.modules.order.service.mapper.StoreOrderMapper; +import co.yixiang.modules.order.vo.*; +import co.yixiang.modules.product.domain.YxStoreProductReply; +import co.yixiang.modules.product.service.YxStoreProductReplyService; +import co.yixiang.modules.product.service.YxStoreProductService; +import co.yixiang.modules.product.vo.YxStoreProductQueryVo; +import co.yixiang.modules.shop.domain.YxSystemStore; +import co.yixiang.modules.shop.service.YxSystemConfigService; +import co.yixiang.modules.shop.service.YxSystemStoreService; +import co.yixiang.modules.shop.service.YxSystemStoreStaffService; +import co.yixiang.modules.template.domain.YxShippingTemplates; +import co.yixiang.modules.template.domain.YxShippingTemplatesFree; +import co.yixiang.modules.template.domain.YxShippingTemplatesRegion; +import co.yixiang.modules.template.service.YxShippingTemplatesFreeService; +import co.yixiang.modules.template.service.YxShippingTemplatesRegionService; +import co.yixiang.modules.template.service.YxShippingTemplatesService; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.domain.YxUserAddress; +import co.yixiang.modules.user.service.YxUserAddressService; +import co.yixiang.modules.user.service.YxUserBillService; +import co.yixiang.modules.user.service.YxUserLevelService; +import co.yixiang.modules.user.service.YxUserService; +import co.yixiang.modules.user.service.dto.YxUserDto; +import co.yixiang.modules.user.vo.YxUserQueryVo; +import co.yixiang.tools.domain.AlipayConfig; +import co.yixiang.tools.domain.vo.TradeVo; +import co.yixiang.tools.service.AlipayConfigService; +import co.yixiang.utils.FileUtil; +import co.yixiang.utils.OrderUtil; +import co.yixiang.utils.RedisUtils; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.data.domain.Pageable; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + + +/** + * @author hupeng + * @date 2020-05-12 + */ +@Slf4j +@Service +@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) +public class YxStoreOrderServiceImpl extends BaseServiceImpl implements YxStoreOrderService { + + @Autowired + private IGenerator generator; + + + @Autowired + private YxStorePinkService storePinkService; + @Autowired + private YxStoreOrderCartInfoService storeOrderCartInfoService; + @Autowired + private YxStoreCartService storeCartService; + @Autowired + private YxUserAddressService userAddressService; + @Autowired + private YxStoreOrderCartInfoService orderCartInfoService; + @Autowired + private YxStoreOrderStatusService orderStatusService; + @Autowired + private YxUserBillService billService; + @Autowired + private YxStoreCouponUserService couponUserService; + @Autowired + private YxUserService userService; + @Autowired + private YxStoreProductService productService; + @Autowired + private YxStorePinkService pinkService; + @Autowired + private YxStoreBargainUserService storeBargainUserService; + @Autowired + private YxStoreBargainService storeBargainService; + @Autowired + private YxExpressService expressService; + @Autowired + private AlipayConfigService alipayService; + @Autowired + private YxSystemStoreService systemStoreService; + @Autowired + private YxStoreProductReplyService productReplyService; + @Autowired + private YxStoreCartService yxStoreCartService; + @Autowired + private YxSystemStoreStaffService systemStoreStaffService; + @Autowired + private YxShippingTemplatesService shippingTemplatesService; + @Autowired + private YxShippingTemplatesRegionService shippingTemplatesRegionService; + @Autowired + private YxShippingTemplatesFreeService shippingTemplatesFreeService; + @Autowired + private YxSystemConfigService systemConfigService; + @Autowired + private YxUserLevelService userLevelService; + + + @Autowired + private StoreOrderMapper yxStoreOrderMapper; + @Autowired + private StoreCartMapper storeCartMapper; + + + @Autowired + private RedisUtils redisUtils; + + + @Autowired + private RedisTemplate redisTemplate; + + @Autowired + private ApplicationEventPublisher publisher; + + + /** + * 返回订单确认数据 + * + * @param yxUser yxUser + * @param cartIds 购物车id + * @return ConfirmOrderVO + */ + @Override + public ConfirmOrderVo confirmOrder(YxUser yxUser, String cartIds) { + Long uid = yxUser.getUid(); + Map cartGroup = yxStoreCartService.getUserProductCartList(uid, + cartIds, ShopConstants.YSHOP_ONE_NUM); + if (ObjectUtil.isNotEmpty(cartGroup.get("invalid"))) { + throw new YshopException("有失效的商品请重新提交"); + } + if (ObjectUtil.isEmpty(cartGroup.get("valid"))) { + throw new YshopException("请提交购买的商品"); + } + + OtherDto other = new OtherDto(); + other.setIntegralRatio(systemConfigService.getData(SystemConfigConstants.INTERGRAL_RATIO)); + other.setIntegralFull(systemConfigService.getData(SystemConfigConstants.INTERGRAL_FULL)); + other.setIntegralMax(systemConfigService.getData(SystemConfigConstants.INTERGRAL_MAX)); + + //拼团 砍价 秒杀 + Long combinationId = null; + Long secKillId = null; + Long bargainId = null; + if (cartIds.split(",").length == 1) { + YxStoreCart cartQueryVo = yxStoreCartService.getById(cartIds); + combinationId = cartQueryVo.getCombinationId(); + secKillId = cartQueryVo.getSeckillId(); + bargainId = cartQueryVo.getBargainId(); + } + + boolean deduction = false; + boolean enableIntegral = true; + + //拼团砍价秒杀类产品不参与抵扣 + if ((combinationId != null && combinationId > 0) || (secKillId != null && secKillId > 0) + || (bargainId != null && bargainId > 0)) { + deduction = true; + } + + //获取默认地址 + YxUserAddress userAddress = userAddressService.getOne(Wrappers.lambdaQuery() + .eq(YxUserAddress::getUid, uid) + .eq(YxUserAddress::getIsDefault, ShopCommonEnum.DEFAULT_1.getValue()), false); + + List cartInfo = (List) cartGroup.get("valid"); + PriceGroupDto priceGroup = this.getOrderPriceGroup(cartInfo, userAddress); + + //判断积分是否满足订单额度 + if (priceGroup.getTotalPrice().compareTo(new BigDecimal(other.getIntegralFull())) < 0) { + enableIntegral = false; + } + + String cacheKey = this.cacheOrderInfo(uid, cartInfo, priceGroup, other); + + + //获取可用优惠券 + List productIds = cartInfo.stream() + .map(YxStoreCartQueryVo::getProductId) + .map(Object::toString) + .collect(Collectors.toList()); + List storeCouponUsers = couponUserService + .getUsableCouponList(uid, priceGroup.getTotalPrice().doubleValue(), productIds); + + StoreCouponUserVo storeCouponUser = null; + if (storeCouponUsers != null && !storeCouponUsers.isEmpty()) { + storeCouponUser = storeCouponUsers.get(0); + } + + return ConfirmOrderVo.builder() + .addressInfo(userAddress) + .cartInfo(cartInfo) + .priceGroup(priceGroup) + .userInfo(generator.convert(yxUser, YxUserQueryVo.class)) + .orderKey(cacheKey) + .deduction(deduction) + .enableIntegral(enableIntegral) + .enableIntegralNum(Double.valueOf(other.getIntegralMax())) + //.integralRatio(d) + .usableCoupon(storeCouponUser) + .systemStore(systemStoreService.getStoreInfo("", "")) + .build(); + + } + + + /** + * 计算订单价格 + * + * @param userInfo 用户 + * @param key 订单缓存key + * @param couponId 优惠券id + * @param useIntegral 使用积分 1-表示使用 + * @param shippingType 发货类型 OrderInfoEnum + * @return ComputeVo + */ + @Override + public ComputeVo computedOrder(YxUser userInfo, String key, String couponId, + String useIntegral, String shippingType, String addressId) { + Long uid = userInfo.getUid(); + CacheDto cacheDTO = this.getCacheOrderInfo(uid, key); + if (ObjectUtil.isNull(cacheDTO)) { + throw new YshopException("订单已过期,请刷新当前页面"); + } + BigDecimal payPrice = cacheDTO.getPriceGroup().getTotalPrice(); + + + //处理运费模板 + YxUserAddress userAddress = null; + if (StrUtil.isNotBlank(addressId)) { + userAddress = userAddressService.getById(addressId); + } + PriceGroupDto priceGroup = this.getOrderPriceGroup(cacheDTO.getCartInfo(), userAddress); + BigDecimal payPostage = priceGroup.getStorePostage(); + + Integer shippingTypeI = Integer.valueOf(shippingType); + //1-配送 2-到店 + if (OrderInfoEnum.SHIPPIING_TYPE_1.getValue().equals(shippingTypeI)) { + payPrice = NumberUtil.add(payPrice, payPostage); + } else { + payPostage = BigDecimal.ZERO; + } + + Long combinationId = null; + Long seckillId = null; + Long bargainId = null; + List cartInfo = cacheDTO.getCartInfo(); + for (YxStoreCartQueryVo cart : cartInfo) { + combinationId = cart.getCombinationId(); + seckillId = cart.getSeckillId(); + bargainId = cart.getBargainId(); + } + + //拼团等不参与抵扣 + if ((combinationId != null && combinationId > 0) || (seckillId != null && seckillId > 0) + || (bargainId != null && bargainId > 0)) { + couponId = ""; + useIntegral = ""; + } + + BigDecimal couponPrice = BigDecimal.ZERO; + if (StrUtil.isNotBlank(couponId) && !ShopConstants.YSHOP_ZERO.equals(couponId)) {//使用优惠券 + YxStoreCouponUser couponUser = couponUserService.getCoupon(Integer.valueOf(couponId), uid); + if (couponUser == null) { + throw new YshopException("使用优惠劵失败"); + } + + if (couponUser.getUseMinPrice().compareTo(payPrice) > 0) { + throw new YshopException("不满足优惠劵的使用条件"); + } + payPrice = NumberUtil.sub(payPrice, couponUser.getCouponPrice()); + couponPrice = couponUser.getCouponPrice(); + } + + // 积分抵扣 + BigDecimal deductionPrice = BigDecimal.ZERO; //积分抵扣金额 + double usedIntegral = 0; //使用了多少积分 + if (StrUtil.isNotBlank(useIntegral) && ShopConstants.YSHOP_ONE.equals(useIntegral) + && userInfo.getIntegral().intValue() > 0) { + Double integralMax = Double.valueOf(cacheDTO.getOther().getIntegralMax()); + BigDecimal integralFull = new BigDecimal(cacheDTO.getOther().getIntegralFull()); + Double integralRatio = Double.valueOf(cacheDTO.getOther().getIntegralRatio()); + + if (cacheDTO.getPriceGroup().getTotalPrice().compareTo(integralFull) >= 0) { + Double userIntegral = userInfo.getIntegral().doubleValue(); + if (integralMax.intValue() > 0 && Double.compare(userIntegral, integralMax) >= 0) { + userIntegral = integralMax; + } + deductionPrice = BigDecimal.valueOf(NumberUtil.mul(userIntegral, integralRatio)); + if (deductionPrice.compareTo(payPrice) < 0) { + payPrice = NumberUtil.sub(payPrice, deductionPrice); + usedIntegral = userIntegral; + } else { + deductionPrice = payPrice; + payPrice = BigDecimal.ZERO; + usedIntegral = NumberUtil.round(NumberUtil.div(deductionPrice, + BigDecimal.valueOf(integralRatio)), 2).doubleValue(); + } + } + } + + if (payPrice.compareTo(BigDecimal.ZERO) <= 0) { + payPrice = BigDecimal.ZERO; + } + + return ComputeVo.builder() + .totalPrice(cacheDTO.getPriceGroup().getTotalPrice()) + .payPrice(payPrice) + .payPostage(payPostage) + .couponPrice(couponPrice) + .deductionPrice(deductionPrice) + .usedIntegral(usedIntegral) + .payIntegral(cacheDTO.getPriceGroup().getPayIntegral()) + .build(); + } + + + /** + * 创建订单 + * + * @param userInfo 用户信息 + * @param key key + * @param param param + * @return YxStoreOrder + */ + @Override + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY, allEntries = true) + public YxStoreOrder createOrder(YxUser userInfo, String key, OrderParam param) { + + ComputeVo computeVo = this.computedOrder(userInfo, key, param.getCouponId(), + param.getUseIntegral(), param.getShippingType(), param.getAddressId()); + + Long uid = userInfo.getUid(); + + //处理选择门店与正常选择地址下单 + YxUserAddress userAddress = null; + if (OrderInfoEnum.SHIPPIING_TYPE_1.getValue().equals(Integer.valueOf(param.getShippingType()))) { + if (StrUtil.isEmpty(param.getAddressId())) { + throw new YshopException("请选择收货地址"); + } + userAddress = userAddressService.getById(param.getAddressId()); + if (ObjectUtil.isNull(userAddress)) { + throw new YshopException("地址选择有误"); + } + } else { //门店 + if (StrUtil.isBlank(param.getRealName()) || StrUtil.isBlank(param.getPhone())) { + throw new YshopException("请填写姓名和电话"); + } + userAddress = new YxUserAddress(); + userAddress.setRealName(param.getRealName()); + userAddress.setPhone(param.getPhone()); + userAddress.setProvince(""); + userAddress.setCity(""); + userAddress.setDistrict(""); + userAddress.setDetail(""); + } + + Integer totalNum = 0; + //Integer gainIntegral = 0; + List cartIds = new ArrayList<>(); + Long combinationId = 0L; + Long seckillId = 0L; + Long bargainId = 0L; + + Boolean isIntegral = false; + BigDecimal integral = BigDecimal.ZERO; + + CacheDto cacheDTO = this.getCacheOrderInfo(uid, key); + List cartInfo = cacheDTO.getCartInfo(); + + for (YxStoreCartQueryVo cart : cartInfo) { + //检测库存 + yxStoreCartService.checkProductStock(uid, cart.getProductId(), cart.getCartNum(), + cart.getProductAttrUnique(), cart.getCombinationId(), + cart.getSeckillId(), cart.getBargainId()); + + combinationId = cart.getCombinationId(); + seckillId = cart.getSeckillId(); + bargainId = cart.getBargainId(); + + cartIds.add(cart.getId().toString()); + totalNum += cart.getCartNum(); + if (cart.getProductInfo().getIsIntegral() != null + && cart.getProductInfo().getIsIntegral() == 1) { + integral = NumberUtil.add(integral, + NumberUtil.mul(cart.getCartNum(), cart.getProductInfo().getAttrInfo().getIntegral())); + } + } + + + //计算奖励积分 + BigDecimal gainIntegral = this.getGainIntegral(cartInfo); + if (PayTypeEnum.INTEGRAL.getValue().equals(param.getPayType())) { + gainIntegral = BigDecimal.ZERO; + isIntegral = true; + } + //生成分布式唯一值 + String orderSn = IdUtil.getSnowflake(0, 0).nextIdStr(); + //组合数据 + YxStoreOrder storeOrder = new YxStoreOrder(); + storeOrder.setUid(Long.valueOf(String.valueOf(uid))); + storeOrder.setOrderId(orderSn); + storeOrder.setRealName(userAddress.getRealName()); + storeOrder.setUserPhone(userAddress.getPhone()); + storeOrder.setUserAddress(userAddress.getProvince() + " " + userAddress.getCity() + + " " + userAddress.getDistrict() + " " + userAddress.getDetail()); + storeOrder.setCartId(StrUtil.join(",", cartIds)); + storeOrder.setTotalNum(totalNum); + storeOrder.setTotalPrice(computeVo.getTotalPrice()); + storeOrder.setTotalPostage(computeVo.getPayPostage()); + + storeOrder.setCouponId(param.getCouponId() == null ? null : Integer.valueOf(param.getCouponId())); + storeOrder.setCouponPrice(computeVo.getCouponPrice()); + storeOrder.setPayPrice(computeVo.getPayPrice()); + storeOrder.setPayPostage(computeVo.getPayPostage()); + storeOrder.setDeductionPrice(computeVo.getDeductionPrice()); + storeOrder.setPaid(OrderInfoEnum.PAY_STATUS_0.getValue()); + storeOrder.setPayType(param.getPayType()); + if (isIntegral) { + storeOrder.setPayIntegral(integral); + } + storeOrder.setUseIntegral(BigDecimal.valueOf(computeVo.getUsedIntegral())); + storeOrder.setBackIntegral(BigDecimal.ZERO); + storeOrder.setGainIntegral(gainIntegral); + storeOrder.setMark(param.getMark()); + storeOrder.setCombinationId(combinationId); + storeOrder.setPinkId(Long.valueOf(param.getPinkId())); + storeOrder.setSeckillId(seckillId); + storeOrder.setBargainId(bargainId); + storeOrder.setCost(cacheDTO.getPriceGroup().getCostPrice()); + if (AppFromEnum.ROUNTINE.getValue().equals(param.getFrom())) { + storeOrder.setIsChannel(OrderInfoEnum.PAY_CHANNEL_1.getValue()); + } else { + storeOrder.setIsChannel(OrderInfoEnum.PAY_CHANNEL_0.getValue()); + } + storeOrder.setUnique(key); + storeOrder.setShippingType(Integer.valueOf(param.getShippingType())); + //处理门店 + if (OrderInfoEnum.SHIPPIING_TYPE_2.getValue().toString().equals(param.getShippingType())) { + YxSystemStore systemStoreQueryVo = systemStoreService.getById(param.getStoreId()); + if (systemStoreQueryVo == null) { + throw new ErrorRequestException("暂无门店无法选择门店自提"); + } + storeOrder.setVerifyCode(StrUtil.sub(orderSn, orderSn.length(), -12)); + storeOrder.setStoreId(systemStoreQueryVo.getId()); + } + + boolean res = this.save(storeOrder); + if (!res) { + throw new YshopException("订单生成失败"); + } + + //使用了积分扣积分 + if (computeVo.getUsedIntegral() > 0) { + this.decIntegral(userInfo, computeVo.getUsedIntegral(), computeVo.getDeductionPrice().doubleValue()); + } + + //使用了优惠券扣优惠券 + if (computeVo.getCouponPrice().compareTo(BigDecimal.ZERO) > 0) { + couponUserService.useCoupon(Integer.valueOf(param.getCouponId())); + } + + + // 减库存加销量 + this.deStockIncSale(cartInfo); + + + //保存购物车商品信息 + orderCartInfoService.saveCartInfo(storeOrder.getId(), cartInfo); + + + //购物车状态修改 + YxStoreCart cartObj = new YxStoreCart(); + cartObj.setIsPay(OrderInfoEnum.PAY_STATUS_1.getValue()); + storeCartMapper.update(cartObj, Wrappers.lambdaQuery() + .in(YxStoreCart::getId, cartIds)); + + //删除缓存 + this.delCacheOrderInfo(uid, key); + + //增加状态 + orderStatusService.create(storeOrder.getId(), OrderLogEnum.CREATE_ORDER.getValue(), + OrderLogEnum.CREATE_ORDER.getDesc()); + + + //加入redis,30分钟自动取消 + String redisKey = String.valueOf(StrUtil.format("{}{}", + ShopConstants.REDIS_ORDER_OUTTIME_UNPAY, storeOrder.getId())); + redisTemplate.opsForValue().set(redisKey, storeOrder.getOrderId(), + ShopConstants.ORDER_OUTTIME_UNPAY, TimeUnit.MINUTES); + + //使用MQ延时消息 +// TemplateBean templateBean = TemplateBean.builder() +// .orderId(storeOrder.getId()+"") +// .uid(storeOrder.getUid()) +// .templateType(TemplateListenEnum.TYPE_7.getValue()) +// .time(DateUtil.formatTime(new Date())) +// .build(); +// publisher.publishEvent(new TemplateEvent(this,templateBean)); + + + return storeOrder; + } + + + /** + * 订单评价 + * + * @param orderCartInfo + * @param user user + * @param unique 订单orderCart唯一值 + * @param comment 评论内容 + * @param pics 图片 + * @param productScore 评分 + * @param serviceScore 评分 + */ + @Override + public void orderComment(YxStoreOrderCartInfo orderCartInfo, YxUser user, String unique, String comment, String pics, String productScore, + String serviceScore) { + + if (ObjectUtil.isEmpty(orderCartInfo)) { + throw new YshopException("评价产品不存在"); + } + + int count = productReplyService.count(Wrappers.lambdaQuery() + .eq(YxStoreProductReply::getOid, orderCartInfo.getOid()) + .eq(YxStoreProductReply::getProductId, orderCartInfo.getProductId())); + if (count > 0) { + throw new YshopException("该产品已评价"); + } + + + YxStoreProductReply storeProductReply = YxStoreProductReply.builder() + .uid(user.getUid()) + .oid(orderCartInfo.getOid()) + .productId(orderCartInfo.getProductId()) + .productScore(Integer.valueOf(productScore)) + .serviceScore(Integer.valueOf(serviceScore)) + .comment(comment) + .pics(pics) + .unique(unique) + .build(); + + productReplyService.save(storeProductReply); + //获取评价商品数量 + int replyCount = productReplyService.count(new LambdaQueryWrapper().eq(YxStoreProductReply::getOid, orderCartInfo.getOid())); + //购买商品数量 + int cartCount = storeOrderCartInfoService.count(new LambdaQueryWrapper().eq(YxStoreOrderCartInfo::getOid, orderCartInfo.getOid())); + if (replyCount == cartCount) { + YxStoreOrder storeOrder = new YxStoreOrder(); + storeOrder.setStatus(OrderInfoEnum.STATUS_3.getValue()); + storeOrder.setId(orderCartInfo.getOid()); + yxStoreOrderMapper.updateById(storeOrder); + + } + } + + /** + * 确认订单退款 + * + * @param orderId 单号 + * @param price 金额 + * @param type ShopCommonEnum + */ + @Override + public void orderRefund(String orderId, BigDecimal price, Integer type) { + + YxStoreOrderQueryVo orderQueryVo = getOrderInfo(orderId, null); + if (ObjectUtil.isNull(orderQueryVo)) { + throw new YshopException("订单不存在"); + } + + YxUserQueryVo userQueryVo = userService.getYxUserById(orderQueryVo.getUid()); + if (ObjectUtil.isNull(userQueryVo)) { + throw new YshopException("用户不存在"); + } + + if (OrderInfoEnum.REFUND_STATUS_2.getValue().equals(orderQueryVo.getRefundStatus())) { + throw new YshopException("订单已经退款了哦!"); + } + + if (orderQueryVo.getPayPrice().compareTo(price) < 0) { + throw new YshopException("退款金额不正确"); + } + + YxStoreOrder storeOrder = new YxStoreOrder(); + //修改状态 + storeOrder.setId(orderQueryVo.getId()); + if (ShopCommonEnum.AGREE_2.getValue().equals(type)) { + storeOrder.setRefundStatus(OrderInfoEnum.REFUND_STATUS_0.getValue()); + yxStoreOrderMapper.updateById(storeOrder); + return; + } + + //根据支付类型不同退款不同 + if (PayTypeEnum.YUE.getValue().equals(orderQueryVo.getPayType())) { + storeOrder.setRefundStatus(OrderInfoEnum.REFUND_STATUS_2.getValue()); + storeOrder.setRefundPrice(price); + yxStoreOrderMapper.updateById(storeOrder); + //退款到余额 + userService.incMoney(orderQueryVo.getUid(), price); + + //增加流水 + billService.income(orderQueryVo.getUid(), "商品退款", BillDetailEnum.CATEGORY_1.getValue(), + BillDetailEnum.TYPE_5.getValue(), + price.doubleValue(), + NumberUtil.add(price, userQueryVo.getNowMoney()).doubleValue(), + "订单退款到余额" + price + "元", orderQueryVo.getId().toString()); + this.retrunStock(orderQueryVo.getOrderId()); + } else if (PayTypeEnum.INTEGRAL.getValue().equals(orderQueryVo.getPayType())) { + storeOrder.setRefundStatus(OrderInfoEnum.REFUND_STATUS_2.getValue()); + storeOrder.setRefundPrice(price); + yxStoreOrderMapper.updateById(storeOrder); + + orderStatusService.create(orderQueryVo.getId(), OrderLogEnum.ORDER_EDIT.getValue(), "退款给用户:" + orderQueryVo.getPayIntegral() + "分"); + this.retrunStock(orderQueryVo.getOrderId()); + } + + orderStatusService.create(orderQueryVo.getId(), OrderLogEnum.REFUND_ORDER_SUCCESS.getValue(), "退款给用户:" + price + "元"); + + TemplateBean templateBean = TemplateBean.builder() + .orderId(orderQueryVo.getOrderId()) + .price(orderQueryVo.getPayPrice().toString()) + .uid(orderQueryVo.getUid()) + .templateType(TemplateListenEnum.TYPE_2.getValue()) + .time(DateUtil.formatTime(new Date())) + .payType(orderQueryVo.getPayType()) + .build(); + publisher.publishEvent(new TemplateEvent(this, templateBean)); + + + } + + + /** + * 订单发货 + * + * @param orderId 单号 + * @param deliveryId 快递单号 + * @param deliveryName 快递公司code + * @param deliveryType 快递方式 + */ + @Override + public void orderDelivery(String orderId, String deliveryId, String deliveryName, String deliveryType) { + YxStoreOrderQueryVo orderQueryVo = this.getOrderInfo(orderId, null); + if (ObjectUtil.isNull(orderQueryVo)) { + throw new YshopException("订单不存在"); + } + + if (!OrderInfoEnum.STATUS_0.getValue().equals(orderQueryVo.getStatus()) || + OrderInfoEnum.PAY_STATUS_0.getValue().equals(orderQueryVo.getPaid())) { + throw new YshopException("订单状态错误"); + } + + if (!OrderInfoEnum.REFUND_STATUS_0.getValue().equals(orderQueryVo.getRefundStatus())) { + throw new YshopException("订单退款中或已退款"); + } + + YxExpress expressQueryVo = expressService.getOne(new LambdaQueryWrapper().eq(YxExpress::getName, deliveryName)); + if (ObjectUtil.isNull(expressQueryVo)) { + throw new YshopException("请后台先添加快递公司"); + } + + //判断拼团产品 + if (orderQueryVo.getPinkId() != null && orderQueryVo.getPinkId() > 0) { + YxStorePink pink = pinkService.getById(orderQueryVo.getPinkId()); + if (!OrderInfoEnum.PINK_STATUS_2.getValue().equals(pink.getStatus())) { + throw new YshopException("拼团未成功不能发货"); + } + } + + YxStoreOrder storeOrder = YxStoreOrder.builder() + .id(orderQueryVo.getId()) + .status(OrderInfoEnum.STATUS_1.getValue()) + .deliveryId(deliveryId) + .deliveryName(expressQueryVo.getName()) + .deliveryType(deliveryType) + .deliverySn(expressQueryVo.getCode()) + .build(); + + yxStoreOrderMapper.updateById(storeOrder); + + //增加状态 + orderStatusService.create(orderQueryVo.getId(), OrderLogEnum.DELIVERY_GOODS.getValue(), + "已发货 快递公司:" + expressQueryVo.getName() + "快递单号:" + deliveryId); + + //模板消息发布事件 + TemplateBean templateBean = TemplateBean.builder() + .orderId(orderQueryVo.getOrderId()) + .deliveryId(deliveryId) + .deliveryName(expressQueryVo.getName()) + .uid(orderQueryVo.getUid()) + .templateType(TemplateListenEnum.TYPE_3.getValue()) + .build(); + publisher.publishEvent(new TemplateEvent(this, templateBean)); + + + //加入redis,7天后自动确认收货 + String redisKey = String.valueOf(StrUtil.format("{}{}", + ShopConstants.REDIS_ORDER_OUTTIME_UNCONFIRM, orderQueryVo.getId())); + redisTemplate.opsForValue().set(redisKey, orderQueryVo.getOrderId(), + ShopConstants.ORDER_OUTTIME_UNCONFIRM, TimeUnit.DAYS); + + } + + /** + * 修改快递单号 + * + * @param orderId 单号 + * @param deliveryId 快递单号 + * @param deliveryName 快递公司code + * @param deliveryType 快递方式 + */ + @Override + public void updateDelivery(String orderId, String deliveryId, String deliveryName, String deliveryType) { + YxStoreOrderQueryVo orderQueryVo = this.getOrderInfo(orderId, null); + if (ObjectUtil.isNull(orderQueryVo)) { + throw new YshopException("订单不存在"); + } + + if (!OrderInfoEnum.STATUS_1.getValue().equals(orderQueryVo.getStatus()) || + OrderInfoEnum.PAY_STATUS_0.getValue().equals(orderQueryVo.getPaid())) { + throw new YshopException("订单状态错误"); + } + + YxExpress expressQueryVo = expressService.getOne(new LambdaQueryWrapper().eq(YxExpress::getName, deliveryName)); + if (ObjectUtil.isNull(expressQueryVo)) { + throw new YshopException("请后台先添加快递公司"); + } + + + YxStoreOrder storeOrder = YxStoreOrder.builder() + .id(orderQueryVo.getId()) + .deliveryId(deliveryId) + .deliveryName(expressQueryVo.getName()) + .deliveryType(deliveryType) + .deliverySn(expressQueryVo.getCode()) + .build(); + + yxStoreOrderMapper.updateById(storeOrder); + } + + + /** + * 修改订单价格 + * + * @param orderId 单号 + * @param price 价格 + */ + @Override + public void editOrderPrice(String orderId, String price) { + YxStoreOrderQueryVo orderQueryVo = getOrderInfo(orderId, null); + if (ObjectUtil.isNull(orderQueryVo)) { + throw new YshopException("订单不存在"); + } + + + if (orderQueryVo.getPayPrice().compareTo(new BigDecimal(price)) == 0) { + return; + } + + + if (OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderQueryVo.getPaid())) { + throw new YshopException("订单状态错误"); + } + + + YxStoreOrder storeOrder = new YxStoreOrder(); + storeOrder.setId(orderQueryVo.getId()); + storeOrder.setPayPrice(new BigDecimal(price)); + + //判断金额是否有变动,生成一个额外订单号去支付 + if (orderQueryVo.getPayPrice().compareTo(new BigDecimal(price)) != 0) { + String orderSn = IdUtil.getSnowflake(0, 0).nextIdStr(); + storeOrder.setExtendOrderId(orderSn); + } + + yxStoreOrderMapper.updateById(storeOrder); + + //增加状态 + orderStatusService.create(storeOrder.getId(), OrderLogEnum.ORDER_EDIT.getValue(), "修改实际支付金额"); + + } + + /** + * 获取拼团订单 + * + * @param pid 拼团id + * @param uid 用户id + * @return YxStoreOrder + */ + @Override + public YxStoreOrder getOrderPink(Long pid, Long uid) { + return this.lambdaQuery().eq(YxStoreOrder::getUid, uid) + .eq(YxStoreOrder::getPinkId, pid) + .eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()) + .one(); + } + + + /** + * 未付款取消订单 + * + * @param orderId 订单号 + * @param uid 用户id + */ + @Override + public void cancelOrder(String orderId, Long uid) { + YxStoreOrderQueryVo order = this.getOrderInfo(orderId, uid); + if (ObjectUtil.isNull(order)) { + throw new YshopException("订单不存在"); + } + + this.regressionIntegral(order, 0); + + this.regressionStock(order, 0); + + this.regressionCoupon(order, 0); + + yxStoreOrderMapper.deleteById(order.getId()); + } + + + /** + * 删除订单 + * + * @param orderId 单号 + * @param uid uid + */ + @Override + public void removeOrder(String orderId, Long uid) { + YxStoreOrderQueryVo order = getOrderInfo(orderId, (long) uid); + if (order == null) { + throw new YshopException("订单不存在"); + } + order = handleOrder(order); + if (!OrderInfoEnum.STATUS_3.getValue().equals(order.getStatus())) { + throw new YshopException("该订单无法删除"); + } + + yxStoreOrderMapper.deleteById(order.getId()); + + //增加状态 + orderStatusService.create(order.getId(), + OrderLogEnum.REMOVE_ORDER.getValue(), + OrderLogEnum.REMOVE_ORDER.getDesc()); + } + + /** + * 订单确认收货 + * + * @param orderId 单号 + * @param uid uid + */ + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY, allEntries = true) + @Override + public void takeOrder(String orderId, Long uid) { + YxStoreOrderQueryVo order = this.getOrderInfo(orderId, uid); + if (ObjectUtil.isNull(order)) { + throw new YshopException("订单不存在"); + } + order = handleOrder(order); + if (!OrderStatusEnum.STATUS_2.getValue().toString().equals(order.get_status().get_type())) { + throw new BusinessException("订单状态错误"); + } + + YxStoreOrder storeOrder = new YxStoreOrder(); + storeOrder.setStatus(OrderInfoEnum.STATUS_2.getValue()); + storeOrder.setId(order.getId()); + yxStoreOrderMapper.updateById(storeOrder); + + //增加状态 + orderStatusService.create(order.getId(), OrderLogEnum.TAKE_ORDER_DELIVERY.getValue(), OrderLogEnum.TAKE_ORDER_DELIVERY.getDesc()); + + //奖励积分 + this.gainUserIntegral(order); + + //分销计算 + userService.backOrderBrokerage(order); + + //检查是否符合会员升级条件 + // userLevelService.setLevelComplete(uid); + } + + + /** + * 核销订单 + * + * @param verifyCode 核销码 + * @param isConfirm OrderInfoEnum + * @param uid uid + * @return YxStoreOrderQueryVo + */ + @Override + public YxStoreOrderQueryVo verifyOrder(String verifyCode, Integer isConfirm, Long uid) { + + YxStoreOrder order = this.getOne(Wrappers.lambdaQuery() + .eq(YxStoreOrder::getVerifyCode, verifyCode) + .eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) + .eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue())); + if (order == null) { + throw new YshopException("核销的订单不存在或未支付或已退款"); + } + + if (uid != null) { + boolean checkStatus = systemStoreStaffService.checkStatus(uid, order.getStoreId()); + if (!checkStatus) { + throw new YshopException("您没有当前店铺核销权限"); + } + } + + if (!OrderInfoEnum.STATUS_0.getValue().equals(order.getStatus())) { + throw new YshopException("订单已经核销"); + } + + if (order.getCombinationId() != null && order.getCombinationId() > 0 + && order.getPinkId() != null && order.getPinkId() > 0) { + YxStorePink storePink = storePinkService.getById(order.getPinkId()); + if (!OrderInfoEnum.PINK_STATUS_2.getValue().equals(storePink.getStatus())) { + throw new YshopException("拼团订单暂未成功无法核销"); + } + } + + YxStoreOrderQueryVo orderQueryVo = generator.convert(order, YxStoreOrderQueryVo.class); + if (OrderInfoEnum.CONFIRM_STATUS_0.getValue().equals(isConfirm)) { + return orderQueryVo; + } + + + YxStoreOrder storeOrder = new YxStoreOrder(); + storeOrder.setStatus(OrderInfoEnum.STATUS_2.getValue()); + storeOrder.setId(order.getId()); + yxStoreOrderMapper.updateById(storeOrder); + + //增加状态 + orderStatusService.create(order.getId(), OrderLogEnum.TAKE_ORDER_DELIVERY.getValue(), "已核销"); + + //奖励积分 + this.gainUserIntegral(orderQueryVo); + + //分销计算 + userService.backOrderBrokerage(orderQueryVo); + + //检查是否符合会员升级条件 + userLevelService.setLevelComplete(order.getUid()); + + return null; + } + + /** + * 申请退款 + * + * @param explain 退款备注 + * @param Img 图片 + * @param text 理由 + * @param orderId 订单号 + * @param uid uid + */ + @Override + public void orderApplyRefund(String explain, String Img, String text, String orderId, Long uid) { + YxStoreOrderQueryVo order = getOrderInfo(orderId, uid); + if (order == null) { + throw new YshopException("订单不存在"); + } + + if (OrderInfoEnum.REFUND_STATUS_2.getValue().equals(order.getRefundStatus())) { + throw new YshopException("订单已退款"); + } + if (OrderInfoEnum.REFUND_STATUS_1.getValue().equals(order.getRefundStatus())) { + throw new YshopException("正在申请退款中"); + } + if (OrderInfoEnum.STATUS_1.getValue().equals(order.getStatus())) { + throw new YshopException("订单当前无法退款"); + } + + + YxStoreOrder storeOrder = new YxStoreOrder(); + storeOrder.setRefundStatus(OrderInfoEnum.REFUND_STATUS_1.getValue()); + storeOrder.setRefundReasonTime(new Date()); + storeOrder.setRefundReasonWapExplain(explain); + storeOrder.setRefundReasonWapImg(Img); + storeOrder.setRefundReasonWap(text); + storeOrder.setId(order.getId()); + yxStoreOrderMapper.updateById(storeOrder); + + //增加状态 + orderStatusService.create(order.getId(), + OrderLogEnum.REFUND_ORDER_APPLY.getValue(), + "用户申请退款,原因:" + text); + + //模板消息发布事件 + TemplateBean templateBean = TemplateBean.builder() + .orderId(order.getOrderId()) + .price(order.getPayPrice().toString()) + .uid(order.getUid()) + .templateType(TemplateListenEnum.TYPE_9.getValue()) + .time(DateUtil.formatTime(new Date())) + .build(); + publisher.publishEvent(new TemplateEvent(this, templateBean)); + + } + + /** + * 订单列表 + * + * @param uid 用户id + * @param type OrderStatusEnum + * @param page page + * @param limit limit + * @return list + */ + @Override + public Map orderList(Long uid, int type, int page, int limit) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if (uid != null) { + wrapper.eq(YxStoreOrder::getUid, uid); + } + wrapper.orderByDesc(YxStoreOrder::getId); + + switch (OrderStatusEnum.toType(type)) { + case STATUS__1: + break; + //未支付 + case STATUS_0: + wrapper.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_0.getValue()) + .eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()) + .eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_0.getValue()); + break; + //待发货 + case STATUS_1: + wrapper.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) + .eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()) + .eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_0.getValue()); + break; + //待收货 + case STATUS_2: + wrapper.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) + .eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()) + .eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_1.getValue()); + break; + //待评价 + case STATUS_3: + wrapper.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) + .eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()) + .eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_2.getValue()); + break; + //已完成 + case STATUS_4: + wrapper.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) + .eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()) + .eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_3.getValue()); + break; + //退款中 + case STATUS_MINUS_1: + wrapper.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) + .eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_1.getValue()); + break; + //已退款 + case STATUS_MINUS_2: + wrapper.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_0.getValue()) + .eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_2.getValue()); + break; + //退款 + case STATUS_MINUS_3: + String[] strs = {"1", "2"}; + wrapper.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) + .in(YxStoreOrder::getRefundStatus, Arrays.asList(strs)); + break; + default: + } + + Page pageModel = new Page<>(page, limit); + IPage pageList = yxStoreOrderMapper.selectPage(pageModel, wrapper); + List list = generator.convert(pageList.getRecords(), YxStoreOrderQueryVo.class); + Map map = new HashMap<>(); + map.put("list", list.stream() + .map(this::handleOrder) + .collect(Collectors.toList())); + map.put("total", pageList.getTotal()); + map.put("totalPage", pageList.getPages()); + return map; + + } + + /** + * chart图标统计 + * + * @param cate + * @param type + * @return + */ + // @Override + @Deprecated + /** + public Map chartCount(int cate,int type) { + int today = OrderUtil.dateToTimestampT(DateUtil.beginOfDay(new Date())); + int yesterday = OrderUtil.dateToTimestampT(DateUtil.beginOfDay(DateUtil. + yesterday())); + int lastWeek = OrderUtil.dateToTimestampT(DateUtil.beginOfDay(DateUtil.lastWeek())); + int nowMonth = OrderUtil.dateToTimestampT(DateUtil + .beginOfMonth(new Date())); + double price = 0d; + List list = null; + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq("paid",1).eq("refund_status",0).eq("is_del",0); + + switch (OrderCountEnum.toType(cate)){ + case TODAY: //今天 + wrapper.ge("pay_time",today); + break; + case YESTERDAY: //昨天 + wrapper.lt("pay_time",today).ge("pay_time",yesterday); + break; + case WEEK: //上周 + wrapper.ge("pay_time",lastWeek); + break; + case MONTH: //本月 + wrapper.ge("pay_time",nowMonth); + break; + } + if(type == 1){ + list = yxStoreOrderMapper.chartList(wrapper); + price = yxStoreOrderMapper.todayPrice(wrapper); + }else{ + list = yxStoreOrderMapper.chartListT(wrapper); + price = yxStoreOrderMapper.selectCount(wrapper).doubleValue(); + } + + Map map = new LinkedHashMap<>(); + map.put("chart",list); + map.put("time",price); + return map; + } + **/ + + /** + * 获取 今日 昨日 本月 订单金额 + * @return ShoperOrderTimeDataVo + */ + @Override + public ShoperOrderTimeDataVo getShoperOrderTimeData() { + + Date today = DateUtil.beginOfDay(new Date()); + Date yesterday = DateUtil.beginOfDay(DateUtil.yesterday()); + Date nowMonth = DateUtil.beginOfMonth(new Date()); + Date lastWeek = DateUtil.beginOfDay(DateUtil.lastWeek()); + + ShoperOrderTimeDataVo orderTimeDataVo = new ShoperOrderTimeDataVo(); + + //今日成交额 + LambdaQueryWrapper wrapperOne = new LambdaQueryWrapper<>(); + wrapperOne + .ge(YxStoreOrder::getPayTime, today) + .eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) + .eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()); + orderTimeDataVo.setTodayPrice(yxStoreOrderMapper.todayPrice(wrapperOne)); + //今日订单数 + orderTimeDataVo.setTodayCount(yxStoreOrderMapper.selectCount(wrapperOne)); + + //昨日成交额 + LambdaQueryWrapper wrapperTwo = new LambdaQueryWrapper<>(); + wrapperTwo + .lt(YxStoreOrder::getPayTime, today) + .ge(YxStoreOrder::getPayTime, yesterday) + .eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) + .eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()); + orderTimeDataVo.setProPrice(yxStoreOrderMapper.todayPrice(wrapperTwo)); + //昨日订单数 + orderTimeDataVo.setProCount(yxStoreOrderMapper.selectCount(wrapperTwo)); + + //本月成交额 + LambdaQueryWrapper wrapperThree = new LambdaQueryWrapper<>(); + wrapperThree + .ge(YxStoreOrder::getPayTime, nowMonth) + .eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) + .eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()); + orderTimeDataVo.setMonthPrice(yxStoreOrderMapper.todayPrice(wrapperThree)); + //本月订单数 + orderTimeDataVo.setMonthCount(yxStoreOrderMapper.selectCount(wrapperThree)); + + //上周成交额 + LambdaQueryWrapper wrapperLastWeek = new LambdaQueryWrapper<>(); + wrapperLastWeek + .lt(YxStoreOrder::getPayTime, today) + .ge(YxStoreOrder::getPayTime, lastWeek) + .eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) + .eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()); + orderTimeDataVo.setLastWeekPrice(yxStoreOrderMapper.todayPrice(wrapperLastWeek)); + //上周订单数 + orderTimeDataVo.setLastWeekCount(yxStoreOrderMapper.selectCount(wrapperLastWeek)); + + + return orderTimeDataVo; + } + + /** + * 订单每月统计数据 + * + * @param page page + * @param limit list + * @return List + */ + @Override + public List getOrderDataPriceCount(int page, int limit) { + Page pageModel = new Page<>(page, limit); + return yxStoreOrderMapper.getOrderDataPriceList(pageModel); + } + + /** + * 获取某个用户的订单统计数据 + * + * @param uid uid>0 取用户 否则取所有 + * @return UserOrderCountVo + */ + @Override + public UserOrderCountVo orderData(Long uid) { + + //订单支付没有退款 数量 + LambdaQueryWrapper wrapperOne = new LambdaQueryWrapper<>(); + if (uid != null) { + wrapperOne.eq(YxStoreOrder::getUid, uid); + } + wrapperOne.eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()) + .eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()); + Integer orderCount = yxStoreOrderMapper.selectCount(wrapperOne); + + //订单支付没有退款 支付总金额 + double sumPrice = yxStoreOrderMapper.sumPrice(uid); + + //订单待支付 数量 + LambdaQueryWrapper wrapperTwo = new LambdaQueryWrapper<>(); + if (uid != null) { + wrapperTwo.eq(YxStoreOrder::getUid, uid); + } + wrapperTwo.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_0.getValue()) + .eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()) + .eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_0.getValue()); + Integer unpaidCount = yxStoreOrderMapper.selectCount(wrapperTwo); + + //订单待发货 数量 + LambdaQueryWrapper wrapperThree = new LambdaQueryWrapper<>(); + if (uid != null) { + wrapperThree.eq(YxStoreOrder::getUid, uid); + } + wrapperThree.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) + .eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()) + .eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_0.getValue()); + Integer unshippedCount = yxStoreOrderMapper.selectCount(wrapperThree); + + //订单待收货 数量 + LambdaQueryWrapper wrapperFour = new LambdaQueryWrapper<>(); + if (uid != null) { + wrapperFour.eq(YxStoreOrder::getUid, uid); + } + wrapperFour.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) + .eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()) + .eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_1.getValue()); + Integer receivedCount = yxStoreOrderMapper.selectCount(wrapperFour); + + //订单待评价 数量 + LambdaQueryWrapper wrapperFive = new LambdaQueryWrapper<>(); + if (uid != null) { + wrapperFive.eq(YxStoreOrder::getUid, uid); + } + wrapperFive.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) + .eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()) + .eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_2.getValue()); + Integer evaluatedCount = yxStoreOrderMapper.selectCount(wrapperFive); + + //订单已完成 数量 + LambdaQueryWrapper wrapperSix = new LambdaQueryWrapper<>(); + if (uid != null) { + wrapperSix.eq(YxStoreOrder::getUid, uid); + } + wrapperSix.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) + .eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()) + .eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_3.getValue()); + Integer completeCount = yxStoreOrderMapper.selectCount(wrapperSix); + + //订单退款 + LambdaQueryWrapper wrapperSeven = new LambdaQueryWrapper<>(); + if (uid != null) { + wrapperSeven.eq(YxStoreOrder::getUid, uid); + } + String[] strArr = {"1", "2"}; + wrapperSeven.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) + .in(YxStoreOrder::getRefundStatus, Arrays.asList(strArr)); + Integer refundCount = yxStoreOrderMapper.selectCount(wrapperSeven); + + + return UserOrderCountVo.builder() + .orderCount(orderCount) + .sumPrice(sumPrice) + .unpaidCount(unpaidCount) + .unshippedCount(unshippedCount) + .receivedCount(receivedCount) + .evaluatedCount(evaluatedCount) + .completeCount(completeCount) + .refundCount(refundCount) + .build(); + } + + /** + * 处理订单返回的状态 + * + * @param order order + * @return YxStoreOrderQueryVo + */ + @Override + public YxStoreOrderQueryVo handleOrder(YxStoreOrderQueryVo order) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreOrderCartInfo::getOid, order.getId()); + List cartInfos = orderCartInfoService.list(wrapper); + + List cartInfo = cartInfos.stream() + .map(cart -> { + YxStoreCartQueryVo cartQueryVo = JSON.parseObject(cart.getCartInfo(), YxStoreCartQueryVo.class); + cartQueryVo.setUnique(cart.getUnique()); + cartQueryVo.setIsReply(productReplyService.replyCount(cart.getUnique())); + return cartQueryVo; + }) + .collect(Collectors.toList()); + order.setCartInfo(cartInfo); + + StatusDto statusDTO = new StatusDto(); + if (OrderStatusEnum.STATUS_0.getValue().equals(order.getPaid())) { + //计算未支付到自动取消订 时间 + int offset = Integer.valueOf(String.valueOf(ShopConstants.ORDER_OUTTIME_UNPAY)); + Date time = DateUtil.offsetMinute(order.getCreateTime(), offset); + statusDTO.set_class("nobuy"); + statusDTO.set_msg(StrUtil.format("请在{}前完成支付", DateUtil.formatDateTime(time))); + statusDTO.set_type("0"); + statusDTO.set_title("未支付"); + } else if (OrderInfoEnum.REFUND_STATUS_1.getValue().equals(order.getRefundStatus())) { + statusDTO.set_class("state-sqtk"); + statusDTO.set_msg("商家审核中,请耐心等待"); + statusDTO.set_type("-1"); + statusDTO.set_title("申请退款中"); + } else if (OrderInfoEnum.REFUND_STATUS_2.getValue().equals(order.getRefundStatus())) { + statusDTO.set_class("state-sqtk"); + statusDTO.set_msg("已为您退款,感谢您的支持"); + statusDTO.set_type("-2"); + statusDTO.set_title("已退款"); + } else if (OrderInfoEnum.STATUS_0.getValue().equals(order.getStatus())) { + // 拼团 + if (order.getPinkId() > 0) { + if (pinkService.pinkIngCount(order.getPinkId()) > 0) { + statusDTO.set_class("state-nfh"); + statusDTO.set_msg("待其他人参加拼团"); + statusDTO.set_type("1"); + statusDTO.set_title("拼团中"); + } else { + statusDTO.set_class("state-nfh"); + statusDTO.set_msg("商家未发货,请耐心等待"); + statusDTO.set_type("1"); + statusDTO.set_title("未发货"); + } + } else { + if (OrderInfoEnum.SHIPPIING_TYPE_1.getValue().equals(order.getShippingType())) { + statusDTO.set_class("state-nfh"); + statusDTO.set_msg("商家未发货,请耐心等待"); + statusDTO.set_type("1"); + statusDTO.set_title("未发货"); + } else { + statusDTO.set_class("state-nfh"); + statusDTO.set_msg("待核销,请到核销点进行核销"); + statusDTO.set_type("1"); + statusDTO.set_title("待核销"); + } + } + + } else if (OrderInfoEnum.STATUS_1.getValue().equals(order.getStatus())) { + statusDTO.set_class("state-ysh"); + statusDTO.set_msg("服务商已发货"); + statusDTO.set_type("2"); + statusDTO.set_title("待收货"); + } else if (OrderInfoEnum.STATUS_2.getValue().equals(order.getStatus())) { + statusDTO.set_class("state-ypj"); + statusDTO.set_msg("已收货,快去评价一下吧"); + statusDTO.set_type("3"); + statusDTO.set_title("待评价"); + } else if (OrderInfoEnum.STATUS_3.getValue().equals(order.getStatus())) { + statusDTO.set_class("state-ytk"); + statusDTO.set_msg("交易完成,感谢您的支持"); + statusDTO.set_type("4"); + statusDTO.set_title("交易完成"); + } + + if (PayTypeEnum.WEIXIN.getValue().equals(order.getPayType())) { + statusDTO.set_payType("微信支付"); + } else if (PayTypeEnum.YUE.getValue().equals(order.getPayType())) { + statusDTO.set_payType("余额支付"); + } else { + statusDTO.set_payType("积分支付"); + } + + order.set_status(statusDTO); + + + return order; + } + + /** + * 支付成功后操作 + * + * @param orderId 订单号 + * @param payType 支付方式 + */ + @Override + public void paySuccess(String orderId, String payType) { + YxStoreOrderQueryVo orderInfo = getOrderInfo(orderId, null); + + //更新订单状态 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreOrder::getOrderId, orderId); + YxStoreOrder storeOrder = new YxStoreOrder(); + storeOrder.setPaid(OrderInfoEnum.PAY_STATUS_1.getValue()); + storeOrder.setPayType(payType); + storeOrder.setPayTime(new Date()); + yxStoreOrderMapper.update(storeOrder, wrapper); + + //增加用户购买次数 + userService.incPayCount(orderInfo.getUid()); + //增加状态 + orderStatusService.create(orderInfo.getId(), OrderLogEnum.PAY_ORDER_SUCCESS.getValue(), + OrderLogEnum.PAY_ORDER_SUCCESS.getDesc()); + //拼团 + if (orderInfo.getCombinationId() > 0) { + pinkService.createPink(orderInfo); + } + + //砍价 + if (orderInfo.getBargainId() > 0) { + storeBargainUserService.setBargainUserStatus(orderInfo.getBargainId(), orderInfo.getUid()); + } + + YxUser userInfo = userService.getById(orderInfo.getUid()); + //增加流水 + String payTypeMsg = PayTypeEnum.WEIXIN.getDesc(); + if (PayTypeEnum.YUE.getValue().equals(payType)) { + payTypeMsg = PayTypeEnum.YUE.getDesc(); + } + billService.expend(userInfo.getUid(), "购买商品", + BillDetailEnum.CATEGORY_1.getValue(), + BillDetailEnum.TYPE_3.getValue(), + orderInfo.getPayPrice().doubleValue(), userInfo.getNowMoney().doubleValue(), + payTypeMsg + orderInfo.getPayPrice() + "元购买商品"); + + + //模板消息支付成功发布事件 + TemplateBean templateBean = TemplateBean.builder() + .orderId(orderInfo.getOrderId()) + .price(orderInfo.getPayPrice().toString()) + .uid(orderInfo.getUid()) + .templateType(TemplateListenEnum.TYPE_1.getValue()) + .build(); + publisher.publishEvent(new TemplateEvent(this, templateBean)); + + } + + + /** + * 支付宝支付 + * + * @param orderId,支付宝支付 本系统已经集成,请自行根据下面找到代码整合下即可 + * @return + */ + @Override + public String aliPay(String orderId) throws Exception { + AlipayConfig alipay = alipayService.find(); + if (ObjectUtil.isNull(alipay)) { + throw new YshopException("请先配置支付宝"); + } + YxStoreOrderQueryVo orderInfo = getOrderInfo(orderId, null); + if (ObjectUtil.isNull(orderInfo)) { + throw new YshopException("订单不存在"); + } + if (OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderInfo.getPaid())) { + throw new YshopException("该订单已支付"); + } + + if (orderInfo.getPayPrice().compareTo(BigDecimal.ZERO) <= 0) { + throw new YshopException("该支付无需支付"); + } + TradeVo trade = new TradeVo(); + trade.setOutTradeNo(orderId); + String payUrl = alipayService.toPayAsWeb(alipay, trade); + return payUrl; + } + + + /** + * 余额支付 + * + * @param orderId 订单号 + * @param uid 用户id + */ + @Override + public void yuePay(String orderId, Long uid) { + YxStoreOrderQueryVo orderInfo = getOrderInfo(orderId, uid); + if (ObjectUtil.isNull(orderInfo)) { + throw new YshopException("订单不存在"); + } + + if (OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderInfo.getPaid())) { + throw new YshopException("该订单已支付"); + } + + YxUserQueryVo userInfo = userService.getYxUserById(uid); + + if (userInfo.getNowMoney().compareTo(orderInfo.getPayPrice()) < 0) { + throw new YshopException("余额不足"); + } + + userService.decPrice(uid, orderInfo.getPayPrice()); + + //支付成功后处理 + this.paySuccess(orderInfo.getOrderId(), PayTypeEnum.YUE.getValue()); + } + + + /** + * 积分兑换 + * + * @param orderId 订单号 + * @param uid 用户id + */ + @Override + public void integralPay(String orderId, Long uid) { + YxStoreOrderQueryVo orderInfo = getOrderInfo(orderId, uid); + if (ObjectUtil.isNull(orderInfo)) { + throw new YshopException("订单不存在"); + } + + if (OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderInfo.getPaid())) { + throw new YshopException("该订单已支付"); + } + orderInfo = handleOrder(orderInfo); + orderInfo.getCartInfo().forEach(cart -> { + if (cart.getProductInfo().getIsIntegral() == 0) { + throw new YshopException("该商品不为积分商品"); + } + }); + YxUser userInfo = userService.getById(uid); + + if (userInfo.getIntegral().compareTo(orderInfo.getPayIntegral()) < 0) { + throw new YshopException("积分不足"); + } + + //扣除积分 + //userService.decIntegral(uid,orderInfo.getPayIntegral().doubleValue()); + BigDecimal newIntegral = NumberUtil.sub(userInfo.getIntegral(), orderInfo.getPayIntegral()); + userInfo.setIntegral(newIntegral); + userService.updateById(userInfo); + //增加流水 + billService.expend(userInfo.getUid(), "兑换商品", BillDetailEnum.CATEGORY_2.getValue(), + BillDetailEnum.TYPE_8.getValue(), + orderInfo.getPayIntegral().doubleValue(), + newIntegral.doubleValue(), + "兑换商品扣除" + orderInfo.getPayIntegral().doubleValue() + "积分"); + //支付成功后处理 + this.paySuccess(orderInfo.getOrderId(), PayTypeEnum.INTEGRAL.getValue()); + } + + + /** + * 订单信息 + * + * @param unique 唯一值或者单号 + * @param uid 用户id + * @return YxStoreOrderQueryVo + */ + @Override + public YxStoreOrderQueryVo getOrderInfo(String unique, Long uid) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.and( + i -> i.eq(YxStoreOrder::getOrderId, unique).or().eq(YxStoreOrder::getUnique, unique).or() + .eq(YxStoreOrder::getExtendOrderId, unique)); + if (uid != null) { + wrapper.eq(YxStoreOrder::getUid, uid); + } + + return generator.convert(yxStoreOrderMapper.selectOne(wrapper), YxStoreOrderQueryVo.class); + } + + + /** + * 奖励积分 + * + * @param order 订单 + */ + private void gainUserIntegral(YxStoreOrderQueryVo order) { + if (order.getGainIntegral().compareTo(BigDecimal.ZERO) > 0) { + YxUser user = userService.getById(order.getUid()); + + BigDecimal newIntegral = NumberUtil.add(user.getIntegral(), order.getGainIntegral()); + user.setIntegral(newIntegral); + user.setUid(order.getUid()); + userService.updateById(user); + + //增加流水 + billService.income(user.getUid(), "购买商品赠送积分", BillDetailEnum.CATEGORY_2.getValue(), + BillDetailEnum.TYPE_9.getValue(), + order.getGainIntegral().doubleValue(), + newIntegral.doubleValue(), + "购买商品赠送" + order.getGainIntegral() + "积分", order.getId().toString()); + } + } + + /** + * 减库存增加销量 + * + * @param cartInfo 购物车 + */ + public void deStockIncSale(List cartInfo) { + for (YxStoreCartQueryVo storeCartVO : cartInfo) { + Long combinationId = storeCartVO.getCombinationId(); + Long seckillId = storeCartVO.getSeckillId(); + Long bargainId = storeCartVO.getBargainId(); + if (combinationId != null && combinationId > 0) { + productService.decProductStock(storeCartVO.getCartNum(), storeCartVO.getProductId(), + storeCartVO.getProductAttrUnique(), combinationId, ProductTypeEnum.COMBINATION.getValue()); + } else if (seckillId != null && seckillId > 0) { + productService.decProductStock(storeCartVO.getCartNum(), storeCartVO.getProductId(), + storeCartVO.getProductAttrUnique(), seckillId, ProductTypeEnum.SECKILL.getValue()); + } else if (bargainId != null && bargainId > 0) { + storeBargainService.decStockIncSales(storeCartVO.getCartNum(), bargainId); + } else { + productService.decProductStock(storeCartVO.getCartNum(), storeCartVO.getProductId(), + storeCartVO.getProductAttrUnique(), 0L, ""); + } + } + } + + + /** + * 积分抵扣 + * + * @param userInfo 用户信息 + * @param usedIntegral 使用得积分 + * @param deductionPrice 抵扣的金额 + */ + private void decIntegral(YxUser userInfo, double usedIntegral, double deductionPrice) { + userService.decIntegral(userInfo.getUid(), usedIntegral); + billService.expend(userInfo.getUid(), "积分抵扣", BillDetailEnum.CATEGORY_2.getValue(), + BillDetailEnum.TYPE_8.getValue(), usedIntegral, userInfo.getIntegral().doubleValue(), + "购买商品使用" + usedIntegral + "积分抵扣" + deductionPrice + "元"); + } + + /** + * 计算奖励的积分 + * + * @param cartInfo cartInfo + * @return double + */ + private BigDecimal getGainIntegral(List cartInfo) { + BigDecimal gainIntegral = BigDecimal.ZERO; + for (YxStoreCartQueryVo cart : cartInfo) { + if (cart.getCombinationId() > 0 || cart.getSeckillId() > 0 || cart.getBargainId() > 0) { + continue; + } + BigDecimal cartInfoGainIntegral = BigDecimal.ZERO; + Double gain = cart.getProductInfo().getGiveIntegral().doubleValue(); + if (gain > 0) { + cartInfoGainIntegral = NumberUtil.round(NumberUtil.mul(cart.getCartNum(), gain), 2); + } + gainIntegral = NumberUtil.add(gainIntegral, cartInfoGainIntegral); + } + return gainIntegral; + } + + + /** + * 退回优惠券 + * + * @param order 订单 + */ + private void regressionCoupon(YxStoreOrderQueryVo order, Integer type) { + if (type == 0) { + if (OrderInfoEnum.PAY_STATUS_1.getValue().equals(order.getPaid()) + || OrderStatusEnum.STATUS_MINUS_2.getValue().equals(order.getStatus())) { + return; + } + } else { + if (!(OrderInfoEnum.PAY_STATUS_1.getValue().equals(order.getPaid()) + && OrderInfoEnum.REFUND_STATUS_2.getValue().equals(order.getRefundStatus()))) { + return; + } + } + + if (order.getCouponId() != null && order.getCouponId() > 0) { + YxStoreCouponUser couponUser = couponUserService + .getOne(Wrappers.lambdaQuery() + .eq(YxStoreCouponUser::getId, order.getCouponId()) + .eq(YxStoreCouponUser::getStatus, CouponEnum.STATUS_1.getValue()) + .eq(YxStoreCouponUser::getUid, order.getUid())); + + if (ObjectUtil.isNotNull(couponUser)) { + YxStoreCouponUser storeCouponUser = new YxStoreCouponUser(); + storeCouponUser.setStatus(CouponEnum.STATUS_0.getValue()); + storeCouponUser.setUseTime(null); + couponUserService.update(storeCouponUser, Wrappers.lambdaQuery() + .eq(YxStoreCouponUser::getId, order.getCouponId()) + .eq(YxStoreCouponUser::getUid, order.getUid())); + } + } + + } + + /** + * 退回库存 + * + * @param order 订单 + */ + private void regressionStock(YxStoreOrderQueryVo order, Integer type) { + if (type == 0) { + if (OrderInfoEnum.PAY_STATUS_1.getValue().equals(order.getPaid()) + || OrderStatusEnum.STATUS_MINUS_2.getValue().equals(order.getStatus())) { + return; + } + } else { + if (!(OrderInfoEnum.PAY_STATUS_1.getValue().equals(order.getPaid()) + && OrderInfoEnum.REFUND_STATUS_2.getValue().equals(order.getRefundStatus()))) { + return; + } + } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(YxStoreOrderCartInfo::getCartId, Arrays.asList(order.getCartId().split(","))); + + List cartInfoList = orderCartInfoService.list(wrapper); + for (YxStoreOrderCartInfo cartInfo : cartInfoList) { + YxStoreCartQueryVo cart = JSONObject.parseObject(cartInfo.getCartInfo() + , YxStoreCartQueryVo.class); + if (order.getCombinationId() != null && order.getCombinationId() > 0) {//拼团 + productService.incProductStock(cart.getCartNum(), cart.getProductId(), cart.getProductAttrUnique(), order.getCombinationId(), ProductTypeEnum.COMBINATION.getValue()); + } else if (order.getSeckillId() != null && order.getSeckillId() > 0) {//秒杀 + productService.incProductStock(cart.getCartNum(), cart.getProductId(), cart.getProductAttrUnique(), order.getSeckillId(), ProductTypeEnum.SECKILL.getValue()); + } else if (order.getBargainId() != null && order.getBargainId() > 0) {//砍价 + storeBargainService.incStockDecSales(cart.getCartNum(), order.getBargainId()); + } else { + productService.incProductStock(cart.getCartNum(), cart.getProductId() + , cart.getProductAttrUnique(), 0L, null); + } + + } + } + + /** + * 退回积分 + * + * @param order 订单 + */ + private void regressionIntegral(YxStoreOrderQueryVo order, Integer type) { + if (type == 0) { + if (OrderInfoEnum.PAY_STATUS_1.getValue().equals(order.getPaid()) + || OrderStatusEnum.STATUS_MINUS_2.getValue().equals(order.getStatus())) { + return; + } + } else { + if (!(OrderInfoEnum.PAY_STATUS_1.getValue().equals(order.getPaid()) + && OrderInfoEnum.REFUND_STATUS_2.getValue().equals(order.getRefundStatus()))) { + return; + } + } + + if (order.getPayIntegral().compareTo(BigDecimal.ZERO) > 0) { + order.setUseIntegral(order.getPayIntegral()); + } + if (order.getUseIntegral().compareTo(BigDecimal.ZERO) <= 0) { + return; + } + + if (!OrderStatusEnum.STATUS_MINUS_2.getValue().equals(order.getStatus()) + && !OrderInfoEnum.REFUND_STATUS_2.getValue().equals(order.getRefundStatus()) + && order.getBackIntegral().compareTo(BigDecimal.ZERO) > 0) { + return; + } + + YxUser yxUser = userService.getById(order.getUid()); + + //增加积分 + BigDecimal newIntegral = NumberUtil.add(order.getUseIntegral(), yxUser.getIntegral()); + yxUser.setIntegral(newIntegral); + userService.updateById(yxUser); + + //增加流水 + billService.income(yxUser.getUid(), "积分回退", BillDetailEnum.CATEGORY_2.getValue(), + BillDetailEnum.TYPE_8.getValue(), + order.getUseIntegral().doubleValue(), + newIntegral.doubleValue(), + "购买商品失败,回退积分" + order.getUseIntegral(), order.getId().toString()); + + //更新回退积分 + YxStoreOrder storeOrder = new YxStoreOrder(); + storeOrder.setBackIntegral(order.getUseIntegral()); + storeOrder.setId(order.getId()); + yxStoreOrderMapper.updateById(storeOrder); + } + + /** + * 获取订单缓存 + * + * @param uid uid + * @param key key + * @return CacheDto + */ + private CacheDto getCacheOrderInfo(Long uid, String key) { + Object obj = redisUtils.get(ShopConstants.YSHOP_ORDER_CACHE_KEY + uid + key); + if (obj == null) { + return null; + } + return JSON.parseObject(obj.toString(), CacheDto.class); + } + + + /** + * 删除订单缓存 + * + * @param uid uid + * @param key key + */ + private void delCacheOrderInfo(Long uid, String key) { + redisUtils.del(ShopConstants.YSHOP_ORDER_CACHE_KEY + uid + key); + } + + /** + * 缓存订单 + * + * @param uid uid + * @param cartInfo cartInfo + * @param priceGroup priceGroup + * @param other other + * @return string + */ + private String cacheOrderInfo(Long uid, List cartInfo, PriceGroupDto priceGroup, OtherDto other) { + String key = IdUtil.simpleUUID(); + CacheDto cacheDTO = new CacheDto(); + cacheDTO.setCartInfo(cartInfo); + cacheDTO.setPriceGroup(priceGroup); + cacheDTO.setOther(other); + redisUtils.set(ShopConstants.YSHOP_ORDER_CACHE_KEY + uid + key, + JSON.toJSONString(cacheDTO), + ShopConstants.YSHOP_ORDER_CACHE_TIME); + return key; + } + + /** + * 获取订单价格 + * + * @param cartInfo 购物车列表 + * @return PriceGroupDto + */ + private PriceGroupDto getOrderPriceGroup(List cartInfo, YxUserAddress userAddress) { + + BigDecimal storePostage = BigDecimal.ZERO; + + + String storeFreePostageStr = systemConfigService.getData(SystemConfigConstants.STORE_FREE_POSTAGE);//满额包邮 + BigDecimal storeFreePostage = BigDecimal.ZERO; + if (NumberUtil.isNumber(storeFreePostageStr) && StrUtil.isNotBlank(storeFreePostageStr)) { + storeFreePostage = new BigDecimal(storeFreePostageStr); + } + + + BigDecimal totalPrice = this.getOrderSumPrice(cartInfo, "truePrice");//获取订单总金额 + BigDecimal costPrice = this.getOrderSumPrice(cartInfo, "costPrice");//获取订单成本价 + BigDecimal vipPrice = this.getOrderSumPrice(cartInfo, "vipTruePrice");//获取订单会员优惠金额 + BigDecimal payIntegral = this.getOrderSumPrice(cartInfo, "payIntegral");//获取订单需要的积分 + + //如果设置满包邮0 表示全局包邮,如果设置大于0表示满这价格包邮,否则走运费模板算法 + if (storeFreePostage.compareTo(BigDecimal.ZERO) != 0 && totalPrice.compareTo(storeFreePostage) <= 0) { + storePostage = this.handlePostage(cartInfo, userAddress); + } + if (cartInfo.size() == 1 && cartInfo.get(0).getProductInfo().getIsIntegral() != null + && cartInfo.get(0).getProductInfo().getIsIntegral() == 1) { + totalPrice = BigDecimal.ZERO; + } + + PriceGroupDto priceGroupDTO = new PriceGroupDto(); + priceGroupDTO.setStorePostage(storePostage); + priceGroupDTO.setStoreFreePostage(storeFreePostage); + priceGroupDTO.setTotalPrice(totalPrice); + priceGroupDTO.setCostPrice(costPrice); + priceGroupDTO.setVipPrice(vipPrice); + priceGroupDTO.setPayIntegral(payIntegral); + return priceGroupDTO; + } + + + /** + * 根据运费模板算法返回邮费 + * + * @param cartInfo 购物车 + * @param userAddress 地址 + * @return double + */ + private BigDecimal handlePostage(List cartInfo, YxUserAddress userAddress) { + BigDecimal storePostage = BigDecimal.ZERO; + if (userAddress != null) { + if (userAddress.getCityId() == null) { + return storePostage; + } + //城市包括默认 + int cityId = userAddress.getCityId(); + List citys = new ArrayList<>(); + citys.add(cityId); + citys.add(0); + + List storeProductVOList = cartInfo + .stream() + .map(YxStoreCartQueryVo::getProductInfo) + .collect(Collectors.toList()); + List tempIdS = storeProductVOList + .stream() + .map(YxStoreProductQueryVo::getTempId) + .collect(Collectors.toList()); + + + //获取商品用到的运费模板 + List shippingTemplatesList = shippingTemplatesService + .list(Wrappers.lambdaQuery() + .in(YxShippingTemplates::getId, tempIdS)); + //获取运费模板区域列表按照城市排序 + List shippingTemplatesRegionList = shippingTemplatesRegionService + .list(Wrappers.lambdaQuery() + .in(YxShippingTemplatesRegion::getTempId, tempIdS) + .in(YxShippingTemplatesRegion::getCityId, citys) + .orderByAsc(YxShippingTemplatesRegion::getCityId)); + //提取运费模板类型 + Map shippingTemplatesMap = shippingTemplatesList + .stream() + .collect(Collectors.toMap(YxShippingTemplates::getId, + YxShippingTemplates::getType)); + //提取运费模板有相同值覆盖 + Map shippingTemplatesRegionMap = + shippingTemplatesRegionList.stream() + .collect(Collectors.toMap(YxShippingTemplatesRegion::getTempId, + YxShippingTemplatesRegion -> YxShippingTemplatesRegion, + (key1, key2) -> key2)); + + + Map templateDTOMap = new HashMap<>(); + for (YxStoreCartQueryVo storeCartVO : cartInfo) { + Integer tempId = storeCartVO.getProductInfo().getTempId(); + + //处理拼团等营销商品没有设置运费模板 + if (tempId == null) { + return storePostage; + } + + //根据模板类型获取相应的数量 + double num = 0d; + if (ShippingTempEnum.TYPE_1.getValue().equals(shippingTemplatesMap.get(tempId))) { + num = storeCartVO.getCartNum().doubleValue(); + } else if (ShippingTempEnum.TYPE_2.getValue().equals(shippingTemplatesMap.get(tempId))) { + num = NumberUtil.mul(storeCartVO.getCartNum(), + storeCartVO.getProductInfo().getAttrInfo().getWeight()).doubleValue(); + } else if (ShippingTempEnum.TYPE_3.getValue().equals(shippingTemplatesMap.get(tempId))) { + num = NumberUtil.mul(storeCartVO.getCartNum(), + storeCartVO.getProductInfo().getAttrInfo().getVolume()).doubleValue(); + } + + YxShippingTemplatesRegion shippingTemplatesRegion = shippingTemplatesRegionMap.get(tempId); + BigDecimal price = NumberUtil.round(NumberUtil.mul(storeCartVO.getCartNum(), + storeCartVO.getTruePrice()), 2); + if (!templateDTOMap.containsKey(tempId)) { + TemplateDto templateDTO = TemplateDto.builder() + .number(num) + .price(price) + .first(shippingTemplatesRegion.getFirst().doubleValue()) + .firstPrice(shippingTemplatesRegion.getFirstPrice()) + ._continue(shippingTemplatesRegion.getContinues().doubleValue()) + .continuePrice(shippingTemplatesRegion.getContinuePrice()) + .tempId(tempId) + .cityId(cityId) + .build(); + templateDTOMap.put(tempId, templateDTO); + } else { + TemplateDto templateDTO = templateDTOMap.get(tempId); + templateDTO.setNumber(templateDTO.getNumber() + num); + templateDTO.setPrice(NumberUtil.add(templateDTO.getPrice().doubleValue(), price)); + } + + + } + + //处理包邮情况 + for (Map.Entry entry : templateDTOMap.entrySet()) { + Integer mapKey = entry.getKey(); + TemplateDto mapValue = entry.getValue(); + + int count = shippingTemplatesFreeService.count(Wrappers.lambdaQuery() + .eq(YxShippingTemplatesFree::getTempId, mapValue.getTempId()) + .eq(YxShippingTemplatesFree::getCityId, mapValue.getCityId()) + .le(YxShippingTemplatesFree::getNumber, mapValue.getNumber()) + .le(YxShippingTemplatesFree::getPrice, mapValue.getPrice())); + //满足包邮条件剔除 + if (count > 0) { + templateDTOMap.remove(mapKey); + } + } + + //处理区域邮费 + boolean isFirst = true; //用来是否多个产品的标识 false表示数量大于1 + for (TemplateDto templateDTO : templateDTOMap.values()) { + if (isFirst) {//首件 + //只满足首件 + if (Double.compare(templateDTO.getNumber(), templateDTO.getFirst()) <= 0) { + storePostage = NumberUtil.round(NumberUtil.add(storePostage, + templateDTO.getFirstPrice()), 2); + } else { + BigDecimal fristPrice = NumberUtil.add(storePostage, templateDTO.getFirstPrice()); + + if (templateDTO.get_continue() <= 0) { + storePostage = fristPrice; + } else { + //续件平均值且向上取整数 + double average = Math.ceil(NumberUtil.div(NumberUtil.sub(templateDTO.getNumber(), + templateDTO.getFirst()), + templateDTO.get_continue().doubleValue())); + //最终邮费 + storePostage = NumberUtil.add(fristPrice, NumberUtil.mul(average, + templateDTO.getContinuePrice())); + } + + } + + isFirst = false; + } else { + //多件直接在以前的基数继续续建 + if (templateDTO.get_continue() > 0) { + //续件平均值且向上取整数 + double average = Math.ceil( + NumberUtil.div( + templateDTO.getNumber(), + templateDTO.get_continue() + ) + ); + //最终邮费 + storePostage = NumberUtil.add(storePostage.doubleValue(), NumberUtil.mul(average, + templateDTO.getContinuePrice())); + } + } + } + } + + + return storePostage; + } + + /** + * 获取某字段价格 + * + * @param cartInfo 购物车 + * @param key key值 + * @return Double + */ + private BigDecimal getOrderSumPrice(List cartInfo, String key) { + BigDecimal sumPrice = BigDecimal.ZERO; + + if ("truePrice".equals(key)) { + for (YxStoreCartQueryVo storeCart : cartInfo) { + sumPrice = NumberUtil.add(sumPrice, NumberUtil.mul(storeCart.getCartNum(), storeCart.getTruePrice())); + } + } else if ("costPrice".equals(key)) { + for (YxStoreCartQueryVo storeCart : cartInfo) { + sumPrice = NumberUtil.add(sumPrice, + NumberUtil.mul(storeCart.getCartNum(), storeCart.getCostPrice())); + } + } else if ("vipTruePrice".equals(key)) { + for (YxStoreCartQueryVo storeCart : cartInfo) { + sumPrice = NumberUtil.add(sumPrice, + NumberUtil.mul(storeCart.getCartNum(), storeCart.getVipTruePrice())); + } + } else if ("payIntegral".equals(key)) { + for (YxStoreCartQueryVo storeCart : cartInfo) { + if (storeCart.getProductInfo().getAttrInfo() != null && storeCart.getProductInfo().getAttrInfo().getIntegral() != null) { + sumPrice = NumberUtil.add(sumPrice, + NumberUtil.mul(storeCart.getCartNum(), storeCart.getProductInfo().getAttrInfo().getIntegral())); + } + + } + } + + return sumPrice; + } + + + //=======================================================// + + + /** + * 根据商品分类统计订单占比 + * + * @return OrderCountDto + */ + @Override + public OrderCountDto getOrderCount() { + //获取所有订单转态为已支付的 + List nameList = storeCartService.findCateName(); + Map childrenMap = new HashMap<>(); + nameList.forEach(i -> { + if (i != null) { + if (childrenMap.containsKey(i.getCatename())) { + childrenMap.put(i.getCatename(), childrenMap.get(i.getCatename()) + 1); + } else { + childrenMap.put(i.getCatename(), 1); + } + } + + }); + List list = new ArrayList<>(); + List columns = new ArrayList<>(); + childrenMap.forEach((k, v) -> { + OrderCountDto.OrderCountData orderCountData = new OrderCountDto.OrderCountData(); + orderCountData.setName(k); + orderCountData.setValue(v); + columns.add(k); + list.add(orderCountData); + }); + OrderCountDto orderCountDto = new OrderCountDto(); + orderCountDto.setColumn(columns); + orderCountDto.setOrderCountDatas(list); + return orderCountDto; + } + + /** + * 首页订单/用户等统计 + * + * @return OrderTimeDataDto + */ + @Override + public OrderTimeDataDto getOrderTimeData() { + OrderTimeDataDto orderTimeDataDto = new OrderTimeDataDto(); + + ShoperOrderTimeDataVo shoperOrderTimeData = this.getShoperOrderTimeData(); + + BeanUtil.copyProperties(shoperOrderTimeData, orderTimeDataDto); + + + orderTimeDataDto.setUserCount(userService.count()); + orderTimeDataDto.setOrderCount(this.count()); + orderTimeDataDto.setPriceCount(yxStoreOrderMapper.sumTotalPrice()); + orderTimeDataDto.setGoodsCount(productService.count()); + + return orderTimeDataDto; + } + + /** + * 返回本月订单金额与数量 + * + * @return map + */ + @Override + public Map chartCount() { + Map map = new LinkedHashMap<>(); + Date nowMonth = DateUtil.beginOfMonth(new Date()); + + map.put("chart", yxStoreOrderMapper.chartList(nowMonth)); + map.put("chartT", yxStoreOrderMapper.chartListT(nowMonth)); + + return map; + } + + @Override + public void retrunStock(String orderId) { + YxStoreOrderQueryVo order = this.getOrderInfo(orderId, null); + this.regressionIntegral(order, 1); + this.regressionStock(order, 1); + this.regressionCoupon(order, 1); + } + + @Override + public Map queryAll(YxStoreOrderQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + List storeOrderDTOS = new ArrayList<>(); + for (YxStoreOrder yxStoreOrder : page.getList()) { + this.orderList(storeOrderDTOS, yxStoreOrder); + + } + Map map = new LinkedHashMap<>(2); + map.put("content", storeOrderDTOS); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + public List queryAll(YxStoreOrderQueryCriteria criteria) { + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreOrder.class, criteria)); + } + + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(YxStoreOrder resources) { + YxStoreOrder yxStoreOrder = this.getById(resources.getId()); + YxStoreOrder yxStoreOrder1 = this.getOne(new LambdaQueryWrapper() + .eq(YxStoreOrder::getUnique, resources.getUnique())); + if (yxStoreOrder1 != null && !yxStoreOrder1.getId().equals(yxStoreOrder.getId())) { + throw new EntityExistException(YxStoreOrder.class, "unique", resources.getUnique()); + } + yxStoreOrder.copy(resources); + this.saveOrUpdate(yxStoreOrder); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxStoreOrderDto yxStoreOrder : all) { + Map map = new LinkedHashMap<>(); + map.put("订单号", yxStoreOrder.getOrderId()); + map.put("用户id", yxStoreOrder.getUid()); + map.put("用户姓名", yxStoreOrder.getRealName()); + map.put("用户电话", yxStoreOrder.getUserPhone()); + map.put("详细地址", yxStoreOrder.getUserAddress()); + map.put("购物车id", yxStoreOrder.getCartId()); + map.put("运费金额", yxStoreOrder.getFreightPrice()); + map.put("订单商品总数", yxStoreOrder.getTotalNum()); + map.put("订单总价", yxStoreOrder.getTotalPrice()); + map.put("邮费", yxStoreOrder.getTotalPostage()); + map.put("实际支付金额", yxStoreOrder.getPayPrice()); + map.put("支付邮费", yxStoreOrder.getPayPostage()); + map.put("抵扣金额", yxStoreOrder.getDeductionPrice()); + map.put("优惠券id", yxStoreOrder.getCouponId()); + map.put("优惠券金额", yxStoreOrder.getCouponPrice()); + map.put("支付状态", yxStoreOrder.getPaid()); + map.put("支付时间", yxStoreOrder.getPayTime()); + map.put("支付方式", yxStoreOrder.getPayType()); + map.put("订单状态(-1 : 申请退款 -2 : 退货成功 0:待发货;1:待收货;2:已收货;3:待评价;-1:已退款)", yxStoreOrder.getStatus()); + map.put("0 未退款 1 申请中 2 已退款", yxStoreOrder.getRefundStatus()); + map.put("退款图片", yxStoreOrder.getRefundReasonWapImg()); + map.put("退款用户说明", yxStoreOrder.getRefundReasonWapExplain()); + map.put("退款时间", yxStoreOrder.getRefundReasonTime()); + map.put("前台退款原因", yxStoreOrder.getRefundReasonWap()); + map.put("不退款的理由", yxStoreOrder.getRefundReason()); + map.put("退款金额", yxStoreOrder.getRefundPrice()); + map.put("快递公司编号", yxStoreOrder.getDeliverySn()); + map.put("快递名称/送货人姓名", yxStoreOrder.getDeliveryName()); + map.put("发货类型", yxStoreOrder.getDeliveryType()); + map.put("快递单号/手机号", yxStoreOrder.getDeliveryId()); + map.put("消费赚取积分", yxStoreOrder.getGainIntegral()); + map.put("使用积分", yxStoreOrder.getUseIntegral()); + map.put("给用户退了多少积分", yxStoreOrder.getBackIntegral()); + map.put("备注", yxStoreOrder.getMark()); + map.put("唯一id(md5加密)类似id", yxStoreOrder.getUnique()); + map.put("管理员备注", yxStoreOrder.getRemark()); + map.put("商户ID", yxStoreOrder.getMerId()); + map.put(" isMerCheck", yxStoreOrder.getIsMerCheck()); + map.put("拼团产品id0一般产品", yxStoreOrder.getCombinationId()); + map.put("拼团id 0没有拼团", yxStoreOrder.getPinkId()); + map.put("成本价", yxStoreOrder.getCost()); + map.put("秒杀产品ID", yxStoreOrder.getSeckillId()); + map.put("砍价id", yxStoreOrder.getBargainId()); + map.put("核销码", yxStoreOrder.getVerifyCode()); + map.put("门店id", yxStoreOrder.getStoreId()); + map.put("配送方式 1=快递 ,2=门店自提", yxStoreOrder.getShippingType()); + map.put("支付渠道(0微信公众号1微信小程序)", yxStoreOrder.getIsChannel()); + map.put(" isRemind", yxStoreOrder.getIsRemind()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + /** + * 获取订单详情 + * + * @param orderId + * @return + */ + @Override + public YxStoreOrderDto getOrderDetail(Long orderId) { + YxStoreOrder yxStoreOrder = this.getById(orderId); + if (ObjectUtil.isEmpty(yxStoreOrder)) { + throw new BadRequestException("订单详情不存在"); + } + YxStoreOrderDto yxStoreOrderDto = generator.convert(yxStoreOrder, YxStoreOrderDto.class); + Integer _status = OrderUtil.orderStatus(yxStoreOrder.getPaid(), yxStoreOrder.getStatus(), + yxStoreOrder.getRefundStatus()); + + if (yxStoreOrder.getStoreId() > 0) { + String storeName = systemStoreService.getById(yxStoreOrder.getStoreId()).getName(); + yxStoreOrderDto.setStoreName(storeName); + } + + //订单状态 + String orderStatusStr = OrderUtil.orderStatusStr(yxStoreOrder.getPaid() + , yxStoreOrder.getStatus(), yxStoreOrder.getShippingType() + , yxStoreOrder.getRefundStatus()); + + if (_status == 3) { + + String refundTime = DateUtil.formatDateTime(yxStoreOrder.getRefundReasonTime()); + String str = "申请退款" + + "退款原因:" + yxStoreOrder.getRefundReasonWap() + "" + + "备注说明:" + yxStoreOrder.getRefundReasonWapExplain() + "" + + "退款时间:" + refundTime + ""; + orderStatusStr = str; + } + yxStoreOrderDto.setStatusName(orderStatusStr); + + yxStoreOrderDto.set_status(_status); + + String payTypeName = OrderUtil.payTypeName(yxStoreOrder.getPayType() + , yxStoreOrder.getPaid()); + yxStoreOrderDto.setPayTypeName(payTypeName); + //订单类型处理 + yxStoreOrderDto.setPinkName(this.orderType(yxStoreOrder.getId() + , yxStoreOrder.getPinkId(), yxStoreOrder.getCombinationId() + , yxStoreOrder.getSeckillId(), yxStoreOrder.getBargainId(), + yxStoreOrder.getShippingType(), yxStoreOrder.getPayIntegral())); + + //添加订单状态 + List storeOrderStatuses = orderStatusService.list(new LambdaQueryWrapper() + .eq(YxStoreOrderStatus::getOid, yxStoreOrder.getId())); + List orderStatusDtos = generator.convert(storeOrderStatuses, YxStoreOrderStatusDto.class); + yxStoreOrderDto.setStoreOrderStatusList(orderStatusDtos); + //添加购物车详情 + List cartInfos = storeOrderCartInfoService.list( + new LambdaQueryWrapper().eq(YxStoreOrderCartInfo::getOid, yxStoreOrder.getId())); + List cartInfoDTOS = new ArrayList<>(); + for (YxStoreOrderCartInfo cartInfo : cartInfos) { + StoreOrderCartInfoDto cartInfoDTO = new StoreOrderCartInfoDto(); + cartInfoDTO.setCartInfoMap(JSON.parseObject(cartInfo.getCartInfo())); + + cartInfoDTOS.add(cartInfoDTO); + } + yxStoreOrderDto.setCartInfoList(cartInfoDTOS); + //添加用户信息 + yxStoreOrderDto.setUserDTO(generator.convert(userService.getById(yxStoreOrder.getUid()), YxUserDto.class)); + if (yxStoreOrderDto.getUserDTO() == null) { + yxStoreOrderDto.setUserDTO(new YxUserDto()); + } + return yxStoreOrderDto; + } + + @Override + public Map queryAll(List ids) { + List yxStoreOrders = this.list(new LambdaQueryWrapper().in(YxStoreOrder::getOrderId, ids)); + List storeOrderDTOS = new ArrayList<>(); + for (YxStoreOrder yxStoreOrder : yxStoreOrders) { + this.orderList(storeOrderDTOS, yxStoreOrder); + } + + Map map = new LinkedHashMap<>(2); + map.put("content", storeOrderDTOS); + + return map; + } + + + /** + * 处理订单 + * + * @param storeOrderDTOS 订单列表 + * @param yxStoreOrder 订单 + */ + private void orderList(List storeOrderDTOS, YxStoreOrder yxStoreOrder) { + YxStoreOrderDto yxStoreOrderDto = generator.convert(yxStoreOrder, YxStoreOrderDto.class); + Integer _status = OrderUtil.orderStatus(yxStoreOrder.getPaid(), yxStoreOrder.getStatus(), + yxStoreOrder.getRefundStatus()); + + if (yxStoreOrder.getStoreId() > 0) { + String storeName = systemStoreService.getById(yxStoreOrder.getStoreId()).getName(); + yxStoreOrderDto.setStoreName(storeName); + } + + //订单状态 + String orderStatusStr = OrderUtil.orderStatusStr(yxStoreOrder.getPaid() + , yxStoreOrder.getStatus(), yxStoreOrder.getShippingType() + , yxStoreOrder.getRefundStatus()); + + if (_status == 3) { + + String refundTime = DateUtil.formatDateTime(yxStoreOrder.getRefundReasonTime()); + String str = "申请退款
" + + "退款原因:" + yxStoreOrder.getRefundReasonWap() + "
" + + "备注说明:" + yxStoreOrder.getRefundReasonWapExplain() + "
" + + "退款时间:" + refundTime + "
"; + orderStatusStr = str; + } + yxStoreOrderDto.setStatusName(orderStatusStr); + + yxStoreOrderDto.set_status(_status); + + String payTypeName = OrderUtil.payTypeName(yxStoreOrder.getPayType() + , yxStoreOrder.getPaid()); + yxStoreOrderDto.setPayTypeName(payTypeName); + //订单类型处理 + yxStoreOrderDto.setPinkName(this.orderType(yxStoreOrder.getId() + , yxStoreOrder.getPinkId(), yxStoreOrder.getCombinationId() + , yxStoreOrder.getSeckillId(), yxStoreOrder.getBargainId(), + yxStoreOrder.getShippingType(), yxStoreOrder.getPayIntegral())); + + List cartInfos = storeOrderCartInfoService.list( + new LambdaQueryWrapper().eq(YxStoreOrderCartInfo::getOid, yxStoreOrder.getId())); + List cartInfoDTOS = new ArrayList<>(); + for (YxStoreOrderCartInfo cartInfo : cartInfos) { + StoreOrderCartInfoDto cartInfoDTO = new StoreOrderCartInfoDto(); + cartInfoDTO.setCartInfoMap(JSON.parseObject(cartInfo.getCartInfo())); + + cartInfoDTOS.add(cartInfoDTO); + } + yxStoreOrderDto.setCartInfoList(cartInfoDTOS); + yxStoreOrderDto.setUserDTO(generator.convert(userService.getById(yxStoreOrder.getUid()), YxUserDto.class)); + if (yxStoreOrderDto.getUserDTO() == null) { + yxStoreOrderDto.setUserDTO(new YxUserDto()); + } + storeOrderDTOS.add(yxStoreOrderDto); + } + + + /** + * 订单状态处理 + * + * @param id 订单id + * @param pinkId 拼团id + * @param combinationId 拼团产品id + * @param seckillId 秒杀id + * @param bargainId 砍价id + * @param shippingType 发货类型 + * @return string + */ + private String orderType(Long id, Long pinkId, Long combinationId, Long seckillId, + Long bargainId, Integer shippingType, BigDecimal payIntegral) { + String str = "[普通订单]"; + if (pinkId > 0 || combinationId > 0) { + YxStorePink storePink = storePinkService.getOne(new LambdaQueryWrapper() + .eq(YxStorePink::getOrderIdKey, id)); + if (ObjectUtil.isNull(storePink)) { + str = "[拼团订单]"; + } else { + if (OrderInfoEnum.PINK_STATUS_1.getValue().equals(storePink.getStatus())) { + str = "[拼团订单]正在进行中"; + } else if (OrderInfoEnum.PINK_STATUS_2.getValue().equals(storePink.getStatus())) { + str = "[拼团订单]已完成"; + } else if (OrderInfoEnum.PINK_STATUS_3.getValue().equals(storePink.getStatus())) { + str = "[拼团订单]未完成"; + } else { + str = "[拼团订单]历史订单"; + } + + } + + } else if (seckillId > 0) { + str = "[秒杀订单]"; + } else if (bargainId > 0) { + str = "[砍价订单]"; + } + + if (OrderInfoEnum.SHIPPIING_TYPE_2.getValue().equals(shippingType)) { + str = "[核销订单]"; + } + if (payIntegral.compareTo(new BigDecimal("0.00")) == 1) { + str = "[积分兑换]"; + } + return str; + } + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderStatusServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderStatusServiceImpl.java new file mode 100644 index 0000000..fb99cdd --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderStatusServiceImpl.java @@ -0,0 +1,94 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.order.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.order.domain.YxStoreOrderStatus; +import co.yixiang.modules.order.service.YxStoreOrderStatusService; +import co.yixiang.modules.order.service.dto.YxStoreOrderStatusDto; +import co.yixiang.modules.order.service.dto.YxStoreOrderStatusQueryCriteria; +import co.yixiang.modules.order.service.mapper.StoreOrderStatusMapper; +import co.yixiang.utils.FileUtil; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxStoreOrderStatusServiceImpl extends BaseServiceImpl implements YxStoreOrderStatusService { + + private final IGenerator generator; + + + /** + * 添加订单操作记录 + * @param oid 订单id + * @param changetype 操作状态 + * @param changeMessage 操作内容 + */ + @Override + public void create(Long oid, String changetype, String changeMessage) { + YxStoreOrderStatus storeOrderStatus = new YxStoreOrderStatus(); + storeOrderStatus.setOid(oid); + storeOrderStatus.setChangeType(changetype); + storeOrderStatus.setChangeMessage(changeMessage); + this.baseMapper.insert(storeOrderStatus); + } + + + + @Override + //@Cacheable + public Map queryAll(YxStoreOrderStatusQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxStoreOrderStatusDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxStoreOrderStatusQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreOrderStatus.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxStoreOrderStatusDto yxStoreOrderStatus : all) { + Map map = new LinkedHashMap<>(); + map.put("订单id", yxStoreOrderStatus.getOid()); + map.put("操作类型", yxStoreOrderStatus.getChangeType()); + map.put("操作备注", yxStoreOrderStatus.getChangeMessage()); + map.put("操作时间", yxStoreOrderStatus.getChangeTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/mapper/ExpressMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/mapper/ExpressMapper.java new file mode 100644 index 0000000..7045a53 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/mapper/ExpressMapper.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.order.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.order.domain.YxExpress; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface ExpressMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/mapper/StoreOrderCartInfoMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/mapper/StoreOrderCartInfoMapper.java new file mode 100644 index 0000000..fe40bdc --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/mapper/StoreOrderCartInfoMapper.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.order.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.order.domain.YxStoreOrderCartInfo; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface StoreOrderCartInfoMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/mapper/StoreOrderMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/mapper/StoreOrderMapper.java new file mode 100644 index 0000000..de63cf3 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/mapper/StoreOrderMapper.java @@ -0,0 +1,74 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.order.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.order.domain.YxStoreOrder; +import co.yixiang.modules.order.service.dto.ChartDataDto; +import co.yixiang.modules.order.vo.OrderDataVo; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.Date; +import java.util.List; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface StoreOrderMapper extends CoreMapper { + + + + @Select("SELECT sum(pay_price) as price,count(id) as count," + + "DATE_FORMAT(create_time, '%m-%d') as time FROM yx_store_order" + + " WHERE is_del = 0 AND paid = 1 AND refund_status = 0 " + + "GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') ORDER BY create_time DESC") + List getOrderDataPriceList(Page page); + + + @Select("SELECT IFNULL(sum(pay_price),0) " + + " FROM yx_store_order ${ew.customSqlSegment}") + Double todayPrice(@Param(Constants.WRAPPER) Wrapper wrapper); + + + + @Select("select IFNULL(sum(pay_price),0) from yx_store_order " + + "where paid=1 and is_del=0 and refund_status=0 and uid=#{uid}") + double sumPrice(@Param("uid") Long uid); + + + @Select("SELECT COUNT(*) FROM yx_store_order WHERE pay_time >= ${today}") + Integer countByPayTimeGreaterThanEqual(@Param("today")int today); + + @Select("SELECT COUNT(*) FROM yx_store_order WHERE pay_time < ${today} and pay_time >= ${yesterday}") + Integer countByPayTimeLessThanAndPayTimeGreaterThanEqual(@Param("today")int today, @Param("yesterday")int yesterday); + + @Select( "select IFNULL(sum(pay_price),0) from yx_store_order " + + "where refund_status=0 and is_del=0 and paid=1") + Double sumTotalPrice(); + + @Select("SELECT IFNULL(sum(pay_price),0) as num," + + "DATE_FORMAT(create_time, '%m-%d') as time " + + " FROM yx_store_order where refund_status=0 and is_del=0 and paid=1 and pay_time >= #{time}" + + " GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') " + + " ORDER BY create_time ASC") + List chartList(@Param("time") Date time); + @Select("SELECT count(id) as num," + + "DATE_FORMAT(create_time, '%m-%d') as time " + + " FROM yx_store_order where refund_status=0 and is_del=0 and paid=1 and pay_time >= #{time}" + + " GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') " + + " ORDER BY create_time ASC") + List chartListT(@Param("time") Date time); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/mapper/StoreOrderStatusMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/mapper/StoreOrderStatusMapper.java new file mode 100644 index 0000000..176e9b4 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/mapper/StoreOrderStatusMapper.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.order.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.order.domain.YxStoreOrderStatus; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface StoreOrderStatusMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/vo/ComputeVo.java b/yshop-mall/src/main/java/co/yixiang/modules/order/vo/ComputeVo.java new file mode 100644 index 0000000..a5f0340 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/vo/ComputeVo.java @@ -0,0 +1,43 @@ +package co.yixiang.modules.order.vo; + +import co.yixiang.serializer.BigDecimalSerializer; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @ClassName ComputeVo + * @Author hupeng <610796224@qq.com> + * @Date 2019/10/27 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ComputeVo implements Serializable { + + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal couponPrice; + + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal deductionPrice; + + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal payPostage; + + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal payPrice; + + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal totalPrice; + + private Double usedIntegral; //使用了多少积分 + + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal payIntegral; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/vo/ConfirmOrderVo.java b/yshop-mall/src/main/java/co/yixiang/modules/order/vo/ConfirmOrderVo.java new file mode 100644 index 0000000..57c9343 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/vo/ConfirmOrderVo.java @@ -0,0 +1,66 @@ +package co.yixiang.modules.order.vo; + +import co.yixiang.modules.activity.vo.StoreCouponUserVo; +import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; +import co.yixiang.modules.order.service.dto.PriceGroupDto; +import co.yixiang.modules.product.vo.YxSystemStoreQueryVo; +import co.yixiang.modules.user.domain.YxUserAddress; +import co.yixiang.modules.user.vo.YxUserQueryVo; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @ClassName ConfirmOrderVo + * @Author hupeng <610796224@qq.com> + * @Date 2019/10/27 + **/ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class ConfirmOrderVo implements Serializable { + //地址信息 + private YxUserAddress addressInfo; + + //砍价id + private Integer bargainId; + + private List cartInfo; + + private Integer combinationId; + + //优惠券减 + private Boolean deduction; + + private Boolean enableIntegral; + + private Double enableIntegralNum; + + //积分抵扣 + private Integer integralRatio; + + private String orderKey; + + private PriceGroupDto priceGroup; + + private Integer seckillId; + + //店铺自提 + private Integer storeSelfMention; + + //店铺信息 + private YxSystemStoreQueryVo systemStore; + + + private StoreCouponUserVo usableCoupon; + + private YxUserQueryVo userInfo; + + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/vo/OrderCartInfoVo.java b/yshop-mall/src/main/java/co/yixiang/modules/order/vo/OrderCartInfoVo.java new file mode 100644 index 0000000..a0e0cd9 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/vo/OrderCartInfoVo.java @@ -0,0 +1,45 @@ +package co.yixiang.modules.order.vo; + +import co.yixiang.modules.order.service.dto.ProductDto; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 订单商品对象 + *

+ * + * @author hupeng + * @date 2019-11-03 + */ +@Data +@Builder +public class OrderCartInfoVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "订单ID") + private String orderId; + + @ApiModelProperty(value = "商品ID") + private Long productId; + + @ApiModelProperty(value = "购物车数量") + private Integer cartNum; + + @ApiModelProperty(value = "拼团产品ID") + private Long combinationId; + + @ApiModelProperty(value = "秒杀产品ID") + private Long seckillId; + + @ApiModelProperty(value = "砍价产品ID") + private Long bargainId; + + @ApiModelProperty(value = "产品信息") + private ProductDto productInfo; + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/vo/OrderDataVo.java b/yshop-mall/src/main/java/co/yixiang/modules/order/vo/OrderDataVo.java new file mode 100644 index 0000000..98de219 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/vo/OrderDataVo.java @@ -0,0 +1,20 @@ +package co.yixiang.modules.order.vo; + +import co.yixiang.serializer.DoubleSerializer; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName OrderDataVo + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/25 + **/ +@Data +public class OrderDataVo implements Serializable { + private Integer count; + @JsonSerialize(using = DoubleSerializer.class) + private Double price; + private String time; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/vo/ShoperOrderTimeDataVo.java b/yshop-mall/src/main/java/co/yixiang/modules/order/vo/ShoperOrderTimeDataVo.java new file mode 100644 index 0000000..978c712 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/vo/ShoperOrderTimeDataVo.java @@ -0,0 +1,38 @@ +package co.yixiang.modules.order.vo; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName OrderTimeDataDTO + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/25 + **/ +@Data +public class ShoperOrderTimeDataVo implements Serializable { + + /**今日成交额*/ + private Double todayPrice; + + /**今日订单数*/ + private Integer todayCount; + + /**昨日成交额*/ + private Double proPrice; + + /**昨日订单数*/ + private Integer proCount; + + /**本月成交额*/ + private Double monthPrice; + + /**本月订单数*/ + private Integer monthCount; + + /**上周订单数*/ + private Integer lastWeekCount; + + /**上周成交额*/ + private Double lastWeekPrice; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/vo/UserOrderCountVo.java b/yshop-mall/src/main/java/co/yixiang/modules/order/vo/UserOrderCountVo.java new file mode 100644 index 0000000..db7182e --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/vo/UserOrderCountVo.java @@ -0,0 +1,55 @@ +package co.yixiang.modules.order.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.io.Serializable; + +/** + * @ClassName OrderCountDTO + * @Author hupeng <610796224@qq.com> + * @Date 2019/10/30 + **/ +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class UserOrderCountVo implements Serializable { + + /**订单支付没有退款 数量*/ + @ApiModelProperty(value = "订单支付没有退款数量") + private Integer orderCount; + + /**订单支付没有退款 支付总金额*/ + @ApiModelProperty(value = "订单支付没有退款支付总金额") + private Double sumPrice; + + /**订单待支付 数量*/ + @ApiModelProperty(value = "订单待支付数量") + private Integer unpaidCount; + + /**订单待发货数量*/ + @ApiModelProperty(value = "订单待发货数量") + private Integer unshippedCount; + + /**订单待收货数量*/ + @ApiModelProperty(value = "订单待收货数量") + private Integer receivedCount; + + /**订单待评价数量*/ + @ApiModelProperty(value = "订单待评价数量") + private Integer evaluatedCount; + + /**订单已完成数量*/ + @ApiModelProperty(value = "订单已完成数量") + private Integer completeCount; + + /**订单退款数量*/ + @ApiModelProperty(value = "订单退款数量") + private Integer refundCount; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/vo/YxStoreOrderCartInfoQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/order/vo/YxStoreOrderCartInfoQueryVo.java new file mode 100644 index 0000000..c330911 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/vo/YxStoreOrderCartInfoQueryVo.java @@ -0,0 +1,39 @@ +package co.yixiang.modules.order.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 订单购物详情表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-10-27 + */ +@Data +@ApiModel(value = "YxStoreOrderCartInfoQueryVo对象", description = "订单购物详情表查询参数") +public class YxStoreOrderCartInfoQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + private Integer id; + + @ApiModelProperty(value = "订单id") + private Integer oid; + + @ApiModelProperty(value = "购物车id") + private Integer cartId; + + @ApiModelProperty(value = "商品ID") + private Integer productId; + + @ApiModelProperty(value = "购买东西的详细信息") + private String cartInfo; + + @ApiModelProperty(value = "唯一id") + private String unique; + +} \ No newline at end of file diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/vo/YxStoreOrderQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/order/vo/YxStoreOrderQueryVo.java new file mode 100644 index 0000000..3539eeb --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/vo/YxStoreOrderQueryVo.java @@ -0,0 +1,209 @@ +package co.yixiang.modules.order.vo; + + +import cn.hutool.core.util.StrUtil; +import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; +import co.yixiang.modules.order.service.dto.StatusDto; +import co.yixiang.modules.product.vo.YxSystemStoreQueryVo; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + *

+ * 订单表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-10-27 + */ +@Data +@ApiModel(value = "YxStoreOrderQueryVo对象", description = "订单表查询参数") +public class YxStoreOrderQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "订单ID") + private Long id; + + @ApiModelProperty(value = "订单号") + private String orderId; + + + private String extendOrderId; + + @ApiModelProperty(value = "用户id") + private Long uid; + + @ApiModelProperty(value = "用户姓名") + private String realName; + + @ApiModelProperty(value = "用户电话") + private String userPhone; + + @ApiModelProperty(value = "详细地址") + private String userAddress; + + @ApiModelProperty(value = "购物车id") + private String cartId; + + private List cartInfo; + + private StatusDto _status; + + @ApiModelProperty(value = "运费金额") + private BigDecimal freightPrice; + + @ApiModelProperty(value = "订单商品总数") + private Integer totalNum; + + @ApiModelProperty(value = "订单总价") + private BigDecimal totalPrice; + + @ApiModelProperty(value = "邮费") + private BigDecimal totalPostage; + + @ApiModelProperty(value = "实际支付金额") + private BigDecimal payPrice; + + @ApiModelProperty(value = "实际支付积分") + private BigDecimal payIntegral; + + @ApiModelProperty(value = "支付邮费") + private BigDecimal payPostage; + + @ApiModelProperty(value = "抵扣金额") + private BigDecimal deductionPrice; + + @ApiModelProperty(value = "优惠券id") + private Integer couponId; + + @ApiModelProperty(value = "优惠券金额") + private BigDecimal couponPrice; + + @ApiModelProperty(value = "支付状态") + private Integer paid; + + @ApiModelProperty(value = "支付时间") + private Date payTime; + + @ApiModelProperty(value = "支付方式") + private String payType; + + @ApiModelProperty(value = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date createTime; + + @ApiModelProperty(value = "订单状态(-1 : 申请退款 -2 : 退货成功 0:待发货;1:待收货;2:已收货;3:待评价;-1:已退款)") + private Integer status; + + @ApiModelProperty(value = "0 未退款 1 申请中 2 已退款") + private Integer refundStatus; + + @ApiModelProperty(value = "退款图片") + private String refundReasonWapImg; + + @ApiModelProperty(value = "退款用户说明") + private String refundReasonWapExplain; + + @ApiModelProperty(value = "退款时间") + private Date refundReasonTime; + + @ApiModelProperty(value = "前台退款原因") + private String refundReasonWap; + + @ApiModelProperty(value = "不退款的理由") + private String refundReason; + + @ApiModelProperty(value = "退款金额") + private BigDecimal refundPrice; + + @ApiModelProperty(value = "快递名称/送货人姓名") + private String deliveryName; + + private String deliverySn; + + @ApiModelProperty(value = "发货类型") + private String deliveryType; + + public String getDeliveryType() { + if(StrUtil.isBlank(deliveryType)) { + return "express"; + } + return deliveryType; + } + + + @ApiModelProperty(value = "快递单号/手机号") + private String deliveryId; + + @ApiModelProperty(value = "消费赚取积分") + private BigDecimal gainIntegral; + + @ApiModelProperty(value = "使用积分") + private BigDecimal useIntegral; + + @ApiModelProperty(value = "给用户退了多少积分") + private BigDecimal backIntegral; + + @ApiModelProperty(value = "备注") + private String mark; + + @ApiModelProperty(value = "唯一id(md5加密)类似id") + private String unique; + + @ApiModelProperty(value = "管理员备注") + private String remark; + + @ApiModelProperty(value = "商户ID") + private Integer merId; + + private Integer isMerCheck; + + @ApiModelProperty(value = "拼团产品id0一般产品") + private Long combinationId; + + @ApiModelProperty(value = "拼团id 0没有拼团") + private Long pinkId; + + @ApiModelProperty(value = "成本价") + private BigDecimal cost; + + @ApiModelProperty(value = "秒杀产品ID") + private Long seckillId; + + @ApiModelProperty(value = "砍价id") + private Long bargainId; + + @ApiModelProperty(value = "核销码") + private String verifyCode; + + @ApiModelProperty(value = "门店id") + private Integer storeId; + + @ApiModelProperty(value = "配送方式 1=快递 ,2=门店自提") + private Integer shippingType; + + + @ApiModelProperty(value = "支付渠道(0微信公众号1微信小程序)") + private Integer isChannel; + + private Integer isRemind; + + private Integer isSystemDel; + + @ApiModelProperty(value = "门店信息与二维码链接") + private String code; + + @ApiModelProperty(value = "腾讯地图key") + private String mapKey; + + @ApiModelProperty(value = "门店信息") + private YxSystemStoreQueryVo systemStore; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/vo/YxStoreOrderStatusQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/order/vo/YxStoreOrderStatusQueryVo.java new file mode 100644 index 0000000..40036c6 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/vo/YxStoreOrderStatusQueryVo.java @@ -0,0 +1,36 @@ +package co.yixiang.modules.order.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 订单操作记录表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-10-27 + */ +@Data +@ApiModel(value = "YxStoreOrderStatusQueryVo对象", description = "订单操作记录表查询参数") +public class YxStoreOrderStatusQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + private Integer id; + + @ApiModelProperty(value = "订单id") + private Integer oid; + + @ApiModelProperty(value = "操作类型") + private String changeType; + + @ApiModelProperty(value = "操作备注") + private String changeMessage; + + @ApiModelProperty(value = "操作时间") + private Integer changeTime; + +} \ No newline at end of file diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProduct.java b/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProduct.java new file mode 100644 index 0000000..454ffc9 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProduct.java @@ -0,0 +1,250 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.product.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import co.yixiang.modules.category.domain.YxStoreCategory; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.validation.constraints.DecimalMax; +import javax.validation.constraints.DecimalMin; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + + +@TableName("yx_store_product") +@Builder +@AllArgsConstructor +@NoArgsConstructor +@Getter +@Setter +public class YxStoreProduct extends BaseDomain { + + /** 商品id */ + @TableId + @ApiModelProperty(value = "商品ID") + private Long id; + + + /** 商户Id(0为总后台管理员创建,不为0的时候是商户后台创建) */ + @ApiModelProperty(value = "商户Id(0为总后台管理员创建,不为0的时候是商户后台创建) 预留字段") + private Integer merId; + + + /** 商品图片 */ + @NotBlank(message = "请上传商品图片") + @ApiModelProperty(value = "商品图片") + private String image; + + + /** 轮播图 */ + @NotBlank(message = "请上传商品轮播图") + @ApiModelProperty(value = "商品轮播图") + private String sliderImage; + + + /** 商品名称 */ + @NotBlank(message = "商品名称不能空") + @ApiModelProperty(value = "商品名称") + private String storeName; + + + /** 商品简介 */ + @ApiModelProperty(value = "商品简介") + private String storeInfo; + + + /** 关键字 */ + @ApiModelProperty(value = "关键字") + private String keyword; + + + /** 产品条码(一维码) */ + @ApiModelProperty(value = "产品条码(一维码)") + private String barCode; + + + /** 分类id */ + @ApiModelProperty(value = "分类id") + private String cateId; + + + /** 商品价格 */ + @ApiModelProperty(value = "商品价格") + @NotNull(message = "请输入商品价格") + @DecimalMin(value="0.00", message = "商品价格不在合法范围内" ) + @DecimalMax(value="99999999.99", message = "商品价格不在合法范围内") + private BigDecimal price; + + + /** 会员价格 */ + @ApiModelProperty(value = "会员价格") + private BigDecimal vipPrice; + + + /** 市场价 */ + @ApiModelProperty(value = "市场价") + @NotNull(message = "请输入市场价") + @DecimalMin(value="0.00", message = "市场价不在合法范围内" ) + @DecimalMax(value="99999999.99", message = "市场价不在合法范围内") + private BigDecimal otPrice; + + + /** 邮费 */ + @ApiModelProperty(value = "邮费") + private BigDecimal postage; + + + /** 单位名 */ + @NotBlank(message = "请填写单位") + @ApiModelProperty(value = "单位名") + private String unitName; + + + /** 排序 */ + @ApiModelProperty(value = "排序") + private Integer sort; + + + /** 销量 */ + @ApiModelProperty(value = "销量") + private Integer sales; + + + /** 库存 */ + @ApiModelProperty(value = "库存") + @NotNull(message = "请输入库存") + @Min(message = "库存不能小于0",value = 1) + private Integer stock; + + + /** 需要多少积分兑换 */ + @ApiModelProperty(value = "需要多少积分兑换 只在开启积分兑换时生效") + private Integer integral; + + + /** 状态(0:未上架,1:上架) */ + @ApiModelProperty(value = "状态(0:未上架,1:上架)") + private Integer isShow; + + + /** 是否热卖 */ + @ApiModelProperty(value = "是否热卖(0:否,1:是)") + private Integer isHot; + + + /** 是否优惠 */ + @ApiModelProperty(value = "是否猜你喜欢(0:否,1:是)") + private Integer isBenefit; + + + /** 是否精品 */ + @ApiModelProperty(value = "是否精品(0:否,1:是)") + private Integer isBest; + + + /** 是否新品 */ + @ApiModelProperty(value = "是否新品(0:否,1:是)") + private Integer isNew; + + + /** 产品描述 */ + @NotBlank(message = "请填写商品详情") + @ApiModelProperty(value = "商品详情") + private String description; + + + /** 是否包邮 */ + @ApiModelProperty(value = "是否包邮") + private Integer isPostage; + + + /** 商户是否代理 0不可代理1可代理 */ + @ApiModelProperty(value = "商户是否代理 0不可代理1可代理 ") + private Integer merUse; + + + /** 获得积分 */ + @ApiModelProperty(value = "获得积分") + @DecimalMin(value="0.00", message = "获得积分不在合法范围内" ) + @DecimalMax(value="99999999.99", message = "获得积分不在合法范围内") + private BigDecimal giveIntegral; + + + /** 成本价 */ + @ApiModelProperty(value = "成本价") + @NotNull(message = "请输入成本价") + @DecimalMin(value="0.00", message = "成本价不在合法范围内" ) + @DecimalMax(value="99999999.99", message = "成本价不在合法范围内") + private BigDecimal cost; + + + /** 秒杀状态 0 未开启 1已开启 */ + @ApiModelProperty(value = "秒杀状态 0 未开启 1已开启") + private Integer isSeckill; + + + /** 砍价状态 0未开启 1开启 */ + @ApiModelProperty(value = "砍价状态 0 未开启 1已开启") + private Integer isBargain; + + + /** 是否优品推荐 */ + @ApiModelProperty(value = "是否优品推荐(0:否,1:是)") + private Integer isGood; + + + /** 虚拟销量 */ + @ApiModelProperty(value = "虚拟销量") + private Integer ficti; + + + /** 浏览量 */ + @ApiModelProperty(value = "浏览量") + private Integer browse; + + + /** 产品二维码地址(用户小程序海报) */ + @ApiModelProperty(value = "品二维码地址(用户小程序海报) ") + private String codePath; + + @ApiModelProperty(value = "邮费模版ID") + private Integer tempId; + + @ApiModelProperty(value = "规格 0单 1多 ") + private Integer specType; + + @ApiModelProperty(value = "是否单独分佣") + private Integer isSub; + + @ApiModelProperty(value = "是否开启积分兑换") + private Integer isIntegral; + + @TableField(exist = false) + private YxStoreCategory storeCategory; + + + public void copy(YxStoreProduct source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProductAttr.java b/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProductAttr.java new file mode 100644 index 0000000..455e06d --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProductAttr.java @@ -0,0 +1,50 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.product.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName("yx_store_product_attr") +public class YxStoreProductAttr implements Serializable { + + @TableId + private Long id; + + + /** 商品ID */ + private Long productId; + + + /** 属性名 */ + private String attrName; + + + /** 属性值 */ + private String attrValues; + + + public void copy(YxStoreProductAttr source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProductAttrResult.java b/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProductAttrResult.java new file mode 100644 index 0000000..a32e203 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProductAttrResult.java @@ -0,0 +1,45 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.product.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Data +@TableName("yx_store_product_attr_result") +public class YxStoreProductAttrResult implements Serializable { + + @TableId + private Long id; + + + /** 商品ID */ + private Long productId; + + + /** 商品属性参数 */ + private String result; + + + /** 上次修改时间 */ + private Date changeTime; + + + public void copy(YxStoreProductAttrResult source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProductAttrValue.java b/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProductAttrValue.java new file mode 100644 index 0000000..44b459b --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProductAttrValue.java @@ -0,0 +1,133 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.product.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.serializer.BigDecimalSerializer; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Builder +@AllArgsConstructor +@NoArgsConstructor +@Getter +@Setter +@TableName("yx_store_product_attr_value") +public class YxStoreProductAttrValue implements Serializable { + + @TableId + private Long id; + + + /** 商品ID */ + @ApiModelProperty(value = "商品ID") + private Long productId; + + + /** 商品属性索引值 (attr_value|attr_value[|....]) */ + @ApiModelProperty(value = "商品属性索引值 (attr_value|attr_value[|....])") + private String sku; + + + /** 属性对应的库存 */ + @ApiModelProperty(value = "属性对应的库存") + private Integer stock; + + /** 拼团库存属性对应的库存 */ + @ApiModelProperty(value = "拼团库存属性对应的库存") + private Integer pinkStock; + + /** 秒杀库存属性对应的库存 */ + @ApiModelProperty(value = "秒杀库存属性对应的库存") + private Integer seckillStock; + + /** 销量 */ + @ApiModelProperty(value = "销量") + private Integer sales; + + + /** 属性金额 */ + @ApiModelProperty(value = "属性金额") + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal price; + + /** 拼团属性对应的金额 */ + @ApiModelProperty(value = "拼团属性对应的金额") + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal pinkPrice; + + /** 秒杀属性对应的金额 */ + @ApiModelProperty(value = "秒杀属性对应的金额") + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal seckillPrice; + + /** 图片 */ + @ApiModelProperty(value = "属性对应的图片") + private String image; + + + /** 唯一值 */ + @TableField(value = "`unique`") + @ApiModelProperty(value = "唯一值") + private String unique; + + + /** 成本价 */ + @ApiModelProperty(value = "成本价") + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal cost; + + /** 商品条码 */ + @ApiModelProperty(value = "商品条码") + private String barCode; + + /** 原价 */ + @ApiModelProperty(value = "原价") + private BigDecimal otPrice; + + /** 重量 */ + @ApiModelProperty(value = "重量") + private BigDecimal weight; + + /** 体积 */ + @ApiModelProperty(value = "体积") + private BigDecimal volume; + + + /** 一级返佣 */ + @ApiModelProperty(value = "一级返佣") + private BigDecimal brokerage; + + /** 二级返佣 */ + @ApiModelProperty(value = "二级返佣") + private BigDecimal brokerageTwo; + + /** 所需多少积分兑换商品 */ + @ApiModelProperty(value = "所需多少积分兑换商品") + private Integer integral; + + + public void copy(YxStoreProductAttrValue source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProductRelation.java b/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProductRelation.java new file mode 100644 index 0000000..0d5465a --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProductRelation.java @@ -0,0 +1,49 @@ +package co.yixiang.modules.product.domain; + + +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +/** + *

+ * 商品点赞和收藏表 + *

+ * + * @author hupeng + * @since 2019-10-23 + */ + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class YxStoreProductRelation extends BaseDomain { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty(value = "用户ID") + private Long uid; + + @ApiModelProperty(value = "商品ID") + private Long productId; + + @ApiModelProperty(value = "类型(收藏(collect)、点赞(like)、足迹(foot))") + private String type; + + @ApiModelProperty(value = "某种类型的商品(普通商品、秒杀商品)") + private String category; + + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProductReply.java b/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProductReply.java new file mode 100644 index 0000000..224b57f --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProductReply.java @@ -0,0 +1,101 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.product.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import co.yixiang.modules.user.domain.YxUser; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Data +@EqualsAndHashCode(callSuper = true) +@AllArgsConstructor +@NoArgsConstructor +@Builder +@TableName("yx_store_product_reply") +public class YxStoreProductReply extends BaseDomain { + + /** 评论ID */ + @TableId + private Long id; + + + /** 用户ID */ + private Long uid; + + + /** 订单ID */ + private Long oid; + + + /** 唯一id */ + @TableField(value = "`unique`") + private String unique; + + + /** 产品id */ + private Long productId; + + + /** 某种商品类型(普通商品、秒杀商品) */ + private String replyType; + + + /** 商品分数 */ + private Integer productScore; + + + /** 服务分数 */ + private Integer serviceScore; + + + /** 评论内容 */ + private String comment; + + + /** 评论图片 */ + private String pics; + + + + /** 管理员回复内容 */ + @NotBlank(message = "回复内容不能为空") + private String merchantReplyContent; + + + /** 管理员回复时间 */ + private Date merchantReplyTime; + + + /** 0未回复1已回复 */ + private Integer isReply; + + @TableField(exist = false) + private YxStoreProduct storeProduct; + + @TableField(exist = false) + private YxUser user; + + public void copy(YxStoreProductReply source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProductRule.java b/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProductRule.java new file mode 100644 index 0000000..76bcf43 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/domain/YxStoreProductRule.java @@ -0,0 +1,51 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.product.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.alibaba.fastjson.JSONArray; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** +* @author hupeng +* @date 2020-06-28 +*/ +@Data +@TableName(value = "yx_store_product_rule",autoResultMap = true) +public class YxStoreProductRule extends BaseDomain { + + @TableId + private Integer id; + + + /** 规格名称 */ + @NotBlank(message = "请输入规则名称") + private String ruleName; + + + /** 规格值 */ + @TableField(typeHandler = FastjsonTypeHandler.class) + @NotNull(message = "规格名称/值必填") + private JSONArray ruleValue; + + + + public void copy(YxStoreProductRule source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/param/YxStoreProductQueryParam.java b/yshop-mall/src/main/java/co/yixiang/modules/product/param/YxStoreProductQueryParam.java new file mode 100644 index 0000000..3ec842e --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/param/YxStoreProductQueryParam.java @@ -0,0 +1,43 @@ +package co.yixiang.modules.product.param; + +import co.yixiang.common.web.param.QueryParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 商品表 查询参数对象 + *

+ * + * @author hupeng + * @date 2019-10-19 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value="YxStoreProductQueryParam对象", description="商品表查询参数") +public class YxStoreProductQueryParam extends QueryParam { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "类别") + private String type; + + @ApiModelProperty(value = "分类ID") + private String sid; + + @ApiModelProperty(value = "是否新品") + private String news; + + @ApiModelProperty(value = "是否积分兑换商品") + private Integer isIntegral; + + @ApiModelProperty(value = "价格排序") + private String priceOrder; + + @ApiModelProperty(value = "销量排序") + private String salesOrder; + + @ApiModelProperty(value = "关键字") + private String keyword; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductAttrResultService.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductAttrResultService.java new file mode 100644 index 0000000..d9f04f6 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductAttrResultService.java @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.product.domain.YxStoreProductAttrResult; + +import java.util.Map; + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxStoreProductAttrResultService extends BaseService{ + + /** + * 新增商品属性详情 + * @param map map + * @param productId 商品id + */ + void insertYxStoreProductAttrResult(Map map, Long productId); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductAttrService.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductAttrService.java new file mode 100644 index 0000000..357e7f0 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductAttrService.java @@ -0,0 +1,66 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.product.domain.YxStoreProductAttr; +import co.yixiang.modules.product.domain.YxStoreProductAttrValue; +import co.yixiang.modules.product.service.dto.FromatDetailDto; +import co.yixiang.modules.product.service.dto.ProductFormatDto; + +import java.util.List; +import java.util.Map; + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxStoreProductAttrService extends BaseService{ + + /** + * 增加库存减去销量 + * @param num 数量 + * @param productId 商品id + * @param unique sku唯一值 + */ + void incProductAttrStock(Integer num, Long productId, String unique,String type); + + /** + * 减少库存增加销量 + * @param num 数量 + * @param productId 商品id + * @param unique sku唯一值 + */ + void decProductAttrStock(int num, Long productId, String unique,String type); + + + /** + * 更加sku 唯一值获取sku对象 + * @param unique 唯一值 + * @return YxStoreProductAttrValue + */ + YxStoreProductAttrValue uniqueByAttrInfo(String unique); + + /** + * 获取商品sku属性 + * @param productId 商品id + * @return map + */ + Map getProductAttrDetail(long productId); + + /** + * 新增商品属性 + * @param items attr + * @param attrs value + * @param productId 商品id + */ + void insertYxStoreProductAttr(List items, List attrs, + Long productId); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductAttrValueService.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductAttrValueService.java new file mode 100644 index 0000000..48dede3 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductAttrValueService.java @@ -0,0 +1,21 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.product.domain.YxStoreProductAttrValue; + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxStoreProductAttrValueService extends BaseService{ + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductRelationService.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductRelationService.java new file mode 100644 index 0000000..90cc825 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductRelationService.java @@ -0,0 +1,93 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.service; + + +import co.yixiang.common.service.BaseService; +import co.yixiang.domain.PageResult; +import co.yixiang.modules.product.domain.YxStoreProductRelation; +import co.yixiang.modules.product.service.dto.YxStoreProductRelationDto; +import co.yixiang.modules.product.service.dto.YxStoreProductRelationQueryCriteria; +import co.yixiang.modules.product.vo.YxStoreProductRelationQueryVo; +import javax.servlet.http.HttpServletResponse; +import org.springframework.data.domain.Pageable; +import java.io.IOException; +import java.util.List; + +/** + *

+ * 商品点赞和收藏表 服务类 + *

+ * + * @author hupeng + * @since 2019-10-23 + */ +public interface YxStoreProductRelationService extends BaseService { + + /** + * 是否收藏 + * @param productId 商品ID + * @param uid 用户ID + * @return Boolean + */ + Boolean isProductRelation(long productId, long uid); + + /** + *添加收藏 + * @param productId 商品id + * @param uid 用户id + */ + void addRroductRelation(long productId,long uid,String category); + + /** + * 取消收藏 + * @param productId 商品id + * @param uid 用户id + */ + void delRroductRelation(long productId,long uid,String category); + + /** + * 获取用户收藏列表 + * @param page page + * @param limit limit + * @param uid 用户id + * @return list + */ + List userCollectProduct(int page, int limit, Long uid,String type); + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + PageResult queryAll(YxStoreProductRelationQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxStoreProductRelationQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + + /** + * 批量删除 + * @param ids / + */ + void collectDelFoot(List ids); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductReplyService.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductReplyService.java new file mode 100644 index 0000000..1b6f1b6 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductReplyService.java @@ -0,0 +1,92 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.product.domain.YxStoreProductReply; +import co.yixiang.modules.product.service.dto.YxStoreProductReplyDto; +import co.yixiang.modules.product.service.dto.YxStoreProductReplyQueryCriteria; +import co.yixiang.modules.product.vo.ReplyCountVo; +import co.yixiang.modules.product.vo.YxStoreProductReplyQueryVo; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxStoreProductReplyService extends BaseService{ + + /** + * 评价数据 + * @param productId 商品id + * @return ReplyCountVO + */ + ReplyCountVo getReplyCount(long productId); + + /** + * 处理评价 + * @param replyQueryVo replyQueryVo + * @return YxStoreProductReplyQueryVo + */ + YxStoreProductReplyQueryVo handleReply(YxStoreProductReplyQueryVo replyQueryVo); + + /** + * 获取单条评价 + * @param productId 商品di + * @return YxStoreProductReplyQueryVo + */ + YxStoreProductReplyQueryVo getReply(long productId); + + /** + * 获取评价列表 + * @param productId 商品id + * @param type 0-全部 1-好评 2-中评 3-差评 + * @param page page + * @param limit limit + * @return list + */ + List getReplyList(long productId,int type,int page, int limit); + + int getInfoCount(Integer oid, String unique); + + int productReplyCount(long productId); + + int replyCount(String unique); + + String replyPer(long productId); + + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxStoreProductReplyQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxStoreProductReplyQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductRuleService.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductRuleService.java new file mode 100644 index 0000000..549e415 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductRuleService.java @@ -0,0 +1,50 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.product.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.product.domain.YxStoreProductRule; +import co.yixiang.modules.product.service.dto.YxStoreProductRuleDto; +import co.yixiang.modules.product.service.dto.YxStoreProductRuleQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-06-28 +*/ +public interface YxStoreProductRuleService extends BaseService { + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxStoreProductRuleQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxStoreProductRuleQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductService.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductService.java new file mode 100644 index 0000000..54e81fd --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/YxStoreProductService.java @@ -0,0 +1,151 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.product.domain.YxStoreProduct; +import co.yixiang.modules.product.param.YxStoreProductQueryParam; +import co.yixiang.modules.product.service.dto.StoreProductDto; +import co.yixiang.modules.product.service.dto.YxStoreProductDto; +import co.yixiang.modules.product.service.dto.YxStoreProductQueryCriteria; +import co.yixiang.modules.product.vo.ProductVo; +import co.yixiang.modules.product.vo.YxStoreProductQueryVo; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxStoreProductService extends BaseService{ + + /** + * 增加库存 减少销量 + * @param num 数量 + * @param productId 商品id + * @param unique sku唯一值 + */ + void incProductStock(Integer num, Long productId, String unique,Long activityId, String type); + + /** + * 减少库存与增加销量 + * @param num 数量 + * @param productId 商品id + * @param unique sku + */ + void decProductStock(int num, Long productId, String unique,Long activityId,String type); + + YxStoreProduct getProductInfo(Long id); + + /** + * 获取单个商品 + * @param id 商品id + * @return YxStoreProductQueryVo + */ + YxStoreProductQueryVo getStoreProductById(Long id); + + /** + * 返回普通商品库存 + * @param productId 商品id + * @param unique sku唯一值 + * @return int + */ + int getProductStock(Long productId, String unique,String type); + + /** + * 商品列表 + * @param productQueryParam YxStoreProductQueryParam + * @return list + */ + List getGoodsList(YxStoreProductQueryParam productQueryParam); + + /** + * 商品详情 + * @param id 商品id + * @param uid 用户id + * @param latitude 纬度 + * @param longitude 经度 + * @return ProductVo + */ + ProductVo goodsDetail(Long id, Long uid, String latitude, String longitude); + + /** + * 商品浏览量 + * @param productId + */ + void incBrowseNum(Long productId); + + /** + * 商品列表 + * @param page 页码 + * @param limit 条数 + * @param order ProductEnum + * @return List + */ + List getList(int page, int limit, int order); + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxStoreProductQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxStoreProductQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + + + /** + * 商品上架下架 + * @param id 商品id + * @param status ShopCommonEnum + */ + void onSale(Long id,Integer status); + + /** + * 获取生成的属性 + * @param id 商品id + * @param jsonStr jsonStr + * @return map + */ + Map getFormatAttr(Long id, String jsonStr,boolean isActivity); + + + + + /** + * 新增/保存商品 + * @param storeProductDto 商品 + */ + void insertAndEditYxStoreProduct(StoreProductDto storeProductDto); + + /**+ + * 删除商品转发海报 + * @param id + */ + void deleteForwardImg(Long id); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/AttrValueDto.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/AttrValueDto.java new file mode 100644 index 0000000..6b3f48c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/AttrValueDto.java @@ -0,0 +1,19 @@ +package co.yixiang.modules.product.service.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @ClassName AttrValueDTO + * @Author hupeng <610796224@qq.com> + * @Date 2019/10/23 + **/ +@Data +public class AttrValueDto { + + @ApiModelProperty(value = "属性") + private String attr; + + @ApiModelProperty(value = "是否选择") + private Boolean check = false; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/DetailDto.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/DetailDto.java new file mode 100644 index 0000000..7b8cc9c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/DetailDto.java @@ -0,0 +1,25 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.product.service.dto; + +import lombok.Data; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName DetailDTO + * @Author hupeng <610796224@qq.com> + * @Date 2019/10/12 + **/ +@Data +public class DetailDto { + private List data; + + //private List>>> res; + + private List>> res; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/FromatDetailDto.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/FromatDetailDto.java new file mode 100644 index 0000000..bfc74d9 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/FromatDetailDto.java @@ -0,0 +1,36 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.product.service.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.List; + +/** + * @ClassName FromatDetailDTO + * @Author hupeng <610796224@qq.com> + * @Date 2019/10/12 + **/ + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class FromatDetailDto { + private String attrHidden; + + private String detailValue; + + private List detail; + + private String value; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/ProductDto.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/ProductDto.java new file mode 100644 index 0000000..397045b --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/ProductDto.java @@ -0,0 +1,150 @@ +package co.yixiang.modules.product.service.dto; + + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.List; +import java.util.Map; + +/** + * 商品对象VO + * + * @author hupeng + * @date 2020-04-25 + */ +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Setter +public class ProductDto +{ + + /** 商品id */ + private Long id; + + + /** 商品图片 */ + private String image; + + /** 轮播图 */ + @JsonProperty("slider_image") + private List sliderImage; + + /** 商品名称 */ + @JsonProperty("store_name") + private String storeName; + + /** 商品简介 */ + @JsonProperty("store_info") + private String storeInfo; + + /** 关键字 */ + private String keyword; + + /** 商品条码(一维码) */ + @JsonProperty("bar_code") + private String barCode; + + /** 分类id */ + @JsonProperty("cate_id") + private String cateId; + + /** 商品价格 */ + private Double price; + + + /** 市场价 */ + @JsonProperty("ot_price") + private Double otPrice; + + /** 邮费 */ + private Double postage; + + /** 单位名 */ + @JsonProperty("unit_name") + private String unitName; + + /** 排序 */ + private Long sort; + + /** 销量 */ + private Long sales; + + /** 库存 */ + private Long stock; + + /** 状态(0:未上架,1:上架) */ + @JsonProperty("is_show") + private Integer isShow; + + /** 是否热卖 */ + @JsonProperty("is_hot") + private Integer isHot; + + /** 是否优惠 */ + @JsonProperty("is_benefit") + private Integer isBenefit; + + /** 是否精品 */ + @JsonProperty("is_best") + private Integer isBest; + + /** 是否新品 */ + @JsonProperty("is_new") + private Integer isNew; + + /** 商品描述 */ + private String description; + + + /** 是否包邮 */ + @JsonProperty("is_postage") + private Integer isPostage; + + + /** 获得积分 */ + @JsonProperty("give_integral") + private Double giveIntegral; + + /** 成本价 */ + private Double cost; + + + /** 是否优品推荐 */ + @JsonProperty("is_good") + private Integer isGood; + + /** 是否单独分佣 */ + @JsonProperty("is_sub") + private Integer isSub; + + /** 是否开启啊积分兑换 */ + @JsonProperty("is_integral") + private Integer isIntegral; + + /** 虚拟销量 */ + private Long ficti; + + + /** 运费模板ID */ + @JsonProperty("temp_id") + private Long tempId; + + /** 规格 0单 1多 */ + @JsonProperty("spec_type") + private Integer specType; + + private ProductFormatDto attr; + + private List items; + + private List attrs; + + + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/ProductFormatDto.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/ProductFormatDto.java new file mode 100644 index 0000000..af3940c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/ProductFormatDto.java @@ -0,0 +1,71 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.product.service.dto; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.Map; + +/** + * @ClassName ProductFormatDTO + * @Author hupeng <610796224@qq.com> + * @Date 2019/10/12 + **/ + +@Builder +@AllArgsConstructor +@NoArgsConstructor +@Getter +@Setter +public class ProductFormatDto { + + private String sku = ""; + + @JsonProperty("bar_code") + private String barCode = ""; + + private Double brokerage = 0d; + + @JsonProperty("brokerage_two") + private Double brokerageTwo = 0d; + + private Double price = 0d; + + @JsonProperty("ot_price") + private Double otPrice = 0d; + + private Double cost = 0d; + + private Integer stock = 0; + + private Integer integral = 0; + + private String pic = ""; + + private String value1 = ""; + + private String value2 = ""; + + private Double volume = 0d; + + private Double weight = 0d; + @JsonProperty("pink_price") + private Double pinkPrice = 0d; + @JsonProperty("pink_stock") + private Integer pinkStock = 0; + @JsonProperty("seckill_price") + private Double seckillPrice = 0d; + @JsonProperty("seckill_stock") + private Integer seckillStock = 0; + + private Map detail; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/ProductResultDto.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/ProductResultDto.java new file mode 100644 index 0000000..4e791ac --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/ProductResultDto.java @@ -0,0 +1,26 @@ +package co.yixiang.modules.product.service.dto; + +import io.swagger.models.auth.In; +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; + +/** + * @ClassName 产品结果DTO + * @Author hupeng <610796224@qq.com> + * @Date 2020/4/24 + **/ +@Getter +@Setter +@Builder +public class ProductResultDto { + private Double minPrice; + + private Double minOtPrice; + + private Double minCost; + + private Integer stock; + + private Integer minIntegral; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/StoreProductDto.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/StoreProductDto.java new file mode 100644 index 0000000..06e22bf --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/StoreProductDto.java @@ -0,0 +1,150 @@ +package co.yixiang.modules.product.service.dto; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + + +/** + * 商品对象DTO + * + * @author hupeng + * @date 2020-04-23 + */ +@Getter +@Setter +@ToString +public class StoreProductDto +{ + + /** 商品id */ + private Long id; + + + /** 商品图片 */ + @NotBlank(message = "商品图片必传") + private String image; + + /** 轮播图 */ + @NotNull(message = "轮播图不为空") + @JsonProperty("slider_image") + private List sliderImage; + + /** 商品名称 */ + @NotBlank(message = "商品名称不能为空") + @JsonProperty("store_name") + private String storeName; + + /** 商品简介 */ + @JsonProperty("store_info") + private String storeInfo; + + /** 关键字 */ + @NotBlank(message = "关键字不能为空") + private String keyword; + + /** 商品条码(一维码) */ + @JsonProperty("bar_code") + private String barCode; + + /** 分类id */ + @NotNull(message = "分类id不能为空") + @JsonProperty("cate_id") + private String cateId; + + /** 商品价格 */ + private Double price; + + /** 市场价 */ + private Double otPrice; + + /** 邮费 */ + private Double postage; + + /** 单位名 */ + @JsonProperty("unit_name") + private String unitName; + + /** 排序 */ + private Long sort; + + /** 销量 */ + private Long sales; + + /** 库存 */ + private Long stock; + + /** 状态(0:未上架,1:上架) */ + @JsonProperty("is_show") + private Integer isShow; + + /** 是否热卖 */ + @JsonProperty("is_hot") + private Integer isHot; + + /** 是否优惠 */ + @JsonProperty("is_benefit") + private Integer isBenefit; + + /** 是否精品 */ + @JsonProperty("is_best") + private Integer isBest; + + /** 是否新品 */ + @JsonProperty("is_new") + private Integer isNew; + + /** 商品描述 */ + @NotBlank(message = "商品详情不能为空") + private String description; + + + /** 是否包邮 */ + @JsonProperty("is_postage") + private Integer isPostage; + + /** 获得积分 */ + @JsonProperty("give_integral") + private Double giveIntegral; + + /** 成本价 */ + private Double cost; + + + /** 是否优品推荐 */ + @JsonProperty("is_good") + private Integer isGood; + + /** 是否单独分佣 */ + @JsonProperty("is_sub") + private Integer isSub; + + /** 是否开启啊积分兑换 */ + @JsonProperty("is_integral") + private Integer isIntegral; + + /** 虚拟销量 */ + private Long ficti; + + /** 运费模板ID */ + @JsonProperty("temp_id") + private Long tempId; + + /** 规格 0单 1多 */ + @JsonProperty("spec_type") + private Integer specType; + + //属性项目 + private List items; + + //sku结果集 + private List attrs; + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductAttrQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductAttrQueryCriteria.java new file mode 100644 index 0000000..cad0c0c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductAttrQueryCriteria.java @@ -0,0 +1,12 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.product.service.dto; + +import lombok.Data; + +@Data +public class YxStoreProductAttrQueryCriteria { +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductAttrValueQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductAttrValueQueryCriteria.java new file mode 100644 index 0000000..758b73d --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductAttrValueQueryCriteria.java @@ -0,0 +1,12 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.product.service.dto; + +import lombok.Data; + +@Data +public class YxStoreProductAttrValueQueryCriteria { +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductDto.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductDto.java new file mode 100644 index 0000000..0de3ae9 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductDto.java @@ -0,0 +1,134 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.product.service.dto; + +import co.yixiang.modules.category.service.dto.YxStoreCategorySmallDto; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxStoreProductDto implements Serializable { + + /** 商品id */ + private Integer id; + + /** 商户Id(0为总后台管理员创建,不为0的时候是商户后台创建) */ + private Integer merId; + + /** 商品图片 */ + private String image; + + /** 轮播图 */ + private String sliderImage; + + /** 商品名称 */ + private String storeName; + + /** 商品简介 */ + private String storeInfo; + + /** 关键字 */ + private String keyword; + + /** 产品条码(一维码) */ + private String barCode; + + /** 分类id */ + private String cateId; + + /** 商品价格 */ + private BigDecimal price; + + /** 会员价格 */ + private BigDecimal vipPrice; + + /** 市场价 */ + private BigDecimal otPrice; + + /** 邮费 */ + private BigDecimal postage; + + /** 单位名 */ + private String unitName; + + /** 排序 */ + private Integer sort; + + /** 销量 */ + private Integer sales; + + /** 库存 */ + private Integer stock; + + /** 状态(0:未上架,1:上架) */ + private Integer isShow; + + /** 是否热卖 */ + private Integer isHot; + + /** 是否优惠 */ + private Integer isBenefit; + + /** 是否精品 */ + private Integer isBest; + + /** 是否新品 */ + private Integer isNew; + + /** 产品描述 */ + private String description; + + /** 添加时间 */ + private Integer addTime; + + /** 是否包邮 */ + private Integer isPostage; + + /** 是否删除 */ + private Integer isDel; + + /** 商户是否代理 0不可代理1可代理 */ + private Integer merUse; + + /** 获得积分 */ + private BigDecimal giveIntegral; + + /** 成本价 */ + private BigDecimal cost; + + /** 秒杀状态 0 未开启 1已开启 */ + private Integer isSeckill; + + /** 砍价状态 0未开启 1开启 */ + private Integer isBargain; + + /** 是否优品推荐 */ + private Integer isGood; + + /** 虚拟销量 */ + private Integer ficti; + + /** 浏览量 */ + private Integer browse; + + /** 产品二维码地址(用户小程序海报) */ + private String codePath; + + /** 淘宝京东1688类型 */ + private String soureLink; + + @ApiModelProperty(value = "是否开启积分兑换") + private Integer isIntegral; + + private YxStoreCategorySmallDto storeCategory; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductQueryCriteria.java new file mode 100644 index 0000000..abb2fae --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductQueryCriteria.java @@ -0,0 +1,34 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.product.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxStoreProductQueryCriteria{ + + // 模糊 + @Query(type = Query.Type.INNER_LIKE) + private String storeName; + + // 精确 + @Query + private Integer isDel; + + @Query + private Integer isShow; + + @Query + private Integer cateId; + + @Query + private Integer isIntegral; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductRelationDto.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductRelationDto.java new file mode 100644 index 0000000..34ef76a --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductRelationDto.java @@ -0,0 +1,54 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.service.dto; + +import co.yixiang.modules.product.domain.YxStoreProduct; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.sql.Timestamp; +import java.io.Serializable; + +/** + * @author hupeng + * @date 2020-09-03 + */ +@Data +public class YxStoreProductRelationDto implements Serializable { + + private Long id; + + /** 用户ID */ + private Long uid; + + private String userName; + + /** 商品ID */ + private Long productId; + + private YxStoreProduct product; + + /** 类型(收藏(collect)、点赞(like)) */ + private String type; + + /** 某种类型的商品(普通商品、秒杀商品) */ + private String category; + + /** 添加时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Timestamp createTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Timestamp updateTime; + + private Integer isDel; +} + diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductRelationQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductRelationQueryCriteria.java new file mode 100644 index 0000000..931117c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductRelationQueryCriteria.java @@ -0,0 +1,23 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.service.dto; + +import lombok.Data; +import java.util.List; +import co.yixiang.annotation.Query; + +/** + * @author hupeng + * @date 2020-09-03 + */ +@Data +public class YxStoreProductRelationQueryCriteria{ + @Query(type = Query.Type.EQUAL) + private String type; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductReplyDto.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductReplyDto.java new file mode 100644 index 0000000..e748dc0 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductReplyDto.java @@ -0,0 +1,67 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.product.service.dto; + +import co.yixiang.modules.user.service.dto.YxUserSmallDto; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxStoreProductReplyDto implements Serializable { + + // 评论ID + private Long id; + + // 用户ID + private Long uid; + + private YxUserSmallDto user; + + // 订单ID + private Long oid; + + // 唯一id + private String unique; + + // 产品id + private Long productId; + + private YxStoreProductSmallDto storeProduct; + + + // 某种商品类型(普通商品、秒杀商品) + private String replyType; + + // 商品分数 + private Integer productScore; + + // 服务分数 + private Integer serviceScore; + + // 评论内容 + private String comment; + + // 评论图片 + private String pics; + + // 评论时间 + private Date createTime; + + // 管理员回复内容 + private String merchantReplyContent; + + // 管理员回复时间 + private Date merchantReplyTime; + + // 0未回复1已回复 + private Integer isReply; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductReplyQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductReplyQueryCriteria.java new file mode 100644 index 0000000..cf26526 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductReplyQueryCriteria.java @@ -0,0 +1,19 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.product.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxStoreProductReplyQueryCriteria{ + @Query + private Integer isDel; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductRuleDto.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductRuleDto.java new file mode 100644 index 0000000..925c506 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductRuleDto.java @@ -0,0 +1,37 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.product.service.dto; + +import com.alibaba.fastjson.JSONArray; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @author hupeng +* @date 2020-06-28 +*/ +@Data +public class YxStoreProductRuleDto implements Serializable { + + private Integer id; + + /** 规格名称 */ + private String ruleName; + + /** 规格值 */ + private JSONArray ruleValue; + + private Timestamp createTime; + + private Timestamp updateTime; + + private Integer isDel; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductRuleQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductRuleQueryCriteria.java new file mode 100644 index 0000000..8db286a --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductRuleQueryCriteria.java @@ -0,0 +1,19 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.product.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-06-28 +*/ +@Data +public class YxStoreProductRuleQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductSmallDto.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductSmallDto.java new file mode 100644 index 0000000..ffa8bfd --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductSmallDto.java @@ -0,0 +1,31 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.product.service.dto; + +import lombok.Data; + +import java.io.Serializable; + + +/** +* @author hupeng +* @date 2019-10-04 +*/ +@Data +public class YxStoreProductSmallDto implements Serializable { + + // 商品id + private Integer id; + + // 商品图片 + private String image; + + + // 商品名称 + private String storeName; + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductAttrResultServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductAttrResultServiceImpl.java new file mode 100644 index 0000000..e281ffe --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductAttrResultServiceImpl.java @@ -0,0 +1,59 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.modules.product.domain.YxStoreProductAttrResult; +import co.yixiang.modules.product.service.YxStoreProductAttrResultService; +import co.yixiang.modules.product.service.mapper.StoreProductAttrResultMapper; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; +import java.util.Map; + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxStoreProductAttrResultServiceImpl extends BaseServiceImpl implements YxStoreProductAttrResultService { + + /** + * 新增商品属性详情 + * @param map map + * @param productId 商品id + */ + @Override + public void insertYxStoreProductAttrResult(Map map, Long productId) + { + YxStoreProductAttrResult yxStoreProductAttrResult = new YxStoreProductAttrResult(); + yxStoreProductAttrResult.setProductId(productId); + yxStoreProductAttrResult.setResult(JSON.toJSONString(map)); + yxStoreProductAttrResult.setChangeTime(new Date()); + + int count = this.count(Wrappers.lambdaQuery() + .eq(YxStoreProductAttrResult::getProductId,productId)); + if(count > 0) { + this.remove(Wrappers.lambdaQuery() + .eq(YxStoreProductAttrResult::getProductId,productId)); + } + + this.save(yxStoreProductAttrResult); + } + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductAttrServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductAttrServiceImpl.java new file mode 100644 index 0000000..dfe4d2f --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductAttrServiceImpl.java @@ -0,0 +1,263 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.BusinessException; +import co.yixiang.api.YshopException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.ProductTypeEnum; +import co.yixiang.exception.BadRequestException; +import co.yixiang.modules.product.domain.YxStoreProductAttr; +import co.yixiang.modules.product.domain.YxStoreProductAttrValue; +import co.yixiang.modules.product.service.YxStoreProductAttrResultService; +import co.yixiang.modules.product.service.YxStoreProductAttrService; +import co.yixiang.modules.product.service.YxStoreProductAttrValueService; +import co.yixiang.modules.product.service.dto.AttrValueDto; +import co.yixiang.modules.product.service.dto.FromatDetailDto; +import co.yixiang.modules.product.service.dto.ProductFormatDto; +import co.yixiang.modules.product.service.mapper.StoreProductAttrMapper; +import co.yixiang.modules.product.service.mapper.StoreProductAttrValueMapper; +import co.yixiang.modules.product.vo.YxStoreProductAttrQueryVo; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) +public class YxStoreProductAttrServiceImpl extends BaseServiceImpl implements YxStoreProductAttrService { + + @Autowired + private IGenerator generator; + + @Autowired + private StoreProductAttrMapper yxStoreProductAttrMapper; + @Autowired + private StoreProductAttrValueMapper yxStoreProductAttrValueMapper; + + @Autowired + private YxStoreProductAttrValueService storeProductAttrValueService; + @Autowired + private YxStoreProductAttrResultService storeProductAttrResultService; + + /** + * 新增商品属性 + * @param items attr + * @param attrs value + * @param productId 商品id + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void insertYxStoreProductAttr(List items, List attrs, + Long productId) + { + List attrGroup = new ArrayList<>(); + for (FromatDetailDto fromatDetailDto : items) { + YxStoreProductAttr yxStoreProductAttr = YxStoreProductAttr.builder() + .productId(productId) + .attrName(fromatDetailDto.getValue()) + .attrValues(StrUtil.join(",",fromatDetailDto.getDetail())) + .build(); + + attrGroup.add(yxStoreProductAttr); + } + + /*int count = storeProductAttrValueService.count(Wrappers.lambdaQuery().eq(YxStoreProductAttrValue::getProductId, productId)); + if (count > 0 ) { + throw new BadRequestException("该产品已被添加到其他活动,禁止操作!"); + }*/ + + List valueGroup = new ArrayList<>(); + for (ProductFormatDto productFormatDto : attrs) { + + if(productFormatDto.getPinkStock()>productFormatDto.getStock() || productFormatDto.getSeckillStock()>productFormatDto.getStock()){ + throw new BadRequestException("活动商品库存不能大于原有商品库存"); + } + List stringList = new ArrayList<>(productFormatDto.getDetail().values()); + Collections.sort(stringList); + + YxStoreProductAttrValue yxStoreProductAttrValue = YxStoreProductAttrValue.builder() + .productId(productId) + .sku(StrUtil.join(",",stringList)) + .price(BigDecimal.valueOf(productFormatDto.getPrice())) + .cost(BigDecimal.valueOf(productFormatDto.getCost())) + .otPrice(BigDecimal.valueOf(productFormatDto.getOtPrice())) + .unique(IdUtil.simpleUUID()) + .image(productFormatDto.getPic()) + .barCode(productFormatDto.getBarCode()) + .weight(BigDecimal.valueOf(productFormatDto.getWeight())) + .volume(BigDecimal.valueOf(productFormatDto.getVolume())) + .brokerage(BigDecimal.valueOf(productFormatDto.getBrokerage())) + .brokerageTwo(BigDecimal.valueOf(productFormatDto.getBrokerageTwo())) + .stock(productFormatDto.getStock()) + .integral(productFormatDto.getIntegral()) + .pinkPrice(BigDecimal.valueOf(productFormatDto.getPinkPrice()==null?0:productFormatDto.getPinkPrice())) + .seckillPrice(BigDecimal.valueOf(productFormatDto.getSeckillPrice()==null?0:productFormatDto.getSeckillPrice())) + .pinkStock(productFormatDto.getPinkStock()==null?0:productFormatDto.getPinkStock()) + .seckillStock(productFormatDto.getSeckillStock()==null?0:productFormatDto.getSeckillStock()) + .build(); + + + valueGroup.add(yxStoreProductAttrValue); + } + + if(attrGroup.isEmpty() || valueGroup.isEmpty()){ + throw new BusinessException("请设置至少一个属性!"); + } + + //清理属性 + this.clearProductAttr(productId); + + //批量添加 + this.saveBatch(attrGroup); + storeProductAttrValueService.saveBatch(valueGroup); + + Map map = new LinkedHashMap<>(); + map.put("attr",items); + map.put("value",attrs); + + storeProductAttrResultService.insertYxStoreProductAttrResult(map,productId); + } + + /** + * 删除YxStoreProductAttrValue表的属性 + * @param productId 商品id + */ + private void clearProductAttr(Long productId) { + if(ObjectUtil.isNull(productId)) { + throw new YshopException("产品不存在"); + } + + yxStoreProductAttrMapper.delete(Wrappers.lambdaQuery() + .eq(YxStoreProductAttr::getProductId,productId)); + yxStoreProductAttrValueMapper.delete(Wrappers.lambdaQuery() + .eq(YxStoreProductAttrValue::getProductId,productId)); + + } + + + /** + * 增加库存减去销量 + * @param num 数量 + * @param productId 商品id + * @param unique sku唯一值 + */ + @Override + public void incProductAttrStock(Integer num, Long productId, String unique, String type ) { + + if(ProductTypeEnum.COMBINATION.getValue().equals(type)){ + yxStoreProductAttrValueMapper.incCombinationStockDecSales(num,productId,unique); + }else if(ProductTypeEnum.SECKILL.getValue().equals(type)){ + yxStoreProductAttrValueMapper.incSeckillStockDecSales(num,productId,unique); + }else { + yxStoreProductAttrValueMapper.incStockDecSales(num,productId,unique); + } + } + + /** + * 减少库存增加销量(针对sku操作) + * @param num 数量 + * @param productId 商品id + * @param unique sku唯一值 + */ + @Override + public void decProductAttrStock(int num, Long productId, String unique,String type) { + int res = 0; + if(ProductTypeEnum.COMBINATION.getValue().equals(type)){ + res = yxStoreProductAttrValueMapper.decCombinationStockIncSales(num,productId,unique); + }else if(ProductTypeEnum.SECKILL.getValue().equals(type)){ + res = yxStoreProductAttrValueMapper.decSeckillStockIncSales(num,productId,unique); + }else { + res = yxStoreProductAttrValueMapper.decStockIncSales(num,productId,unique); + } + if(res == 0) { + throw new YshopException("商品库存不足"); + } + } + + + + /** + * 更加sku 唯一值获取sku对象 + * @param unique 唯一值 + * @return YxStoreProductAttrValue + */ + @Override + public YxStoreProductAttrValue uniqueByAttrInfo(String unique) { + return yxStoreProductAttrValueMapper.selectOne(Wrappers.lambdaQuery() + .eq(YxStoreProductAttrValue::getUnique,unique)); + } + + + /** + * 获取商品sku属性 + * @param productId 商品id + * @return map + */ + @Override + public Map getProductAttrDetail(long productId) { + + List storeProductAttrs = yxStoreProductAttrMapper + .selectList(Wrappers.lambdaQuery() + .eq(YxStoreProductAttr::getProductId,productId) + .orderByAsc(YxStoreProductAttr::getAttrValues)); + + List productAttrValues = storeProductAttrValueService + .list(Wrappers.lambdaQuery() + .eq(YxStoreProductAttrValue::getProductId,productId)); + + + Map map = productAttrValues.stream() + .collect(Collectors.toMap(YxStoreProductAttrValue::getSku, p -> p)); + + List yxStoreProductAttrQueryVoList = new ArrayList<>(); + + for (YxStoreProductAttr attr : storeProductAttrs) { + List stringList = Arrays.asList(attr.getAttrValues().split(",")); + List attrValueDTOS = new ArrayList<>(); + for (String str : stringList) { + AttrValueDto attrValueDTO = new AttrValueDto(); + attrValueDTO.setAttr(str); + attrValueDTOS.add(attrValueDTO); + } + YxStoreProductAttrQueryVo attrQueryVo = generator.convert(attr,YxStoreProductAttrQueryVo.class); + attrQueryVo.setAttrValue(attrValueDTOS); + attrQueryVo.setAttrValueArr(stringList); + + yxStoreProductAttrQueryVoList.add(attrQueryVo); + } + + Map returnMap = new LinkedHashMap<>(2); + returnMap.put("productAttr",yxStoreProductAttrQueryVoList); + returnMap.put("productValue",map); + + return returnMap; + } + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductAttrValueServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductAttrValueServiceImpl.java new file mode 100644 index 0000000..6e8950e --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductAttrValueServiceImpl.java @@ -0,0 +1,31 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.modules.product.domain.YxStoreProductAttrValue; +import co.yixiang.modules.product.service.YxStoreProductAttrValueService; +import co.yixiang.modules.product.service.mapper.StoreProductAttrValueMapper; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxStoreProductAttrValueServiceImpl extends BaseServiceImpl implements YxStoreProductAttrValueService { + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductRelationServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductRelationServiceImpl.java new file mode 100644 index 0000000..709c3fb --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductRelationServiceImpl.java @@ -0,0 +1,174 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.service.impl; + +import co.yixiang.api.YshopException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.domain.PageResult; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.product.domain.YxStoreProductRelation; +import co.yixiang.modules.product.service.YxStoreProductRelationService; +import co.yixiang.modules.product.service.YxStoreProductService; +import co.yixiang.modules.product.service.dto.YxStoreProductRelationDto; +import co.yixiang.modules.product.service.dto.YxStoreProductRelationQueryCriteria; +import co.yixiang.modules.product.service.mapper.YxStoreProductRelationMapper; +import co.yixiang.modules.product.vo.YxStoreProductRelationQueryVo; +import co.yixiang.modules.user.service.YxUserService; +import co.yixiang.utils.FileUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import org.springframework.data.domain.Pageable; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + +/** + *

+ * 商品点赞和收藏表 服务实现类 + *

+ * + * @author hupeng + * @since 2019-10-23 + */ +@Slf4j +@Service +@AllArgsConstructor +@Transactional(rollbackFor = Exception.class) +public class YxStoreProductRelationServiceImpl extends BaseServiceImpl implements YxStoreProductRelationService { + + private final YxStoreProductRelationMapper yxStoreProductRelationMapper; + private final YxStoreProductService storeProductService; + private final YxUserService userService; + private final IGenerator generator; + + /** + * 获取用户收藏列表 + * @param page page + * @param limit limit + * @param uid 用户id + * @return list + */ + @Override + public List userCollectProduct(int page, int limit, Long uid,String type) { + Page pageModel = new Page<>(page, limit); + List list = yxStoreProductRelationMapper.selectRelationList(pageModel,uid,type); + return list; + } + + /** + * 添加收藏 + * @param productId 商品id + * @param uid 用户id + */ + @Override + public void addRroductRelation(long productId,long uid,String category) { + if(isProductRelation(productId,uid)) { + throw new YshopException("已收藏"); + } + YxStoreProductRelation storeProductRelation = YxStoreProductRelation.builder() + .productId(productId) + .uid(uid) + .type(category) + .build(); + yxStoreProductRelationMapper.insert(storeProductRelation); + } + + /** + * 取消收藏 + * @param productId 商品id + * @param uid 用户id + */ + @Override + public void delRroductRelation(long productId,long uid,String category) { + YxStoreProductRelation productRelation = this.lambdaQuery() + .eq(YxStoreProductRelation::getProductId,productId) + .eq(YxStoreProductRelation::getUid,uid) + .eq(YxStoreProductRelation::getType,category) + .one(); + if(productRelation == null) { + throw new YshopException("已取消"); + } + this.removeById(productRelation.getId()); + } + + + /** + * 是否收藏 + * @param productId 商品ID + * @param uid 用户ID + * @return Boolean + */ + @Override + public Boolean isProductRelation(long productId, long uid) { + int count = yxStoreProductRelationMapper + .selectCount(Wrappers.lambdaQuery() + .eq(YxStoreProductRelation::getUid,uid) + .eq(YxStoreProductRelation::getType,"collect") + .eq(YxStoreProductRelation::getProductId,productId)); + if(count > 0) { + return true; + } + + return false; + } + + @Override + //@Cacheable + public PageResult queryAll(YxStoreProductRelationQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + PageResult relationDtoPageResult = generator.convertPageInfo(page, YxStoreProductRelationDto.class); + relationDtoPageResult.getContent().forEach(i ->{ + i.setProduct(storeProductService.getById(i.getProductId())); + i.setUserName(userService.getYxUserById(i.getUid()).getNickname()); + }); + return relationDtoPageResult; + } + + + @Override + //@Cacheable + public List queryAll(YxStoreProductRelationQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreProductRelation.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxStoreProductRelationDto yxStoreProductRelation : all) { + Map map = new LinkedHashMap<>(); + map.put("用户ID", yxStoreProductRelation.getUid()); + map.put("商品ID", yxStoreProductRelation.getProductId()); + map.put("类型(收藏(collect)、点赞(like))", yxStoreProductRelation.getType()); + map.put("某种类型的商品(普通商品、秒杀商品)", yxStoreProductRelation.getCategory()); + map.put("添加时间", yxStoreProductRelation.getCreateTime()); + map.put(" updateTime", yxStoreProductRelation.getUpdateTime()); + map.put(" isDel", yxStoreProductRelation.getIsDel()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + public void collectDelFoot(List ids) { + yxStoreProductRelationMapper.deleteBatchIds(ids); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductReplyServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductReplyServiceImpl.java new file mode 100644 index 0000000..8aa0329 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductReplyServiceImpl.java @@ -0,0 +1,280 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.service.impl; + +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; +import co.yixiang.modules.product.domain.YxStoreProductReply; +import co.yixiang.modules.product.service.YxStoreProductReplyService; +import co.yixiang.modules.product.service.YxStoreProductService; +import co.yixiang.modules.product.service.dto.YxStoreProductReplyDto; +import co.yixiang.modules.product.service.dto.YxStoreProductReplyQueryCriteria; +import co.yixiang.modules.product.service.mapper.StoreProductReplyMapper; +import co.yixiang.modules.product.vo.ReplyCountVo; +import co.yixiang.modules.product.vo.YxStoreProductReplyQueryVo; +import co.yixiang.modules.user.service.YxUserService; +import co.yixiang.utils.FileUtil; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxStoreProductReplyServiceImpl extends BaseServiceImpl implements YxStoreProductReplyService { + + @Autowired + private IGenerator generator; + + @Autowired + private YxUserService yxUserService; + + @Autowired + private YxStoreProductService yxStoreProductService; + + + /** + * 评价数据 + * @param productId 商品id + * @return ReplyCountVO + */ + @Override + public ReplyCountVo getReplyCount(long productId) { + int sumCount = productReplyCount(productId); + + if(sumCount == 0) { + return new ReplyCountVo(); + } + + //好评 + int goodCount = this.baseMapper.selectCount(Wrappers.lambdaQuery() + .eq(YxStoreProductReply::getProductId,productId) + .eq(YxStoreProductReply::getProductScore,5)); + + //中评 + int inCount = this.baseMapper.selectCount(Wrappers.lambdaQuery() + .eq(YxStoreProductReply::getProductId,productId) + .lt(YxStoreProductReply::getProductScore,5) + .gt(YxStoreProductReply::getProductScore,2)); + + //差评 + int poorCount = this.baseMapper.selectCount(Wrappers.lambdaQuery() + .eq(YxStoreProductReply::getProductId,productId) + .lt(YxStoreProductReply::getProductScore,2)); + + //好评率 + String replyChance = ""+NumberUtil.round(NumberUtil.mul(NumberUtil.div(goodCount,sumCount),100),2); + String replyStar = ""+NumberUtil.round(NumberUtil.mul(NumberUtil.div(goodCount,sumCount),5),2); + + return ReplyCountVo.builder() + .sumCount(sumCount) + .goodCount(goodCount) + .inCount(inCount) + .poorCount(poorCount) + .replyChance(replyChance) + .replySstar(replyStar) + .build(); + + } + + /** + * 处理评价 + * @param replyQueryVo replyQueryVo + * @return YxStoreProductReplyQueryVo + */ + @Override + public YxStoreProductReplyQueryVo handleReply(YxStoreProductReplyQueryVo replyQueryVo) { + YxStoreCartQueryVo cartInfo = JSONObject.parseObject(replyQueryVo.getCartInfo() + ,YxStoreCartQueryVo.class); + if(ObjectUtil.isNotNull(cartInfo)){ + if(ObjectUtil.isNotNull(cartInfo.getProductInfo())){ + if(ObjectUtil.isNotNull(cartInfo.getProductInfo().getAttrInfo())){ + replyQueryVo.setSku(cartInfo.getProductInfo().getAttrInfo().getSku()); + } + } + } + + BigDecimal star = NumberUtil.add(replyQueryVo.getProductScore(), + replyQueryVo.getServiceScore()); + + star = NumberUtil.div(star,2); + + replyQueryVo.setStar(String.valueOf(star.intValue())); + + if(StrUtil.isEmpty(replyQueryVo.getComment())){ + replyQueryVo.setComment("此用户没有填写评价"); + } + + return replyQueryVo; + } + + /** + * 获取单条评价 + * @param productId 商品di + * @return YxStoreProductReplyQueryVo + */ + @Override + public YxStoreProductReplyQueryVo getReply(long productId) { + YxStoreProductReplyQueryVo vo = this.baseMapper.getReply(productId); + if(ObjectUtil.isNotNull(vo)){ + return handleReply(this.baseMapper.getReply(productId)); + } + return null; + } + + + /** + * 获取评价列表 + * @param productId 商品id + * @param type 0-全部 1-好评 2-中评 3-差评 + * @param page page + * @param limit limit + * @return list + */ + @Override + public List getReplyList(long productId,int type,int page, int limit) { + List newList = new ArrayList<>(); + Page pageModel = new Page<>(page, limit); + List list = this.baseMapper + .selectReplyList(pageModel,productId,type); + List list1 = list.stream().map(i ->{ + YxStoreProductReplyQueryVo vo = new YxStoreProductReplyQueryVo(); + BeanUtils.copyProperties(i,vo); + if(i.getPictures().contains(",")){ + vo.setPics(i.getPictures().split(",")); + } + return vo; + }).collect(Collectors.toList()); + for (YxStoreProductReplyQueryVo queryVo : list1) { + newList.add(handleReply(queryVo)); + } + return newList; + } + + @Override + public int getInfoCount(Integer oid, String unique) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreProductReply::getUnique,unique).eq(YxStoreProductReply::getOid,oid); + return this.baseMapper.selectCount(wrapper); + } + + @Override + public int productReplyCount(long productId) { + + return this.baseMapper.selectCount(Wrappers.lambdaQuery() + .eq(YxStoreProductReply::getProductId,productId)); + + } + + @Override + public int replyCount(String unique) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreProductReply::getUnique,unique); + return this.baseMapper.selectCount(wrapper); + } + + /** + * 好评比例 + * @param productId 商品id + * @return % + */ + @Override + public String replyPer(long productId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreProductReply::getProductId,productId) + .eq(YxStoreProductReply::getIsDel,ShopCommonEnum.DELETE_0.getValue()) + .eq(YxStoreProductReply::getProductScore,5); + int productScoreCount = this.baseMapper.selectCount(wrapper); + int count = productReplyCount(productId); + if(count > 0){ + return ""+NumberUtil.round(NumberUtil.mul(NumberUtil.div(productScoreCount,count),100),2); + } + + return "0"; + } + + + + + + //===================================// + + @Override + //@Cacheable + public Map queryAll(YxStoreProductReplyQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxStoreProductReplyDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxStoreProductReplyQueryCriteria criteria){ + List storeProductReplyList = baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreProductReply.class, criteria)); + storeProductReplyList.forEach(yxStoreProductReply->{ + yxStoreProductReply.setUser(yxUserService.getById(yxStoreProductReply.getUid())); + yxStoreProductReply.setStoreProduct(yxStoreProductService.getById(yxStoreProductReply.getProductId())); + }); + return storeProductReplyList; + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxStoreProductReplyDto yxStoreProductReply : all) { + Map map = new LinkedHashMap<>(); + map.put("用户ID", yxStoreProductReply.getUid()); + map.put("订单ID", yxStoreProductReply.getOid()); + map.put("唯一id", yxStoreProductReply.getUnique()); + map.put("产品id", yxStoreProductReply.getProductId()); + map.put("某种商品类型(普通商品、秒杀商品)", yxStoreProductReply.getReplyType()); + map.put("商品分数", yxStoreProductReply.getProductScore()); + map.put("服务分数", yxStoreProductReply.getServiceScore()); + map.put("评论内容", yxStoreProductReply.getComment()); + map.put("评论图片", yxStoreProductReply.getPics()); + map.put("管理员回复内容", yxStoreProductReply.getMerchantReplyContent()); + map.put("管理员回复时间", yxStoreProductReply.getMerchantReplyTime()); + map.put("0未回复1已回复", yxStoreProductReply.getIsReply()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductRuleServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductRuleServiceImpl.java new file mode 100644 index 0000000..31e4205 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductRuleServiceImpl.java @@ -0,0 +1,80 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.product.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.product.domain.YxStoreProductRule; +import co.yixiang.modules.product.service.YxStoreProductRuleService; +import co.yixiang.modules.product.service.dto.YxStoreProductRuleDto; +import co.yixiang.modules.product.service.dto.YxStoreProductRuleQueryCriteria; +import co.yixiang.modules.product.service.mapper.YxStoreProductRuleMapper; +import co.yixiang.utils.FileUtil; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + + +/** +* @author hupeng +* @date 2020-06-28 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxStoreProductRuleServiceImpl extends BaseServiceImpl implements YxStoreProductRuleService { + + private final IGenerator generator; + + @Override + //@Cacheable + public Map queryAll(YxStoreProductRuleQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", page.getList()); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxStoreProductRuleQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreProductRule.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxStoreProductRule yxStoreProductRule : all) { + Map map = new LinkedHashMap<>(); + map.put("规格名称", yxStoreProductRule.getRuleName()); + map.put("规格值", yxStoreProductRule.getRuleValue()); + map.put(" createTime", yxStoreProductRule.getCreateTime()); + map.put(" updateTime", yxStoreProductRule.getUpdateTime()); + map.put(" isDel", yxStoreProductRule.getIsDel()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductServiceImpl.java new file mode 100644 index 0000000..009913f --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductServiceImpl.java @@ -0,0 +1,975 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.ListUtil; +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.YshopException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.constant.ShopConstants; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.CommonEnum; +import co.yixiang.enums.ProductEnum; +import co.yixiang.enums.ProductTypeEnum; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.enums.SortEnum; +import co.yixiang.enums.SpecTypeEnum; +import co.yixiang.exception.BadRequestException; +import co.yixiang.exception.ErrorRequestException; +import co.yixiang.modules.category.service.YxStoreCategoryService; +import co.yixiang.modules.product.domain.YxStoreProduct; +import co.yixiang.modules.product.domain.YxStoreProductAttrValue; +import co.yixiang.modules.product.domain.YxStoreProductRelation; +import co.yixiang.modules.product.param.YxStoreProductQueryParam; +import co.yixiang.modules.product.service.YxStoreProductAttrService; +import co.yixiang.modules.product.service.YxStoreProductAttrValueService; +import co.yixiang.modules.product.service.YxStoreProductRelationService; +import co.yixiang.modules.product.service.YxStoreProductReplyService; +import co.yixiang.modules.product.service.YxStoreProductService; +import co.yixiang.modules.product.service.dto.DetailDto; +import co.yixiang.modules.product.service.dto.FromatDetailDto; +import co.yixiang.modules.product.service.dto.ProductFormatDto; +import co.yixiang.modules.product.service.dto.ProductResultDto; +import co.yixiang.modules.product.service.dto.StoreProductDto; +import co.yixiang.modules.product.service.dto.YxStoreProductDto; +import co.yixiang.modules.product.service.dto.YxStoreProductQueryCriteria; +import co.yixiang.modules.product.service.mapper.StoreProductMapper; +import co.yixiang.modules.product.vo.ProductVo; +import co.yixiang.modules.product.vo.YxStoreProductAttrQueryVo; +import co.yixiang.modules.product.vo.YxStoreProductQueryVo; +import co.yixiang.modules.product.vo.YxStoreProductReplyQueryVo; +import co.yixiang.modules.shop.service.YxSystemStoreService; +import co.yixiang.modules.template.domain.YxShippingTemplates; +import co.yixiang.modules.template.service.YxShippingTemplatesService; +import co.yixiang.modules.user.service.YxUserService; +import co.yixiang.utils.FileUtil; +import co.yixiang.utils.RedisUtil; +import co.yixiang.utils.RegexUtil; +import co.yixiang.utils.ShopKeyUtils; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.pagehelper.PageInfo; +import com.qiniu.util.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + + +/** + * @author hupeng + * @date 2020-05-12 + */ +@Service +@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) +public class YxStoreProductServiceImpl extends BaseServiceImpl implements YxStoreProductService { + + @Autowired + private IGenerator generator; + @Autowired + private StoreProductMapper storeProductMapper; + @Autowired + private YxStoreCategoryService yxStoreCategoryService; + @Autowired + private YxStoreProductAttrService yxStoreProductAttrService; + @Autowired + private YxStoreProductAttrValueService yxStoreProductAttrValueService; + @Autowired + private YxUserService userService; + @Autowired + private YxStoreProductReplyService replyService; + @Autowired + private YxStoreProductRelationService relationService; + @Autowired + private YxSystemStoreService systemStoreService; + @Autowired + private YxShippingTemplatesService shippingTemplatesService; + + + /** + * 增加库存 减少销量 + * + * @param num 数量 + * @param productId 商品id + * @param unique sku唯一值 + */ + @Override + public void incProductStock(Integer num, Long productId, String unique, Long activityId, String type) { + //处理属性sku + if (StrUtil.isNotEmpty(unique)) { + yxStoreProductAttrService.incProductAttrStock(num, productId, unique, type); + } + //先处理商品库存,活动商品也要处理,因为共享库存 + storeProductMapper.incStockDecSales(num, productId); + //处理商品外层显示的库存 + if (ProductTypeEnum.COMBINATION.getValue().equals(type)) { + storeProductMapper.incCombinationStockIncSales(num, productId, activityId); + } else if (ProductTypeEnum.SECKILL.getValue().equals(type)) { + storeProductMapper.incSeckillStockIncSales(num, productId, activityId); + } + //todo 处理砍价商品库存 + } + + /** + * 减少库存与增加销量 + * + * @param num 数量 + * @param productId 商品id + * @param unique sku + */ + @Override + public void decProductStock(int num, Long productId, String unique, Long activityId, String type) { + //处理属性sku + if (StrUtil.isNotEmpty(unique)) { + yxStoreProductAttrService.decProductAttrStock(num, productId, unique, type); + } + //先处理商品库存,活动商品也要处理,因为共享库存 + int product = storeProductMapper.decStockIncSales(num, productId); + if (product == 0) { + throw new YshopException("共享商品库存不足"); + } + //处理商品外层显示的库存 + if (ProductTypeEnum.COMBINATION.getValue().equals(type)) { + int combinationRes = storeProductMapper.decCombinationStockIncSales(num, productId, activityId); + if (combinationRes == 0) { + throw new YshopException("拼团商品库存不足"); + } + } else if (ProductTypeEnum.SECKILL.getValue().equals(type)) { + int seckillRes = storeProductMapper.decSeckillStockIncSales(num, productId, activityId); + if (seckillRes == 0) { + throw new YshopException("秒杀商品库存不足"); + } + } + //todo 处理砍价库存 + + } + + + @Override + public YxStoreProduct getProductInfo(Long id) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreProduct::getIsShow, 1).eq(YxStoreProduct::getId, id); + YxStoreProduct storeProduct = this.baseMapper.selectOne(wrapper); + if (ObjectUtil.isNull(storeProduct)) { + throw new ErrorRequestException("商品不存在或已下架"); + } + + return storeProduct; + } + + + /** + * 获取单个商品 + * + * @param id 商品id + * @return YxStoreProductQueryVo + */ + @Override + public YxStoreProductQueryVo getStoreProductById(Long id) { + return generator.convert(this.baseMapper.selectById(id), YxStoreProductQueryVo.class); + } + + + /** + * 返回普通商品库存 + * + * @param productId 商品id + * @param unique sku唯一值 + * @return int + */ + @Override + public int getProductStock(Long productId, String unique, String type) { + YxStoreProductAttrValue storeProductAttrValue = yxStoreProductAttrValueService + .getOne(Wrappers.lambdaQuery() + .eq(YxStoreProductAttrValue::getUnique, unique) + .eq(YxStoreProductAttrValue::getProductId, productId)); + + if (storeProductAttrValue == null) { + return 0; + } + if (ProductTypeEnum.PINK.getValue().equals(type)) { + return storeProductAttrValue.getPinkStock(); + } else if (ProductTypeEnum.SECKILL.getValue().equals(type)) { + return storeProductAttrValue.getSeckillStock(); + } + return storeProductAttrValue.getStock(); + + } + + + /** + * 商品列表 + * + * @param productQueryParam YxStoreProductQueryParam + * @return list + */ + @Override + public List getGoodsList(YxStoreProductQueryParam productQueryParam) { + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreProduct::getIsShow, CommonEnum.SHOW_STATUS_1.getValue()); + wrapper.eq(YxStoreProduct::getIsDel, CommonEnum.DEL_STATUS_0.getValue()); +// wrapper.eq(YxStoreProduct::getIsIntegral, CommonEnum.SHOW_STATUS_1.getValue()); + + if(productQueryParam.getIsIntegral()!=null){ + wrapper.eq(YxStoreProduct::getIsIntegral, productQueryParam.getIsIntegral()); + } + //多字段模糊查询分类搜索 + if (StrUtil.isNotBlank(productQueryParam.getSid()) && + !ShopConstants.YSHOP_ZERO.equals(productQueryParam.getSid())) { + wrapper.eq(YxStoreProduct::getCateId, productQueryParam.getSid()); + } + //关键字搜索 + if (StrUtil.isNotEmpty(productQueryParam.getKeyword())) { + wrapper.and(wrapper1 -> { + wrapper1.or(); + wrapper1.like(YxStoreProduct::getStoreName, productQueryParam.getKeyword()); + wrapper1.or(); + wrapper1.like(YxStoreProduct::getStoreInfo, productQueryParam.getKeyword()); + wrapper1.or(); + wrapper1.like(YxStoreProduct::getKeyword, productQueryParam.getKeyword()); + }); + } + //新品搜索 + if (StrUtil.isNotBlank(productQueryParam.getNews()) && + !ShopConstants.YSHOP_ZERO.equals(productQueryParam.getNews())) { + wrapper.eq(YxStoreProduct::getIsNew, ShopCommonEnum.IS_NEW_1.getValue()); + } + + //销量排序 + if (SortEnum.DESC.getValue().equals(productQueryParam.getSalesOrder())) { + wrapper.orderByDesc(YxStoreProduct::getSales); + } else if (SortEnum.ASC.getValue().equals(productQueryParam.getSalesOrder())) { + wrapper.orderByAsc(YxStoreProduct::getSales); + } + + //价格排序 + if (SortEnum.DESC.getValue().equals(productQueryParam.getPriceOrder())) { + wrapper.orderByDesc(YxStoreProduct::getPrice); + } else if (SortEnum.ASC.getValue().equals(productQueryParam.getPriceOrder())) { + wrapper.orderByAsc(YxStoreProduct::getPrice); + } + + //无其他排序条件时,防止因为商品排序导致商品重复 + if (StringUtils.isNullOrEmpty(productQueryParam.getPriceOrder()) && StringUtils.isNullOrEmpty(productQueryParam.getSalesOrder())) { + wrapper.orderByDesc(YxStoreProduct::getId); + wrapper.orderByDesc(YxStoreProduct::getSort); + } + Page pageModel = new Page<>(productQueryParam.getPage(), + productQueryParam.getLimit()); + + IPage pageList = storeProductMapper.selectPage(pageModel, wrapper); + + List list = generator.convert(pageList.getRecords(), YxStoreProductQueryVo.class); + + return list; + } + + /** + * 商品详情 + * + * @param id 商品id + * @param uid 用户id + * @param latitude 纬度 + * @param longitude 经度 + * @return ProductVo + */ + @Override + public ProductVo goodsDetail(Long id, Long uid, String latitude, String longitude) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue()) + .eq(YxStoreProduct::getId, id); + YxStoreProduct storeProduct = storeProductMapper.selectOne(wrapper); + if (ObjectUtil.isNull(storeProduct)) { + throw new ErrorRequestException("商品不存在或已下架"); + } + + //获取商品sku + Map returnMap = yxStoreProductAttrService.getProductAttrDetail(id); + ProductVo productVo = new ProductVo(); + YxStoreProductQueryVo storeProductQueryVo = generator.convert(storeProduct, YxStoreProductQueryVo.class); + + //设置销量 + storeProductQueryVo.setSales(storeProductQueryVo.getSales() + storeProductQueryVo.getFicti()); + + if (uid.longValue() > 0) { + //设置VIP价格 + double vipPrice = userService.setLevelPrice( + storeProductQueryVo.getPrice().doubleValue(), uid); + storeProductQueryVo.setVipPrice(BigDecimal.valueOf(vipPrice)); + + //收藏 + boolean isCollect = relationService.isProductRelation(id, uid); + storeProductQueryVo.setUserCollect(isCollect); + } + //总条数 + int totalCount = replyService.productReplyCount(id); + productVo.setReplyCount(totalCount); + + //评价 + YxStoreProductReplyQueryVo storeProductReplyQueryVo = replyService.getReply(id); + productVo.setReply(storeProductReplyQueryVo); + + //好评比例 + String replyPer = replyService.replyPer(id); + productVo.setReplyChance(replyPer); + + //获取运费模板名称 + String storeFreePostage = RedisUtil.get("store_free_postage"); + String tempName = ""; + if (StrUtil.isBlank(storeFreePostage) + || !NumberUtil.isNumber(storeFreePostage) + || Integer.valueOf(storeFreePostage) == 0) { + tempName = "全国包邮"; + } else { + YxShippingTemplates shippingTemplates = shippingTemplatesService.getById(storeProduct.getTempId()); + if (ObjectUtil.isNotNull(shippingTemplates)) { + tempName = shippingTemplates.getName(); + } else { + throw new BadRequestException("请配置运费模板"); + } + + } + productVo.setTempName(tempName); + + //设置商品相关信息 + productVo.setStoreInfo(storeProductQueryVo); + productVo.setProductAttr((List) returnMap.get("productAttr")); + productVo.setProductValue((Map) returnMap.get("productValue")); + + + //门店 + productVo.setSystemStore(systemStoreService.getStoreInfo(latitude, longitude)); + productVo.setMapKey(RedisUtil.get(ShopKeyUtils.getTengXunMapKey())); + if (uid.longValue() > 0) { + //添加足迹 + YxStoreProductRelation foot = relationService.getOne(new LambdaQueryWrapper() + .eq(YxStoreProductRelation::getUid, uid) + .eq(YxStoreProductRelation::getProductId, storeProductQueryVo.getId()) + .eq(YxStoreProductRelation::getType, "foot")); + + if (ObjectUtil.isNotNull(foot)) { + foot.setCreateTime(new Date()); + relationService.saveOrUpdate(foot); + } else { + YxStoreProductRelation storeProductRelation = new YxStoreProductRelation(); + storeProductRelation.setProductId(storeProductQueryVo.getId()); + storeProductRelation.setUid(uid); + storeProductRelation.setCreateTime(new Date()); + storeProductRelation.setType("foot"); + relationService.save(storeProductRelation); + } + } + + return productVo; + } + + /** + * 商品浏览量 + * + * @param productId + */ + @Override + public void incBrowseNum(Long productId) { + storeProductMapper.incBrowseNum(productId); + } + + + /** + * 商品列表 + * + * @param page 页码 + * @param limit 条数 + * @param order ProductEnum + * @return List + */ + @Override + public List getList(int page, int limit, int order) { + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue()) + .eq(YxStoreProduct::getIsDel,ShopCommonEnum.DELETE_0.getValue()) + .orderByDesc(YxStoreProduct::getSort); + wrapper.eq(YxStoreProduct::getIsIntegral,0); + // order + switch (ProductEnum.toType(order)) { + //精品推荐 + case TYPE_1: + wrapper.eq(YxStoreProduct::getIsBest, + ShopCommonEnum.IS_STATUS_1.getValue()); + break; + //首发新品 + case TYPE_3: + wrapper.eq(YxStoreProduct::getIsNew, + ShopCommonEnum.IS_STATUS_1.getValue()); + break; + // 猜你喜欢 + case TYPE_4: + wrapper.eq(YxStoreProduct::getIsBenefit, + ShopCommonEnum.IS_STATUS_1.getValue()); + break; + // 热门榜单 + case TYPE_2: + wrapper.eq(YxStoreProduct::getIsHot, + ShopCommonEnum.IS_STATUS_1.getValue()); + break; + default: + } + Page pageModel = new Page<>(page, limit); + + IPage pageList = storeProductMapper.selectPage(pageModel, wrapper); + + return generator.convert(pageList.getRecords(), YxStoreProductQueryVo.class); + } + + + //============ 分割线================// + + + @Override + public Map queryAll(YxStoreProductQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxStoreProductDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + public List queryAll(YxStoreProductQueryCriteria criteria) { + List yxStoreProductList = baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreProduct.class, criteria)); + yxStoreProductList.forEach(yxStoreProduct -> { + yxStoreProduct.setStoreCategory(yxStoreCategoryService.getById(yxStoreProduct.getCateId())); + }); + return yxStoreProductList; + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxStoreProductDto yxStoreProduct : all) { + Map map = new LinkedHashMap<>(); + map.put("商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)", yxStoreProduct.getMerId()); + map.put("商品图片", yxStoreProduct.getImage()); + map.put("轮播图", yxStoreProduct.getSliderImage()); + map.put("商品名称", yxStoreProduct.getStoreName()); + map.put("商品简介", yxStoreProduct.getStoreInfo()); + map.put("关键字", yxStoreProduct.getKeyword()); + map.put("产品条码(一维码)", yxStoreProduct.getBarCode()); + map.put("分类id", yxStoreProduct.getCateId()); + map.put("商品价格", yxStoreProduct.getPrice()); + map.put("会员价格", yxStoreProduct.getVipPrice()); + map.put("市场价", yxStoreProduct.getOtPrice()); + map.put("邮费", yxStoreProduct.getPostage()); + map.put("单位名", yxStoreProduct.getUnitName()); + map.put("排序", yxStoreProduct.getSort()); + map.put("销量", yxStoreProduct.getSales()); + map.put("库存", yxStoreProduct.getStock()); + map.put("状态(0:未上架,1:上架)", yxStoreProduct.getIsShow()); + map.put("是否热卖", yxStoreProduct.getIsHot()); + map.put("是否优惠", yxStoreProduct.getIsBenefit()); + map.put("是否精品", yxStoreProduct.getIsBest()); + map.put("是否新品", yxStoreProduct.getIsNew()); + map.put("产品描述", yxStoreProduct.getDescription()); + map.put("添加时间", yxStoreProduct.getAddTime()); + map.put("是否包邮", yxStoreProduct.getIsPostage()); + map.put("是否删除", yxStoreProduct.getIsDel()); + map.put("商户是否代理 0不可代理1可代理", yxStoreProduct.getMerUse()); + map.put("获得积分", yxStoreProduct.getGiveIntegral()); + map.put("成本价", yxStoreProduct.getCost()); + map.put("秒杀状态 0 未开启 1已开启", yxStoreProduct.getIsSeckill()); + map.put("砍价状态 0未开启 1开启", yxStoreProduct.getIsBargain()); + map.put("是否优品推荐", yxStoreProduct.getIsGood()); + map.put("虚拟销量", yxStoreProduct.getFicti()); + map.put("浏览量", yxStoreProduct.getBrowse()); + map.put("产品二维码地址(用户小程序海报)", yxStoreProduct.getCodePath()); + map.put("淘宝京东1688类型", yxStoreProduct.getSoureLink()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + + /** + * 商品上架下架 + * + * @param id 商品id + * @param status ShopCommonEnum + */ + @Override + public void onSale(Long id, Integer status) { + if (ShopCommonEnum.SHOW_1.getValue().equals(status)) { + status = ShopCommonEnum.SHOW_0.getValue(); + } else { + status = ShopCommonEnum.SHOW_1.getValue(); + } + storeProductMapper.updateOnsale(status, id); + } + + + /** + * 新增/保存商品 + * + * @param storeProductDto 商品 + */ + @Override + public void insertAndEditYxStoreProduct(StoreProductDto storeProductDto) { + storeProductDto.setDescription(RegexUtil.converProductDescription(storeProductDto.getDescription())); + ProductResultDto resultDTO = this.computedProduct(storeProductDto.getAttrs()); + + //添加商品 + YxStoreProduct yxStoreProduct = new YxStoreProduct(); + BeanUtil.copyProperties(storeProductDto, yxStoreProduct, "sliderImage"); + if (storeProductDto.getSliderImage().isEmpty()) { + throw new YshopException("请上传轮播图"); + } + + yxStoreProduct.setPrice(BigDecimal.valueOf(resultDTO.getMinPrice())); + yxStoreProduct.setOtPrice(BigDecimal.valueOf(resultDTO.getMinOtPrice())); + yxStoreProduct.setCost(BigDecimal.valueOf(resultDTO.getMinCost())); + yxStoreProduct.setIntegral(resultDTO.getMinIntegral()); + yxStoreProduct.setStock(resultDTO.getStock()); + yxStoreProduct.setSliderImage(String.join(",", storeProductDto.getSliderImage())); + + if (storeProductDto.getId() != null) { + //清空商品转发图 + deleteForwardImg(storeProductDto.getId()); + } + + this.saveOrUpdate(yxStoreProduct); + + //属性处理 + //处理单sKu + if (SpecTypeEnum.TYPE_0.getValue().equals(storeProductDto.getSpecType())) { + FromatDetailDto fromatDetailDto = FromatDetailDto.builder() + .value("规格") + .detailValue("") + .attrHidden("") + .detail(ListUtil.toList("默认")) + .build(); + List attrs = storeProductDto.getAttrs(); + ProductFormatDto productFormatDto = attrs.get(0); + productFormatDto.setValue1("规格"); + Map map = new HashMap<>(); + map.put("规格", "默认"); + productFormatDto.setDetail(map); + yxStoreProductAttrService.insertYxStoreProductAttr(ListUtil.toList(fromatDetailDto), + ListUtil.toList(productFormatDto), yxStoreProduct.getId()); + } else { + yxStoreProductAttrService.insertYxStoreProductAttr(storeProductDto.getItems(), + storeProductDto.getAttrs(), yxStoreProduct.getId()); + } + + + } + + + /** + * 获取生成的属性 + * + * @param id 商品id + * @param jsonStr jsonStr + * @return map + */ + @Override + public Map getFormatAttr(Long id, String jsonStr, boolean isActivity) { + JSONObject jsonObject = JSON.parseObject(jsonStr); + Map resultMap = new LinkedHashMap<>(3); + + if (jsonObject == null || jsonObject.get("attrs") == null || jsonObject.getJSONArray("attrs").isEmpty()) { + resultMap.put("attr", new ArrayList<>()); + resultMap.put("value", new ArrayList<>()); + resultMap.put("header", new ArrayList<>()); + return resultMap; + } + + + List fromatDetailDTOList = JSON.parseArray(jsonObject.get("attrs").toString(), + FromatDetailDto.class); + + //fromatDetailDTOList + DetailDto detailDto = this.attrFormat(fromatDetailDTOList); + + List> headerMapList = null; + List> valueMapList = new ArrayList<>(); + String align = "center"; + Map headerMap = new LinkedHashMap<>(); + for (Map> map : detailDto.getRes()) { + Map detail = map.get("detail"); + String[] detailArr = detail.values().toArray(new String[]{}); + Arrays.sort(detailArr); + + String sku = String.join(",", detailArr); + + Map valueMap = new LinkedHashMap<>(); + + List detailKeys = + detail.entrySet() + .stream() + .map(Map.Entry::getKey) + .collect(Collectors.toList()); + + int i = 0; + headerMapList = new ArrayList<>(); + for (String title : detailKeys) { + headerMap.put("title", title); + headerMap.put("minWidth", "130"); + headerMap.put("align", align); + headerMap.put("key", "value" + (i + 1)); + headerMap.put("slot", "value" + (i + 1)); + headerMapList.add(ObjectUtil.clone(headerMap)); + i++; + } + + String[] detailValues = detail.values().toArray(new String[]{}); + for (int j = 0; j < detailValues.length; j++) { + String key = "value" + (j + 1); + valueMap.put(key, detailValues[j]); + } +// /** 拼团属性对应的金额 */ +// private BigDecimal pinkPrice; +// +// /** 秒杀属性对应的金额 */ +// private BigDecimal seckillPrice; +// /** 拼团库存属性对应的库存 */ +// private Integer pinkStock; +// +// private Integer seckillStock; + valueMap.put("detail", detail); + valueMap.put("sku", ""); + valueMap.put("pic", ""); + valueMap.put("price", 0); + valueMap.put("cost", 0); + valueMap.put("ot_price", 0); + valueMap.put("stock", 0); + valueMap.put("bar_code", ""); + valueMap.put("weight", 0); + valueMap.put("volume", 0); + valueMap.put("brokerage", 0); + valueMap.put("brokerage_two", 0); + valueMap.put("pink_price", 0); + valueMap.put("seckill_price", 0); + valueMap.put("pink_stock", 0); + valueMap.put("seckill_stock", 0); + valueMap.put("integral", 0); + if (id > 0) { + YxStoreProductAttrValue storeProductAttrValue = yxStoreProductAttrValueService + .getOne(Wrappers.lambdaQuery() + .eq(YxStoreProductAttrValue::getProductId, id) + .eq(YxStoreProductAttrValue::getSku, sku)); + if (storeProductAttrValue != null) { + valueMap.put("sku",storeProductAttrValue.getSku()); + valueMap.put("pic", storeProductAttrValue.getImage()); + valueMap.put("price", storeProductAttrValue.getPrice()); + valueMap.put("cost", storeProductAttrValue.getCost()); + valueMap.put("ot_price", storeProductAttrValue.getOtPrice()); + valueMap.put("stock", storeProductAttrValue.getStock()); + valueMap.put("bar_code", storeProductAttrValue.getBarCode()); + valueMap.put("weight", storeProductAttrValue.getWeight()); + valueMap.put("volume", storeProductAttrValue.getVolume()); + valueMap.put("brokerage", storeProductAttrValue.getBrokerage()); + valueMap.put("brokerage_two", storeProductAttrValue.getBrokerageTwo()); + valueMap.put("pink_price", storeProductAttrValue.getPinkPrice()); + valueMap.put("seckill_price", storeProductAttrValue.getSeckillPrice()); + valueMap.put("pink_stock", storeProductAttrValue.getPinkStock()); + valueMap.put("seckill_stock", storeProductAttrValue.getSeckillStock()); + valueMap.put("integral", storeProductAttrValue.getIntegral()); + } + } + + valueMapList.add(ObjectUtil.clone(valueMap)); + + } + + this.addMap(headerMap, headerMapList, align, isActivity); + + + resultMap.put("attr", fromatDetailDTOList); + resultMap.put("value", valueMapList); + resultMap.put("header", headerMapList); + + return resultMap; + } + + + /** + * 计算产品数据 + * + * @param attrs attrs + * @return ProductResultDto + */ + private ProductResultDto computedProduct(List attrs) { + //取最小价格 + Double minPrice = attrs + .stream() + .map(ProductFormatDto::getPrice) + .min(Comparator.naturalOrder()) + .orElse(0d); + + //取最小积分 + Integer minIntegral = attrs + .stream() + .map(ProductFormatDto::getIntegral) + .min(Comparator.naturalOrder()) + .orElse(0); + + Double minOtPrice = attrs + .stream() + .map(ProductFormatDto::getOtPrice) + .min(Comparator.naturalOrder()) + .orElse(0d); + + Double minCost = attrs + .stream() + .map(ProductFormatDto::getCost) + .min(Comparator.naturalOrder()) + .orElse(0d); + //计算库存 + Integer stock = attrs + .stream() + .map(ProductFormatDto::getStock) + .reduce(Integer::sum) + .orElse(0); + + if (stock <= 0) { + throw new YshopException("库存不能低于0"); + } + + return ProductResultDto.builder() + .minPrice(minPrice) + .minOtPrice(minOtPrice) + .minCost(minCost) + .stock(stock) + .minIntegral(minIntegral) + .build(); + } + + /** + * mapTobean + * + * @param listMap listMap + * @return list + */ + private List ListMapToListBean(List> listMap) { + List list = new ArrayList<>(); + // 循环遍历出map对象 + for (Map m : listMap) { + list.add(BeanUtil.mapToBean(m, ProductFormatDto.class, true)); + } + return list; + } + + /** + * 增加表头 + * + * @param headerMap headerMap + * @param headerMapList headerMapList + * @param align align + */ + private void addMap(Map headerMap, List> headerMapList, String align, boolean isActivity) { + headerMap.put("title", "图片"); + headerMap.put("slot", "pic"); + headerMap.put("align", align); + headerMap.put("minWidth", 80); + headerMapList.add(ObjectUtil.clone(headerMap)); + + headerMap.put("title", "售价"); + headerMap.put("slot", "price"); + headerMap.put("align", align); + headerMap.put("minWidth", 120); + headerMapList.add(ObjectUtil.clone(headerMap)); + + headerMap.put("title", "成本价"); + headerMap.put("slot", "cost"); + headerMap.put("align", align); + headerMap.put("minWidth", 140); + headerMapList.add(ObjectUtil.clone(headerMap)); + + headerMap.put("title", "原价"); + headerMap.put("slot", "ot_price"); + headerMap.put("align", align); + headerMap.put("minWidth", 140); + headerMapList.add(ObjectUtil.clone(headerMap)); + + headerMap.put("title", "库存"); + headerMap.put("slot", "stock"); + headerMap.put("align", align); + headerMap.put("minWidth", 140); + headerMapList.add(ObjectUtil.clone(headerMap)); + + headerMap.put("title", "产品编号"); + headerMap.put("slot", "bar_code"); + headerMap.put("align", align); + headerMap.put("minWidth", 140); + headerMapList.add(ObjectUtil.clone(headerMap)); + + headerMap.put("title", "重量(KG)"); + headerMap.put("slot", "weight"); + headerMap.put("align", align); + headerMap.put("minWidth", 140); + headerMapList.add(ObjectUtil.clone(headerMap)); + + headerMap.put("title", "体积(m³)"); + headerMap.put("slot", "volume"); + headerMap.put("align", align); + headerMap.put("minWidth", 140); + headerMapList.add(ObjectUtil.clone(headerMap)); + + headerMap.put("title", "所需兑换积分"); + headerMap.put("slot", "integral"); + headerMap.put("align", align); + headerMap.put("minWidth", 140); + headerMapList.add(ObjectUtil.clone(headerMap)); + + if (isActivity) { + headerMap.put("title", "拼团价"); + headerMap.put("slot", "pink_price"); + headerMap.put("align", align); + headerMap.put("minWidth", 140); + headerMapList.add(ObjectUtil.clone(headerMap)); + + headerMap.put("title", "拼团活动库存"); + headerMap.put("slot", "pink_stock"); + headerMap.put("align", align); + headerMap.put("minWidth", 140); + headerMapList.add(ObjectUtil.clone(headerMap)); + + headerMap.put("title", "秒杀价"); + headerMap.put("slot", "seckill_price"); + headerMap.put("align", align); + headerMap.put("minWidth", 140); + headerMapList.add(ObjectUtil.clone(headerMap)); + + headerMap.put("title", "秒杀活动库存"); + headerMap.put("slot", "seckill_stock"); + headerMap.put("align", align); + headerMap.put("minWidth", 140); + headerMapList.add(ObjectUtil.clone(headerMap)); + } + + headerMap.put("title", "操作"); + headerMap.put("slot", "action"); + headerMap.put("align", align); + headerMap.put("minWidth", 70); + headerMapList.add(ObjectUtil.clone(headerMap)); + } + + /** + * 组合规则属性算法 + * + * @param fromatDetailDTOList + * @return DetailDto + */ + private DetailDto attrFormat(List fromatDetailDTOList) { + + List data = new ArrayList<>(); + List>> res = new ArrayList<>(); + + fromatDetailDTOList.stream() + .map(FromatDetailDto::getDetail) + .forEach(i -> { + if (i == null || i.isEmpty()) { + throw new YshopException("请至少添加一个规格值哦"); + } + String str = ArrayUtil.join(i.toArray(), ","); + if (str.contains("-")) { + throw new YshopException("规格值里包含'-',请重新添加"); + } + }); + + if (fromatDetailDTOList.size() > 1) { + for (int i = 0; i < fromatDetailDTOList.size() - 1; i++) { + if (i == 0) { + data = fromatDetailDTOList.get(i).getDetail(); + } + List tmp = new LinkedList<>(); + for (String v : data) { + for (String g : fromatDetailDTOList.get(i + 1).getDetail()) { + String rep2 = ""; + if (i == 0) { + rep2 = fromatDetailDTOList.get(i).getValue() + "_" + v + "-" + + fromatDetailDTOList.get(i + 1).getValue() + "_" + g; + } else { + rep2 = v + "-" + + fromatDetailDTOList.get(i + 1).getValue() + "_" + g; + } + + tmp.add(rep2); + + if (i == fromatDetailDTOList.size() - 2) { + Map> rep4 = new LinkedHashMap<>(); + Map reptemp = new LinkedHashMap<>(); + for (String h : Arrays.asList(rep2.split("-"))) { + List rep3 = Arrays.asList(h.split("_")); + if (rep3.size() > 1) { + reptemp.put(rep3.get(0), rep3.get(1)); + } else { + reptemp.put(rep3.get(0), ""); + } + } + rep4.put("detail", reptemp); + + res.add(rep4); + } + } + + } + + if (!tmp.isEmpty()) { + data = tmp; + } + } + } else { + List dataArr = new ArrayList<>(); + for (FromatDetailDto fromatDetailDTO : fromatDetailDTOList) { + for (String str : fromatDetailDTO.getDetail()) { + Map> map2 = new LinkedHashMap<>(); + dataArr.add(fromatDetailDTO.getValue() + "_" + str); + Map map1 = new LinkedHashMap<>(); + map1.put(fromatDetailDTO.getValue(), str); + map2.put("detail", map1); + res.add(map2); + } + } + String s = StrUtil.join("-", dataArr); + data.add(s); + } + + DetailDto detailDto = new DetailDto(); + detailDto.setData(data); + detailDto.setRes(res); + + return detailDto; + } + + @Override + public void deleteForwardImg(Long id) { + baseMapper.deleteForwardImg(id, "_product_detail_wap"); + } + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductAttrMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductAttrMapper.java new file mode 100644 index 0000000..935a2b2 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductAttrMapper.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.product.domain.YxStoreProductAttr; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface StoreProductAttrMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductAttrResultMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductAttrResultMapper.java new file mode 100644 index 0000000..7ab5e5e --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductAttrResultMapper.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.product.domain.YxStoreProductAttrResult; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface StoreProductAttrResultMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductAttrValueMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductAttrValueMapper.java new file mode 100644 index 0000000..1f7c1a1 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductAttrValueMapper.java @@ -0,0 +1,100 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.product.domain.YxStoreProductAttrValue; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Update; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface StoreProductAttrValueMapper extends CoreMapper { + + + /** + * 正常商品 加库存 减销量 + * @param num + * @param productId + * @param unique + * @return + */ + @Update("update yx_store_product_attr_value set stock=stock+#{num}, sales=sales-#{num}" + + " where product_id=#{productId} and `unique`=#{unique}") + int incStockDecSales(@Param("num") Integer num,@Param("productId") Long productId, + @Param("unique") String unique); + + + /** + * 拼团商品 加库存 减销量 + * @param num + * @param productId + * @param unique + * @return + */ + + @Update("update yx_store_product_attr_value set stock=stock+#{num}, pink_stock=pink_stock+#{num}, sales=sales-#{num}" + + " where product_id=#{productId} and `unique`=#{unique}") + int incCombinationStockDecSales(@Param("num") Integer num,@Param("productId") Long productId, + @Param("unique") String unique); + + + /** + * 秒杀 加库存 减销量 + * @param num + * @param productId + * @param unique + * @return + */ + @Update("update yx_store_product_attr_value set stock=stock+#{num},seckill_stock=seckill_stock+#{num}, sales=sales-#{num}" + + " where product_id=#{productId} and `unique`=#{unique}") + int incSeckillStockDecSales(@Param("num") Integer num,@Param("productId") Long productId, + @Param("unique") String unique); + + + /** + * 普通商品 减库存 加销量 + * @param num + * @param productId + * @param unique + * @return + */ + @Update("update yx_store_product_attr_value set stock=stock-#{num}, sales=sales+#{num}" + + " where product_id=#{productId} and `unique`=#{unique} and stock >= #{num}") + int decStockIncSales(@Param("num") Integer num, @Param("productId") Long productId, + @Param("unique") String unique); + + /** + * 拼团产品 减库存 加销量 + * @param num + * @param productId + * @param unique + * @return + */ + @Update("update yx_store_product_attr_value set stock=stock-#{num}, pink_stock=pink_stock-#{num} ,sales=sales+#{num}" + + " where product_id=#{productId} and `unique`=#{unique} and stock >= #{num} and pink_stock>=#{num}") + int decCombinationStockIncSales(@Param("num") Integer num, @Param("productId") Long productId, + @Param("unique") String unique); + + /** + * 秒杀产品 减库存 加销量 + * @param num + * @param productId + * @param unique + * @return + */ + @Update("update yx_store_product_attr_value set stock=stock-#{num}, seckill_stock=seckill_stock-#{num},sales=sales+#{num}" + + " where product_id=#{productId} and `unique`=#{unique} and stock >= #{num} and seckill_stock>=#{num}") + int decSeckillStockIncSales(@Param("num") Integer num, @Param("productId") Long productId, + @Param("unique") String unique); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductMapper.java new file mode 100644 index 0000000..b11b9e2 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductMapper.java @@ -0,0 +1,111 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.product.domain.YxStoreProduct; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface StoreProductMapper extends CoreMapper { + + /** + * 正常商品库存 减库存 加销量 + * @param num + * @param productId + * @return + */ + @Update("update yx_store_product set stock=stock-#{num}, sales=sales+#{num}" + + " where id=#{productId} and stock >= #{num}") + int decStockIncSales(@Param("num") Integer num,@Param("productId") Long productId); + + /** + * 正常商品库存 加库存 减销量 + * @param num + * @param productId + * @return + */ + @Update("update yx_store_product set stock=stock+#{num}, sales=sales-#{num}" + + " where id=#{productId}") + int incStockDecSales(@Param("num") Integer num,@Param("productId") Long productId); + + + @Update("update yx_store_product set is_show = #{status} where id = #{id}") + void updateOnsale(@Param("status") Integer status, @Param("id") Long id); + + /** + * 拼团商品库存,减库存 加销量 + * @param num + * @param productId + * @param activityId + * @return + */ + @Update("update yx_store_combination set stock=stock-#{num}, sales=sales+#{num}" + + " where id=#{activityId} and stock >= #{num}") + int decCombinationStockIncSales(@Param("num") Integer num, @Param("productId") Long productId,@Param("activityId") Long activityId); + + /** + * 秒杀产品库存 减库存,加销量 + * @param num + * @param productId + * @param activityId + * @return + */ + @Update("update yx_store_seckill set stock=stock-#{num}, sales=sales+#{num}" + + " where id=#{activityId} and stock >= #{num}") + int decSeckillStockIncSales(@Param("num") Integer num, @Param("productId") Long productId,@Param("activityId") Long activityId); + + /** + * 拼团商品库存,加库存 减销量 + * @param num + * @param productId + * @param activityId + */ + @Update("update yx_store_combination set stock=stock+#{num}, sales=sales-#{num}" + + " where id=#{activityId} and stock >= #{num}") + void incCombinationStockIncSales(@Param("num") Integer num, @Param("productId") Long productId,@Param("activityId") Long activityId); + + /** + * 秒杀产品库存 加库存,减销量 + * @param num + * @param productId + * @param activityId + * @return + */ + @Update("update yx_store_seckill set stock=stock+#{num}, sales=sales-#{num}" + + " where id=#{activityId} and stock >= #{num}") + void incSeckillStockIncSales(@Param("num") Integer num, @Param("productId") Long productId,@Param("activityId") Long activityId); + + /** + * 商品浏览量 + * @param productId + * @return + */ + @Update("update yx_store_product set browse=browse+1 " + + "where id=#{productId}") + int incBrowseNum(@Param("productId") Long productId); + + @Delete("DELETE from yx_system_attachment where name like CONCAT(#{id},'_%',#{name}, '%')") + void deleteForwardImg(@Param("id") Long id,@Param("name") String name); + + @Override + @Select("SELECT id,spec_type,ot_price,mer_use,description,is_postage,is_sub,is_best,(sales+ficti) as sales,price,is_bargain,vip_price,store_name,stock,keyword,image,cost,is_good,unit_name,is_benefit,update_time,give_integral,is_new,sort,slider_image,is_show,bar_code,postage,code_path,create_time,cate_id,is_seckill,mer_id,temp_id,ficti,store_info,is_del,is_hot,is_integral,integral,browse FROM yx_store_product ${ew.customSqlSegment}") + > E selectPage(E page, @Param(Constants.WRAPPER) Wrapper queryWrapper); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductReplyMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductReplyMapper.java new file mode 100644 index 0000000..0a5d5ee --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductReplyMapper.java @@ -0,0 +1,51 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.product.domain.YxStoreProductReply; +import co.yixiang.modules.product.vo.YxStoreProductReplyQueryVo; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface StoreProductReplyMapper extends CoreMapper { + + @Select("select A.product_score as productScore,A.service_score as serviceScore," + + "A.comment,A.merchant_reply_content as merchantReplyContent," + + "A.merchant_reply_time as merchantReplyTime,A.pics as pictures,A.create_Time as createTime," + + "B.nickname,B.avatar,C.cart_info as cartInfo" + + " from yx_store_product_reply A left join yx_user B " + + "on A.uid = B.uid left join yx_store_order_cart_info C on A.`unique` = C.`unique`" + + " where A.product_id=#{productId} and A.is_del=0 " + + "order by A.create_Time DESC limit 1") + YxStoreProductReplyQueryVo getReply(long productId); + + @Select("") + List selectReplyList(Page page, @Param("productId") long productId, @Param("type") int type); + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/YxStoreProductRelationMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/YxStoreProductRelationMapper.java new file mode 100644 index 0000000..305f48f --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/YxStoreProductRelationMapper.java @@ -0,0 +1,40 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.service.mapper; + + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.product.domain.YxStoreProductRelation; +import co.yixiang.modules.product.vo.YxStoreProductRelationQueryVo; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * 商品点赞和收藏表 Mapper 接口 + *

+ * + * @author hupeng + * @since 2019-10-23 + */ +@Repository +public interface YxStoreProductRelationMapper extends CoreMapper { + + @Select("select B.id pid,A.type as category,B.store_name as storeName,B.price,B.is_integral as isIntegral,A.id id," + + "B.ot_price as otPrice,B.sales,B.image,B.is_show as isShow" + + " from yx_store_product_relation A left join yx_store_product B " + + "on A.product_id = B.id where A.type=#{type} and A.uid=#{uid} and A.is_del = 0 and B.is_del = 0 order by A.create_time desc") + List selectRelationList(Page page, @Param("uid") Long uid, @Param("type") String type); + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/YxStoreProductRuleMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/YxStoreProductRuleMapper.java new file mode 100644 index 0000000..5cab1a9 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/service/mapper/YxStoreProductRuleMapper.java @@ -0,0 +1,23 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.product.service.mapper; + + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.product.domain.YxStoreProductRule; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-06-28 +*/ +@Repository +public interface YxStoreProductRuleMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/vo/ProductVo.java b/yshop-mall/src/main/java/co/yixiang/modules/product/vo/ProductVo.java new file mode 100644 index 0000000..9be7106 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/vo/ProductVo.java @@ -0,0 +1,62 @@ +package co.yixiang.modules.product.vo; + +import co.yixiang.modules.product.domain.YxStoreProductAttrValue; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + *

+ * 商品dto + *

+ * + * @author hupeng + * @date 2019-10-23 + */ +@Data +public class ProductVo{ + + @ApiModelProperty(value = "商品信息列表") + private List goodList = new ArrayList(); + + @ApiModelProperty(value = "商户ID,预留字段") + private Integer merId = 0; + + private String priceName = ""; + + private List productAttr = new ArrayList(); + + private Map productValue = new LinkedHashMap<>(); + + @ApiModelProperty(value = "评论信息") + private YxStoreProductReplyQueryVo reply; + + @ApiModelProperty(value = "回复渠道") + private String replyChance; + + @ApiModelProperty(value = "回复数") + private Integer replyCount = 0; + + //todo + private List similarity = new ArrayList(); + + @ApiModelProperty(value = "商品信息") + private YxStoreProductQueryVo storeInfo; + + @ApiModelProperty(value = "腾讯地图key") + private String mapKey; + + @ApiModelProperty(value = "门店信息") + private YxSystemStoreQueryVo systemStore; + + @ApiModelProperty(value = "用户ID") + private Integer uid = 0; + + @ApiModelProperty(value = "模版名称") + private String tempName; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/vo/ReplyCountVo.java b/yshop-mall/src/main/java/co/yixiang/modules/product/vo/ReplyCountVo.java new file mode 100644 index 0000000..19713c9 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/vo/ReplyCountVo.java @@ -0,0 +1,42 @@ +package co.yixiang.modules.product.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.io.Serializable; + +/** + * @ClassName ReplyCount + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/4 + **/ +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ReplyCountVo implements Serializable { + + @ApiModelProperty(value = "总的评论数") + private Integer sumCount; + + @ApiModelProperty(value = "好评数") + private Integer goodCount; + + @ApiModelProperty(value = "中评数") + private Integer inCount; + + @ApiModelProperty(value = "差评数") + private Integer poorCount; + + @ApiModelProperty(value = "好评率") + private String replyChance; + + @ApiModelProperty(value = "好评星星数") + private String replySstar; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/vo/YxStoreProductAttrQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/product/vo/YxStoreProductAttrQueryVo.java new file mode 100644 index 0000000..b585476 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/vo/YxStoreProductAttrQueryVo.java @@ -0,0 +1,41 @@ +package co.yixiang.modules.product.vo; + +import co.yixiang.modules.product.service.dto.AttrValueDto; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 商品属性表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-10-23 + */ +@Data +@ApiModel(value = "YxStoreProductAttrQueryVo对象", description = "商品属性表查询参数") +public class YxStoreProductAttrQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + private Long id; + + @ApiModelProperty(value = "商品ID") + private Long productId; + + @ApiModelProperty(value = "属性名") + private String attrName; + + @ApiModelProperty(value = "属性值") + private String attrValues; + + @ApiModelProperty(value = "属性值集合") + private List attrValue; + + @ApiModelProperty(value = "属性") + private List attrValueArr; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/vo/YxStoreProductQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/product/vo/YxStoreProductQueryVo.java new file mode 100644 index 0000000..387cf76 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/vo/YxStoreProductQueryVo.java @@ -0,0 +1,160 @@ +package co.yixiang.modules.product.vo; + + + +import cn.hutool.core.util.StrUtil; +import co.yixiang.modules.product.domain.YxStoreProductAttrValue; +import co.yixiang.serializer.BigDecimalSerializer; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + *

+ * 商品表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-10-19 + */ +@Data +@ApiModel(value = "YxStoreProductQueryVo对象", description = "商品表查询参数") +public class YxStoreProductQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "商品id") + private Long id; + + @ApiModelProperty(value = "商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)") + private Integer merId; + + @ApiModelProperty(value = "商品图片") + private String image; + + private String image_base; + + private String codeBase; + + public String getImage_base() { + return image; + } + + @ApiModelProperty(value = "是否收藏") + private Boolean userCollect = false; + + @ApiModelProperty(value = "是否喜欢") + private Boolean userLike = false; + + @ApiModelProperty(value = "轮播图,多个用,分割") + private String sliderImage; + + private List sliderImageArr; + + public List getSliderImageArr() { + //Arrays.asList(sliderImage.split(",")); + if(StrUtil.isNotEmpty(sliderImage)){ + return Arrays.asList(sliderImage.split(",")); + } + return new ArrayList<>(); + } + + private YxStoreProductAttrValue attrInfo; + + @ApiModelProperty(value = "商品名称") + private String storeName; + + @ApiModelProperty(value = "商品简介") + private String storeInfo; + + @ApiModelProperty(value = "关键字") + private String keyword; + + @ApiModelProperty(value = "分类id") + private String cateId; + + @ApiModelProperty(value = "商品价格") + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal price; + + @ApiModelProperty(value = "会员价格") + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal vipPrice; + + @ApiModelProperty(value = "市场价") + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal otPrice; + + @ApiModelProperty(value = "邮费") + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal postage; + + @ApiModelProperty(value = "单位名") + private String unitName; + + @ApiModelProperty(value = "排序") + private Integer sort; + + @ApiModelProperty(value = "销量") + private Integer sales; + + @ApiModelProperty(value = "库存") + private Integer stock; + + @ApiModelProperty(value = "产品描述") + private String description; + + @ApiModelProperty(value = "是否包邮") + private Integer isPostage; + + @ApiModelProperty(value = "成本价") + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal cost; + + @ApiModelProperty(value = "秒杀状态 0 未开启 1已开启") + private Integer isSeckill; + + @ApiModelProperty(value = "砍价状态 0未开启 1开启") + private Integer isBargain; + + @ApiModelProperty(value = "是否优品推荐") + private Integer isGood; + + @ApiModelProperty(value = "虚拟销量") + private Integer ficti; + + @ApiModelProperty(value = "浏览量") + private Integer browse; + + @ApiModelProperty(value = "状态(0:未上架,1:上架)") + private Integer isShow; + + @ApiModelProperty(value = "获得积分") + private BigDecimal giveIntegral; + + @ApiModelProperty(value = "运费模板ID") + private Integer tempId; + + /** 是否单独分佣 */ + @ApiModelProperty(value = "是否单独分佣") + private Integer isSub; + + /** 规格 0单 1多 */ + @ApiModelProperty(value = "规格 0单 1多 ") + private Integer specType; + + /** 是否开启积分兑换*/ + @ApiModelProperty(value = "是否开启积分兑换") + private Integer isIntegral; + + /** 需要多少积分*/ + @ApiModelProperty(value = "需要多少积分") + private Integer integral; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/vo/YxStoreProductRelationQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/product/vo/YxStoreProductRelationQueryVo.java new file mode 100644 index 0000000..9799142 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/vo/YxStoreProductRelationQueryVo.java @@ -0,0 +1,68 @@ +package co.yixiang.modules.product.vo; + +import co.yixiang.serializer.DoubleSerializer; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 商品点赞和收藏表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-10-23 + */ +@Data +@ApiModel(value = "YxStoreProductRelationQueryVo对象", description = "商品点赞和收藏表查询参数") +public class YxStoreProductRelationQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + private Long id; + + @ApiModelProperty(value = "用户ID") + private Long uid; + + @ApiModelProperty(value = "商品ID") + private Long productId; + + @ApiModelProperty(value = "类型(收藏(collect)、点赞(like))") + private String type; + + @ApiModelProperty(value = "某种类型的商品(普通商品、秒杀商品)") + private String category; + + @ApiModelProperty(value = "添加时间") + private Date createTime; + + @ApiModelProperty(value = "产品图片") + private String image; + + @ApiModelProperty(value = "是否显示") + private Integer isShow; + + @ApiModelProperty(value = "原价") + @JsonSerialize(using = DoubleSerializer.class) + private Double otPrice; + + @ApiModelProperty(value = "父ID") + private Integer pid; + + @ApiModelProperty(value = "产品价格") + @JsonSerialize(using = DoubleSerializer.class) + private Double price; + + @ApiModelProperty(value = "产品销量") + private Integer sales; + + @ApiModelProperty(value = "商品名称") + private String storeName; + + @ApiModelProperty(value = "是否开启积分兑换") + private Integer isIntegral; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/vo/YxStoreProductReplyQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/product/vo/YxStoreProductReplyQueryVo.java new file mode 100644 index 0000000..8036ea9 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/vo/YxStoreProductReplyQueryVo.java @@ -0,0 +1,86 @@ +package co.yixiang.modules.product.vo; + +import cn.hutool.core.util.StrUtil; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 评论表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-10-23 + */ +@Data +@ApiModel(value = "YxStoreProductReplyQueryVo对象", description = "评论表查询参数") +public class YxStoreProductReplyQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "评论ID") + private Long id; + + @ApiModelProperty(value = "产品id") + private Long productId; + + @ApiModelProperty(value = "某种商品类型(普通商品、秒杀商品)") + private String replyType; + + @ApiModelProperty(value = "商品分数") + private Integer productScore; + + @ApiModelProperty(value = "服务分数") + private Integer serviceScore; + + @ApiModelProperty(value = "评论内容") + private String comment; + + @ApiModelProperty(value = "评论图片") + private String[] pics; + + private String pictures; + + private String[] picturesArr; + + public String[] getPicturesArr() { + if(StrUtil.isNotEmpty(pictures)){ + return pictures.split(","); + }else{ + return new String[]{}; + } + + } + + + @ApiModelProperty(value = "管理员回复内容") + private String merchantReplyContent; + + @ApiModelProperty(value = "管理员回复时间") + private Date merchantReplyTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date createTime; + + @ApiModelProperty(value = "评价星星数") + private String star; + + @ApiModelProperty(value = "用户昵称") + private String nickname; + + @ApiModelProperty(value = "用户头像") + private String avatar; + + @ApiModelProperty(value = "商品sku") + private String sku; + + @JsonIgnore + private String cartInfo; + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/product/vo/YxSystemStoreQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/product/vo/YxSystemStoreQueryVo.java new file mode 100644 index 0000000..75230c2 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/product/vo/YxSystemStoreQueryVo.java @@ -0,0 +1,64 @@ +package co.yixiang.modules.product.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 门店自提 查询结果对象 + *

+ * + * @author hupeng + * @date 2020-03-04 + */ +@Data +@ApiModel(value = "YxSystemStoreQueryVo对象", description = "门店自提查询参数") +public class YxSystemStoreQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "门店ID") + private Integer id; + + @ApiModelProperty(value = "门店名称") + private String name; + + @ApiModelProperty(value = "简介") + private String introduction; + + @ApiModelProperty(value = "手机号码") + private String phone; + + @ApiModelProperty(value = "省市区") + private String address; + + @ApiModelProperty(value = "详细地址") + private String detailedAddress; + + @ApiModelProperty(value = "门店logo") + private String image; + + @ApiModelProperty(value = "纬度") + private String latitude; + + @ApiModelProperty(value = "经度") + private String longitude; + + @ApiModelProperty(value = "核销有效日期") + private String validTime; + + private String latlng; + + public String getLatlng(){ + return latitude+","+longitude; + } + + @ApiModelProperty(value = "每日营业开关时间") + private String dayTime; + + @ApiModelProperty(value = "距离") + private String distance; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/domain/StoreAfterSales.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/domain/StoreAfterSales.java new file mode 100644 index 0000000..d1cf43c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/domain/StoreAfterSales.java @@ -0,0 +1,79 @@ +package co.yixiang.modules.sales.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +/** + * @author : gzlv 2021/6/27 15:42 + */ +@Data +@TableName("yx_store_after_sales") +public class StoreAfterSales { + + /** id */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** 订单号 */ + private String orderCode; + + /** 退款金额 */ + private BigDecimal refundAmount; + + /** 服务类型0仅退款1退货退款 */ + private Integer serviceType; + + /** 申请原因 */ + private String reasons; + + /** 说明 */ + private String explains; + + /** 说明图片->多个用逗号分割 */ + private String explainImg; + + @ApiModelProperty(value = "快递公司编码") + private String shipperCode; + + /** 物流单号 */ + private String deliverySn; + + /** 物流名称 */ + private String deliveryName; + + /** 状态 0已提交等待平台审核 1平台已审核 等待用户发货/退款 2 用户已发货 3已完成 */ + private Integer state; + + /** 售后状态-0正常1用户取消2商家拒绝 */ + private Integer salesState; + + /** 添加时间 */ + private Timestamp createTime; + + /** 逻辑删除 */ + private Integer isDel; + + /** 用户id */ + private Long userId; + + /** + * 收货人 + */ + private String consignee; + + /** + * 手机号 + */ + private String phoneNumber; + + /** + * 地址 + */ + private String address; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/domain/StoreAfterSalesItem.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/domain/StoreAfterSalesItem.java new file mode 100644 index 0000000..1102f24 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/domain/StoreAfterSalesItem.java @@ -0,0 +1,30 @@ +package co.yixiang.modules.sales.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +/** + * @author : gzlv 2021/6/27 15:49 + */ +@Data +@TableName("yx_store_after_sales_item") +public class StoreAfterSalesItem { + + /** 主键id */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** 售后id */ + private Long storeAfterSalesId; + + /** 商品id */ + private Long productId; + + /** 退货东西的详情信息 */ + private String cartInfo; + + /** 逻辑删除 */ + private Integer isDel; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/domain/StoreAfterSalesStatus.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/domain/StoreAfterSalesStatus.java new file mode 100644 index 0000000..74418cf --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/domain/StoreAfterSalesStatus.java @@ -0,0 +1,35 @@ +package co.yixiang.modules.sales.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.sql.Timestamp; + +/** + * @author : gzlv 2021/6/27 15:51 + */ +@Data +@TableName("yx_store_after_sales_status") +public class StoreAfterSalesStatus { + + /** Id */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** 售后id */ + private Long storeAfterSalesId; + + /** 操作类型 0售后订单生成 1后台审核成功 2用户发货 3打款 4审核失败 5用户撤销*/ + private Integer changeType; + + /** 操作备注 */ + private String changeMessage; + + /** 操作时间 */ + private Timestamp changeTime; + + /** 操作人 */ + private String operator; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/param/ProsuctParam.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/param/ProsuctParam.java new file mode 100644 index 0000000..f267fde --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/param/ProsuctParam.java @@ -0,0 +1,16 @@ +package co.yixiang.modules.sales.param; + +import lombok.Data; + +/** + * @author : gzlv 2021/6/27 17:18 + */ +@Data +public class ProsuctParam { + + /** + * 商品id + */ + private Long productId; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/param/SalesCheckDto.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/param/SalesCheckDto.java new file mode 100644 index 0000000..973d8fc --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/param/SalesCheckDto.java @@ -0,0 +1,40 @@ +package co.yixiang.modules.sales.param; + +import lombok.Data; + +/** + * @author : gzlv 2021/6/29 5:25 + */ +@Data +public class SalesCheckDto { + + /** + * 售后id + */ + private Long salesId; + + /** + * 订单编号 + */ + private String orderCode; + + /** + * 审核状态0成功1失败 + */ + private Integer approvalStatus; + + /** + * 收货人 + */ + private String consignee; + + /** + * 手机号 + */ + private String phoneNumber; + + /** + * 地址 + */ + private String address; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/param/StoreAfterSalesParam.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/param/StoreAfterSalesParam.java new file mode 100644 index 0000000..6a046a6 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/param/StoreAfterSalesParam.java @@ -0,0 +1,48 @@ +package co.yixiang.modules.sales.param; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.List; + +/** + * @author : gzlv 2021/6/27 16:36 + */ +@Data +public class StoreAfterSalesParam { + + /** + * 订单号 + */ + @NotBlank + private String orderCode; + + /** + * 服务类型 0仅退款1退货退款 + */ + @NotBlank + private Integer serviceType; + + /** + * 申请原因 + */ + @NotBlank + private String reasonForApplication; + + /** + * 申请说明 + */ + private String applicationInstructions; + + /** + * 申请说明图片 + */ + private String applicationDescriptionPicture; + + /** + * 商品数据 + */ + @NotBlank + private List productParamList; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/param/YxStoreAfterSalesDto.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/param/YxStoreAfterSalesDto.java new file mode 100644 index 0000000..559f56c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/param/YxStoreAfterSalesDto.java @@ -0,0 +1,75 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.sales.param; + +import lombok.Data; +import java.util.Date; +import java.math.BigDecimal; +import java.io.Serializable; + +/** +* @author gzlv +* @date 2021-06-30 +*/ +@Data +public class YxStoreAfterSalesDto implements Serializable { + + private Long id; + + /** 订单号 */ + private String orderCode; + + /** 退款金额 */ + private BigDecimal refundAmount; + + /** 服务类型0仅退款1退货退款 */ + private Integer serviceType; + + /** 申请原因 */ + private String reasons; + + /** 说明 */ + private String explains; + + /** 说明图片->多个用逗号分割 */ + private String explainImg; + + /** 物流公司编码 */ + private String shipperCode; + + /** 物流单号 */ + private String deliverySn; + + /** 物流名称 */ + private String deliveryName; + + /** 状态 0已提交等待平台审核 1平台已审核 等待用户发货/退款 2 用户已发货 3退款成功 */ + private Integer state; + + /** 售后状态-0正常1用户取消2商家拒绝 */ + private Integer salesState; + + /** 添加时间 */ + private Date createTime; + + /** 逻辑删除 */ + private Integer isDel; + + /** 用户id */ + private Long userId; + + /** 商家收货人 */ + private String consignee; + + /** 商家手机号 */ + private String phoneNumber; + + /** 商家地址 */ + private String address; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/param/YxStoreAfterSalesQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/param/YxStoreAfterSalesQueryCriteria.java new file mode 100644 index 0000000..4e3b728 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/param/YxStoreAfterSalesQueryCriteria.java @@ -0,0 +1,41 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.sales.param; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.sql.Timestamp; +import java.util.Date; +import java.util.List; +import co.yixiang.annotation.Query; + +/** +* @author gzlv +* @date 2021-06-30 +*/ +@Data +public class YxStoreAfterSalesQueryCriteria{ + + /** + * 订单号 + */ + private String orderCode; + + /** 售后状态-0正常1用户取消2商家拒绝 */ + private Integer salesState; + + private List time; + + /** 状态 0已提交等待平台审核 1平台已审核 等待用户发货/退款 2 用户已发货 3已完成 */ + private Integer state; + + /** 服务类型0仅退款1退货退款 */ + private Integer serviceType; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/service/StoreAfterSalesItemService.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/StoreAfterSalesItemService.java new file mode 100644 index 0000000..bd56779 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/StoreAfterSalesItemService.java @@ -0,0 +1,10 @@ +package co.yixiang.modules.sales.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.sales.domain.StoreAfterSalesItem; + +/** + * @author : gzlv 2021/6/27 15:55 + */ +public interface StoreAfterSalesItemService extends BaseService { +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/service/StoreAfterSalesService.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/StoreAfterSalesService.java new file mode 100644 index 0000000..c229e48 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/StoreAfterSalesService.java @@ -0,0 +1,130 @@ +package co.yixiang.modules.sales.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.sales.domain.StoreAfterSales; +import co.yixiang.modules.sales.param.StoreAfterSalesParam; +import co.yixiang.modules.sales.param.YxStoreAfterSalesDto; +import co.yixiang.modules.sales.param.YxStoreAfterSalesQueryCriteria; +import co.yixiang.modules.sales.service.vo.StoreAfterSalesVo; +import co.yixiang.modules.sales.service.vo.YxStoreOrderCartInfoVo; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * @author : gzlv 2021/6/27 15:54 + */ +public interface StoreAfterSalesService extends BaseService { + + /** + * 创建售后订单 + * + * @param userId 用户id + * @param nickname 用户昵称 + * @param storeAfterSalesParam / + */ + void applyForAfterSales(Long userId, String nickname, StoreAfterSalesParam storeAfterSalesParam); + + /** + * 查询订单详情 + * @param key 订单号 + */ + List checkOrderDetails(String key); + + /** + * 查询列表 + * @param uid 用户id + * @param status 状态 + * @param page 页 + * @param orderCode + * @param limit 数量 + * @return + */ + Map salesList(Long uid, Integer status, Integer page, String orderCode, Integer limit); + + /** + * 查询详情 + * @param key 订单号 + * @param id + * @param uid 用户id + */ + List getStoreInfo(String key, Long id, Long uid); + + /** + * + * @param storeInfo + * @return + */ + StoreAfterSalesVo handleSales(StoreAfterSalesVo storeInfo); + + /** + * 撤销申请 + * @param key 订单号 + * @param uid 用户id + * @param aLong + * @return Boolean + */ + Boolean revoke(String key, Long uid, Long aLong); + + /** + * 添加快递信息 + * @param code 物流公司编码 + * @param name 物流公司名称 + * @param postalCode + * @param orderCode + * @return + */ + Boolean addLogisticsInformation(String code, String name, String postalCode ,String orderCode); + + /** + * 删除售后订单 + * @param orderCode / + * @param id + * @return / + */ + Boolean deleteAfterSalesOrder(String orderCode, Long id); + + /** + * 售后订单审核 + * @param salesId 售后id + * @param orderCode 订单id + * @param approvalStatus 审核状态 + * @param consignee 收货人 + * @param phoneNumber 收货人电话 + * @param address 地址 + * @return / + */ + Object salesCheck(Long salesId, String orderCode, Integer approvalStatus, String consignee, String phoneNumber, String address); + + /** + * 打款 + */ + StoreAfterSales makeMoney(Long salesId, String orderCode); + + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxStoreAfterSalesQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxStoreAfterSalesQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/service/StoreAfterSalesStatusService.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/StoreAfterSalesStatusService.java new file mode 100644 index 0000000..3232e20 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/StoreAfterSalesStatusService.java @@ -0,0 +1,10 @@ +package co.yixiang.modules.sales.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.sales.domain.StoreAfterSalesStatus; + +/** + * @author : gzlv 2021/6/27 15:55 + */ +public interface StoreAfterSalesStatusService extends BaseService { +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesItemServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesItemServiceImpl.java new file mode 100644 index 0000000..049759c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesItemServiceImpl.java @@ -0,0 +1,19 @@ +package co.yixiang.modules.sales.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.modules.sales.domain.StoreAfterSalesItem; +import co.yixiang.modules.sales.service.StoreAfterSalesItemService; +import co.yixiang.modules.sales.service.mapper.StoreAfterSalesItemMapper; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +/** + * @author : gzlv 2021/6/27 15:55 + */ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class StoreAfterSalesItemServiceImpl extends BaseServiceImpl implements StoreAfterSalesItemService { +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java new file mode 100644 index 0000000..89b7e49 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java @@ -0,0 +1,414 @@ +package co.yixiang.modules.sales.service.impl; + +import cn.hutool.core.util.NumberUtil; +import co.yixiang.api.YshopException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.OrderInfoEnum; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.exception.ErrorRequestException; +import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; +import co.yixiang.modules.order.domain.YxStoreOrder; +import co.yixiang.modules.order.domain.YxStoreOrderCartInfo; +import co.yixiang.modules.order.service.mapper.StoreOrderCartInfoMapper; +import co.yixiang.modules.order.service.mapper.StoreOrderMapper; +import co.yixiang.modules.sales.domain.StoreAfterSales; +import co.yixiang.modules.sales.domain.StoreAfterSalesItem; +import co.yixiang.modules.sales.domain.StoreAfterSalesStatus; +import co.yixiang.modules.sales.param.ProsuctParam; +import co.yixiang.modules.sales.param.StoreAfterSalesParam; +import co.yixiang.modules.sales.param.YxStoreAfterSalesDto; +import co.yixiang.modules.sales.param.YxStoreAfterSalesQueryCriteria; +import co.yixiang.modules.sales.service.StoreAfterSalesService; +import co.yixiang.modules.sales.service.mapper.StoreAfterSalesItemMapper; +import co.yixiang.modules.sales.service.mapper.StoreAfterSalesMapper; +import co.yixiang.modules.sales.service.mapper.StoreAfterSalesStatusMapper; +import co.yixiang.modules.sales.service.vo.StoreAfterSalesVo; +import co.yixiang.modules.sales.service.vo.YxStoreOrderCartInfoVo; +import co.yixiang.utils.FileUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.AllArgsConstructor; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author : gzlv 2021/6/27 15:56 + */ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class StoreAfterSalesServiceImpl extends BaseServiceImpl implements StoreAfterSalesService { + + private final StoreOrderMapper storeOrderMapper; + private final StoreOrderCartInfoMapper storeOrderCartInfoMapper; + private final StoreAfterSalesItemMapper storeAfterSalesItemMapper; + private final StoreAfterSalesStatusMapper storeAfterSalesStatusMapper; + private final IGenerator generator; + + @Override + public void applyForAfterSales(Long userId, String nickname, StoreAfterSalesParam storeAfterSalesParam) { + + YxStoreOrder yxStoreOrder = storeOrderMapper.selectOne(Wrappers.lambdaQuery().eq(YxStoreOrder::getOrderId, storeAfterSalesParam.getOrderCode()).eq(YxStoreOrder::getUid, userId)); + checkOrder(yxStoreOrder); + //商品除去优惠后的总价格 + BigDecimal totalPrice = BigDecimal.ZERO; + //拿到所有的商品 + List yxStoreOrderCartInfos = storeOrderCartInfoMapper.selectList(Wrappers.lambdaQuery().eq(YxStoreOrderCartInfo::getOid, yxStoreOrder.getId())); + for (YxStoreOrderCartInfo yxStoreOrderCartInfo : yxStoreOrderCartInfos) { + YxStoreCartQueryVo cartInfo = JSONObject.parseObject(yxStoreOrderCartInfo.getCartInfo(), YxStoreCartQueryVo.class); + ProsuctParam prosuctParam = storeAfterSalesParam.getProductParamList().stream().filter(item -> item.getProductId().equals(yxStoreOrderCartInfo.getProductId())).findFirst().orElse(new ProsuctParam()); + if (prosuctParam.getProductId() != null) { + //商品优惠前总金额 + BigDecimal totalAmountOfGoods = NumberUtil.mul(cartInfo.getTruePrice(), cartInfo.getCartNum()); + //商品优惠总金额 + BigDecimal commodityDiscountAmount = NumberUtil.mul(NumberUtil.div(totalAmountOfGoods, NumberUtil.sub(yxStoreOrder.getTotalPrice(), yxStoreOrder.getPayPostage())), yxStoreOrder.getCouponPrice()); + //商品优惠后总金额 + totalPrice = NumberUtil.add(totalPrice, NumberUtil.sub(totalAmountOfGoods, commodityDiscountAmount)); + + yxStoreOrderCartInfo.setIsAfterSales(0); + storeOrderCartInfoMapper.updateById(yxStoreOrderCartInfo); + + yxStoreOrder.setStatus(-1); + storeOrderMapper.updateById(yxStoreOrder); + } + } + //生成售后订单 + StoreAfterSales storeAfterSales = new StoreAfterSales(); + storeAfterSales.setOrderCode(storeAfterSalesParam.getOrderCode()); + storeAfterSales.setRefundAmount(totalPrice); + storeAfterSales.setServiceType(storeAfterSalesParam.getServiceType()); + storeAfterSales.setReasons(storeAfterSalesParam.getReasonForApplication()); + storeAfterSales.setExplains(storeAfterSalesParam.getApplicationInstructions()); + storeAfterSales.setExplainImg(storeAfterSalesParam.getApplicationDescriptionPicture()); + storeAfterSales.setState(0); + storeAfterSales.setSalesState(0); + storeAfterSales.setCreateTime(Timestamp.valueOf(LocalDateTime.now())); + storeAfterSales.setIsDel(0); + storeAfterSales.setUserId(userId); + baseMapper.insert(storeAfterSales); + //售后商品详情 + for (ProsuctParam prosuctParam : storeAfterSalesParam.getProductParamList()) { + YxStoreOrderCartInfo yxStoreOrderCartInfo = yxStoreOrderCartInfos.stream().filter(item -> item.getProductId().equals(prosuctParam.getProductId())).findFirst().orElse(new YxStoreOrderCartInfo()); + StoreAfterSalesItem storeAfterSalesItem = new StoreAfterSalesItem(); + storeAfterSalesItem.setStoreAfterSalesId(storeAfterSales.getId()); + storeAfterSalesItem.setProductId(yxStoreOrderCartInfo.getProductId()); + storeAfterSalesItem.setCartInfo(yxStoreOrderCartInfo.getCartInfo()); + storeAfterSalesItem.setIsDel(0); + storeAfterSalesItemMapper.insert(storeAfterSalesItem); + } + + //操作记录 + StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus(); + storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId()); + storeAfterSalesStatus.setChangeType(0); + storeAfterSalesStatus.setChangeMessage("售后订单生成"); + storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now())); + storeAfterSalesStatus.setOperator(nickname); + storeAfterSalesStatusMapper.insert(storeAfterSalesStatus); + + } + + @Override + public List checkOrderDetails(String key) { + List yxStoreOrderCartInfos = storeOrderCartInfoMapper.selectList(Wrappers.lambdaQuery().eq(YxStoreOrderCartInfo::getOid, key)); + YxStoreOrder yxStoreOrder = storeOrderMapper.selectById(key); + List yxStoreOrderCartInfoVos = new ArrayList<>(); + for (YxStoreOrderCartInfo yxStoreOrderCartInfo : yxStoreOrderCartInfos) { + + YxStoreOrderCartInfoVo yxStoreOrderCartInfoVo = new YxStoreOrderCartInfoVo(); + yxStoreOrderCartInfoVo.setId(yxStoreOrderCartInfo.getId()); + yxStoreOrderCartInfoVo.setOid(yxStoreOrderCartInfo.getOid()); + yxStoreOrderCartInfoVo.setCartId(yxStoreOrderCartInfo.getCartId()); + yxStoreOrderCartInfoVo.setProductId(yxStoreOrderCartInfo.getProductId()); + YxStoreCartQueryVo cartInfo = JSONObject.parseObject(yxStoreOrderCartInfo.getCartInfo(), YxStoreCartQueryVo.class); + yxStoreOrderCartInfoVo.setCartInfo(cartInfo); + yxStoreOrderCartInfoVo.setUnique(yxStoreOrderCartInfo.getUnique()); + yxStoreOrderCartInfoVo.setIsAfterSales(yxStoreOrderCartInfo.getIsAfterSales() == null ? 0 : yxStoreOrderCartInfo.getIsAfterSales()); + + //商品优惠前总金额 + BigDecimal totalAmountOfGoods = NumberUtil.mul(cartInfo.getTruePrice(), cartInfo.getCartNum()); + //商品优惠总金额 + BigDecimal commodityDiscountAmount = NumberUtil.mul(NumberUtil.div(totalAmountOfGoods, NumberUtil.sub(yxStoreOrder.getTotalPrice(), yxStoreOrder.getPayPostage())), yxStoreOrder.getCouponPrice()); + + yxStoreOrderCartInfoVo.setRefundablePrice(NumberUtil.sub(totalAmountOfGoods, commodityDiscountAmount)); + yxStoreOrderCartInfoVos.add(yxStoreOrderCartInfoVo); + } + + return yxStoreOrderCartInfoVos; + + } + + @Override + public Map salesList(Long uid, Integer status, Integer page, String orderCode, Integer limit) { + Page storeAfterSalesPage = new Page<>(page, limit); + List integers = new ArrayList<>(); + if (status == 1) { + integers.add(0); + integers.add(1); + integers.add(2); + } + if (status == 2) { + integers.add(3); + } + baseMapper.selectPage(storeAfterSalesPage, Wrappers.lambdaQuery() + .eq(uid != null, StoreAfterSales::getUserId, uid).in(status == 1, StoreAfterSales::getState, integers) + .in(status == 2, StoreAfterSales::getState, integers) + .eq(StringUtils.isNotBlank(orderCode), StoreAfterSales::getOrderCode, orderCode) + .orderByDesc(StoreAfterSales::getCreateTime) + .eq(StoreAfterSales::getIsDel, ShopCommonEnum.DELETE_0.getValue())); + List storeAfterSalesVos = generator.convert(storeAfterSalesPage.getRecords(), StoreAfterSalesVo.class); + Map map = new HashMap<>(); + if (uid == null) { + map.put("content", storeAfterSalesVos.stream().map(this::handleSales).collect(Collectors.toList())); + map.put("totalElements", storeAfterSalesPage.getTotal()); + } else { + map.put("list", storeAfterSalesVos.stream().map(this::handleSales).collect(Collectors.toList())); + map.put("total", storeAfterSalesPage.getTotal()); + map.put("totalPage", storeAfterSalesPage.getPages()); + } + return map; + } + + @Override + public List getStoreInfo(String key, Long id, Long uid) { + List storeAfterSales = baseMapper.selectList(Wrappers.lambdaQuery().eq(id != null, StoreAfterSales::getId, id).eq(StoreAfterSales::getUserId, uid).eq(StoreAfterSales::getOrderCode, key)); + return generator.convert(storeAfterSales, StoreAfterSalesVo.class); + } + + /** + * 处理售后订单返回的状态 + * + * @param storeAfterSalesVo / + * @return StoreAfterSalesVo / + */ + @Override + public StoreAfterSalesVo handleSales(StoreAfterSalesVo storeAfterSalesVo) { + List storeAfterSalesItems = storeAfterSalesItemMapper.selectList(Wrappers.lambdaQuery().eq(StoreAfterSalesItem::getStoreAfterSalesId, storeAfterSalesVo.getId())); + List cartInfo = storeAfterSalesItems.stream() + .map(cart -> JSON.parseObject(cart.getCartInfo(), YxStoreCartQueryVo.class)) + .collect(Collectors.toList()); + storeAfterSalesVo.setCartInfo(cartInfo); + List storeAfterSalesStatuses = storeAfterSalesStatusMapper.selectList(Wrappers.lambdaQuery().eq(StoreAfterSalesStatus::getStoreAfterSalesId, storeAfterSalesVo.getId())); + + storeAfterSalesVo.setCompleteTime(storeAfterSalesStatuses.stream().filter(item -> item.getChangeType() == 3).findFirst().orElse(new StoreAfterSalesStatus()).getChangeTime()); + storeAfterSalesVo.setDeliveryTime(storeAfterSalesStatuses.stream().filter(item -> item.getChangeType() == 2).findFirst().orElse(new StoreAfterSalesStatus()).getChangeTime()); + storeAfterSalesVo.setAuditFailedTime(storeAfterSalesStatuses.stream().filter(item -> item.getChangeType() == 4).findFirst().orElse(new StoreAfterSalesStatus()).getChangeTime()); + storeAfterSalesVo.setReviewTime(storeAfterSalesStatuses.stream().filter(item -> item.getChangeType() == 1).findFirst().orElse(new StoreAfterSalesStatus()).getChangeTime()); + storeAfterSalesVo.setRevocationTime(storeAfterSalesStatuses.stream().filter(item -> item.getChangeType() == 5).findFirst().orElse(new StoreAfterSalesStatus()).getChangeTime()); + return storeAfterSalesVo; + } + + @Override + public Boolean revoke(String key, Long uid, Long id) { + StoreAfterSales storeAfterSales = baseMapper.selectOne(Wrappers.lambdaQuery().eq(StoreAfterSales::getUserId, uid).eq(StoreAfterSales::getId, id).eq(StoreAfterSales::getOrderCode, key)); + if (storeAfterSales == null) { + throw new YshopException("未查询到售后订单信息"); + } + if (storeAfterSales.getState() == 2 || storeAfterSales.getState() == 3) { + throw new YshopException("订单不能撤销"); + } + storeAfterSales.setSalesState(1); + + YxStoreOrder yxStoreOrder = storeOrderMapper.selectOne(Wrappers.lambdaQuery().eq(YxStoreOrder::getOrderId, key)); + yxStoreOrder.setStatus(-2); + storeOrderMapper.updateById(yxStoreOrder); + + List yxStoreOrderCartInfos = storeOrderCartInfoMapper.selectList(Wrappers.lambdaQuery().eq(YxStoreOrderCartInfo::getOid, yxStoreOrder.getId())); + for (YxStoreOrderCartInfo yxStoreOrderCartInfo : yxStoreOrderCartInfos) { + yxStoreOrderCartInfo.setIsAfterSales(1); + storeOrderCartInfoMapper.updateById(yxStoreOrderCartInfo); + } + + //操作记录 + StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus(); + storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId()); + storeAfterSalesStatus.setChangeType(5); + storeAfterSalesStatus.setChangeMessage("售后订单生成"); + storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now())); + storeAfterSalesStatus.setOperator("用户操作"); + storeAfterSalesStatusMapper.insert(storeAfterSalesStatus); + + return baseMapper.updateById(storeAfterSales) > 0; + } + + @Override + public Boolean addLogisticsInformation(String code, String name, String postalCode, String orderCode) { + StoreAfterSales storeAfterSales = baseMapper.selectOne(Wrappers.lambdaQuery().eq(StoreAfterSales::getOrderCode, orderCode)); + if (storeAfterSales.getState() != 1) { + throw new YshopException("当前状态不能添加物流信息!"); + } + storeAfterSales.setShipperCode(code); + storeAfterSales.setDeliverySn(postalCode); + storeAfterSales.setDeliveryName(name); + storeAfterSales.setState(2); + + //操作记录 + StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus(); + storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId()); + storeAfterSalesStatus.setChangeType(2); + storeAfterSalesStatus.setChangeMessage("售后订单生成"); + storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now())); + storeAfterSalesStatus.setOperator("用户操作"); + storeAfterSalesStatusMapper.insert(storeAfterSalesStatus); + + return baseMapper.updateById(storeAfterSales) > 0; + } + + @Override + public Boolean deleteAfterSalesOrder(String orderCode, Long id) { + StoreAfterSales storeAfterSales = baseMapper.selectOne(Wrappers.lambdaQuery().eq(StoreAfterSales::getId, id).eq(StoreAfterSales::getOrderCode, orderCode)); + return baseMapper.deleteById(storeAfterSales.getId()) > 0; + } + + @Override + public Object salesCheck(Long salesId, String orderCode, Integer approvalStatus, String consignee, String phoneNumber, String address) { + StoreAfterSales storeAfterSales = baseMapper.selectOne(Wrappers.lambdaQuery().eq(StoreAfterSales::getOrderCode, orderCode).eq(StoreAfterSales::getId, salesId)); + if (approvalStatus == 0) { + storeAfterSales.setState(1); + if (storeAfterSales.getServiceType() == 1) { + if (StringUtils.isEmpty(consignee) || StringUtils.isEmpty(phoneNumber) || StringUtils.isEmpty(address)) { + throw new ErrorRequestException("请输入收货人信息"); + } + storeAfterSales.setConsignee(consignee); + storeAfterSales.setPhoneNumber(phoneNumber); + storeAfterSales.setAddress(address); + } + //操作记录 + StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus(); + storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId()); + storeAfterSalesStatus.setChangeType(1); + storeAfterSalesStatus.setChangeMessage("平台审核成功"); + storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now())); + storeAfterSalesStatus.setOperator("admin"); + storeAfterSalesStatusMapper.insert(storeAfterSalesStatus); + } else { + storeAfterSales.setState(1); + storeAfterSales.setSalesState(2); + //操作记录 + StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus(); + storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId()); + storeAfterSalesStatus.setChangeType(4); + storeAfterSalesStatus.setChangeMessage("平台审核失败"); + storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now())); + storeAfterSalesStatus.setOperator("admin"); + storeAfterSalesStatusMapper.insert(storeAfterSalesStatus); + + this.makeMoney(storeAfterSales.getId(),storeAfterSales.getOrderCode()); + } + return baseMapper.updateById(storeAfterSales) > 0; + } + + @Override + public StoreAfterSales makeMoney(Long salesId, String orderCode) { + StoreAfterSales storeAfterSales = baseMapper.selectOne(Wrappers.lambdaQuery().eq(StoreAfterSales::getOrderCode, orderCode).eq(StoreAfterSales::getId, salesId)); + storeAfterSales.setState(3); + baseMapper.updateById(storeAfterSales); + //操作记录 + StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus(); + storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId()); + storeAfterSalesStatus.setChangeType(3); + storeAfterSalesStatus.setChangeMessage("平台打款成功"); + storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now())); + storeAfterSalesStatus.setOperator("admin"); + storeAfterSalesStatusMapper.insert(storeAfterSalesStatus); + + YxStoreOrder yxStoreOrder = storeOrderMapper.selectOne(Wrappers.lambdaQuery().eq(YxStoreOrder::getOrderId, storeAfterSales.getOrderCode())); + yxStoreOrder.setStatus(-2); + storeOrderMapper.updateById(yxStoreOrder); + return storeAfterSales; + } + + /** + * 检查订单是否符合售后订单 + * + * @param yxStoreOrder 订单 + */ + private void checkOrder(YxStoreOrder yxStoreOrder) { + if (yxStoreOrder == null) { + throw new YshopException("未查询到订单信息"); + } + + if (!yxStoreOrder.getPaid().equals(OrderInfoEnum.PAY_STATUS_1.getValue()) || !yxStoreOrder.getRefundStatus().equals(OrderInfoEnum.REFUND_STATUS_0.getValue()) || !yxStoreOrder.getStatus().equals(OrderInfoEnum.STATUS_2.getValue())) { + throw new YshopException("订单状态不能售后"); + } + } + + @Override + //@Cacheable + public Map queryAll(YxStoreAfterSalesQueryCriteria criteria, Pageable pageable) { + Page storeAfterSalesPage = new Page<>(pageable.getPageNumber(), pageable.getPageSize()); + + LambdaQueryWrapper eq = Wrappers.lambdaQuery() + .in(ObjectUtils.isNotEmpty(criteria.getState()), StoreAfterSales::getState, criteria.getState()) + .eq(StringUtils.isNotBlank(criteria.getOrderCode()), StoreAfterSales::getOrderCode, criteria.getOrderCode()) + .eq(ObjectUtils.isNotEmpty(criteria.getSalesState()), StoreAfterSales::getSalesState, criteria.getSalesState()) + .eq(ObjectUtils.isNotEmpty(criteria.getServiceType()), StoreAfterSales::getServiceType, criteria.getServiceType()) + .orderByDesc(StoreAfterSales::getCreateTime) + .eq(StoreAfterSales::getIsDel, ShopCommonEnum.DELETE_0.getValue()); + if (CollectionUtils.isNotEmpty(criteria.getTime())) { + eq.ge(StoreAfterSales::getCreateTime, criteria.getTime().get(0)) + .le(StoreAfterSales::getCreateTime, criteria.getTime().get(1)); + } + + baseMapper.selectPage(storeAfterSalesPage, eq); + List storeAfterSalesVos = generator.convert(storeAfterSalesPage.getRecords(), StoreAfterSalesVo.class); + Map map = new HashMap<>(); + map.put("content", storeAfterSalesVos.stream().map(this::handleSales).collect(Collectors.toList())); + map.put("totalElements", storeAfterSalesPage.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxStoreAfterSalesQueryCriteria criteria) { + return baseMapper.selectList(QueryHelpPlus.getPredicate(StoreAfterSales.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxStoreAfterSalesDto yxStoreAfterSales : all) { + Map map = new LinkedHashMap<>(); + map.put("订单号", yxStoreAfterSales.getOrderCode()); + map.put("退款金额", yxStoreAfterSales.getRefundAmount()); + map.put("服务类型0仅退款1退货退款", yxStoreAfterSales.getServiceType()); + map.put("申请原因", yxStoreAfterSales.getReasons()); + map.put("说明", yxStoreAfterSales.getExplains()); + map.put("说明图片->多个用逗号分割", yxStoreAfterSales.getExplainImg()); + map.put("物流公司编码", yxStoreAfterSales.getShipperCode()); + map.put("物流单号", yxStoreAfterSales.getDeliverySn()); + map.put("物流名称", yxStoreAfterSales.getDeliveryName()); + map.put("状态 0已提交等待平台审核 1平台已审核 等待用户发货/退款 2 用户已发货 3退款成功", yxStoreAfterSales.getState()); + map.put("售后状态-0正常1用户取消2商家拒绝", yxStoreAfterSales.getSalesState()); + map.put("添加时间", yxStoreAfterSales.getCreateTime()); + map.put("逻辑删除", yxStoreAfterSales.getIsDel()); + map.put("用户id", yxStoreAfterSales.getUserId()); + map.put("商家收货人", yxStoreAfterSales.getConsignee()); + map.put("商家手机号", yxStoreAfterSales.getPhoneNumber()); + map.put("商家地址", yxStoreAfterSales.getAddress()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesStatusServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesStatusServiceImpl.java new file mode 100644 index 0000000..a66a5cb --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesStatusServiceImpl.java @@ -0,0 +1,19 @@ +package co.yixiang.modules.sales.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.modules.sales.domain.StoreAfterSalesStatus; +import co.yixiang.modules.sales.service.StoreAfterSalesStatusService; +import co.yixiang.modules.sales.service.mapper.StoreAfterSalesStatusMapper; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +/** + * @author : gzlv 2021/6/27 15:56 + */ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class StoreAfterSalesStatusServiceImpl extends BaseServiceImpl implements StoreAfterSalesStatusService { +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/service/mapper/StoreAfterSalesItemMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/mapper/StoreAfterSalesItemMapper.java new file mode 100644 index 0000000..a21ebd2 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/mapper/StoreAfterSalesItemMapper.java @@ -0,0 +1,10 @@ +package co.yixiang.modules.sales.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.sales.domain.StoreAfterSalesItem; + +/** + * @author : gzlv 2021/6/27 15:53 + */ +public interface StoreAfterSalesItemMapper extends CoreMapper { +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/service/mapper/StoreAfterSalesMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/mapper/StoreAfterSalesMapper.java new file mode 100644 index 0000000..51fd30e --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/mapper/StoreAfterSalesMapper.java @@ -0,0 +1,10 @@ +package co.yixiang.modules.sales.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.sales.domain.StoreAfterSales; + +/** + * @author : gzlv 2021/6/27 15:53 + */ +public interface StoreAfterSalesMapper extends CoreMapper { +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/service/mapper/StoreAfterSalesStatusMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/mapper/StoreAfterSalesStatusMapper.java new file mode 100644 index 0000000..a7ce7d4 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/mapper/StoreAfterSalesStatusMapper.java @@ -0,0 +1,10 @@ +package co.yixiang.modules.sales.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.sales.domain.StoreAfterSalesStatus; + +/** + * @author : gzlv 2021/6/27 15:52 + */ +public interface StoreAfterSalesStatusMapper extends CoreMapper { +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/service/vo/StoreAfterSalesVo.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/vo/StoreAfterSalesVo.java new file mode 100644 index 0000000..402bfb1 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/vo/StoreAfterSalesVo.java @@ -0,0 +1,122 @@ +package co.yixiang.modules.sales.service.vo; + +import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.List; + +/** + * @author : gzlv 2021/6/28 0:43 + */ +@Data +public class StoreAfterSalesVo { + + /** id */ + @TableId(value = "uid", type = IdType.AUTO) + private Long id; + + /** 订单号 */ + private String orderCode; + + /** 退款金额 */ + private BigDecimal refundAmount; + + /** 服务类型0仅退款1退货退款 */ + private Integer serviceType; + + /** 申请原因 */ + private String reasons; + + /** 说明 */ + private String explains; + + /** 说明图片->多个用逗号分割 */ + private String explainImg; + + /** 物流单号 */ + private String deliverySn; + + /** 物流名称 */ + private String deliveryName; + + @ApiModelProperty(value = "快递公司编码") + private String shipperCode; + + /** 状态 0已提交等待平台审核 1平台已审核 等待用户发货/退款 2 用户已发货 3退款成功 */ + private Integer state; + + /** 售后状态-0正常1用户取消2商家拒绝 */ + private Integer salesState; + + /** 添加时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Timestamp createTime; + + /** 逻辑删除 */ + private Integer isDel; + + /** 用户id */ + private Long userId; + + private List cartInfo; + + /** + * 收货人 + */ + private String consignee; + + /** + * 手机号 + */ + private String phoneNumber; + + /** + * 地址 + */ + private String address; + + + /** + * 审核时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Timestamp reviewTime; + + /** + * 发货时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Timestamp deliveryTime; + + /** + * 完成时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Timestamp completeTime; + + /** + * 审核失败时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Timestamp auditFailedTime; + + /** + * 撤销时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Timestamp revocationTime; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/service/vo/YxStoreOrderCartInfoVo.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/vo/YxStoreOrderCartInfoVo.java new file mode 100644 index 0000000..5f85242 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/vo/YxStoreOrderCartInfoVo.java @@ -0,0 +1,46 @@ +package co.yixiang.modules.sales.service.vo; + +import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author : gzlv 2021/6/27 22:40 + */ +@Data +public class YxStoreOrderCartInfoVo { + + @TableId + private Long id; + + + /** 订单id */ + private Long oid; + + + /** 购物车id */ + private Long cartId; + + + /** 商品ID */ + private Long productId; + + + /** 购买东西的详细信息 */ + private YxStoreCartQueryVo cartInfo; + + + /** 唯一id */ + @TableField(value = "`unique`") + private String unique; + + /** 是否能售后0不能1能 */ + private Integer isAfterSales; + + /** 可退價格 */ + private BigDecimal refundablePrice; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxAppVersion.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxAppVersion.java new file mode 100644 index 0000000..8480135 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxAppVersion.java @@ -0,0 +1,54 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.shop.domain; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import com.baomidou.mybatisplus.annotation.TableName; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.validation.constraints.*; +import java.util.Date; +import co.yixiang.domain.BaseDomain; + +/** +* @author lioncity +* @date 2020-12-09 +*/ +@Data +@TableName("yx_app_version") +public class YxAppVersion extends BaseDomain { + @TableId + private Integer id; + + + + + /** 版本code */ + private String versionCode; + + /** 版本名称 */ + private String versionName; + + /** 版本描述 */ + private String versionInfo; + + /** 安卓下载链接 */ + private String androidUrl; + + /** 是否强制升级 */ + private Integer forceUpdate; + + /** ios store应用商店链接 */ + private String iosUrl; + + + public void copy(YxAppVersion source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxMaterial.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxMaterial.java new file mode 100644 index 0000000..c5d0648 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxMaterial.java @@ -0,0 +1,55 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("yx_material") +public class YxMaterial extends BaseDomain { + + /** PK */ + @TableId(type = IdType.UUID) + private String id; + + + /** 创建者ID */ + private String createId; + + + /** 类型1、图片;2、视频 */ + private String type; + + + /** 分组ID */ + private String groupId; + + + /** 素材名 */ + private String name; + + + /** 素材链接 */ + private String url; + + + public void copy(YxMaterial source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxMaterialGroup.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxMaterialGroup.java new file mode 100644 index 0000000..94c5001 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxMaterialGroup.java @@ -0,0 +1,43 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("yx_material_group") +public class YxMaterialGroup extends BaseDomain { + + /** PK */ + @TableId(type = IdType.UUID) + private String id; + + + /** 创建者ID */ + private String createId; + + + /** 分组名 */ + private String name; + + + public void copy(YxMaterialGroup source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxSystemAttachment.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxSystemAttachment.java new file mode 100644 index 0000000..d3b5893 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxSystemAttachment.java @@ -0,0 +1,64 @@ +package co.yixiang.modules.shop.domain; + + +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +/** + *

+ * 附件管理表 + *

+ * + * @author hupeng + * @since 2019-11-11 + */ +@Getter +@Setter +@Builder +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "YxSystemAttachment对象", description = "附件管理表") +public class YxSystemAttachment extends BaseDomain { + + private static final long serialVersionUID = 1L; + + @TableId(value = "att_id", type = IdType.AUTO) + private Long attId; + + @ApiModelProperty(value = "附件名称") + private String name; + + @ApiModelProperty(value = "附件路径") + private String attDir; + + @ApiModelProperty(value = "压缩图片路径") + private String sattDir; + + @ApiModelProperty(value = "附件大小") + private String attSize; + + @ApiModelProperty(value = "附件类型") + private String attType; + + @ApiModelProperty(value = "分类ID0编辑器,1产品图片,2拼团图片,3砍价图片,4秒杀图片,5文章图片,6组合数据图") + private Integer pid; + + @ApiModelProperty(value = "图片上传类型 1本地 2七牛云 3OSS 4COS ") + private Integer imageType; + + @ApiModelProperty(value = "图片上传模块类型 1 后台上传 2 用户生成") + private Integer moduleType; + + private Long uid; + + private String inviteCode; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxSystemConfig.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxSystemConfig.java new file mode 100644 index 0000000..cc1c8d1 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxSystemConfig.java @@ -0,0 +1,49 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Data +@TableName("yx_system_config") +public class YxSystemConfig implements Serializable { + + /** 配置id */ + @TableId + private Integer id; + + + /** 字段名称 */ + private String menuName; + + + /** 默认值 */ + private String value; + + + /** 排序 */ + private Integer sort; + + + /** 是否隐藏 */ + private Integer status; + + + public void copy(YxSystemConfig source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxSystemGroupData.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxSystemGroupData.java new file mode 100644 index 0000000..6f0f88a --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxSystemGroupData.java @@ -0,0 +1,56 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +@TableName("yx_system_group_data") +public class YxSystemGroupData extends BaseDomain { + + /** 组合数据详情ID */ + @TableId + private Integer id; + + + /** 对应的数据名称 */ + private String groupName; + + + /** 数据组对应的数据值(json数据) */ + private String value; + + + /** 数据排序 */ + private Integer sort; + + + /** 状态(1:开启;2:关闭;) */ + private Integer status; + + + public void copy(YxSystemGroupData source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxSystemStore.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxSystemStore.java new file mode 100644 index 0000000..3637c7e --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxSystemStore.java @@ -0,0 +1,99 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("yx_system_store") +public class YxSystemStore extends BaseDomain { + + @TableId + private Integer id; + + + /** 门店名称 */ + @NotBlank(message = "请填写门店名称") + private String name; + + + /** 简介 */ + @NotBlank(message = "请填写门店简介") + private String introduction; + + + /** 手机号码 */ + @NotBlank(message = "请填手机号码") + private String phone; + + + /** 省市区 */ + @NotBlank(message = "请填地址") + private String address; + + + /** 详细地址 */ + private String detailedAddress; + + + /** 门店logo */ + @NotBlank(message = "请上传门店logo") + private String image; + + + /** 纬度 */ + @NotBlank(message = "请输入纬度") + private String latitude; + + + /** 经度 */ + @NotBlank(message = "请输入经度") + private String longitude; + + + /** 核销有效日期 */ + @NotBlank(message = "请输入核销时效") + private String validTime; + + + /** 每日营业开关时间 */ + @NotBlank(message = "请输入营业时间") + private String dayTime; + + + + /** 是否显示 */ + private Integer isShow; + + + private Date validTimeEnd; + + private Date validTimeStart; + + private Date dayTimeStart; + + private Date dayTimeEnd; + + + public void copy(YxSystemStore source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxSystemStoreStaff.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxSystemStoreStaff.java new file mode 100644 index 0000000..e0a73c3 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxSystemStoreStaff.java @@ -0,0 +1,77 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("yx_system_store_staff") +public class YxSystemStoreStaff extends BaseDomain { + + @TableId + private Integer id; + + + /** 微信用户id */ + private Long uid; + + + /** 店员头像 */ + @NotBlank(message = "请选择用户") + private String avatar; + + + /** 门店id */ + @NotNull(message = "请选择门店") + private Integer storeId; + + + /** 店员名称 */ + @NotBlank(message = "请输入店员名称") + private String staffName; + + + /** 手机号码 */ + @NotBlank(message = "请输入手机号码") + private String phone; + + + /** 核销开关 */ + private Integer verifyStatus; + + + /** 状态 */ + private Integer status; + + + + /** 微信昵称 */ + private String nickname; + + + /** 所属门店 */ + private String storeName; + + + public void copy(YxSystemStoreStaff source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxSystemUserLevel.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxSystemUserLevel.java new file mode 100644 index 0000000..1b95d2f --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/domain/YxSystemUserLevel.java @@ -0,0 +1,92 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("yx_system_user_level") +public class YxSystemUserLevel extends BaseDomain { + + @TableId + private Integer id; + + + /** 商户id */ + private Integer merId; + + + /** 会员名称 */ + @NotBlank(message = "名称必填") + private String name; + + + /** 购买金额 */ + private BigDecimal money; + + + /** 有效时间 */ + private Integer validDate; + + + /** 是否为永久会员 */ + private Integer isForever; + + + /** 是否购买,1=购买,0=不购买 */ + private Integer isPay; + + + /** 是否显示 1=显示,0=隐藏 */ + private Integer isShow; + + + /** 会员等级 */ + @NotNull(message = "请输入会员等级") + private Integer grade; + + + /** 享受折扣 */ + @NotNull(message = "请输入会员折扣") + private BigDecimal discount; + + /** 会员卡背景 */ + @NotBlank(message = "请上传会员背景") + private String image; + + + /** 会员图标 */ + @NotBlank(message = "请上传会员图标") + private String icon; + + + /** 说明 */ + @TableField(value = "`explain`") + private String explain; + + + + public void copy(YxSystemUserLevel source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxAppVersionService.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxAppVersionService.java new file mode 100644 index 0000000..c461d74 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxAppVersionService.java @@ -0,0 +1,48 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.shop.service; +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.shop.domain.YxAppVersion; +import co.yixiang.modules.shop.service.dto.YxAppVersionDto; +import co.yixiang.modules.shop.service.dto.YxAppVersionQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import co.yixiang.domain.PageResult; +/** +* @author lioncity +* @date 2020-12-09 +*/ +public interface YxAppVersionService extends BaseService{ + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + PageResult queryAll(YxAppVersionQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxAppVersionQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxMaterialGroupService.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxMaterialGroupService.java new file mode 100644 index 0000000..fbfb55e --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxMaterialGroupService.java @@ -0,0 +1,50 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.shop.domain.YxMaterialGroup; +import co.yixiang.modules.shop.service.dto.YxMaterialGroupDto; +import co.yixiang.modules.shop.service.dto.YxMaterialGroupQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxMaterialGroupService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxMaterialGroupQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxMaterialGroupQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxMaterialService.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxMaterialService.java new file mode 100644 index 0000000..749a804 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxMaterialService.java @@ -0,0 +1,41 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.shop.domain.YxMaterial; +import co.yixiang.modules.shop.service.dto.YxMaterialQueryCriteria; +import org.springframework.data.domain.Pageable; + +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxMaterialService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxMaterialQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxMaterialQueryCriteria criteria); + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxSystemAttachmentService.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxSystemAttachmentService.java new file mode 100644 index 0000000..4795f36 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxSystemAttachmentService.java @@ -0,0 +1,60 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service; + + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.shop.domain.YxSystemAttachment; + +/** + *

+ * 附件管理表 服务类 + *

+ * + * @author hupeng + * @since 2019-11-11 + */ +public interface YxSystemAttachmentService extends BaseService { + + /** + * 根据名称获取 + * @param name name + * @return YxSystemAttachment + */ + YxSystemAttachment getInfo(String name); + + /** + * 根据code获取 + * @param code code + * @return YxSystemAttachment + */ + YxSystemAttachment getByCode(String code); + + /** + * 添加附件记录 + * @param name 名称 + * @param attSize 附件大小 + * @param attDir 路径 + * @param sattDir 路径 + */ + void attachmentAdd(String name,String attSize,String attDir,String sattDir); + + /** + * 添加附件记录 + * @param name 名称 + * @param attSize 附件大小 + * @param attDir 路径 + * @param sattDir 路径 + * @param uid 用户id + * @param code 邀请码 + */ + void newAttachmentAdd(String name,String attSize,String attDir,String sattDir,Long uid,String code); + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxSystemConfigService.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxSystemConfigService.java new file mode 100644 index 0000000..c2851b2 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxSystemConfigService.java @@ -0,0 +1,59 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.shop.domain.YxSystemConfig; +import co.yixiang.modules.shop.service.dto.YxSystemConfigDto; +import co.yixiang.modules.shop.service.dto.YxSystemConfigQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxSystemConfigService extends BaseService{ + + /** + * 获取配置值 + * @param name 配置名 + * @return string + */ + String getData(String name); + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxSystemConfigQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxSystemConfigQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + YxSystemConfig findByKey(String store_brokerage_statu); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxSystemGroupDataService.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxSystemGroupDataService.java new file mode 100644 index 0000000..5bd815f --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxSystemGroupDataService.java @@ -0,0 +1,58 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.shop.domain.YxSystemGroupData; +import co.yixiang.modules.shop.service.dto.YxSystemGroupDataDto; +import co.yixiang.modules.shop.service.dto.YxSystemGroupDataQueryCriteria; +import com.alibaba.fastjson.JSONObject; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxSystemGroupDataService extends BaseService{ + + /** + * 获取配置数据 + * @param name 配置名称 + * @return List + */ + List getDatas(String name); + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxSystemGroupDataQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxSystemGroupDataQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxSystemStoreService.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxSystemStoreService.java new file mode 100644 index 0000000..33c31c7 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxSystemStoreService.java @@ -0,0 +1,71 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.product.vo.YxSystemStoreQueryVo; +import co.yixiang.modules.shop.domain.YxSystemStore; +import co.yixiang.modules.shop.service.dto.YxSystemStoreDto; +import co.yixiang.modules.shop.service.dto.YxSystemStoreQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxSystemStoreService extends BaseService{ + + YxSystemStoreQueryVo getYxSystemStoreById(int id); + + /** + * 获取门店列表 + * @param latitude 纬度 + * @param longitude 经度 + * @param page page + * @param limit limit + * @return List + */ + List getStoreList(String latitude, String longitude, int page, int limit); + + /** + * 获取最新单个门店 + * @param latitude 纬度 + * @param longitude 经度 + * @return YxSystemStoreQueryVo + */ + YxSystemStoreQueryVo getStoreInfo(String latitude,String longitude); + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxSystemStoreQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxSystemStoreQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxSystemStoreStaffService.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxSystemStoreStaffService.java new file mode 100644 index 0000000..e921d01 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/YxSystemStoreStaffService.java @@ -0,0 +1,59 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.shop.domain.YxSystemStoreStaff; +import co.yixiang.modules.shop.service.dto.YxSystemStoreStaffDto; +import co.yixiang.modules.shop.service.dto.YxSystemStoreStaffQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxSystemStoreStaffService extends BaseService{ + + /** + * 接测店员客服状态 + * @param uid 用户id + * @param storeId 门店id + * @return boolean true=可核销 + */ + boolean checkStatus(Long uid,Integer storeId); + + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxSystemStoreStaffQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxSystemStoreStaffQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxAppVersionDto.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxAppVersionDto.java new file mode 100644 index 0000000..9f6c889 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxAppVersionDto.java @@ -0,0 +1,48 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.shop.service.dto; + +import lombok.Data; +import java.util.Date; +import java.io.Serializable; + +/** +* @author lioncity +* @date 2020-12-09 +*/ +@Data +public class YxAppVersionDto implements Serializable { + + private Integer id; + + private Integer isDel; + + /** 更新时间 */ + private Date createTime; + + private Date updateTime; + + /** 版本code */ + private String versionCode; + + /** 版本名称 */ + private String versionName; + + /** 版本描述 */ + private String versionInfo; + + /** 安卓下载链接 */ + private String androidUrl; + + /** 是否强制升级 */ + private Integer forceUpdate; + + /** ios store应用商店链接 */ + private String iosUrl; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxAppVersionQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxAppVersionQueryCriteria.java new file mode 100644 index 0000000..65e9372 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxAppVersionQueryCriteria.java @@ -0,0 +1,21 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.shop.service.dto; + +import lombok.Data; +import java.util.List; +import co.yixiang.annotation.Query; + +/** +* @author lioncity +* @date 2020-12-09 +*/ +@Data +public class YxAppVersionQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxMaterialDto.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxMaterialDto.java new file mode 100644 index 0000000..250aa81 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxMaterialDto.java @@ -0,0 +1,42 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxMaterialDto implements Serializable { + + /** PK */ + private String id; + + + /** 创建时间 */ + private Date createTime; + + + /** 创建者ID */ + private String createId; + + /** 类型1、图片;2、视频 */ + private String type; + + /** 分组ID */ + private String groupId; + + /** 素材名 */ + private String name; + + /** 素材链接 */ + private String url; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxMaterialGroupDto.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxMaterialGroupDto.java new file mode 100644 index 0000000..8cc4e01 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxMaterialGroupDto.java @@ -0,0 +1,31 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxMaterialGroupDto implements Serializable { + /** PK */ + private String id; + + + /** 创建时间 */ + private Date createTime; + + /** 创建者ID */ + private String createId; + + /** 分组名 */ + private String name; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxMaterialGroupQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxMaterialGroupQueryCriteria.java new file mode 100644 index 0000000..9d39309 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxMaterialGroupQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxMaterialGroupQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxMaterialQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxMaterialQueryCriteria.java new file mode 100644 index 0000000..3a19384 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxMaterialQueryCriteria.java @@ -0,0 +1,20 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxMaterialQueryCriteria{ + + @Query + private String groupId; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemConfigDto.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemConfigDto.java new file mode 100644 index 0000000..d0fd8b1 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemConfigDto.java @@ -0,0 +1,33 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxSystemConfigDto implements Serializable { + + /** 配置id */ + private Integer id; + + /** 字段名称 */ + private String menuName; + + /** 默认值 */ + private String value; + + /** 排序 */ + private Integer sort; + + /** 是否隐藏 */ + private Integer status; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemConfigQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemConfigQueryCriteria.java new file mode 100644 index 0000000..57a45a0 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemConfigQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxSystemConfigQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemGroupDataDto.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemGroupDataDto.java new file mode 100644 index 0000000..7a786a9 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemGroupDataDto.java @@ -0,0 +1,39 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxSystemGroupDataDto implements Serializable { + + // 组合数据详情ID + private Integer id; + + // 对应的数据名称 + private String groupName; + + // 数据组对应的数据值(json数据) + private String value; + + private Map map; + + // 添加数据时间 + private Integer addTime; + + // 数据排序 + private Integer sort; + + // 状态(1:开启;2:关闭;) + private Integer status; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemGroupDataQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemGroupDataQueryCriteria.java new file mode 100644 index 0000000..91f348f --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemGroupDataQueryCriteria.java @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxSystemGroupDataQueryCriteria{ + + // 精确 + @Query + private String groupName; + + @Query + private Integer status; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemStoreDto.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemStoreDto.java new file mode 100644 index 0000000..e405583 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemStoreDto.java @@ -0,0 +1,66 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxSystemStoreDto implements Serializable { + + private Integer id; + + /** 门店名称 */ + private String name; + + /** 简介 */ + private String introduction; + + /** 手机号码 */ + private String phone; + + /** 省市区 */ + private String address; + + /** 详细地址 */ + private String detailedAddress; + + /** 门店logo */ + private String image; + + /** 纬度 */ + private String latitude; + + /** 经度 */ + private String longitude; + + /** 核销有效日期 */ + private String validTime; + + /** 每日营业开关时间 */ + private String dayTime; + + /** 添加时间 */ + private Date createTime; + + /** 是否显示 */ + private Integer isShow; + + private Date validTimeEnd; + + private Date validTimeStart; + + private Date dayTimeStart; + + private Date dayTimeEnd; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemStoreQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemStoreQueryCriteria.java new file mode 100644 index 0000000..aedbd13 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemStoreQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxSystemStoreQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemStoreStaffDto.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemStoreStaffDto.java new file mode 100644 index 0000000..466fcfa --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemStoreStaffDto.java @@ -0,0 +1,51 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxSystemStoreStaffDto implements Serializable { + + private Integer id; + + /** 微信用户id */ + private Long uid; + + /** 店员头像 */ + private String avatar; + + /** 门店id */ + private Integer storeId; + + /** 店员名称 */ + private String staffName; + + /** 手机号码 */ + private String phone; + + /** 核销开关 */ + private Integer verifyStatus; + + /** 状态 */ + private Integer status; + + /** 添加时间 */ + private Date createTime; + + /** 微信昵称 */ + private String nickname; + + /** 所属门店 */ + private String storeName; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemStoreStaffQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemStoreStaffQueryCriteria.java new file mode 100644 index 0000000..afcf26a --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/dto/YxSystemStoreStaffQueryCriteria.java @@ -0,0 +1,25 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxSystemStoreStaffQueryCriteria{ + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String staffName; + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String nickname; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxAppVersionServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxAppVersionServiceImpl.java new file mode 100644 index 0000000..bc6d412 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxAppVersionServiceImpl.java @@ -0,0 +1,86 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.shop.service.impl; + +import co.yixiang.modules.shop.domain.YxAppVersion; +import co.yixiang.common.service.impl.BaseServiceImpl; +import lombok.AllArgsConstructor; +import co.yixiang.dozer.service.IGenerator; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.utils.ValidationUtil; +import co.yixiang.utils.FileUtil; +import co.yixiang.modules.shop.service.YxAppVersionService; +import co.yixiang.modules.shop.service.dto.YxAppVersionDto; +import co.yixiang.modules.shop.service.dto.YxAppVersionQueryCriteria; +import co.yixiang.modules.shop.service.mapper.YxAppVersionMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import co.yixiang.domain.PageResult; +/** +* @author lioncity +* @date 2020-12-09 +*/ +@Service +@AllArgsConstructor +//@CacheConfig(cacheNames = "yxAppVersion") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxAppVersionServiceImpl extends BaseServiceImpl implements YxAppVersionService { + + private final IGenerator generator; + + @Override + //@Cacheable + public PageResult queryAll(YxAppVersionQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + return generator.convertPageInfo(page,YxAppVersionDto.class); + } + + + @Override + //@Cacheable + public List queryAll(YxAppVersionQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxAppVersion.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxAppVersionDto yxAppVersion : all) { + Map map = new LinkedHashMap<>(); + map.put(" isDel", yxAppVersion.getIsDel()); + map.put("更新时间", yxAppVersion.getCreateTime()); + map.put(" updateTime", yxAppVersion.getUpdateTime()); + map.put("版本code", yxAppVersion.getVersionCode()); + map.put("版本名称", yxAppVersion.getVersionName()); + map.put("版本描述", yxAppVersion.getVersionInfo()); + map.put("安卓下载链接", yxAppVersion.getAndroidUrl()); + map.put("是否强制升级", yxAppVersion.getForceUpdate()); + map.put("ios store应用商店链接", yxAppVersion.getIosUrl()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxMaterialGroupServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxMaterialGroupServiceImpl.java new file mode 100644 index 0000000..d8c9e75 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxMaterialGroupServiceImpl.java @@ -0,0 +1,76 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.shop.domain.YxMaterialGroup; +import co.yixiang.modules.shop.service.YxMaterialGroupService; +import co.yixiang.modules.shop.service.dto.YxMaterialGroupDto; +import co.yixiang.modules.shop.service.dto.YxMaterialGroupQueryCriteria; +import co.yixiang.modules.shop.service.mapper.MaterialGroupMapper; +import co.yixiang.utils.FileUtil; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxMaterialGroupServiceImpl extends BaseServiceImpl implements YxMaterialGroupService { + + private final IGenerator generator; + + @Override + public Map queryAll(YxMaterialGroupQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxMaterialGroupDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + public List queryAll(YxMaterialGroupQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxMaterialGroup.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxMaterialGroupDto yxMaterialGroup : all) { + Map map = new LinkedHashMap<>(); + map.put("创建时间", yxMaterialGroup.getCreateTime()); + map.put("创建者ID", yxMaterialGroup.getCreateId()); + map.put("分组名", yxMaterialGroup.getName()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxMaterialServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxMaterialServiceImpl.java new file mode 100644 index 0000000..f67d77e --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxMaterialServiceImpl.java @@ -0,0 +1,62 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.shop.domain.YxMaterial; +import co.yixiang.modules.shop.service.YxMaterialService; +import co.yixiang.modules.shop.service.dto.YxMaterialDto; +import co.yixiang.modules.shop.service.dto.YxMaterialQueryCriteria; +import co.yixiang.modules.shop.service.mapper.MaterialMapper; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxMaterialServiceImpl extends BaseServiceImpl implements YxMaterialService { + + private final IGenerator generator; + + @Override + //@Cacheable + public Map queryAll(YxMaterialQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxMaterialDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxMaterialQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxMaterial.class, criteria)); + } + + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxSystemAttachmentServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxSystemAttachmentServiceImpl.java new file mode 100644 index 0000000..8065277 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxSystemAttachmentServiceImpl.java @@ -0,0 +1,111 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service.impl; + + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.modules.shop.domain.YxSystemAttachment; +import co.yixiang.modules.shop.service.YxSystemAttachmentService; +import co.yixiang.modules.shop.service.mapper.YxSystemAttachmentMapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + + +/** + *

+ * 附件管理表 服务实现类 + *

+ * + * @author hupeng + * @since 2019-11-11 + */ +@Slf4j +@Service +@AllArgsConstructor +@Transactional(rollbackFor = Exception.class) +public class YxSystemAttachmentServiceImpl extends BaseServiceImpl implements YxSystemAttachmentService { + + private final YxSystemAttachmentMapper yxSystemAttachmentMapper; + + /** + * 根据名称获取 + * @param name name + * @return YxSystemAttachment + */ + @Override + public YxSystemAttachment getInfo(String name) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxSystemAttachment::getName,name) + .last("limit 1"); + return yxSystemAttachmentMapper.selectOne(wrapper); + } + + /** + * 根据code获取 + * @param code code + * @return YxSystemAttachment + */ + @Override + public YxSystemAttachment getByCode(String code) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxSystemAttachment::getInviteCode,code) + .last("limit 1"); + return yxSystemAttachmentMapper.selectOne(wrapper); + } + + /** + * 添加附件记录 + * @param name 名称 + * @param attSize 附件大小 + * @param attDir 路径 + * @param sattDir 路径 + */ + @Override + public void attachmentAdd(String name, String attSize, String attDir,String sattDir) { + YxSystemAttachment attachment = YxSystemAttachment.builder() + .name(name) + .attSize(attSize) + .attDir(attDir) + .attType("image/jpeg") + .sattDir(sattDir) + .build(); + yxSystemAttachmentMapper.insert(attachment); + } + + /** + * 添加附件记录 + * @param name 名称 + * @param attSize 附件大小 + * @param attDir 路径 + * @param sattDir 路径 + * @param uid 用户id + * @param code 邀请码 + */ + @Override + public void newAttachmentAdd(String name, String attSize, String attDir, String sattDir, + Long uid, String code) { + + YxSystemAttachment attachment = YxSystemAttachment.builder() + .name(name) + .attSize(attSize) + .attDir(attDir) + .attType("image/jpeg") + .sattDir(sattDir) + .uid(uid) + .inviteCode(code) + .build(); + yxSystemAttachmentMapper.insert(attachment); + } + + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxSystemConfigServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxSystemConfigServiceImpl.java new file mode 100644 index 0000000..36fe204 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxSystemConfigServiceImpl.java @@ -0,0 +1,109 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service.impl; + +import cn.hutool.core.util.StrUtil; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.shop.domain.YxSystemConfig; +import co.yixiang.modules.shop.service.YxSystemConfigService; +import co.yixiang.modules.shop.service.dto.YxSystemConfigDto; +import co.yixiang.modules.shop.service.dto.YxSystemConfigQueryCriteria; +import co.yixiang.modules.shop.service.mapper.SystemConfigMapper; +import co.yixiang.utils.FileUtil; +import co.yixiang.utils.RedisUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxSystemConfigServiceImpl extends BaseServiceImpl implements YxSystemConfigService { + + private final IGenerator generator; + private final RedisUtils redisUtils; + + /** + * 获取配置值 + * @param name 配置名 + * @return string + */ + @Override + public String getData(String name) { + String result = redisUtils.getY(name); + if(StrUtil.isNotBlank(result)) { + return result; + } + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxSystemConfig::getMenuName,name); + YxSystemConfig systemConfig = this.baseMapper.selectOne(wrapper); + if(systemConfig == null) { + return ""; + } + return systemConfig.getValue(); + } + + @Override + //@Cacheable + public Map queryAll(YxSystemConfigQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxSystemConfigDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxSystemConfigQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxSystemConfig.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxSystemConfigDto yxSystemConfig : all) { + Map map = new LinkedHashMap<>(); + map.put("字段名称", yxSystemConfig.getMenuName()); + map.put("默认值", yxSystemConfig.getValue()); + map.put("排序", yxSystemConfig.getSort()); + map.put("是否隐藏", yxSystemConfig.getStatus()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + public YxSystemConfig findByKey(String key) { + return this.getOne(new LambdaQueryWrapper() + .eq(YxSystemConfig::getMenuName,key)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxSystemGroupDataServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxSystemGroupDataServiceImpl.java new file mode 100644 index 0000000..a0ce071 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxSystemGroupDataServiceImpl.java @@ -0,0 +1,119 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.CommonEnum; +import co.yixiang.modules.shop.domain.YxSystemGroupData; +import co.yixiang.modules.shop.service.YxSystemGroupDataService; +import co.yixiang.modules.shop.service.dto.YxSystemGroupDataDto; +import co.yixiang.modules.shop.service.dto.YxSystemGroupDataQueryCriteria; +import co.yixiang.modules.shop.service.mapper.SystemGroupDataMapper; +import co.yixiang.utils.FileUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxSystemGroupDataServiceImpl extends BaseServiceImpl implements YxSystemGroupDataService { + + private final IGenerator generator; + + + /** + * 获取配置数据 + * @param name 配置名称 + * @return List + */ + @Override + //@Cacheable(value = "yshop:configDatas",key = "#name") + public List getDatas(String name) { + List systemGroupDatas = this.baseMapper + .selectList(Wrappers.lambdaQuery() + .eq(YxSystemGroupData::getGroupName,name) + .eq(YxSystemGroupData::getStatus,CommonEnum.SHOW_STATUS_1.getValue()) + .orderByDesc(YxSystemGroupData::getSort)); + + List list = systemGroupDatas + .stream() + .map(YxSystemGroupData::getValue) + .map(JSONObject::parseObject) + .collect(Collectors.toList()); + + return list; + } + + + //===============管理后台============== + + @Override + //@Cacheable + public Map queryAll(YxSystemGroupDataQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + List systemGroupDataDTOS = new ArrayList<>(); + for (YxSystemGroupData systemGroupData : page.getList()) { + + YxSystemGroupDataDto systemGroupDataDTO = generator.convert(systemGroupData,YxSystemGroupDataDto.class); + systemGroupDataDTO.setMap(JSON.parseObject(systemGroupData.getValue())); + systemGroupDataDTOS.add(systemGroupDataDTO); + } + map.put("content",systemGroupDataDTOS); + map.put("totalElements",page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxSystemGroupDataQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxSystemGroupData.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxSystemGroupDataDto yxSystemGroupData : all) { + Map map = new LinkedHashMap<>(); + map.put("对应的数据名称", yxSystemGroupData.getGroupName()); + map.put("数据组对应的数据值(json数据)", yxSystemGroupData.getValue()); + map.put("添加数据时间", yxSystemGroupData.getAddTime()); + map.put("数据排序", yxSystemGroupData.getSort()); + map.put("状态(1:开启;2:关闭;)", yxSystemGroupData.getStatus()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxSystemStoreServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxSystemStoreServiceImpl.java new file mode 100644 index 0000000..d172be2 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxSystemStoreServiceImpl.java @@ -0,0 +1,156 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service.impl; + +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.modules.product.vo.YxSystemStoreQueryVo; +import co.yixiang.modules.shop.domain.YxSystemStore; +import co.yixiang.modules.shop.service.YxSystemStoreService; +import co.yixiang.modules.shop.service.dto.YxSystemStoreDto; +import co.yixiang.modules.shop.service.dto.YxSystemStoreQueryCriteria; +import co.yixiang.modules.shop.service.mapper.SystemStoreMapper; +import co.yixiang.utils.FileUtil; +import co.yixiang.utils.RedisUtil; +import co.yixiang.utils.ShopKeyUtils; +import co.yixiang.utils.location.LocationUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxSystemStoreServiceImpl extends BaseServiceImpl implements YxSystemStoreService { + + private final IGenerator generator; + private final SystemStoreMapper systemStoreMapper; + + @Override + public YxSystemStoreQueryVo getYxSystemStoreById(int id){ + return generator.convert(this.getById(id),YxSystemStoreQueryVo.class); + } + + /** + * 获取门店列表 + * @param latitude 纬度 + * @param longitude 经度 + * @param page page + * @param limit limit + * @return List + */ + @Override + public List getStoreList(String latitude, String longitude, int page, int limit) { + Page pageModel = new Page<>(page, limit); + if(StrUtil.isBlank(latitude) || StrUtil.isBlank(longitude)){ + return generator.convert(this.page(pageModel).getRecords(),YxSystemStoreQueryVo.class); + } + List list = systemStoreMapper.getStoreList(pageModel,Double.valueOf(longitude),Double.valueOf(latitude)); + list.forEach(item->{ + String newDis = NumberUtil.round(Double.valueOf(item.getDistance()) / 1000,2).toString(); + item.setDistance(newDis); + }); + return list; + } + + /** + * 获取最新单个门店 + * @param latitude 纬度 + * @param longitude 经度 + * @return YxSystemStoreQueryVo + */ + @Override + public YxSystemStoreQueryVo getStoreInfo(String latitude,String longitude) { + YxSystemStore yxSystemStore = systemStoreMapper.selectOne( + Wrappers.lambdaQuery() + .eq(YxSystemStore::getIsShow, ShopCommonEnum.SHOW_1.getValue()) + .orderByDesc(YxSystemStore::getId) + .last("limit 1")); + if(yxSystemStore == null) { + return null; + } + String mention = RedisUtil.get(ShopKeyUtils.getStoreSelfMention()); + if(StrUtil.isBlank(mention) || ShopCommonEnum.ENABLE_2.getValue().toString().equals(mention)) { + return null; + } + YxSystemStoreQueryVo systemStoreQueryVo = generator.convert(yxSystemStore,YxSystemStoreQueryVo.class); + if(StrUtil.isNotEmpty(latitude) && StrUtil.isNotEmpty(longitude)){ + double distance = LocationUtils.getDistance(Double.valueOf(latitude),Double.valueOf(longitude), + Double.valueOf(yxSystemStore.getLatitude()),Double.valueOf(yxSystemStore.getLongitude())); + systemStoreQueryVo.setDistance(String.valueOf(distance)); + } + return systemStoreQueryVo; + } + + + + //===================================// + + @Override + //@Cacheable + public Map queryAll(YxSystemStoreQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxSystemStoreDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxSystemStoreQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxSystemStore.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxSystemStoreDto yxSystemStore : all) { + Map map = new LinkedHashMap<>(); + map.put("门店名称", yxSystemStore.getName()); + map.put("简介", yxSystemStore.getIntroduction()); + map.put("手机号码", yxSystemStore.getPhone()); + map.put("省市区", yxSystemStore.getAddress()); + map.put("详细地址", yxSystemStore.getDetailedAddress()); + map.put("门店logo", yxSystemStore.getImage()); + map.put("纬度", yxSystemStore.getLatitude()); + map.put("经度", yxSystemStore.getLongitude()); + map.put("核销有效日期", yxSystemStore.getValidTime()); + map.put("每日营业开关时间", yxSystemStore.getDayTime()); + map.put("是否显示", yxSystemStore.getIsShow()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxSystemStoreStaffServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxSystemStoreStaffServiceImpl.java new file mode 100644 index 0000000..51f1225 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/impl/YxSystemStoreStaffServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.modules.shop.domain.YxSystemStoreStaff; +import co.yixiang.modules.shop.service.YxSystemStoreStaffService; +import co.yixiang.modules.shop.service.dto.YxSystemStoreStaffDto; +import co.yixiang.modules.shop.service.dto.YxSystemStoreStaffQueryCriteria; +import co.yixiang.modules.shop.service.mapper.SystemStoreStaffMapper; +import co.yixiang.utils.FileUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxSystemStoreStaffServiceImpl extends BaseServiceImpl implements YxSystemStoreStaffService { + + private final IGenerator generator; + + + /** + * 接测店员客服状态 + * @param uid 用户id + * @param storeId 门店id + * @return boolean true=可核销 + */ + @Override + public boolean checkStatus(Long uid,Integer storeId) { + YxSystemStoreStaff storeStaff = new YxSystemStoreStaff(); + storeStaff.setUid(uid); + storeStaff.setVerifyStatus(ShopCommonEnum.IS_STATUS_1.getValue()); + if(storeId != null) { + storeStaff.setStoreId(storeId); + } + return this.baseMapper.selectCount(Wrappers.query(storeStaff)) > 0; + } + + @Override + //@Cacheable + public Map queryAll(YxSystemStoreStaffQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxSystemStoreStaffDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxSystemStoreStaffQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxSystemStoreStaff.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxSystemStoreStaffDto yxSystemStoreStaff : all) { + Map map = new LinkedHashMap<>(); + map.put("微信用户id", yxSystemStoreStaff.getUid()); + map.put("店员头像", yxSystemStoreStaff.getAvatar()); + map.put("门店id", yxSystemStoreStaff.getStoreId()); + map.put("店员名称", yxSystemStoreStaff.getStaffName()); + map.put("手机号码", yxSystemStoreStaff.getPhone()); + map.put("核销开关", yxSystemStoreStaff.getVerifyStatus()); + map.put("状态", yxSystemStoreStaff.getStatus()); + map.put("微信昵称", yxSystemStoreStaff.getNickname()); + map.put("所属门店", yxSystemStoreStaff.getStoreName()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/MaterialGroupMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/MaterialGroupMapper.java new file mode 100644 index 0000000..73d8bf3 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/MaterialGroupMapper.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.shop.domain.YxMaterialGroup; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface MaterialGroupMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/MaterialMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/MaterialMapper.java new file mode 100644 index 0000000..319c6dc --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/MaterialMapper.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.shop.domain.YxMaterial; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface MaterialMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/SystemConfigMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/SystemConfigMapper.java new file mode 100644 index 0000000..1728817 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/SystemConfigMapper.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.shop.domain.YxSystemConfig; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface SystemConfigMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/SystemGroupDataMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/SystemGroupDataMapper.java new file mode 100644 index 0000000..42e8069 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/SystemGroupDataMapper.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.shop.domain.YxSystemGroupData; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface SystemGroupDataMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/SystemStoreMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/SystemStoreMapper.java new file mode 100644 index 0000000..53807ed --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/SystemStoreMapper.java @@ -0,0 +1,34 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.product.vo.YxSystemStoreQueryVo; +import co.yixiang.modules.shop.domain.YxSystemStore; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface SystemStoreMapper extends CoreMapper { + + @Select("SELECT*,ROUND(6378.138 * 2 * ASIN(SQRT(POW(SIN((#{lat} * PI() / 180 - latitude * PI() / 180" + + " ) / 2),2) + COS(40.0497810000 * PI() / 180) * COS(latitude * PI() / 180) * POW(" + + " SIN((#{lon} * PI() / 180 - longitude * PI() / 180) / 2),2))) * 1000) AS distance" + + " FROM yx_system_store WHERE is_del=0 AND is_show = 1 ORDER BY distance ASC" + ) + List getStoreList(Page page, @Param("lon") double lon, @Param("lat") double lat); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/SystemStoreStaffMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/SystemStoreStaffMapper.java new file mode 100644 index 0000000..3d0997a --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/SystemStoreStaffMapper.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.shop.domain.YxSystemStoreStaff; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface SystemStoreStaffMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/YxAppVersionMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/YxAppVersionMapper.java new file mode 100644 index 0000000..198d4a5 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/YxAppVersionMapper.java @@ -0,0 +1,23 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.shop.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.shop.domain.YxAppVersion; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** +* @author lioncity +* @date 2020-12-09 +*/ +@Repository +public interface YxAppVersionMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/YxSystemAttachmentMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/YxSystemAttachmentMapper.java new file mode 100644 index 0000000..ce4e5d1 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/service/mapper/YxSystemAttachmentMapper.java @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.service.mapper; + + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.shop.domain.YxSystemAttachment; +import org.springframework.stereotype.Repository; + +/** + *

+ * 附件管理表 Mapper 接口 + *

+ * + * @author hupeng + * @since 2019-11-11 + */ +@Repository +public interface YxSystemAttachmentMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/vo/AppCheckVersion.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/vo/AppCheckVersion.java new file mode 100644 index 0000000..a64ac42 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/vo/AppCheckVersion.java @@ -0,0 +1,26 @@ +package co.yixiang.modules.shop.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author :LionCity + * @date :Created in 2020-12-09 10:47 + * @description: + * @modified By: + * @version: + */ +@Data +@ApiModel(description = "app校验升级") +public class AppCheckVersion implements Serializable { + + private static final long serialVersionUID = 1L; + @ApiModelProperty(value = "类型 1101 安卓 1102 ios") + private String type; + + @ApiModelProperty(value = "app版本名称") + private String versionName; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/vo/YxAppVersionVo.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/vo/YxAppVersionVo.java new file mode 100644 index 0000000..dc11c8f --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/vo/YxAppVersionVo.java @@ -0,0 +1,45 @@ +package co.yixiang.modules.shop.vo; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author :LionCity + * @date :Created in 2020-12-09 10:25 + * @description: + * @modified By: + * @version: + */ + +@Data +public class YxAppVersionVo implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer id; + + /** 版本code */ + private String versionCode; + + /** 版本名称 */ + private String versionName; + + /** 版本描述 */ + private String versionInfo; + + /** 安卓下载链接 */ + private String downloadUrl; + + /**是否强制升级*/ + private Boolean forceUpdate; + + public void copy(co.yixiang.modules.shop.domain.YxAppVersion source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/shop/vo/YxSystemGroupDataVo.java b/yshop-mall/src/main/java/co/yixiang/modules/shop/vo/YxSystemGroupDataVo.java new file mode 100644 index 0000000..2eabf81 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/shop/vo/YxSystemGroupDataVo.java @@ -0,0 +1,42 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.vo; + +import com.alibaba.fastjson.JSONObject; +import lombok.Getter; +import lombok.Setter; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Getter +@Setter +public class YxSystemGroupDataVo{ + + /** 组合数据详情ID */ + + private Integer id; + + + /** 对应的数据名称 */ + private String groupName; + + + /** 数据组对应的数据值(json数据) */ + private JSONObject value; + + + /** 数据排序 */ + private Integer sort; + + + /** 状态(1:开启;2:关闭;) */ + private Integer status; + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/domain/YxShippingTemplates.java b/yshop-mall/src/main/java/co/yixiang/modules/template/domain/YxShippingTemplates.java new file mode 100644 index 0000000..353afe5 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/domain/YxShippingTemplates.java @@ -0,0 +1,62 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("yx_shipping_templates") +public class YxShippingTemplates extends BaseDomain { + + /** 模板ID */ + @TableId + private Integer id; + + + /** 模板名称 */ + private String name; + + + /** 计费方式 */ + private Integer type; + + + /** 地域以及费用 */ + private String regionInfo; + + + /** 指定包邮开关 */ + private Integer appoint; + + + /** 指定包邮内容 */ + private String appointInfo; + + + + + /** 排序 */ + private Integer sort; + + + public void copy(YxShippingTemplates source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/domain/YxShippingTemplatesFree.java b/yshop-mall/src/main/java/co/yixiang/modules/template/domain/YxShippingTemplatesFree.java new file mode 100644 index 0000000..44c7a10 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/domain/YxShippingTemplatesFree.java @@ -0,0 +1,79 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.math.BigDecimal; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@AllArgsConstructor +@NoArgsConstructor +@Builder +@Data +@TableName("yx_shipping_templates_free") +public class YxShippingTemplatesFree implements Serializable { + + /** 编号 */ + @TableId + private Integer id; + + + /** 省ID */ + @NotNull + private Integer provinceId; + + + /** 模板ID */ + @NotNull + private Integer tempId; + + + /** 城市ID */ + @NotNull + private Integer cityId; + + + /** 包邮件数 */ + @NotNull + private BigDecimal number; + + + /** 包邮金额 */ + @NotNull + private BigDecimal price; + + + /** 计费方式 */ + @NotNull + private Integer type; + + + /** 分组唯一值 */ + @NotBlank + private String uniqid; + + + public void copy(YxShippingTemplatesFree source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/domain/YxShippingTemplatesRegion.java b/yshop-mall/src/main/java/co/yixiang/modules/template/domain/YxShippingTemplatesRegion.java new file mode 100644 index 0000000..5ed2744 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/domain/YxShippingTemplatesRegion.java @@ -0,0 +1,89 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.math.BigDecimal; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@AllArgsConstructor +@NoArgsConstructor +@Builder +@Data +@TableName("yx_shipping_templates_region") +public class YxShippingTemplatesRegion implements Serializable { + + /** 编号 */ + @TableId + private Integer id; + + + /** 省ID */ + @NotNull + private Integer provinceId; + + + /** 模板ID */ + @NotNull + private Integer tempId; + + + /** 城市ID */ + @NotNull + private Integer cityId; + + + /** 首件 */ + @NotNull + private BigDecimal first; + + + /** 首件运费 */ + @NotNull + private BigDecimal firstPrice; + + + /** 续件 */ + @NotNull + private BigDecimal continues; + + + /** 续件运费 */ + @NotNull + private BigDecimal continuePrice; + + + /** 计费方式 */ + @NotNull + private Integer type; + + + /** 分组唯一值 */ + @NotBlank + private String uniqid; + + + public void copy(YxShippingTemplatesRegion source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/domain/YxSystemCity.java b/yshop-mall/src/main/java/co/yixiang/modules/template/domain/YxSystemCity.java new file mode 100644 index 0000000..5d07737 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/domain/YxSystemCity.java @@ -0,0 +1,88 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@Data +@TableName("yx_system_city") +public class YxSystemCity implements Serializable { + + @TableId + private Integer id; + + + /** 城市id */ + @NotNull + @JsonProperty(value = "city_id") + private Integer cityId; + + + /** 省市级别 */ + @NotNull + private Integer level; + + + /** 父级id */ + @NotNull + private Integer parentId; + + + /** 区号 */ + @NotBlank + private String areaCode; + + + /** 名称 */ + @NotBlank + private String name; + + + /** 合并名称 */ + @NotBlank + private String mergerName; + + + /** 经度 */ + @NotBlank + private String lng; + + + /** 纬度 */ + @NotBlank + private String lat; + + + /** 是否展示 */ + @NotNull + private Integer isShow; + + @TableField(exist = false) + private List children; + + + public void copy(YxSystemCity source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/YxShippingTemplatesFreeService.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/YxShippingTemplatesFreeService.java new file mode 100644 index 0000000..4566c90 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/YxShippingTemplatesFreeService.java @@ -0,0 +1,50 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.template.domain.YxShippingTemplatesFree; +import co.yixiang.modules.template.service.dto.YxShippingTemplatesFreeDto; +import co.yixiang.modules.template.service.dto.YxShippingTemplatesFreeQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +public interface YxShippingTemplatesFreeService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxShippingTemplatesFreeQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxShippingTemplatesFreeQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/YxShippingTemplatesRegionService.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/YxShippingTemplatesRegionService.java new file mode 100644 index 0000000..308aeec --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/YxShippingTemplatesRegionService.java @@ -0,0 +1,50 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.template.domain.YxShippingTemplatesRegion; +import co.yixiang.modules.template.service.dto.YxShippingTemplatesRegionDto; +import co.yixiang.modules.template.service.dto.YxShippingTemplatesRegionQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +public interface YxShippingTemplatesRegionService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxShippingTemplatesRegionQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxShippingTemplatesRegionQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/YxShippingTemplatesService.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/YxShippingTemplatesService.java new file mode 100644 index 0000000..fb9ce3e --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/YxShippingTemplatesService.java @@ -0,0 +1,58 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.template.domain.YxShippingTemplates; +import co.yixiang.modules.template.service.dto.ShippingTemplatesDto; +import co.yixiang.modules.template.service.dto.YxShippingTemplatesDto; +import co.yixiang.modules.template.service.dto.YxShippingTemplatesQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +public interface YxShippingTemplatesService extends BaseService{ + + /** + * 新增与更新模板 + * @param id 模板id + * @param shippingTemplatesDto ShippingTemplatesDto + */ + void addAndUpdate(Integer id,ShippingTemplatesDto shippingTemplatesDto); + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxShippingTemplatesQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxShippingTemplatesQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/YxSystemCityService.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/YxSystemCityService.java new file mode 100644 index 0000000..4193005 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/YxSystemCityService.java @@ -0,0 +1,50 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.template.domain.YxSystemCity; +import co.yixiang.modules.template.service.dto.YxSystemCityDto; +import co.yixiang.modules.template.service.dto.YxSystemCityQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +public interface YxSystemCityService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxSystemCityQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxSystemCityQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/AppointInfoDto.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/AppointInfoDto.java new file mode 100644 index 0000000..100322f --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/AppointInfoDto.java @@ -0,0 +1,28 @@ +package co.yixiang.modules.template.service.dto; + +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +/** + * @ClassName AppointInfoDto + * @Author hupeng <610796224@qq.com> + * @Date 2020/5/26 + **/ +@Getter +@Setter +public class AppointInfoDto { + + /** 包邮件数 */ + private String a_num; + + /** 包邮费用 */ + private String a_price; + + /** 包邮地区 */ + private List place; + + private String placeName; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/RegionChildrenDto.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/RegionChildrenDto.java new file mode 100644 index 0000000..6a28aed --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/RegionChildrenDto.java @@ -0,0 +1,16 @@ +package co.yixiang.modules.template.service.dto; + +import lombok.Getter; +import lombok.Setter; + +/** + * @ClassName RegionChildrenDto + * @Author hupeng <610796224@qq.com> + * @Date 2020/5/25 + **/ +@Getter +@Setter +public class RegionChildrenDto { + + private String city_id; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/RegionDto.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/RegionDto.java new file mode 100644 index 0000000..8f56313 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/RegionDto.java @@ -0,0 +1,23 @@ +package co.yixiang.modules.template.service.dto; + +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +/** + * @ClassName RegionDto + * @Author hupeng <610796224@qq.com> + * @Date 2020/5/25 + **/ +@Getter +@Setter +public class RegionDto { + + private String name; + + private String city_id; + + List children; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/RegionInfoDto.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/RegionInfoDto.java new file mode 100644 index 0000000..3c5bec6 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/RegionInfoDto.java @@ -0,0 +1,38 @@ +package co.yixiang.modules.template.service.dto; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import javax.validation.constraints.NotBlank; +import java.util.List; + +/** + * @ClassName RegionInfoDto + * @Author hupeng <610796224@qq.com> + * @Date 2020/5/25 + **/ +@Getter +@Setter +@ToString +public class RegionInfoDto { + + @NotBlank(message = "请填写可配送区域") + private String regionName; + + @NotBlank(message = "请填写首件") + private String first; + + @NotBlank(message = "请填写首件价格") + private String price; + + @NotBlank(message = "请填写续件") + @JsonProperty("_continue") + private String _continue; + + @NotBlank(message = "请填写续件价格") + private String continue_price; + + private List region; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/ShippingTemplatesDto.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/ShippingTemplatesDto.java new file mode 100644 index 0000000..2989c17 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/ShippingTemplatesDto.java @@ -0,0 +1,51 @@ +package co.yixiang.modules.template.service.dto; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** + * 运费模板对象 yx_shipping_templates + * + * @author hupeng + * @date 2020-05-23 + */ +@Getter +@Setter +public class ShippingTemplatesDto implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 模板ID */ + private Integer id; + + /** 模板名称 */ + @NotBlank(message = "模板名称不能为空") + private String name; + + /** 计费方式 */ + private Integer type; + + /** 地域以及费用 */ + @NotNull(message = "请设置地域") + @JsonProperty(value = "region_info") + private List regionInfo; + + /** 指定包邮开关 */ + private Integer appoint; + + /** 指定包邮内容 */ + @JsonProperty(value = "appoint_info") + private List appointInfo; + + /** 排序 */ + private Long sort; + + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxShippingTemplatesDto.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxShippingTemplatesDto.java new file mode 100644 index 0000000..6e96abc --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxShippingTemplatesDto.java @@ -0,0 +1,50 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@Data +public class YxShippingTemplatesDto implements Serializable { + + /** 模板ID */ + private Integer id; + + /** 模板名称 */ + private String name; + + /** 计费方式 */ + private Integer type; + + /** 地域以及费用 */ + private String regionInfo; + + /** 指定包邮开关 */ + private Integer appoint; + + /** 指定包邮内容 */ + private String appointInfo; + + /** 添加时间 */ + private Timestamp createTime; + + private Timestamp updateTime; + + private Integer isDel; + + /** 排序 */ + private Integer sort; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxShippingTemplatesFreeDto.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxShippingTemplatesFreeDto.java new file mode 100644 index 0000000..97f4286 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxShippingTemplatesFreeDto.java @@ -0,0 +1,46 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@Data +public class YxShippingTemplatesFreeDto implements Serializable { + + /** 编号 */ + private Integer id; + + /** 省ID */ + private Integer provinceId; + + /** 模板ID */ + private Integer tempId; + + /** 城市ID */ + private Integer cityId; + + /** 包邮件数 */ + private BigDecimal number; + + /** 包邮金额 */ + private BigDecimal price; + + /** 计费方式 */ + private Integer type; + + /** 分组唯一值 */ + private String uniqid; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxShippingTemplatesFreeQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxShippingTemplatesFreeQueryCriteria.java new file mode 100644 index 0000000..7709e67 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxShippingTemplatesFreeQueryCriteria.java @@ -0,0 +1,19 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@Data +public class YxShippingTemplatesFreeQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxShippingTemplatesQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxShippingTemplatesQueryCriteria.java new file mode 100644 index 0000000..244ed22 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxShippingTemplatesQueryCriteria.java @@ -0,0 +1,19 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@Data +public class YxShippingTemplatesQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxShippingTemplatesRegionDto.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxShippingTemplatesRegionDto.java new file mode 100644 index 0000000..15c1991 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxShippingTemplatesRegionDto.java @@ -0,0 +1,52 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@Data +public class YxShippingTemplatesRegionDto implements Serializable { + + /** 编号 */ + private Integer id; + + /** 省ID */ + private Integer provinceId; + + /** 模板ID */ + private Integer tempId; + + /** 城市ID */ + private Integer cityId; + + /** 首件 */ + private BigDecimal first; + + /** 首件运费 */ + private BigDecimal firstPrice; + + /** 续件 */ + private BigDecimal continues; + + /** 续件运费 */ + private BigDecimal continuePrice; + + /** 计费方式 */ + private Integer type; + + /** 分组唯一值 */ + private String uniqid; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxShippingTemplatesRegionQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxShippingTemplatesRegionQueryCriteria.java new file mode 100644 index 0000000..261fa8c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxShippingTemplatesRegionQueryCriteria.java @@ -0,0 +1,19 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@Data +public class YxShippingTemplatesRegionQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxSystemCityDto.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxSystemCityDto.java new file mode 100644 index 0000000..d6fbaf1 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxSystemCityDto.java @@ -0,0 +1,50 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@Data +public class YxSystemCityDto implements Serializable { + + private Integer id; + + /** 城市id */ + private Integer cityId; + + /** 省市级别 */ + private Integer level; + + /** 父级id */ + private Integer parentId; + + /** 区号 */ + private String areaCode; + + /** 名称 */ + private String name; + + /** 合并名称 */ + private String mergerName; + + /** 经度 */ + private String lng; + + /** 纬度 */ + private String lat; + + /** 是否展示 */ + private Integer isShow; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxSystemCityQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxSystemCityQueryCriteria.java new file mode 100644 index 0000000..fee145d --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/dto/YxSystemCityQueryCriteria.java @@ -0,0 +1,19 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@Data +public class YxSystemCityQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/impl/YxShippingTemplatesFreeServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/impl/YxShippingTemplatesFreeServiceImpl.java new file mode 100644 index 0000000..d3a61df --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/impl/YxShippingTemplatesFreeServiceImpl.java @@ -0,0 +1,82 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.service.impl; + + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.template.domain.YxShippingTemplatesFree; +import co.yixiang.modules.template.service.YxShippingTemplatesFreeService; +import co.yixiang.modules.template.service.dto.YxShippingTemplatesFreeDto; +import co.yixiang.modules.template.service.dto.YxShippingTemplatesFreeQueryCriteria; +import co.yixiang.modules.template.service.mapper.YxShippingTemplatesFreeMapper; +import co.yixiang.utils.FileUtil; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxShippingTemplatesFreeServiceImpl extends BaseServiceImpl implements YxShippingTemplatesFreeService { + + private final IGenerator generator; + + @Override + //@Cacheable + public Map queryAll(YxShippingTemplatesFreeQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxShippingTemplatesFreeDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxShippingTemplatesFreeQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxShippingTemplatesFree.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxShippingTemplatesFreeDto yxShippingTemplatesFree : all) { + Map map = new LinkedHashMap<>(); + map.put("省ID", yxShippingTemplatesFree.getProvinceId()); + map.put("模板ID", yxShippingTemplatesFree.getTempId()); + map.put("城市ID", yxShippingTemplatesFree.getCityId()); + map.put("包邮件数", yxShippingTemplatesFree.getNumber()); + map.put("包邮金额", yxShippingTemplatesFree.getPrice()); + map.put("计费方式", yxShippingTemplatesFree.getType()); + map.put("分组唯一值", yxShippingTemplatesFree.getUniqid()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/impl/YxShippingTemplatesRegionServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/impl/YxShippingTemplatesRegionServiceImpl.java new file mode 100644 index 0000000..dda0afd --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/impl/YxShippingTemplatesRegionServiceImpl.java @@ -0,0 +1,89 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.service.impl; + + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.template.domain.YxShippingTemplatesRegion; +import co.yixiang.modules.template.service.YxShippingTemplatesRegionService; +import co.yixiang.modules.template.service.dto.YxShippingTemplatesRegionDto; +import co.yixiang.modules.template.service.dto.YxShippingTemplatesRegionQueryCriteria; +import co.yixiang.modules.template.service.mapper.YxShippingTemplatesRegionMapper; +import co.yixiang.utils.FileUtil; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@Service +@AllArgsConstructor +//@CacheConfig(cacheNames = "yxShippingTemplatesRegion") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxShippingTemplatesRegionServiceImpl extends BaseServiceImpl implements YxShippingTemplatesRegionService { + + private final IGenerator generator; + + @Override + //@Cacheable + public Map queryAll(YxShippingTemplatesRegionQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxShippingTemplatesRegionDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxShippingTemplatesRegionQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxShippingTemplatesRegion.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxShippingTemplatesRegionDto yxShippingTemplatesRegion : all) { + Map map = new LinkedHashMap<>(); + map.put("省ID", yxShippingTemplatesRegion.getProvinceId()); + map.put("模板ID", yxShippingTemplatesRegion.getTempId()); + map.put("城市ID", yxShippingTemplatesRegion.getCityId()); + map.put("首件", yxShippingTemplatesRegion.getFirst()); + map.put("首件运费", yxShippingTemplatesRegion.getFirstPrice()); + map.put("续件", yxShippingTemplatesRegion.getContinues()); + map.put("续件运费", yxShippingTemplatesRegion.getContinuePrice()); + map.put("计费方式", yxShippingTemplatesRegion.getType()); + map.put("分组唯一值", yxShippingTemplatesRegion.getUniqid()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/impl/YxShippingTemplatesServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/impl/YxShippingTemplatesServiceImpl.java new file mode 100644 index 0000000..8f18a7b --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/impl/YxShippingTemplatesServiceImpl.java @@ -0,0 +1,257 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.IdUtil; +import co.yixiang.api.BusinessException; +import co.yixiang.api.YshopException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.modules.template.domain.YxShippingTemplates; +import co.yixiang.modules.template.domain.YxShippingTemplatesFree; +import co.yixiang.modules.template.domain.YxShippingTemplatesRegion; +import co.yixiang.modules.template.service.YxShippingTemplatesFreeService; +import co.yixiang.modules.template.service.YxShippingTemplatesRegionService; +import co.yixiang.modules.template.service.YxShippingTemplatesService; +import co.yixiang.modules.template.service.dto.AppointInfoDto; +import co.yixiang.modules.template.service.dto.RegionChildrenDto; +import co.yixiang.modules.template.service.dto.RegionDto; +import co.yixiang.modules.template.service.dto.RegionInfoDto; +import co.yixiang.modules.template.service.dto.ShippingTemplatesDto; +import co.yixiang.modules.template.service.dto.YxShippingTemplatesDto; +import co.yixiang.modules.template.service.dto.YxShippingTemplatesQueryCriteria; +import co.yixiang.modules.template.service.mapper.YxShippingTemplatesMapper; +import co.yixiang.utils.FileUtil; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxShippingTemplatesServiceImpl extends BaseServiceImpl implements YxShippingTemplatesService { + + private final IGenerator generator; + + + private final YxShippingTemplatesRegionService yxShippingTemplatesRegionService; + private final YxShippingTemplatesFreeService yxShippingTemplatesFreeService; + + + /** + * 新增与更新模板 + * @param id 模板id + * @param shippingTemplatesDto ShippingTemplatesDto + */ + @Override + public void addAndUpdate(Integer id,ShippingTemplatesDto shippingTemplatesDto) { + if(ShopCommonEnum.ENABLE_1.getValue().equals(shippingTemplatesDto.getAppoint()) + && shippingTemplatesDto.getAppointInfo().isEmpty()){ + throw new YshopException("请指定包邮地区"); + } + YxShippingTemplates shippingTemplates = new YxShippingTemplates(); + BeanUtil.copyProperties(shippingTemplatesDto,shippingTemplates); + shippingTemplates.setRegionInfo(JSON.toJSONString(shippingTemplatesDto.getRegionInfo())); + shippingTemplates.setAppointInfo(JSON.toJSONString(shippingTemplatesDto.getAppointInfo())); + if(id != null && id > 0){ + shippingTemplates.setId(id); + this.updateById(shippingTemplates); + }else{ + this.save(shippingTemplates); + } + + this.saveRegion(shippingTemplatesDto,shippingTemplates.getId()); + this.saveFreeReigion(shippingTemplatesDto,shippingTemplates.getId()); + } + + @Override + //@Cacheable + public Map queryAll(YxShippingTemplatesQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxShippingTemplatesDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxShippingTemplatesQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxShippingTemplates.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxShippingTemplatesDto yxShippingTemplates : all) { + Map map = new LinkedHashMap<>(); + map.put("模板名称", yxShippingTemplates.getName()); + map.put("计费方式", yxShippingTemplates.getType()); + map.put("地域以及费用", yxShippingTemplates.getRegionInfo()); + map.put("指定包邮开关", yxShippingTemplates.getAppoint()); + map.put("指定包邮内容", yxShippingTemplates.getAppointInfo()); + map.put("添加时间", yxShippingTemplates.getCreateTime()); + map.put(" updateTime", yxShippingTemplates.getUpdateTime()); + map.put(" isDel", yxShippingTemplates.getIsDel()); + map.put("排序", yxShippingTemplates.getSort()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + /** + * 保存包邮区域 + * @param yxShippingTemplates ShippingTemplatesDto + * @param tempId 模板id + */ + private void saveFreeReigion(ShippingTemplatesDto yxShippingTemplates,Integer tempId){ + + if(yxShippingTemplates.getAppointInfo() == null + || yxShippingTemplates.getAppointInfo().isEmpty()){ + return; + } + + int count = yxShippingTemplatesFreeService.count(Wrappers + .lambdaQuery() + .eq(YxShippingTemplatesFree::getTempId,tempId)); + if(count > 0) { + yxShippingTemplatesFreeService.remove(Wrappers + .lambdaQuery() + .eq(YxShippingTemplatesFree::getTempId,tempId)); + } + + List shippingTemplatesFrees = new ArrayList<>(); + + + List appointInfo = yxShippingTemplates.getAppointInfo(); + for (AppointInfoDto appointInfoDto : appointInfo){ + String uni = IdUtil.simpleUUID(); + + if(appointInfoDto.getPlace() != null && !appointInfoDto.getPlace().isEmpty()){ + for (RegionDto regionDto : appointInfoDto.getPlace()){ + if(regionDto.getChildren() != null && !regionDto.getChildren().isEmpty()){ + for (RegionChildrenDto childrenDto : regionDto.getChildren()){ + YxShippingTemplatesFree shippingTemplatesFree = YxShippingTemplatesFree.builder() + .tempId(tempId) + .number(new BigDecimal(appointInfoDto.getA_num())) + .price(new BigDecimal(appointInfoDto.getA_price())) + .type(yxShippingTemplates.getType()) + .uniqid(uni) + .provinceId(Integer.valueOf(regionDto.getCity_id())) + .cityId(Integer.valueOf(childrenDto.getCity_id())) + .build(); + shippingTemplatesFrees.add(shippingTemplatesFree); + } + } + } + } + } + + + if(shippingTemplatesFrees.isEmpty()) { + throw new YshopException("请添加包邮区域"); + } + + yxShippingTemplatesFreeService.saveBatch(shippingTemplatesFrees); + + + } + + /** + * 保存模板设置的区域价格 + * @param yxShippingTemplates ShippingTemplatesDTO + * @param tempId 运费模板id + */ + private void saveRegion(ShippingTemplatesDto yxShippingTemplates,Integer tempId){ + int count = yxShippingTemplatesRegionService.count(Wrappers + .lambdaQuery() + .eq(YxShippingTemplatesRegion::getTempId,tempId)); + if(count > 0) { + yxShippingTemplatesRegionService.remove(Wrappers + .lambdaQuery() + .eq(YxShippingTemplatesRegion::getTempId,tempId)); + } + + List shippingTemplatesRegions = new ArrayList<>(); + + + List regionInfo = yxShippingTemplates.getRegionInfo(); + + + for (RegionInfoDto regionInfoDto : regionInfo){ + String uni = IdUtil.simpleUUID(); + if(regionInfoDto.getRegion() != null && !regionInfoDto.getRegion().isEmpty()){ + for (RegionDto regionDto : regionInfoDto.getRegion()){ + if(regionDto.getChildren() != null && !regionDto.getChildren().isEmpty()){ + for (RegionChildrenDto childrenDtp : regionDto.getChildren()){ + YxShippingTemplatesRegion shippingTemplatesRegion = YxShippingTemplatesRegion.builder() + .tempId(tempId) + .first(new BigDecimal(regionInfoDto.getFirst())) + .firstPrice(new BigDecimal(regionInfoDto.getPrice())) + .continues(new BigDecimal(regionInfoDto.get_continue())) + .continuePrice(new BigDecimal(regionInfoDto.getContinue_price())) + .type(yxShippingTemplates.getType()) + .uniqid(uni) + .provinceId(Integer.valueOf(regionDto.getCity_id())) + .cityId(Integer.valueOf(childrenDtp.getCity_id())) + .build(); + shippingTemplatesRegions.add(shippingTemplatesRegion); + } + }else{ + YxShippingTemplatesRegion shippingTemplatesRegion = YxShippingTemplatesRegion.builder() + .tempId(tempId) + .first(new BigDecimal(regionInfoDto.getFirst())) + .firstPrice(new BigDecimal(regionInfoDto.getPrice())) + .continues(new BigDecimal(regionInfoDto.get_continue())) + .continuePrice(new BigDecimal(regionInfoDto.getContinue_price())) + .type(yxShippingTemplates.getType()) + .uniqid(uni) + .provinceId(Integer.valueOf(regionDto.getCity_id())) + .build(); + shippingTemplatesRegions.add(shippingTemplatesRegion); + } + } + } + } + + if(shippingTemplatesRegions.isEmpty()) { + throw new BusinessException("请添加区域"); + } + + yxShippingTemplatesRegionService.saveBatch(shippingTemplatesRegions); + + } + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/impl/YxSystemCityServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/impl/YxSystemCityServiceImpl.java new file mode 100644 index 0000000..0f12507 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/impl/YxSystemCityServiceImpl.java @@ -0,0 +1,83 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.template.domain.YxSystemCity; +import co.yixiang.modules.template.service.YxSystemCityService; +import co.yixiang.modules.template.service.dto.YxSystemCityDto; +import co.yixiang.modules.template.service.dto.YxSystemCityQueryCriteria; +import co.yixiang.modules.template.service.mapper.YxSystemCityMapper; +import co.yixiang.utils.FileUtil; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxSystemCityServiceImpl extends BaseServiceImpl implements YxSystemCityService { + + private final IGenerator generator; + + @Override + //@Cacheable + public Map queryAll(YxSystemCityQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxSystemCityDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxSystemCityQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxSystemCity.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxSystemCityDto yxSystemCity : all) { + Map map = new LinkedHashMap<>(); + map.put("城市id", yxSystemCity.getCityId()); + map.put("省市级别", yxSystemCity.getLevel()); + map.put("父级id", yxSystemCity.getParentId()); + map.put("区号", yxSystemCity.getAreaCode()); + map.put("名称", yxSystemCity.getName()); + map.put("合并名称", yxSystemCity.getMergerName()); + map.put("经度", yxSystemCity.getLng()); + map.put("纬度", yxSystemCity.getLat()); + map.put("是否展示", yxSystemCity.getIsShow()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/mapper/YxShippingTemplatesFreeMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/mapper/YxShippingTemplatesFreeMapper.java new file mode 100644 index 0000000..6646f6a --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/mapper/YxShippingTemplatesFreeMapper.java @@ -0,0 +1,22 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.template.domain.YxShippingTemplatesFree; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@Repository +public interface YxShippingTemplatesFreeMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/mapper/YxShippingTemplatesMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/mapper/YxShippingTemplatesMapper.java new file mode 100644 index 0000000..ec1c3a6 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/mapper/YxShippingTemplatesMapper.java @@ -0,0 +1,22 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.template.domain.YxShippingTemplates; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@Repository +public interface YxShippingTemplatesMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/mapper/YxShippingTemplatesRegionMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/mapper/YxShippingTemplatesRegionMapper.java new file mode 100644 index 0000000..8973a23 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/mapper/YxShippingTemplatesRegionMapper.java @@ -0,0 +1,22 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.template.domain.YxShippingTemplatesRegion; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@Repository +public interface YxShippingTemplatesRegionMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/template/service/mapper/YxSystemCityMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/template/service/mapper/YxSystemCityMapper.java new file mode 100644 index 0000000..81b0a5c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/template/service/mapper/YxSystemCityMapper.java @@ -0,0 +1,22 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.template.domain.YxSystemCity; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@Repository +public interface YxSystemCityMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxSystemUserTask.java b/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxSystemUserTask.java new file mode 100644 index 0000000..ecd0c39 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxSystemUserTask.java @@ -0,0 +1,67 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Data +@TableName("yx_system_user_task") +public class YxSystemUserTask extends BaseDomain { + + @TableId + private Integer id; + + + /** 任务名称 */ + private String name; + + + /** 配置原名 */ + private String realName; + + + /** 任务类型 */ + private String taskType; + + + /** 限定数 */ + private Integer number; + + + /** 等级id */ + private Integer levelId; + + + /** 排序 */ + private Integer sort; + + + /** 是否显示 */ + private Integer isShow; + + + /** 是否务必达成任务,1务必达成,0=满足其一 */ + private Integer isMust; + + + /** 任务说明 */ + private String illustrate; + + + public void copy(YxSystemUserTask source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUser.java b/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUser.java new file mode 100644 index 0000000..dad2014 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUser.java @@ -0,0 +1,173 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import co.yixiang.modules.user.service.dto.WechatUserDto; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Builder +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString +@TableName(value = "yx_user",autoResultMap = true) +public class YxUser extends BaseDomain { + + /** 用户id */ + @TableId(value = "uid", type = IdType.AUTO) + private Long uid; + + + /** 用户账户(跟accout一样) */ + private String username; + + + + + /** 用户密码(跟pwd) */ + private String password; + + + + /** 真实姓名 */ + private String realName; + + + /** 生日 */ + private Integer birthday; + + + /** 身份证号码 */ + private String cardId; + + + /** 用户备注 */ + private String mark; + + + /** 合伙人id */ + private Integer partnerId; + + + /** 用户分组id */ + private Integer groupId; + + + /** 用户昵称 */ + private String nickname; + + + /** 用户头像 */ + private String avatar; + + + /** 手机号码 */ + private String phone; + + + + /** 添加ip */ + private String addIp; + + + + /** 最后一次登录ip */ + private String lastIp; + + + /** 用户余额 */ + private BigDecimal nowMoney; + + + /** 佣金金额 */ + private BigDecimal brokeragePrice; + + + /** 用户剩余积分 */ + private BigDecimal integral; + + + /** 连续签到天数 */ + private Integer signNum; + + + /** 1为正常,0为禁止 */ + private Integer status; + + + /** 等级 */ + private Integer level; + + + /** 推广元id */ + private Long spreadUid; + + + /** 推广员关联时间 */ + private Date spreadTime; + + + /** 用户类型 */ + private String userType; + + + /** 是否为推广员 */ + private Integer isPromoter; + + + /** 用户购买次数 */ + private Integer payCount; + + + /** 下级人数 */ + private Integer spreadCount; + + + + /** 详细地址 */ + private String addres; + + + /** 管理员编号 */ + private Integer adminid; + + + /** 用户登陆类型,h5,wechat,routine */ + private String loginType; + + /** 微信用户json信息 */ + @TableField(typeHandler = FastjsonTypeHandler.class) + private WechatUserDto wxProfile; + + + public void copy(YxUser source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUserAddress.java b/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUserAddress.java new file mode 100644 index 0000000..fc8a2d3 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUserAddress.java @@ -0,0 +1,72 @@ +package co.yixiang.modules.user.domain; + + +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +/** + *

+ * 用户地址表 + *

+ * + * @author hupeng + * @since 2019-10-28 + */ +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ApiModel(value = "YxUserAddress对象", description = "用户地址表") +public class YxUserAddress extends BaseDomain { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "用户地址id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty(value = "用户id") + private Long uid; + + @ApiModelProperty(value = "收货人姓名") + private String realName; + + @ApiModelProperty(value = "收货人电话") + private String phone; + + @ApiModelProperty(value = "收货人所在省") + private String province; + + @ApiModelProperty(value = "收货人所在市") + private String city; + + private Integer cityId; + + @ApiModelProperty(value = "收货人所在区") + private String district; + + @ApiModelProperty(value = "收货人详细地址") + private String detail; + + @ApiModelProperty(value = "邮编") + private String postCode; + + @ApiModelProperty(value = "经度") + private String longitude; + + @ApiModelProperty(value = "纬度") + private String latitude; + + @ApiModelProperty(value = "是否默认") + private Integer isDefault; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUserBill.java b/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUserBill.java new file mode 100644 index 0000000..8f9a79a --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUserBill.java @@ -0,0 +1,83 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +@TableName("yx_user_bill") +public class YxUserBill extends BaseDomain { + + /** 用户账单id */ + @TableId + private Long id; + + + /** 用户uid */ + private Long uid; + + + /** 关联id */ + private String linkId; + + + /** 0 = 支出 1 = 获得 */ + private Integer pm; + + + /** 账单标题 */ + private String title; + + + /** 明细种类 */ + private String category; + + + /** 明细类型 */ + private String type; + + + /** 明细数字 */ + private BigDecimal number; + + + /** 剩余 */ + private BigDecimal balance; + + + /** 备注 */ + private String mark; + + + + /** 0 = 带确定 1 = 有效 -1 = 无效 */ + private Integer status; + + + public void copy(YxUserBill source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUserLevel.java b/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUserLevel.java new file mode 100644 index 0000000..89fda05 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUserLevel.java @@ -0,0 +1,60 @@ +package co.yixiang.modules.user.domain; + +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 用户等级记录表 + *

+ * + * @author hupeng + * @since 2019-12-06 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "YxUserLevel对象", description = "用户等级记录表") +public class YxUserLevel extends BaseDomain { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "用户uid") + private Long uid; + + @ApiModelProperty(value = "等级vip") + private Integer levelId; + + @ApiModelProperty(value = "会员等级") + private Integer grade; + + @ApiModelProperty(value = "过期时间") + private Integer validTime; + + @ApiModelProperty(value = "是否永久") + private Integer isForever; + + @ApiModelProperty(value = "商户id") + private Integer merId; + + @ApiModelProperty(value = "0:禁止,1:正常") + private Integer status; + + @ApiModelProperty(value = "备注") + private String mark; + + @ApiModelProperty(value = "是否已通知") + private Integer remind; + + + @ApiModelProperty(value = "享受折扣") + private Integer discount; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUserRecharge.java b/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUserRecharge.java new file mode 100644 index 0000000..bb292f9 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUserRecharge.java @@ -0,0 +1,71 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-12 +*/ + +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("yx_user_recharge") +public class YxUserRecharge extends BaseDomain { + + @TableId + private Long id; + + + /** 充值用户UID */ + private Long uid; + + + /** 订单号 */ + private String orderId; + + + /** 充值金额 */ + private BigDecimal price; + + private BigDecimal givePrice; + + + /** 充值类型 */ + private String rechargeType; + + + /** 是否充值 */ + private Integer paid; + + + /** 充值支付时间 */ + private Date payTime; + + + + /** 退款金额 */ + private BigDecimal refundPrice; + + + /** 昵称 */ + private String nickname; + + + public void copy(YxUserRecharge source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUserSign.java b/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUserSign.java new file mode 100644 index 0000000..1321986 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUserSign.java @@ -0,0 +1,48 @@ +package co.yixiang.modules.user.domain; + + +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + *

+ * 签到记录表 + *

+ * + * @author hupeng + * @since 2019-12-05 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "YxUserSign对象", description = "签到记录表") +public class YxUserSign extends BaseDomain { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty(value = "用户uid") + private Long uid; + + @ApiModelProperty(value = "签到说明") + private String title; + + @ApiModelProperty(value = "获得积分") + private Integer number; + + @ApiModelProperty(value = "剩余积分") + private Integer balance; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUserTaskFinish.java b/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUserTaskFinish.java new file mode 100644 index 0000000..d74bfa1 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/domain/YxUserTaskFinish.java @@ -0,0 +1,39 @@ +package co.yixiang.modules.user.domain; + + +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 用户任务完成记录表 + *

+ * + * @author hupeng + * @since 2019-12-07 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("yx_user_task_finish") +public class YxUserTaskFinish extends BaseDomain { + + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "任务id") + private Integer taskId; + + @ApiModelProperty(value = "用户id") + private Long uid; + + @ApiModelProperty(value = "是否有效") + private Integer status; + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/param/AddressDetailParam.java b/yshop-mall/src/main/java/co/yixiang/modules/user/param/AddressDetailParam.java new file mode 100644 index 0000000..5b5513c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/param/AddressDetailParam.java @@ -0,0 +1,29 @@ +package co.yixiang.modules.user.param; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName AddressDetailParam + * @Author hupeng <610796224@qq.com> + * @Date 2019/10/28 + **/ +@Data +public class AddressDetailParam implements Serializable { + + @JsonProperty(value = "city_id") + @ApiModelProperty(value = "城市ID") + private Integer cityId; + + @ApiModelProperty(value = "城市") + private String city; + + @ApiModelProperty(value = "地区") + private String district; + + @ApiModelProperty(value = "省份") + private String province; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/param/AddressParam.java b/yshop-mall/src/main/java/co/yixiang/modules/user/param/AddressParam.java new file mode 100644 index 0000000..75f795f --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/param/AddressParam.java @@ -0,0 +1,46 @@ +package co.yixiang.modules.user.param; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import java.io.Serializable; + +/** + * @ClassName AddressParam + * @Author hupeng <610796224@qq.com> + * @Date 2019/10/28 + **/ +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class AddressParam implements Serializable { + + @ApiModelProperty(value = "地址ID") + private String id; + @NotBlank + @Size(min = 1, max = 30,message = "长度超过了限制") + @ApiModelProperty(value = "收货地址真实名字") + private String real_name; + + @ApiModelProperty(value = "收货地址邮编") + private String post_code; + + @ApiModelProperty(value = "是否默认收货地址 true是 false否") + private String is_default; + + private String wx_export; + + @NotBlank + @Size(min = 1, max = 60,message = "长度超过了限制") + @ApiModelProperty(value = "收货详细地址") + private String detail; + + @NotBlank + @ApiModelProperty(value = "收货手机号码") + private String phone; + + @ApiModelProperty(value = "收货地址详情") + private AddressDetailParam address; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxSystemUserLevelService.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxSystemUserLevelService.java new file mode 100644 index 0000000..6dc99b8 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxSystemUserLevelService.java @@ -0,0 +1,68 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.shop.domain.YxSystemUserLevel; +import co.yixiang.modules.user.service.dto.UserLevelDto; +import co.yixiang.modules.user.service.dto.YxSystemUserLevelDto; +import co.yixiang.modules.user.service.dto.YxSystemUserLevelQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxSystemUserLevelService extends BaseService{ + + + /** + * 获取当前的下一个会员等级id + * @param levelId 等级id + * @return int + */ + int getNextLevelId(int levelId); + + //boolean getClear(int levelId); + + + /** + * 获取会员等级列表及其任务列表 + * @return UserLevelDto + */ + UserLevelDto getLevelInfo(Long uid); + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxSystemUserLevelQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxSystemUserLevelQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxSystemUserTaskService.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxSystemUserTaskService.java new file mode 100644 index 0000000..cf21fca --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxSystemUserTaskService.java @@ -0,0 +1,68 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.user.domain.YxSystemUserTask; +import co.yixiang.modules.user.service.dto.TaskDto; +import co.yixiang.modules.user.service.dto.YxSystemUserTaskDto; +import co.yixiang.modules.user.service.dto.YxSystemUserTaskQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxSystemUserTaskService extends BaseService{ + + + /** + * 获取已经完成的任务数量 + * @param levelId 等级id + * @param uid uid + * @return int + */ + int getTaskComplete(int levelId,Long uid); + + /** + * 获取等级会员任务列表 + * @param levelId 等级id + * @param uid uid + * @return TaskDto + */ + TaskDto getTaskList(int levelId, Long uid); + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxSystemUserTaskQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxSystemUserTaskQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserAddressService.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserAddressService.java new file mode 100644 index 0000000..6f76fff --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserAddressService.java @@ -0,0 +1,66 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service; + + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.user.domain.YxUserAddress; +import co.yixiang.modules.user.param.AddressParam; +import co.yixiang.modules.user.vo.YxUserAddressQueryVo; + +import java.util.List; + +/** + *

+ * 用户地址表 服务类 + *

+ * + * @author hupeng + * @since 2019-10-28 + */ +public interface YxUserAddressService extends BaseService { + + /** + * 设置默认地址 + * @param uid uid + * @param addressId 地址id + */ + void setDefault(Long uid,Long addressId); + + /** + * 添加或者修改地址 + * @param uid uid + * @param param AddressParam + */ + Long addAndEdit(Long uid, AddressParam param); + + /** + * 地址详情 + * @param id 地址id + * @return YxUserAddressQueryVo + */ + YxUserAddressQueryVo getDetail(Long id); + + /** + * 获取用户地址 + * @param uid uid + * @param page page + * @param limit limit + * @return List + */ + List getList(Long uid,int page,int limit); + + /** + * 获取默认地址 + * @param uid uid + * @return YxUserAddress + */ + YxUserAddress getUserDefaultAddress(Long uid); + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserBillService.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserBillService.java new file mode 100644 index 0000000..2ee25c3 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserBillService.java @@ -0,0 +1,119 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.user.domain.YxUserBill; +import co.yixiang.modules.user.service.dto.YxUserBillDto; +import co.yixiang.modules.user.service.dto.YxUserBillQueryCriteria; +import co.yixiang.modules.user.vo.BillVo; +import co.yixiang.modules.user.vo.YxUserBillQueryVo; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxUserBillService extends BaseService{ + + /** + * 增加支出流水 + * @param uid uid + * @param title 账单标题 + * @param category 明细种类 + * @param type 明细类型 + * @param number 明细数字 + * @param balance 剩余 + * @param mark 备注 + */ + void expend(Long uid,String title,String category,String type,double number,double balance,String mark); + + /** + * 增加收入/支入流水 + * @param uid uid + * @param title 账单标题 + * @param category 明细种类 + * @param type 明细类型 + * @param number 明细数字 + * @param balance 剩余 + * @param mark 备注 + * @param linkid 关联id + */ + void income(Long uid,String title,String category,String type,double number, + double balance,String mark,String linkid); + + int cumulativeAttendance(Long uid); + + /** + * 获取推广订单列表 + * @param uid uid + * @param page page + * @param limit limit + * @return Map + */ + Map spreadOrder(Long uid,int page,int limit); + + /** + * 获取用户账单记录 + * @param page page + * @param limit limit + * @param uid uid + * @param type BillDetailEnum + * @return map + */ + Map getUserBillList(int page, int limit, long uid, int type); + + + double getBrokerage(int uid); + + /** + * 统计昨天的佣金 + * @param uid uid + * @return double + */ + double yesterdayCommissionSum(Long uid); + + /** + * 根据类别获取账单记录 + * @param uid uid + * @param category BillDetailEnum + * @param page page + * @param limit limit + * @return List + */ + List userBillList(Long uid,String category,int page,int limit); + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxUserBillQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxUserBillQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserLevelService.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserLevelService.java new file mode 100644 index 0000000..852cdcb --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserLevelService.java @@ -0,0 +1,43 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.user.domain.YxUserLevel; + + +/** + *

+ * 用户等级记录表 服务类 + *

+ * + * @author hupeng + * @since 2019-12-06 + */ +public interface YxUserLevelService extends BaseService { + + + /** + * 检查是否能成为会员 + * @param uid 用户id + */ + boolean setLevelComplete(Long uid); + + //UserLevelInfoDto getUserLevelInfo(int id); + + /** + * 获取当前用户会员等级返回当前用户等级 + * @param uid uid + * @param grade 用户级别 + * @return YxUserLevel + */ + YxUserLevel getUserLevel(Long uid, Integer grade); + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserRechargeService.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserRechargeService.java new file mode 100644 index 0000000..478a824 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserRechargeService.java @@ -0,0 +1,64 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.domain.YxUserRecharge; +import co.yixiang.modules.user.service.dto.YxUserRechargeDto; +import co.yixiang.modules.user.service.dto.YxUserRechargeQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxUserRechargeService extends BaseService{ + + + void updateRecharge(YxUserRecharge userRecharge); + + YxUserRecharge getInfoByOrderId(String orderId); + + /** + * 添加充值记录 + * @param user 用户 + * @param price 充值金额 + * @param paidPrice 赠送金额 + */ + String addRecharge(YxUser user, String price, String paidPrice); + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxUserRechargeQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxUserRechargeQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserService.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserService.java new file mode 100644 index 0000000..242afbd --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserService.java @@ -0,0 +1,192 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.order.vo.YxStoreOrderQueryVo; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.service.dto.PromUserDto; +import co.yixiang.modules.user.service.dto.UserMoneyDto; +import co.yixiang.modules.user.service.dto.YxUserDto; +import co.yixiang.modules.user.service.dto.YxUserQueryCriteria; +import co.yixiang.modules.user.vo.YxUserQueryVo; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxUserService extends BaseService{ + + /** + * 返回用户累计充值金额与消费金额 + * @param uid uid + * @return Double[] + */ + Double[] getUserMoney(Long uid); + + /** + * 一级返佣 + * @param order 订单 + */ + void backOrderBrokerage(YxStoreOrderQueryVo order); + + + + /** + * 统计分销人员 + * @param uid uid + * @return map + */ + Map getSpreadCount(Long uid); + + /** + * 获取我的分销下人员列表 + * @param uid uid + * @param page page + * @param limit limit + * @param grade ShopCommonEnum.GRADE_0 + * @param keyword 关键字搜索 + * @param sort 排序 + * @return list + */ + List getUserSpreadGrade(Long uid, int page, int limit, Integer grade, String keyword, String sort); + + /** + * 减去用户积分 + * @param uid 用户id + * @param integral 积分 + */ + void decIntegral(Long uid,double integral); + + /** + * 增加购买次数 + * @param uid uid + */ + void incPayCount(Long uid); + + /** + * 减去用户余额 + * @param uid uid + * @param payPrice 金额 + */ + void decPrice(Long uid, BigDecimal payPrice); + + // YxUser findByName(String name); + + /** + * 更新用户余额 + * @param uid y用户id + * @param price 金额 + */ + void incMoney(Long uid,BigDecimal price); + + /** + * 增加积分 + * @param uid uid + * @param integral 积分 + */ + void incIntegral(Long uid,double integral); + + /** + * 获取用户信息 + * @param uid uid + * @return YxUserQueryVo + */ + YxUserQueryVo getYxUserById(Long uid); + + /** + * 获取用户个人详细信息 + * @param yxUser yxUser + * @return YxUserQueryVo + */ + YxUserQueryVo getNewYxUserById(YxUser yxUser); + + /** + * 转换用户信息 + * @param yxUser user + * @return YxUserQueryVo + */ + YxUserQueryVo handleUser(YxUser yxUser); + + /** + * 返回会员价 + * @param price 原价 + * @param uid 用户id + * @return vip 价格 + */ + double setLevelPrice(double price, long uid); + + /** + * 设置推广关系 + * @param spread 上级人 + * @param uid 本人 + */ + void setSpread(String spread, long uid); + + + /** + * 查看下级 + * @param uid uid + * @param grade 等级 + * @return list + */ + List querySpread(Long uid, Integer grade); + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxUserQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxUserQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + /** + * 更新用户状态 + * @param uid uid + * @param status ShopCommonEnum + */ + void onStatus(Long uid, Integer status); + + /** + * 修改余额 + * @param param UserMoneyDto + */ + void updateMoney(UserMoneyDto param); + + /** + * 增加佣金 + * @param price 金额 + * @param uid 用户id + */ + void incBrokeragePrice(BigDecimal price, Long uid); + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserSignService.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserSignService.java new file mode 100644 index 0000000..f3217c3 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserSignService.java @@ -0,0 +1,61 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service; + + + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.domain.YxUserSign; +import co.yixiang.modules.user.vo.SignVo; +import co.yixiang.modules.user.vo.YxUserQueryVo; + +import java.util.List; + +/** + *

+ * 签到记录表 服务类 + *

+ * + * @author hupeng + * @since 2019-12-05 + */ +public interface YxUserSignService extends BaseService { + + /** + * + * @param yxUser 用户 + * @return 签到积分 + */ + int sign(YxUser yxUser); + + /** + * 分页获取用户签到数据 + * @param uid 用户id + * @param page page + * @param limit limit + * @return list + */ + List getSignList(Long uid, int page, int limit); + + //boolean getYesterDayIsSign(int uid); + + //boolean getToDayIsSign(int uid); + + //int getSignSumDay(int uid); + + /** + * 获取签到用户信息 + * @param yxUser yxUser + * @return YxUserQueryVo + */ + YxUserQueryVo userSignInfo(YxUser yxUser); + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserTaskFinishService.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserTaskFinishService.java new file mode 100644 index 0000000..099c314 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/YxUserTaskFinishService.java @@ -0,0 +1,33 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service; + + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.user.domain.YxUserTaskFinish; + +/** + *

+ * 用户任务完成记录表 服务类 + *

+ * + * @author hupeng + * @since 2019-12-07 + */ +public interface YxUserTaskFinishService extends BaseService { + + /** + * 设置任务完成 + * @param uid uid + * @param taskId 任务id + */ + void setFinish(Long uid,int taskId); + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/BillOrderDto.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/BillOrderDto.java new file mode 100644 index 0000000..90dc3f6 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/BillOrderDto.java @@ -0,0 +1,17 @@ +package co.yixiang.modules.user.service.dto; + +import lombok.Data; + +import java.util.List; + +/** + * @ClassName BillVo + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/12 + **/ +@Data +public class BillOrderDto { + private String time; + private Integer count; + private List child; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/BillOrderRecordDto.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/BillOrderRecordDto.java new file mode 100644 index 0000000..82cfd9f --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/BillOrderRecordDto.java @@ -0,0 +1,17 @@ +package co.yixiang.modules.user.service.dto; + +import lombok.Data; + +/** + * @ClassName BillVo + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/12 + **/ +@Data +public class BillOrderRecordDto { + private String orderId; + private String time; + private Double number; + private String avatar; + private String nickname; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/MUserBillDto.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/MUserBillDto.java new file mode 100644 index 0000000..b5480f1 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/MUserBillDto.java @@ -0,0 +1,16 @@ +package co.yixiang.modules.user.service.dto; + +import lombok.Data; + +/** + * @ClassName UserBillDTO + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/12 + **/ +@Data +public class MUserBillDto { + private String addTime; + private String title; + private Double number; + private Integer pm; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/PromUserDto.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/PromUserDto.java new file mode 100644 index 0000000..c6d1905 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/PromUserDto.java @@ -0,0 +1,19 @@ +package co.yixiang.modules.user.service.dto; + +import lombok.Data; + +/** + * @ClassName PromUserDto + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/12 + **/ +@Data +public class PromUserDto { + private String avatar; + private String nickname; + private Integer childCount; + private Integer numberCount; + private Integer orderCount; + private Integer uid; + private String time; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/TaskDto.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/TaskDto.java new file mode 100644 index 0000000..d0c71ec --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/TaskDto.java @@ -0,0 +1,20 @@ +package co.yixiang.modules.user.service.dto; + + +import co.yixiang.modules.user.vo.YxSystemUserTaskQueryVo; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @ClassName TaskDto + * @Author hupeng <610796224@qq.com> + * @Date 2019/12/6 + **/ +@Data +public class TaskDto implements Serializable { + private List list; + private Integer reachCount; + private List task; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/UserBillDto.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/UserBillDto.java new file mode 100644 index 0000000..51d7e41 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/UserBillDto.java @@ -0,0 +1,23 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.service.dto; + +import lombok.Data; + +/** + * @ClassName UserBillDTO + * @Author hupeng <610796224@qq.com> + * @Date 2019/12/11 + **/ +@Data +public class UserBillDto { + private Integer pm; + private String gtitle; + private String category; + private String type; + private Double number; + private String nickname; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/UserLevelDto.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/UserLevelDto.java new file mode 100644 index 0000000..8df5086 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/UserLevelDto.java @@ -0,0 +1,19 @@ +package co.yixiang.modules.user.service.dto; + + +import co.yixiang.modules.user.vo.YxSystemUserLevelQueryVo; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @ClassName UserLevelDto + * @Author hupeng <610796224@qq.com> + * @Date 2019/12/6 + **/ +@Data +public class UserLevelDto implements Serializable { + private List list; + private TaskDto task; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/UserLevelInfoDto.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/UserLevelInfoDto.java new file mode 100644 index 0000000..1c0afe0 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/UserLevelInfoDto.java @@ -0,0 +1,21 @@ +package co.yixiang.modules.user.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName UserLevelInfoDto + * @Author hupeng <610796224@qq.com> + * @Date 2019/12/7 + **/ +@Data +public class UserLevelInfoDto implements Serializable { + private Integer id; + private Integer addTime; + private Double discount; + private Integer levelId; + private String name; + private String icon; + private Integer grade; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/UserMoneyDto.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/UserMoneyDto.java new file mode 100644 index 0000000..7afab13 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/UserMoneyDto.java @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.service.dto; + +import lombok.Data; + +import javax.validation.constraints.Min; +import java.io.Serializable; + +/** + * @ClassName UserMoneyDTO + * @Author hupeng <610796224@qq.com> + * @Date 2019/12/4 + **/ +@Data +public class UserMoneyDto implements Serializable { + //@NotNull(message = "参数缺失") + private Long uid; + //@NotNull(message = "请选择修改余额方式") + private Integer ptype; + //@NotNull(message = "金额必填") + @Min(message = "最低金额为0",value = 0) + private Double money; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/WechatUserDto.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/WechatUserDto.java new file mode 100644 index 0000000..41dffe0 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/WechatUserDto.java @@ -0,0 +1,45 @@ +package co.yixiang.modules.user.service.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +/** + * @ClassName WechatUserDTO + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/4 + **/ +@Getter +@Setter +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class WechatUserDto { + + private String openid; + + private String unionId; + + private String routineOpenid; + + private String nickname; + + private String headimgurl; + + private Integer sex; + + private String city; + + private String language; + + private String province; + + private String country; + + private Boolean subscribe; + + private Long subscribeTime; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxSystemUserLevelDto.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxSystemUserLevelDto.java new file mode 100644 index 0000000..7526267 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxSystemUserLevelDto.java @@ -0,0 +1,63 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxSystemUserLevelDto implements Serializable { + + private Integer id; + + /** 商户id */ + private Integer merId; + + /** 会员名称 */ + private String name; + + /** 购买金额 */ + private BigDecimal money; + + /** 有效时间 */ + private Integer validDate; + + /** 是否为永久会员 */ + private Integer isForever; + + /** 是否购买,1=购买,0=不购买 */ + private Integer isPay; + + /** 是否显示 1=显示,0=隐藏 */ + private Integer isShow; + + /** 会员等级 */ + private Integer grade; + + /** 享受折扣 */ + private BigDecimal discount; + + /** 会员卡背景 */ + private String image; + + /** 会员图标 */ + private String icon; + + /** 说明 */ + private String explain; + + /** 添加时间 */ + private Integer addTime; + + /** 是否删除.1=删除,0=未删除 */ + private Integer isDel; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxSystemUserLevelQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxSystemUserLevelQueryCriteria.java new file mode 100644 index 0000000..d1a8234 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxSystemUserLevelQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxSystemUserLevelQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxSystemUserTaskDto.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxSystemUserTaskDto.java new file mode 100644 index 0000000..9616f73 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxSystemUserTaskDto.java @@ -0,0 +1,51 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxSystemUserTaskDto implements Serializable { + private Integer id; + + // 任务名称 + private String name; + + // 配置原名 + private String realName; + + // 任务类型 + private String taskType; + + // 限定数 + private Integer number; + + // 等级id + private Integer levelId; + + private String levalName; + + // 排序 + private Integer sort; + + // 是否显示 + private Integer isShow; + + // 是否务必达成任务,1务必达成,0=满足其一 + private Integer isMust; + + // 任务说明 + private String illustrate; + + // 新增时间 + private Integer addTime; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxSystemUserTaskQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxSystemUserTaskQueryCriteria.java new file mode 100644 index 0000000..dda0d66 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxSystemUserTaskQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxSystemUserTaskQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserBillDto.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserBillDto.java new file mode 100644 index 0000000..aee6d53 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserBillDto.java @@ -0,0 +1,60 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.service.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxUserBillDto implements Serializable { + + /** 用户账单id */ + private Long id; + + /** 用户uid */ + private Long uid; + + /** 关联id */ + private String linkId; + + /** 0 = 支出 1 = 获得 */ + private Integer pm; + + /** 账单标题 */ + private String title; + + /** 明细种类 */ + private String category; + + /** 明细类型 */ + private String type; + + /** 明细数字 */ + private BigDecimal number; + + /** 剩余 */ + private BigDecimal balance; + + /** 备注 */ + private String mark; + + /** 添加时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date createTime; + + /** 0 = 带确定 1 = 有效 -1 = 无效 */ + private Integer status; + + private String nickname; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserBillQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserBillQueryCriteria.java new file mode 100644 index 0000000..953a20e --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserBillQueryCriteria.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxUserBillQueryCriteria{ + @Query(type = Query.Type.EQUAL) + private String nickname = ""; + @Query(type = Query.Type.EQUAL) + private String category = ""; + @Query(type = Query.Type.EQUAL) + private String type = ""; + @Query(type = Query.Type.EQUAL) + private Integer pm; + @Query(type = Query.Type.EQUAL) + private String title = ""; + private String startTime; + + private String endTime; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserDto.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserDto.java new file mode 100644 index 0000000..970a2a1 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserDto.java @@ -0,0 +1,111 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.service.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxUserDto implements Serializable { + + /** 用户id */ + private Long uid; + + /** 用户账户(跟accout一样) */ + private String username; + + /** 用户密码(跟pwd) */ + private String password; + + + /** 真实姓名 */ + private String realName; + + /** 生日 */ + private Integer birthday; + + /** 身份证号码 */ + private String cardId; + + /** 用户备注 */ + private String mark; + + /** 合伙人id */ + private Integer partnerId; + + /** 用户分组id */ + private Integer groupId; + + /** 用户昵称 */ + private String nickname = ""; + + /** 用户头像 */ + private String avatar; + + /** 手机号码 */ + private String phone; + + /** 添加时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date createTime; + + /** 添加ip */ + private String addIp; + + + /** 用户余额 */ + private BigDecimal nowMoney; + + /** 佣金金额 */ + private BigDecimal brokeragePrice; + + /** 用户剩余积分 */ + private BigDecimal integral; + + /** 连续签到天数 */ + private Integer signNum; + + /** 1为正常,0为禁止 */ + private Integer status; + + /** 等级 */ + private Integer level; + + /** 推广元id */ + private Long spreadUid; + + /** 推广员关联时间 */ + private Date spreadTime; + + /** 用户类型 */ + private String userType; + + /** 是否为推广员 */ + private Integer isPromoter; + + /** 用户购买次数 */ + private Integer payCount; + + /** 下级人数 */ + private Integer spreadCount; + + /** 详细地址 */ + private String addres; + + /** 管理员编号 */ + private Integer adminid; + + /** 用户登陆类型,h5,wechat,routine */ + private String loginType; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserQueryCriteria.java new file mode 100644 index 0000000..731b14b --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserQueryCriteria.java @@ -0,0 +1,35 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxUserQueryCriteria{ + + // 模糊 + @Query(type = Query.Type.INNER_LIKE) + private String nickname; + + // 模糊 + @Query(type = Query.Type.INNER_LIKE) + private String phone; + + @Query + private Integer isPromoter; + + @Query + private String userType; + + private Long uid; + + private Integer grade; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserRechargeDto.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserRechargeDto.java new file mode 100644 index 0000000..fc18bbb --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserRechargeDto.java @@ -0,0 +1,49 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxUserRechargeDto implements Serializable { + + private Long id; + + /** 充值用户UID */ + private Long uid; + + /** 订单号 */ + private String orderId; + + /** 充值金额 */ + private BigDecimal price; + + /** 充值类型 */ + private String rechargeType; + + /** 是否充值 */ + private Integer paid; + + /** 充值支付时间 */ + private Date payTime; + + /** 充值时间 */ + private Date createTime; + + /** 退款金额 */ + private BigDecimal refundPrice; + + /** 昵称 */ + private String nickname; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserRechargeQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserRechargeQueryCriteria.java new file mode 100644 index 0000000..6d8f7b1 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserRechargeQueryCriteria.java @@ -0,0 +1,21 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxUserRechargeQueryCriteria{ + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String nickname; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserSmallDto.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserSmallDto.java new file mode 100644 index 0000000..5807251 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxUserSmallDto.java @@ -0,0 +1,33 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.service.dto; + +import lombok.Data; + +import java.io.Serializable; + + +/** +* @author hupeng +* @date 2019-10-06 +*/ +@Data +public class YxUserSmallDto implements Serializable { + + // 用户id + private Integer uid; + + // 用户昵称 + private String nickname; + + // 用户头像 + private String avatar; + + // 手机号码 + private String phone; + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxWechatUserDto.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxWechatUserDto.java new file mode 100644 index 0000000..70f6eca --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxWechatUserDto.java @@ -0,0 +1,91 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxWechatUserDto implements Serializable { + + /** 微信用户id */ + private Integer uid; + + /** 只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段 */ + private String unionid; + + /** 用户的标识,对当前公众号唯一 */ + private String openid; + + /** 小程序唯一身份ID */ + private String routineOpenid; + + /** 用户的昵称 */ + private String nickname; + + /** 用户头像 */ + private String headimgurl; + + /** 用户的性别,值为1时是男性,值为2时是女性,值为0时是未知 */ + private Integer sex; + + /** 用户所在城市 */ + private String city; + + /** 用户的语言,简体中文为zh_CN */ + private String language; + + /** 用户所在省份 */ + private String province; + + /** 用户所在国家 */ + private String country; + + /** 公众号运营者对粉丝的备注,公众号运营者可在微信公众平台用户管理界面对粉丝添加备注 */ + private String remark; + + /** 用户所在的分组ID(兼容旧的用户分组接口) */ + private Integer groupid; + + /** 用户被打上的标签ID列表 */ + private String tagidList; + + /** 用户是否订阅该公众号标识 */ + private Integer subscribe; + + /** 关注公众号时间 */ + private Integer subscribeTime; + + /** 添加时间 */ + private Integer addTime; + + /** 一级推荐人 */ + private Integer stair; + + /** 二级推荐人 */ + private Integer second; + + /** 一级推荐人订单 */ + private Integer orderStair; + + /** 二级推荐人订单 */ + private Integer orderSecond; + + /** 佣金 */ + private BigDecimal nowMoney; + + /** 小程序用户会话密匙 */ + private String sessionKey; + + /** 用户类型 */ + private String userType; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxWechatUserQueryCriteria.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxWechatUserQueryCriteria.java new file mode 100644 index 0000000..dab79e6 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/dto/YxWechatUserQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxWechatUserQueryCriteria{ +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxSystemUserLevelServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxSystemUserLevelServiceImpl.java new file mode 100644 index 0000000..17bcb28 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxSystemUserLevelServiceImpl.java @@ -0,0 +1,204 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import co.yixiang.api.YshopException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.modules.shop.domain.YxSystemUserLevel; +import co.yixiang.modules.user.domain.YxUserLevel; +import co.yixiang.modules.user.service.YxSystemUserLevelService; +import co.yixiang.modules.user.service.YxSystemUserTaskService; +import co.yixiang.modules.user.service.YxUserLevelService; +import co.yixiang.modules.user.service.dto.TaskDto; +import co.yixiang.modules.user.service.dto.UserLevelDto; +import co.yixiang.modules.user.service.dto.YxSystemUserLevelDto; +import co.yixiang.modules.user.service.dto.YxSystemUserLevelQueryCriteria; +import co.yixiang.modules.user.service.mapper.SystemUserLevelMapper; +import co.yixiang.modules.user.vo.YxSystemUserLevelQueryVo; +import co.yixiang.utils.FileUtil; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxSystemUserLevelServiceImpl extends BaseServiceImpl implements YxSystemUserLevelService { + + @Autowired + private IGenerator generator; + + @Autowired + private SystemUserLevelMapper yxSystemUserLevelMapper; + @Autowired + private YxUserLevelService userLevelService; + @Autowired + private YxSystemUserTaskService systemUserTaskService; + + /** + * 获取当前的下一个会员等级id + * @param levelId 等级id + * @return int + */ + @Override + public int getNextLevelId(int levelId) { + List list = this.lambdaQuery() + .eq(YxSystemUserLevel::getIsShow,ShopCommonEnum.SHOW_1.getValue()) + .orderByAsc(YxSystemUserLevel::getGrade) + .list(); + + int grade = 0; + for (YxSystemUserLevel userLevel : list) { + if(userLevel.getId() == levelId) { + grade = userLevel.getGrade(); + } + } + + YxSystemUserLevel userLevel = this.lambdaQuery() + .eq(YxSystemUserLevel::getIsShow,ShopCommonEnum.SHOW_1.getValue()) + .orderByAsc(YxSystemUserLevel::getGrade) + .gt(YxSystemUserLevel::getGrade,grade) + .last("limit 1") + .one(); + if(ObjectUtil.isNull(userLevel)) { + return 0; + } + return userLevel.getId(); + } + +// @Override +// public boolean getClear(int levelId) { +// List systemUserLevelQueryVos = this.getLevelListAndGrade(levelId); +// for (YxSystemUserLevelQueryVo userLevelQueryVo : systemUserLevelQueryVos) { +// if(userLevelQueryVo.getId() == levelId) return userLevelQueryVo.getIsClear(); +// } +// return false; +// } + + + + /** + * 获取会员等级列表及其任务列表 + * @return UserLevelDto + */ + @Override + public UserLevelDto getLevelInfo(Long uid) { + int levelId = 0; //用户当前等级id 0-表示无 + YxUserLevel userLevel = userLevelService.getUserLevel(uid, null); + if(userLevel != null){ + levelId = userLevel.getLevelId(); + } + + + //会员等级列表 + List list = this.getLevelListAndGrade(levelId); + if(list.isEmpty()) { + throw new YshopException("请后台设置会员等级"); + } + + //任务列表 + TaskDto taskDTO = systemUserTaskService.getTaskList(list.get(0).getId(),uid); + + UserLevelDto userLevelDTO = new UserLevelDto(); + userLevelDTO.setList(list); + userLevelDTO.setTask(taskDTO); + + return userLevelDTO; + } + + /** + * 获取会员等级列表 + * @param levelId 等级id + * @return list + */ + private List getLevelListAndGrade(Integer levelId) { + Integer grade = 0; + List list = this.lambdaQuery() + .eq(YxSystemUserLevel::getIsShow, ShopCommonEnum.SHOW_1.getValue()) + .orderByAsc(YxSystemUserLevel::getGrade) + .list(); + List newList = generator.convert(list,YxSystemUserLevelQueryVo.class); + for (YxSystemUserLevelQueryVo userLevelQueryVo : newList) { + if(userLevelQueryVo.getId().compareTo(levelId) == 0) { + grade = userLevelQueryVo.getGrade(); + } + if(grade.compareTo(userLevelQueryVo.getGrade()) < 0){ + userLevelQueryVo.setIsClear(true); //不解锁 + }else{ + userLevelQueryVo.setIsClear(false);//开启会员解锁 + } + } + return newList; + } + + + //=========================================================================================// + + @Override + //@Cacheable + public Map queryAll(YxSystemUserLevelQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxSystemUserLevelDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxSystemUserLevelQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxSystemUserLevel.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxSystemUserLevelDto yxSystemUserLevel : all) { + Map map = new LinkedHashMap<>(); + map.put("商户id", yxSystemUserLevel.getMerId()); + map.put("会员名称", yxSystemUserLevel.getName()); + map.put("购买金额", yxSystemUserLevel.getMoney()); + map.put("有效时间", yxSystemUserLevel.getValidDate()); + map.put("是否为永久会员", yxSystemUserLevel.getIsForever()); + map.put("是否购买,1=购买,0=不购买", yxSystemUserLevel.getIsPay()); + map.put("是否显示 1=显示,0=隐藏", yxSystemUserLevel.getIsShow()); + map.put("会员等级", yxSystemUserLevel.getGrade()); + map.put("享受折扣", yxSystemUserLevel.getDiscount()); + map.put("会员卡背景", yxSystemUserLevel.getImage()); + map.put("会员图标", yxSystemUserLevel.getIcon()); + map.put("说明", yxSystemUserLevel.getExplain()); + map.put("添加时间", yxSystemUserLevel.getAddTime()); + map.put("是否删除.1=删除,0=未删除", yxSystemUserLevel.getIsDel()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxSystemUserTaskServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxSystemUserTaskServiceImpl.java new file mode 100644 index 0000000..23a0190 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxSystemUserTaskServiceImpl.java @@ -0,0 +1,236 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service.impl; + +import cn.hutool.core.util.NumberUtil; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.modules.order.service.mapper.StoreOrderMapper; +import co.yixiang.modules.shop.domain.YxSystemUserLevel; +import co.yixiang.modules.user.domain.YxSystemUserTask; +import co.yixiang.modules.user.domain.YxUserTaskFinish; +import co.yixiang.modules.user.service.YxSystemUserLevelService; +import co.yixiang.modules.user.service.YxSystemUserTaskService; +import co.yixiang.modules.user.service.YxUserBillService; +import co.yixiang.modules.user.service.YxUserTaskFinishService; +import co.yixiang.modules.user.service.dto.TaskDto; +import co.yixiang.modules.user.service.dto.YxSystemUserTaskDto; +import co.yixiang.modules.user.service.dto.YxSystemUserTaskQueryCriteria; +import co.yixiang.modules.user.service.mapper.SystemUserTaskMapper; +import co.yixiang.modules.user.service.mapper.UserBillMapper; +import co.yixiang.modules.user.service.mapper.YxUserTaskFinishMapper; +import co.yixiang.modules.user.vo.YxSystemUserTaskQueryVo; +import co.yixiang.utils.FileUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxSystemUserTaskServiceImpl extends BaseServiceImpl implements YxSystemUserTaskService { + + @Autowired + private IGenerator generator; + @Autowired + private YxSystemUserLevelService systemUserLevelService; + + @Autowired + private SystemUserTaskMapper yxSystemUserTaskMapper; + @Autowired + private YxUserTaskFinishMapper yxUserTaskFinishMapper; + + @Autowired + private UserBillMapper userBillMapper; + @Autowired + private StoreOrderMapper storeOrderMapper; + + @Autowired + private YxUserTaskFinishService userTaskFinishService; + @Autowired + private YxUserBillService userBillService; + + + + + + /** + * 获取已经完成的任务数量 + * @param levelId 等级id + * @param uid uid + * @return int + */ + @Override + public int getTaskComplete(int levelId, Long uid) { + List list = this.lambdaQuery() + .eq(YxSystemUserTask::getLevelId,levelId) + .eq(YxSystemUserTask::getIsShow,ShopCommonEnum.SHOW_1.getValue()) + .list(); + List taskIds = list.stream().map(YxSystemUserTask::getId) + .collect(Collectors.toList()); + if(taskIds.isEmpty()) { + return 0; + } + + int count = yxUserTaskFinishMapper.selectCount(Wrappers.lambdaQuery() + .in(YxUserTaskFinish::getTaskId,taskIds) + .eq(YxUserTaskFinish::getUid,uid)); + return count; + } + + /** + * 获取等级会员任务列表 + * @param levelId 等级id + * @param uid uid + * @return TaskDto + */ + @Override + public TaskDto getTaskList(int levelId, Long uid) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxSystemUserTask::getLevelId,levelId) + .eq(YxSystemUserTask::getIsShow, ShopCommonEnum.SHOW_1.getValue()) + .orderByDesc(YxSystemUserTask::getSort); + List list = generator.convert(yxSystemUserTaskMapper + .selectList(wrapper),YxSystemUserTaskQueryVo.class); + + TaskDto taskDTO = new TaskDto(); + taskDTO.setList(list); + taskDTO.setReachCount(this.getTaskComplete(levelId,uid)); + taskDTO.setTask(this.tidyTask(list,uid)); + + return taskDTO; + } + + + /** + * 设置任务内容完成情况 + * @param task 任务列表 + * @param uid uid + * @return list + */ + private List tidyTask(List task,Long uid) { + for (YxSystemUserTaskQueryVo taskQueryVo : task) { + int count = userTaskFinishService.lambdaQuery() + .eq(YxUserTaskFinish::getTaskId,taskQueryVo.getId()) + .eq(YxUserTaskFinish::getUid,uid) + .count(); + if(count > 0){ + taskQueryVo.setNewNumber(taskQueryVo.getNumber()); + taskQueryVo.setSpeed(100); //完成比例 + taskQueryVo.setFinish(ShopCommonEnum.IS_FINISH_1.getValue()); + taskQueryVo.setTaskTypeTitle(""); + }else{ + double sumNumber = 0d; + String title = ""; + switch (taskQueryVo.getTaskType()){ + case "SatisfactionIntegral": + sumNumber = userBillMapper.sumIntegral(uid); + title = "还需要{0}经验"; + break; + case "ConsumptionAmount": + sumNumber = storeOrderMapper.sumPrice(uid); + title = "还需消费{0}元"; + break; + case "CumulativeAttendance": + sumNumber = userBillService.cumulativeAttendance(uid); + title = "还需签到{0}天"; + break; + default: + } + + if(sumNumber >= taskQueryVo.getNumber()){ + userTaskFinishService.setFinish(uid,taskQueryVo.getId()); + taskQueryVo.setFinish(ShopCommonEnum.IS_FINISH_1.getValue()); + taskQueryVo.setSpeed(100); + taskQueryVo.setTaskTypeTitle(""); + taskQueryVo.setNewNumber(taskQueryVo.getNumber()); + }else{ + double numdata = NumberUtil.sub(taskQueryVo.getNumber().doubleValue(),sumNumber); + taskQueryVo.setTaskTypeTitle(MessageFormat.format(title,numdata)); + double speed = NumberUtil.div(sumNumber,taskQueryVo.getNumber().doubleValue()); + taskQueryVo.setSpeed(Double.valueOf(NumberUtil.mul(speed,100)).intValue()); + taskQueryVo.setFinish(ShopCommonEnum.IS_FINISH_0.getValue()); + taskQueryVo.setNewNumber(Double.valueOf(sumNumber).intValue()); + } + } + } + + return task; + } + + + //==========================================================// + + @Override + //@Cacheable + public Map queryAll(YxSystemUserTaskQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + List systemUserTaskDTOS = generator.convert(page.getList(),YxSystemUserTaskDto.class); + for (YxSystemUserTaskDto systemUserTaskDTO : systemUserTaskDTOS) { + YxSystemUserLevel userLevel=systemUserLevelService.getById(systemUserTaskDTO.getLevelId()); + if(userLevel == null) { + continue; + } + systemUserTaskDTO.setLevalName(userLevel.getName()); + } + Map map = new LinkedHashMap<>(2); + map.put("content", systemUserTaskDTOS); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxSystemUserTaskQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxSystemUserTask.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxSystemUserTaskDto yxSystemUserTask : all) { + Map map = new LinkedHashMap<>(); + map.put("任务名称", yxSystemUserTask.getName()); + map.put("配置原名", yxSystemUserTask.getRealName()); + map.put("任务类型", yxSystemUserTask.getTaskType()); + map.put("限定数", yxSystemUserTask.getNumber()); + map.put("等级id", yxSystemUserTask.getLevelId()); + map.put("排序", yxSystemUserTask.getSort()); + map.put("是否显示", yxSystemUserTask.getIsShow()); + map.put("是否务必达成任务,1务必达成,0=满足其一", yxSystemUserTask.getIsMust()); + map.put("任务说明", yxSystemUserTask.getIllustrate()); + map.put("新增时间", yxSystemUserTask.getAddTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserAddressServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserAddressServiceImpl.java new file mode 100644 index 0000000..b6a46ea --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserAddressServiceImpl.java @@ -0,0 +1,147 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service.impl; + + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.modules.user.domain.YxUserAddress; +import co.yixiang.modules.user.param.AddressParam; +import co.yixiang.modules.user.service.YxUserAddressService; +import co.yixiang.modules.user.service.mapper.YxUserAddressMapper; +import co.yixiang.modules.user.vo.YxUserAddressQueryVo; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + + +/** + *

+ * 用户地址表 服务实现类 + *

+ * + * @author hupeng + * @since 2019-10-28 + */ +@Slf4j +@Service +@AllArgsConstructor +@Transactional(rollbackFor = Exception.class) +public class YxUserAddressServiceImpl extends BaseServiceImpl implements YxUserAddressService { + + private final YxUserAddressMapper yxUserAddressMapper; + private final IGenerator generator; + + /** + * 设置默认地址 + * @param uid uid + * @param addressId 地址id + */ + @Override + public void setDefault(Long uid,Long addressId){ + YxUserAddress address = new YxUserAddress(); + address.setIsDefault(ShopCommonEnum.DEFAULT_0.getValue()); + yxUserAddressMapper.update(address, + new LambdaQueryWrapper().eq(YxUserAddress::getUid,uid)); + + YxUserAddress userAddress = new YxUserAddress(); + userAddress.setIsDefault(ShopCommonEnum.DEFAULT_1.getValue()); + userAddress.setId(addressId); + yxUserAddressMapper.updateById(userAddress); + } + + + /** + * 添加或者修改地址 + * @param uid uid + * @param param AddressParam + */ + @Override + public Long addAndEdit(Long uid, AddressParam param){ + YxUserAddress userAddress = YxUserAddress.builder() + .city(param.getAddress().getCity()) + .cityId(param.getAddress().getCityId()) + .district(param.getAddress().getDistrict()) + .province(param.getAddress().getProvince()) + .detail(param.getDetail()) + .uid(uid) + .phone(param.getPhone()) + .postCode(param.getPost_code()) + .realName(param.getReal_name()) + .build(); + if("true".equals(param.getIs_default())){ + userAddress.setIsDefault(ShopCommonEnum.DEFAULT_1.getValue()); + //新增地址如果是默认,把之前的状态改掉 + YxUserAddress address = new YxUserAddress(); + address.setIsDefault(ShopCommonEnum.DEFAULT_0.getValue()); + baseMapper.update(address,new LambdaQueryWrapper().eq(YxUserAddress::getUid,uid)); + }else{ + userAddress.setIsDefault(ShopCommonEnum.DEFAULT_0.getValue()); + } + if(StrUtil.isBlank(param.getId())){ + this.save(userAddress); + }else{ + userAddress.setId(Long.valueOf(param.getId())); + this.updateById(userAddress); + } + + return userAddress.getId(); + } + + /** + * 地址详情 + * @param id 地址id + * @return YxUserAddressQueryVo + */ + @Override + public YxUserAddressQueryVo getDetail(Long id){ + return generator.convert(this.getById(id),YxUserAddressQueryVo.class); + } + + + /** + * 获取用户地址 + * @param uid uid + * @param page page + * @param limit limit + * @return List + */ + @Override + public List getList(Long uid,int page,int limit){ + Page pageModel = new Page<>(page, limit); + IPage pageList = this.lambdaQuery().eq(YxUserAddress::getUid,uid).page(pageModel); + return generator.convert(pageList.getRecords(),YxUserAddressQueryVo.class); + } + + /** + * 获取默认地址 + * @param uid uid + * @return YxUserAddress + */ + @Override + public YxUserAddress getUserDefaultAddress(Long uid) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxUserAddress::getIsDefault,1). + eq(YxUserAddress::getUid,uid) + .last("limit 1"); + return getOne(wrapper); + } + + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserBillServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserBillServiceImpl.java new file mode 100644 index 0000000..8fdf867 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserBillServiceImpl.java @@ -0,0 +1,309 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.BillDetailEnum; +import co.yixiang.enums.BillEnum; +import co.yixiang.enums.BillInfoEnum; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.modules.user.domain.YxUserBill; +import co.yixiang.modules.user.service.YxUserBillService; +import co.yixiang.modules.user.service.dto.BillOrderDto; +import co.yixiang.modules.user.service.dto.BillOrderRecordDto; +import co.yixiang.modules.user.service.dto.YxUserBillDto; +import co.yixiang.modules.user.service.dto.YxUserBillQueryCriteria; +import co.yixiang.modules.user.service.mapper.UserBillMapper; +import co.yixiang.modules.user.vo.BillVo; +import co.yixiang.modules.user.vo.YxUserBillQueryVo; +import co.yixiang.utils.FileUtil; +import co.yixiang.utils.StringUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxUserBillServiceImpl extends BaseServiceImpl implements YxUserBillService { + + private final IGenerator generator; + private final UserBillMapper yxUserBillMapper; + + + /** + * 增加支出流水 + * @param uid uid + * @param title 账单标题 + * @param category 明细种类 + * @param type 明细类型 + * @param number 明细数字 + * @param balance 剩余 + * @param mark 备注 + */ + @Override + public void expend(Long uid,String title,String category,String type,double number,double balance,String mark){ + YxUserBill userBill = YxUserBill.builder() + .uid(uid) + .title(title) + .category(category) + .type(type) + .number(BigDecimal.valueOf(number)) + .balance(BigDecimal.valueOf(balance)) + .mark(mark) + .pm(BillEnum.PM_0.getValue()) + .build(); + + yxUserBillMapper.insert(userBill); + } + + /** + * 增加收入/支入流水 + * @param uid uid + * @param title 账单标题 + * @param category 明细种类 + * @param type 明细类型 + * @param number 明细数字 + * @param balance 剩余 + * @param mark 备注 + * @param linkid 关联id + */ + @Override + public void income(Long uid,String title,String category,String type,double number, + double balance,String mark,String linkid){ + YxUserBill userBill = YxUserBill.builder() + .uid(uid) + .title(title) + .category(category) + .type(type) + .number(BigDecimal.valueOf(number)) + .balance(BigDecimal.valueOf(balance)) + .mark(mark) + .pm(BillEnum.PM_1.getValue()) + .linkId(linkid) + .build(); + + yxUserBillMapper.insert(userBill); + } + + /** + * 签到了多少次 + * @param uid + * @return + */ + @Override + public int cumulativeAttendance(Long uid) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxUserBill::getUid,uid).eq(YxUserBill::getCategory,"integral") + .eq(YxUserBill::getType,"sign").eq(YxUserBill::getPm,1); + return yxUserBillMapper.selectCount(wrapper); + } + + /** + * 获取推广订单列表 + * @param uid uid + * @param page page + * @param limit limit + * @return Map + */ + @Override + public Map spreadOrder(Long uid, int page, int limit) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().in(YxUserBill::getUid, uid) + .eq(YxUserBill::getType, BillDetailEnum.TYPE_2.getValue()) + .eq(YxUserBill::getCategory, BillDetailEnum.CATEGORY_1.getValue()); + wrapper.orderByDesc("time").groupBy("time"); + Page pageModel = new Page<>(page, limit); + List list = yxUserBillMapper.getBillOrderList(wrapper, pageModel); + + int count = yxUserBillMapper.selectCount(Wrappers.lambdaQuery() + .eq(YxUserBill::getUid, uid) + .eq(YxUserBill::getType, BillDetailEnum.TYPE_2.getValue()) + .eq(YxUserBill::getCategory, BillDetailEnum.CATEGORY_1.getValue())); + List listT = new ArrayList<>(); + for (String str : list) { + BillOrderDto billOrderDTO = new BillOrderDto(); + List orderRecordDTOS = yxUserBillMapper + .getBillOrderRList(str, uid); + billOrderDTO.setChild(orderRecordDTOS); + billOrderDTO.setCount(orderRecordDTOS.size()); + billOrderDTO.setTime(str); + + listT.add(billOrderDTO); + } + + Map map = new LinkedHashMap<>(2); + map.put("list", listT); + map.put("count", count); + + return map; + } + + /** + * 获取用户账单记录 + * @param page page + * @param limit limit + * @param uid uid + * @param type BillDetailEnum + * @return map + */ + @Override + public Map getUserBillList(int page, int limit, long uid, int type) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(YxUserBill::getUid,uid).orderByDesc(YxUserBill::getCreateTime) + .orderByAsc(YxUserBill::getId); + wrapper.groupBy("time"); + switch (BillInfoEnum.toType(type)){ + case PAY_PRODUCT: + wrapper.lambda().eq(YxUserBill::getCategory,BillDetailEnum.CATEGORY_1.getValue()); + wrapper.lambda().eq(YxUserBill::getType,BillDetailEnum.TYPE_3.getValue()); + break; + case RECHAREGE: + wrapper.lambda().eq(YxUserBill::getCategory,BillDetailEnum.CATEGORY_1.getValue()); + wrapper.lambda().eq(YxUserBill::getType,BillDetailEnum.TYPE_1.getValue()); + break; + case BROKERAGE: + wrapper.lambda().eq(YxUserBill::getCategory,BillDetailEnum.CATEGORY_1.getValue()); + wrapper.lambda().eq(YxUserBill::getType,BillDetailEnum.TYPE_2.getValue()); + break; + case EXTRACT: + wrapper.lambda().eq(YxUserBill::getCategory,BillDetailEnum.CATEGORY_1.getValue()); + wrapper.lambda().eq(YxUserBill::getType,BillDetailEnum.TYPE_4.getValue()); + break; + case SIGN_INTEGRAL: + wrapper.lambda().eq(YxUserBill::getCategory,BillDetailEnum.CATEGORY_2.getValue()); + wrapper.lambda().eq(YxUserBill::getType,BillDetailEnum.TYPE_10.getValue()); + break; + default: + wrapper.lambda().eq(YxUserBill::getCategory,BillDetailEnum.CATEGORY_1.getValue()); + + } + Page pageModel = new Page<>(page, limit); + List billDTOList = yxUserBillMapper.getBillList(wrapper,pageModel); + for (BillVo billDTO : billDTOList) { + LambdaQueryWrapper wrapperT = new LambdaQueryWrapper<>(); + wrapperT.in(YxUserBill::getId,Arrays.asList(billDTO.getIds().split(","))); + wrapperT.orderByDesc(YxUserBill::getCreateTime); + billDTO.setList(yxUserBillMapper.getUserBillList(wrapperT)); + + } + Map map = new HashMap<>(); + map.put("list",billDTOList); + map.put("total",pageModel.getTotal()); + map.put("totalPage",pageModel.getPages()); + return map; + // return billDTOList; + } + + @Override + public double getBrokerage(int uid) { + return yxUserBillMapper.sumPrice(uid); + } + + /** + * 统计昨天的佣金 + * @param uid uid + * @return double + */ + @Override + public double yesterdayCommissionSum(Long uid) { + return yxUserBillMapper.sumYesterdayPrice(uid); + } + + /** + * 根据类别获取账单记录 + * @param uid uid + * @param category BillDetailEnum + * @param page page + * @param limit limit + * @return List + */ + @Override + public List userBillList(Long uid,String category,int page,int limit) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper + .eq(YxUserBill::getStatus, ShopCommonEnum.IS_STATUS_1.getValue()) + .eq(YxUserBill::getUid,uid) + .eq(YxUserBill::getCategory,category) + .orderByDesc(YxUserBill::getId); + Page pageModel = new Page<>(page, limit); + IPage pageList = yxUserBillMapper.selectPage(pageModel,wrapper); + return generator.convert(pageList.getRecords(),YxUserBillQueryVo.class); + } + + + //============================================// + + @Override + //@Cacheable + public Map queryAll(YxUserBillQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", page.getList()); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + public List queryAll(YxUserBillQueryCriteria criteria){ + String date =null; + String date1 = null; + if(StringUtils.isNotEmpty(criteria.getStartTime())){ + date = criteria.getStartTime()+ " 00:00:00"; + if(StringUtils.isNotEmpty(criteria.getEndTime())){ + date1 =criteria.getEndTime()+ " 23:59:59"; + } + } + + return baseMapper.findAllByQueryCriteria(criteria.getCategory(),criteria.getType(),criteria.getNickname(),criteria.getPm(),date,date1,criteria.getTitle()); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxUserBillDto yxUserBill : all) { + Map map = new LinkedHashMap<>(); + map.put("用户uid", yxUserBill.getUid()); + map.put("关联id", yxUserBill.getLinkId()); + map.put("0 = 支出 1 = 获得", yxUserBill.getPm()); + map.put("账单标题", yxUserBill.getTitle()); + map.put("明细种类", yxUserBill.getCategory()); + map.put("明细类型", yxUserBill.getType()); + map.put("明细数字", yxUserBill.getNumber()); + map.put("剩余", yxUserBill.getBalance()); + map.put("备注", yxUserBill.getMark()); + map.put("0 = 带确定 1 = 有效 -1 = 无效", yxUserBill.getStatus()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserLevelServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserLevelServiceImpl.java new file mode 100644 index 0000000..4495b6a --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserLevelServiceImpl.java @@ -0,0 +1,176 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.constant.ShopConstants; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.modules.shop.domain.YxSystemUserLevel; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.domain.YxUserLevel; +import co.yixiang.modules.user.service.YxSystemUserLevelService; +import co.yixiang.modules.user.service.YxSystemUserTaskService; +import co.yixiang.modules.user.service.YxUserLevelService; +import co.yixiang.modules.user.service.YxUserService; +import co.yixiang.modules.user.service.mapper.SystemUserTaskMapper; +import co.yixiang.modules.user.service.mapper.YxUserLevelMapper; +import co.yixiang.utils.OrderUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + + +/** + *

+ * 用户等级记录表 服务实现类 + *

+ * + * @author hupeng + * @since 2019-12-06 + */ +@Slf4j +@Service +@Transactional(rollbackFor = Exception.class) +public class YxUserLevelServiceImpl extends BaseServiceImpl implements YxUserLevelService { + + @Autowired + private YxUserLevelMapper yxUserLevelMapper; + @Autowired + private SystemUserTaskMapper yxSystemUserTaskMapper; + + @Autowired + private YxUserService userService; + @Autowired + private YxSystemUserLevelService systemUserLevelService; + @Autowired + private YxSystemUserTaskService systemUserTaskService; + + + /** + * 检查是否能成为会员 + * @param uid 用户id + */ + @Override + public boolean setLevelComplete(Long uid) { + //获取当前用户级别 + int levelId = 0; + YxUserLevel yxUserLevel = this.getUserLevel(uid,null); + if(yxUserLevel != null ){ + levelId = yxUserLevel.getLevelId(); + } + int nextLevelId = systemUserLevelService.getNextLevelId(levelId); + if(nextLevelId == 0) { + return false; + } + + int finishCount = systemUserTaskService.getTaskComplete(nextLevelId,uid); + + //目前任务固定,如果增加任务需要自己增加逻辑,目前每个会员任务固定3 + if(finishCount == ShopConstants.TASK_FINISH_COUNT){ + this.setUserLevel(uid,nextLevelId); + return true; + } + return false; + } + + + + /** + * 获取当前用户会员等级返回当前用户等级 + * @param uid uid + * @param grade 用户级别 + * @return YxUserLevel + */ + @Override + public YxUserLevel getUserLevel(Long uid, Integer grade) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper + .eq(YxUserLevel::getStatus, ShopCommonEnum.IS_STATUS_1.getValue()) + .eq(YxUserLevel::getUid,uid) + .orderByDesc(YxUserLevel::getGrade); + if(grade != null) { + wrapper.lt(YxUserLevel::getGrade,grade); + } + YxUserLevel userLevel = this.getOne(wrapper,false); + if(ObjectUtil.isNull(userLevel)) { + return null; + } + if(ShopCommonEnum.IS_FOREVER_1.getValue().equals(userLevel.getIsForever())) { + return userLevel; + } + int nowTime = OrderUtil.getSecondTimestampTwo(); + if(nowTime > userLevel.getValidTime()){ + if(ShopCommonEnum.IS_STATUS_1.getValue().equals(userLevel.getStatus())){ + userLevel.setStatus(ShopCommonEnum.IS_STATUS_0.getValue()); + yxUserLevelMapper.updateById(userLevel); + } + return this.getUserLevel(uid,userLevel.getGrade()); + } + return userLevel; + } + + + /** + * 设置会员等级 + * @param uid 用户id + * @param levelId 等级id + */ + private void setUserLevel(Long uid, int levelId){ + YxSystemUserLevel systemUserLevelQueryVo = systemUserLevelService + .getById(levelId); + if(ObjectUtil.isNull(systemUserLevelQueryVo)) { + return; + } + + int validTime = systemUserLevelQueryVo.getValidDate() * 86400; + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxUserLevel::getStatus,ShopCommonEnum.IS_STATUS_1.getValue()) + .eq(YxUserLevel::getUid,uid) + .eq(YxUserLevel::getLevelId,levelId) + .last("limit 1"); + + YxUserLevel yxUserLevel = new YxUserLevel(); + yxUserLevel.setIsForever(systemUserLevelQueryVo.getIsForever()); + yxUserLevel.setStatus(ShopCommonEnum.IS_STATUS_1.getValue()); + yxUserLevel.setGrade(systemUserLevelQueryVo.getGrade()); + yxUserLevel.setUid(uid); + yxUserLevel.setLevelId(levelId); + yxUserLevel.setDiscount(systemUserLevelQueryVo.getDiscount().intValue()); + + if(ShopCommonEnum.IS_FOREVER_1.getValue().equals(systemUserLevelQueryVo.getIsForever())){ + yxUserLevel.setValidTime(0); //永久 + }else{ + yxUserLevel.setValidTime(validTime+OrderUtil.getSecondTimestampTwo()); + } + + yxUserLevel.setMark("恭喜你成为了"+systemUserLevelQueryVo.getName()); + yxUserLevelMapper.insert(yxUserLevel); + + //更新用户等级 + YxUser yxUser = new YxUser(); + yxUser.setLevel(levelId); + yxUser.setUid(uid); + userService.updateById(yxUser); + + } + + + + // @Override +// public UserLevelInfoDto getUserLevelInfo(int id) { +// return yxUserLevelMapper.getUserLevelInfo(id); +// } + + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserRechargeServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserRechargeServiceImpl.java new file mode 100644 index 0000000..b4dd017 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserRechargeServiceImpl.java @@ -0,0 +1,190 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.YshopException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.BillDetailEnum; +import co.yixiang.enums.OrderInfoEnum; +import co.yixiang.enums.PayTypeEnum; +import co.yixiang.event.TemplateBean; +import co.yixiang.event.TemplateEvent; +import co.yixiang.event.TemplateListenEnum; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.domain.YxUserRecharge; +import co.yixiang.modules.user.service.YxUserBillService; +import co.yixiang.modules.user.service.YxUserRechargeService; +import co.yixiang.modules.user.service.dto.YxUserRechargeDto; +import co.yixiang.modules.user.service.dto.YxUserRechargeQueryCriteria; +import co.yixiang.modules.user.service.mapper.UserMapper; +import co.yixiang.modules.user.service.mapper.UserRechargeMapper; +import co.yixiang.utils.FileUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@SuppressWarnings("unchecked") +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxUserRechargeServiceImpl extends BaseServiceImpl implements YxUserRechargeService { + @Autowired + private IGenerator generator; + + @Autowired + private UserRechargeMapper yxUserRechargeMapper; + @Autowired + private YxUserBillService billService; + + @Autowired + private UserMapper yxUserMapper; + + @Autowired + private ApplicationEventPublisher publisher; + + + @Override + public void updateRecharge(YxUserRecharge userRecharge) { + YxUser user = yxUserMapper.selectById(userRecharge.getUid()); + + //修改状态 + userRecharge.setPaid(OrderInfoEnum.PAY_STATUS_1.getValue()); + userRecharge.setPayTime(new Date()); + yxUserRechargeMapper.updateById(userRecharge); + + //最终充值金额 + BigDecimal newPrice = NumberUtil.add(userRecharge.getPrice(),user.getNowMoney()); + newPrice = newPrice.add(userRecharge.getGivePrice()); + + + //增加流水 + billService.income(userRecharge.getUid(),"用户余额充值",BillDetailEnum.CATEGORY_1.getValue(), + BillDetailEnum.TYPE_1.getValue(),userRecharge.getPrice().doubleValue(),newPrice.doubleValue(), + "成功充值余额"+userRecharge.getPrice(),userRecharge.getId().toString()); + + + //update 余额 + user.setNowMoney(newPrice); + yxUserMapper.updateById(user); + + //模板消息发布事件 + TemplateBean templateBean = TemplateBean.builder() + .time(DateUtil.formatTime(userRecharge.getPayTime())) + .price(userRecharge.getPrice().toString()) + .orderId(userRecharge.getOrderId()) + .uid(userRecharge.getUid()) + .templateType(TemplateListenEnum.TYPE_4.getValue()) + .build(); + publisher.publishEvent(new TemplateEvent(this, templateBean)); + + } + + @Override + public YxUserRecharge getInfoByOrderId(String orderId) { + YxUserRecharge userRecharge = new YxUserRecharge(); + userRecharge.setOrderId(orderId); + + return yxUserRechargeMapper.selectOne(Wrappers.query(userRecharge)); + } + + /** + * 添加充值记录 + * @param user 用户 + * @param price 充值金额 + * @param paidPrice 赠送金额 + */ + @Override + public String addRecharge(YxUser user,String price,String paidPrice) { + if(StrUtil.isBlank(price) || StrUtil.isBlank(paidPrice)){ + throw new YshopException("参数非法"); + } + YxUserRecharge yxUserRecharge = new YxUserRecharge(); + + String orderSn = IdUtil.getSnowflake(0,0).nextIdStr(); + + yxUserRecharge.setNickname(user.getNickname()); + yxUserRecharge.setOrderId(orderSn); + yxUserRecharge.setUid(user.getUid()); + yxUserRecharge.setPrice(new BigDecimal(price)); + yxUserRecharge.setGivePrice(new BigDecimal(paidPrice)); + yxUserRecharge.setRechargeType(PayTypeEnum.WEIXIN.getValue()); + yxUserRecharge.setPaid(OrderInfoEnum.PAY_STATUS_0.getValue()); + + yxUserRechargeMapper.insert(yxUserRecharge); + + return orderSn; + + } + + + + //==========================================================================// + + @Override + //@Cacheable + public Map queryAll(YxUserRechargeQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxUserRechargeDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxUserRechargeQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxUserRecharge.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxUserRechargeDto yxUserRecharge : all) { + Map map = new LinkedHashMap<>(); + map.put("充值用户UID", yxUserRecharge.getUid()); + map.put("订单号", yxUserRecharge.getOrderId()); + map.put("充值金额", yxUserRecharge.getPrice()); + map.put("充值类型", yxUserRecharge.getRechargeType()); + map.put("是否充值", yxUserRecharge.getPaid()); + map.put("充值支付时间", yxUserRecharge.getPayTime()); + map.put("退款金额", yxUserRecharge.getRefundPrice()); + map.put("昵称", yxUserRecharge.getNickname()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserServiceImpl.java new file mode 100644 index 0000000..dd72e89 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserServiceImpl.java @@ -0,0 +1,692 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service.impl; + +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.ApiCode; +import co.yixiang.api.UnAuthenticatedException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.constant.SystemConfigConstants; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.BillDetailEnum; +import co.yixiang.enums.Brokerage; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.modules.activity.service.YxStoreCouponUserService; +import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; +import co.yixiang.modules.order.domain.YxStoreOrderCartInfo; +import co.yixiang.modules.order.service.YxStoreOrderCartInfoService; +import co.yixiang.modules.order.service.YxStoreOrderService; +import co.yixiang.modules.order.service.mapper.StoreOrderMapper; +import co.yixiang.modules.order.vo.YxStoreOrderQueryVo; +import co.yixiang.modules.product.vo.YxStoreProductQueryVo; +import co.yixiang.modules.shop.domain.YxSystemUserLevel; +import co.yixiang.modules.shop.service.YxSystemConfigService; +import co.yixiang.modules.shop.service.YxSystemStoreStaffService; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.domain.YxUserLevel; +import co.yixiang.modules.user.service.YxSystemUserLevelService; +import co.yixiang.modules.user.service.YxUserBillService; +import co.yixiang.modules.user.service.YxUserLevelService; +import co.yixiang.modules.user.service.YxUserService; +import co.yixiang.modules.user.service.dto.PromUserDto; +import co.yixiang.modules.user.service.dto.UserMoneyDto; +import co.yixiang.modules.user.service.dto.YxUserDto; +import co.yixiang.modules.user.service.dto.YxUserQueryCriteria; +import co.yixiang.modules.user.service.mapper.UserBillMapper; +import co.yixiang.modules.user.service.mapper.UserMapper; +import co.yixiang.modules.user.vo.YxUserQueryVo; +import co.yixiang.utils.FileUtil; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxUserServiceImpl extends BaseServiceImpl implements YxUserService { + + @Autowired + private IGenerator generator; + + @Autowired + private UserMapper yxUserMapper; + @Autowired + private StoreOrderMapper storeOrderMapper; + @Autowired + private UserBillMapper userBillMapper; + + + @Autowired + private YxSystemUserLevelService systemUserLevelService; + @Autowired + private YxUserLevelService userLevelService; + @Autowired + private YxStoreOrderService orderService; + @Autowired + private YxSystemConfigService systemConfigService; + @Autowired + private YxUserBillService billService; + @Autowired + private YxStoreCouponUserService storeCouponUserService; + @Autowired + private YxSystemStoreStaffService systemStoreStaffService; + @Autowired + private YxStoreOrderCartInfoService storeOrderCartInfoService; + + + /** + * 返回用户累计充值金额与消费金额 + * @param uid uid + * @return Double[] + */ + @Override + public Double[] getUserMoney(Long uid){ + double sumPrice = storeOrderMapper.sumPrice(uid); + double sumRechargePrice = userBillMapper.sumRechargePrice(uid); + return new Double[]{sumPrice,sumRechargePrice}; + } + + + /** + * 增加购买次数 + * @param uid uid + */ + @Override + public void incPayCount(Long uid) { + yxUserMapper.incPayCount(uid); + } + + /** + * 减去用户余额 + * @param uid uid + * @param payPrice 金额 + */ + @Override + public void decPrice(Long uid, BigDecimal payPrice) { + yxUserMapper.decPrice(payPrice,uid); + } + + /** + * 减去用户积分 + * @param uid 用户id + * @param integral 积分 + */ + @Override + public void decIntegral(Long uid, double integral) { + yxUserMapper.decIntegral(integral,uid); + } + + + /** + * 获取我的分销下人员列表 + * @param uid uid + * @param page page + * @param limit limit + * @param grade ShopCommonEnum.GRADE_0 + * @param keyword 关键字搜索 + * @param sort 排序 + * @return list + */ + @Override + public List getUserSpreadGrade(Long uid, int page, int limit, Integer grade, + String keyword, String sort) { + List userList = yxUserMapper.selectList(Wrappers.lambdaQuery() + .eq(YxUser::getSpreadUid, uid)); + List userIds = userList.stream() + .map(YxUser::getUid) + .collect(Collectors.toList()); + + List list = new ArrayList<>(); + if (userIds.isEmpty()) { + return list; + } + + if (StrUtil.isBlank(sort)) { + sort = "u.uid desc"; + } + + Page pageModel = new Page<>(page, limit); + if (ShopCommonEnum.GRADE_0.getValue().equals(grade)) {//-级 + list = yxUserMapper.getUserSpreadCountList(pageModel, userIds, + keyword, sort); + } else {//二级 + List userListT = yxUserMapper.selectList(Wrappers.lambdaQuery() + .in(YxUser::getSpreadUid, userIds)); + List userIdsT = userListT.stream() + .map(YxUser::getUid) + .collect(Collectors.toList()); + if (userIdsT.isEmpty()) { + return list; + } + list = yxUserMapper.getUserSpreadCountList(pageModel, userIdsT, + keyword, sort); + + } + return list; + } + + /** + * 统计分销人员 + * @param uid uid + * @return map + */ + @Override + public Map getSpreadCount(Long uid) { + int countOne = yxUserMapper.selectCount(Wrappers.lambdaQuery() + .eq(YxUser::getSpreadUid,uid)); + + int countTwo = 0; + List userList = yxUserMapper.selectList((Wrappers.lambdaQuery() + .eq(YxUser::getSpreadUid,uid))); + List userIds = userList.stream().map(YxUser::getUid) + .collect(Collectors.toList()); + if(!userIds.isEmpty()){ + countTwo = yxUserMapper.selectCount(Wrappers.lambdaQuery() + .in(YxUser::getSpreadUid,userIds)); + } + + Map map = new LinkedHashMap<>(2); + map.put("first",countOne); //一级 + map.put("second",countTwo);//二级 + + return map; + } + + /** + * 一级返佣 + * @param order 订单 + */ + @Override + public void backOrderBrokerage(YxStoreOrderQueryVo order) { + //如果分销没开启直接返回 + String open = systemConfigService.getData(SystemConfigConstants.STORE_BROKERAGE_OPEN); + if(StrUtil.isBlank(open) || ShopCommonEnum.ENABLE_2.getValue().toString().equals(open)) { + return; + } + + + //获取购买商品的用户 + YxUser userInfo = this.getById(order.getUid()); + System.out.println("userInfo:"+userInfo); + //当前用户不存在 没有上级 直接返回 + if(ObjectUtil.isNull(userInfo) || userInfo.getSpreadUid() == 0) { + return; + } + + + YxUser preUser = this.getById(userInfo.getSpreadUid()); + + //一级返佣金额 + BigDecimal brokeragePrice = this.computeProductBrokerage(order, Brokerage.LEVEL_1); + + //返佣金额小于等于0 直接返回不返佣金 + + if(brokeragePrice.compareTo(BigDecimal.ZERO) <= 0) { + return; + } + + //计算上级推广员返佣之后的金额 + double balance = NumberUtil.add(preUser.getBrokeragePrice(),brokeragePrice).doubleValue(); + String mark = userInfo.getNickname()+"成功消费"+order.getPayPrice()+"元,奖励推广佣金"+ + brokeragePrice; + //增加流水 + billService.income(userInfo.getSpreadUid(),"获得推广佣金",BillDetailEnum.CATEGORY_1.getValue(), + BillDetailEnum.TYPE_2.getValue(),brokeragePrice.doubleValue(),balance, mark,order.getId().toString()); + + //添加用户余额 + yxUserMapper.incBrokeragePrice(brokeragePrice, userInfo.getSpreadUid()); + + //一级返佣成功 跳转二级返佣 + this.backOrderBrokerageTwo(order); + + } + + + + + /** + * 更新用户余额 + * @param uid y用户id + * @param price 金额 + */ + @Override + public void incMoney(Long uid, BigDecimal price) { + if(price!=null&&price.doubleValue()>0){ + yxUserMapper.incMoney(uid,price); + } + } + + /** + * 增加积分 + * @param uid uid + * @param integral 积分 + */ + @Override + public void incIntegral(Long uid, double integral) { + yxUserMapper.incIntegral(integral,uid); + } + + + /** + * 获取用户信息 + * @param uid uid + * @return YxUserQueryVo + */ + @Override + public YxUserQueryVo getYxUserById(Long uid) { + return generator.convert(this.getById(uid),YxUserQueryVo.class); + } + + + /** + * 转换用户信息 + * @param yxUser user + * @return YxUserQueryVo + */ + @Override + public YxUserQueryVo handleUser(YxUser yxUser) { + return generator.convert(yxUser,YxUserQueryVo.class); + } + + /** + * 获取用户个人详细信息 + * @param yxUser yxUser + * @return YxUserQueryVo + */ + @Override + public YxUserQueryVo getNewYxUserById(YxUser yxUser) { + YxUserQueryVo userQueryVo = generator.convert(yxUser,YxUserQueryVo.class); + if(userQueryVo == null){ + throw new UnAuthenticatedException(ApiCode.UNAUTHORIZED); + } + userQueryVo.setOrderStatusNum(orderService.orderData(yxUser.getUid())); + userQueryVo.setCouponCount(storeCouponUserService.getUserValidCouponCount(yxUser.getUid())); + //判断分销类型,指定分销废弃掉,只有一种分销方式 + /** + String statu = systemConfigService.getData(SystemConfigConstants.STORE_BROKERAGE_STATU); + if(StrUtil.isNotEmpty(statu)){ + userQueryVo.setStatu(Integer.valueOf(statu)); + }else{ + userQueryVo.setStatu(0); + } + **/ + + //获取核销权限 + userQueryVo.setCheckStatus(systemStoreStaffService.checkStatus(yxUser.getUid(),null)); + + this.setUserSpreadCount(yxUser); + return userQueryVo; + } + + + + /** + * 返回会员价 + * @param price 原价 + * @param uid 用户id + * @return vip 价格 + */ + @Override + public double setLevelPrice(double price, long uid) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxUserLevel::getStatus, ShopCommonEnum.IS_STATUS_1.getValue()) + .eq(YxUserLevel::getUid,uid) + .orderByDesc(YxUserLevel::getGrade) + .last("limit 1"); + YxUserLevel userLevel = userLevelService.getOne(wrapper); + YxSystemUserLevel systemUserLevel = new YxSystemUserLevel(); + if(ObjectUtil.isNotNull(userLevel)) { + systemUserLevel= systemUserLevelService.getById(userLevel.getLevelId()); + } + int discount = 100; + if(ObjectUtil.isNotNull(userLevel)) { + discount = systemUserLevel.getDiscount().intValue(); + } + return NumberUtil.mul(NumberUtil.div(discount,100),price); + } + + + /** + * 设置推广关系 + * @param spread 上级人 + * @param uid 本人 + */ + @Override + public void setSpread(String spread, long uid) { + if(StrUtil.isBlank(spread) || !NumberUtil.isNumber(spread)) { + return; + } + + //如果分销没开启直接返回 + String open = systemConfigService.getData(SystemConfigConstants.STORE_BROKERAGE_OPEN); + if(StrUtil.isBlank(open) || ShopCommonEnum.ENABLE_2.getValue().toString().equals(open)) { + return; + } + //当前用户信息 + YxUser userInfo = this.getById(uid); + if(ObjectUtil.isNull(userInfo)) { + return; + } + + //当前用户有上级直接返回 + if(userInfo.getSpreadUid() != null && userInfo.getSpreadUid() > 0) { + return; + } + //没有推广编号直接返回 + long spreadInt = Long.valueOf(spread); + if(spreadInt == 0) { + return; + } + if(spreadInt == uid) { + return; + } + + //不能互相成为上下级 + YxUser userInfoT = this.getById(spreadInt); + if(ObjectUtil.isNull(userInfoT)) { + return; + } + + if(userInfoT.getSpreadUid() == uid) { + return; + } + + YxUser yxUser = YxUser.builder() + .spreadUid(spreadInt) + .spreadTime(new Date()) + .uid(uid) + .build(); + + yxUserMapper.updateById(yxUser); + + } + + + /** + * 二级返佣 + * @param order 订单 + */ + private void backOrderBrokerageTwo(YxStoreOrderQueryVo order) { + + YxUser userInfo = this.getById(order.getUid()); + + //获取上推广人 + YxUser userInfoTwo = this.getById(userInfo.getSpreadUid()); + + //上推广人不存在 或者 上推广人没有上级 直接返回 + if(ObjectUtil.isNull(userInfoTwo) || userInfoTwo.getSpreadUid() == 0) { + return; + } + + + //指定分销 判断 上上级是否时推广员 如果不是推广员直接返回 + YxUser preUser = this.getById(userInfoTwo.getSpreadUid()); + + + //二级返佣金额 + BigDecimal brokeragePrice = this.computeProductBrokerage(order,Brokerage.LEVEL_2); + + //返佣金额小于等于0 直接返回不返佣金 + if(brokeragePrice.compareTo(BigDecimal.ZERO) <= 0) { + return; + } + + //获取上上级推广员信息 + double balance = NumberUtil.add(preUser.getBrokeragePrice(),brokeragePrice).doubleValue(); + String mark = "二级推广人"+userInfo.getNickname()+"成功消费"+order.getPayPrice()+"元,奖励推广佣金"+ + brokeragePrice; + + //增加流水 + billService.income(userInfoTwo.getSpreadUid(),"获得推广佣金",BillDetailEnum.CATEGORY_1.getValue(), + BillDetailEnum.TYPE_2.getValue(),brokeragePrice.doubleValue(),balance, mark,order.getId().toString()); + //添加用户余额 + yxUserMapper.incBrokeragePrice(brokeragePrice, + userInfoTwo.getSpreadUid()); + } + + + /** + * 计算获取返佣金额 + * @param order 订单信息 + * @param level 分销级别 + * @return double + */ + private BigDecimal computeProductBrokerage(YxStoreOrderQueryVo order , Brokerage level){ + List storeOrderCartInfoList = storeOrderCartInfoService + .list(Wrappers.lambdaQuery() + .in(YxStoreOrderCartInfo::getCartId, Arrays.asList(order.getCartId().split(",")))); + BigDecimal oneBrokerage = BigDecimal.ZERO;//一级返佣金额 + BigDecimal twoBrokerage = BigDecimal.ZERO;//二级返佣金额 + + List cartInfos = storeOrderCartInfoList.stream() + .map(YxStoreOrderCartInfo::getCartInfo) + .collect(Collectors.toList()); + + for (String cartInfo : cartInfos){ + YxStoreCartQueryVo cart = JSON.parseObject(cartInfo,YxStoreCartQueryVo.class); + + YxStoreProductQueryVo storeProductVO = cart.getProductInfo(); + //产品是否单独分销 + if(ShopCommonEnum.IS_SUB_1.getValue().equals(storeProductVO.getIsSub())){ + oneBrokerage = NumberUtil.round(NumberUtil.add(oneBrokerage, + NumberUtil.mul(cart.getCartNum(),storeProductVO.getAttrInfo().getBrokerage())) + ,2); + + twoBrokerage = NumberUtil.round(NumberUtil.add(twoBrokerage, + NumberUtil.mul(cart.getCartNum(),storeProductVO.getAttrInfo().getBrokerageTwo())) + ,2); + } + + } + + //获取后台一级返佣比例 + String storeBrokerageRatioStr = systemConfigService.getData(SystemConfigConstants.STORE_BROKERAGE_RATIO); + String storeBrokerageTwoStr = systemConfigService.getData(SystemConfigConstants.STORE_BROKERAGE_TWO); + + + //一级返佣比例未设置直接返回 + if(StrUtil.isBlank(storeBrokerageRatioStr) + || !NumberUtil.isNumber(storeBrokerageRatioStr)){ + return oneBrokerage; + } + //二级返佣比例未设置直接返回 + if(StrUtil.isBlank(storeBrokerageTwoStr) + || !NumberUtil.isNumber(storeBrokerageTwoStr)){ + return twoBrokerage; + } + + + switch (level){ + case LEVEL_1: + //根据订单获取一级返佣比例 + BigDecimal storeBrokerageRatio = NumberUtil.round(NumberUtil.div(storeBrokerageRatioStr,"100"),2); + BigDecimal brokeragePrice = NumberUtil + .round(NumberUtil.mul(order.getTotalPrice(),storeBrokerageRatio),2); + //固定返佣 + 比例返佣 = 总返佣金额 + return NumberUtil.add(oneBrokerage,brokeragePrice); + case LEVEL_2: + //根据订单获取一级返佣比例 + BigDecimal storeBrokerageTwo = NumberUtil.round(NumberUtil.div(storeBrokerageTwoStr,"100"),2); + BigDecimal storeBrokerageTwoPrice = NumberUtil + .round(NumberUtil.mul(order.getTotalPrice(),storeBrokerageTwo),2); + //固定返佣 + 比例返佣 = 总返佣金额 + return NumberUtil.add(twoBrokerage,storeBrokerageTwoPrice); + default: + } + + + return BigDecimal.ZERO; + + } + + + + /** + * 更新下级人数 + * @param yxUser user + */ + private void setUserSpreadCount(YxUser yxUser) { + int count = yxUserMapper.selectCount(Wrappers.lambdaQuery() + .eq(YxUser::getSpreadUid,yxUser.getUid())); + yxUser.setSpreadCount(count); + yxUserMapper.updateById(yxUser); + } + + + //===========后面管理后台部分=====================// + + + /** + * 查看下级 + * @param uid uid + * @param grade 等级 + * @return list + */ + @Override + public List querySpread(Long uid, Integer grade) { + return this.getUserSpreadGrade(uid,1, 999,grade,"",""); + } + + + @Override + public Map queryAll(YxUserQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxUserDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxUserQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxUser.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxUserDto yxUser : all) { + Map map = new LinkedHashMap<>(); + map.put("用户账户(跟accout一样)", yxUser.getUsername()); + map.put("用户密码(跟pwd)", yxUser.getPassword()); + map.put("真实姓名", yxUser.getRealName()); + map.put("生日", yxUser.getBirthday()); + map.put("身份证号码", yxUser.getCardId()); + map.put("用户备注", yxUser.getMark()); + map.put("合伙人id", yxUser.getPartnerId()); + map.put("用户分组id", yxUser.getGroupId()); + map.put("用户昵称", yxUser.getNickname()); + map.put("用户头像", yxUser.getAvatar()); + map.put("手机号码", yxUser.getPhone()); + map.put("添加时间", yxUser.getCreateTime()); + map.put("添加ip", yxUser.getAddIp()); + map.put("用户余额", yxUser.getNowMoney()); + map.put("佣金金额", yxUser.getBrokeragePrice()); + map.put("用户剩余积分", yxUser.getIntegral()); + map.put("连续签到天数", yxUser.getSignNum()); + map.put("1为正常,0为禁止", yxUser.getStatus()); + map.put("等级", yxUser.getLevel()); + map.put("推广元id", yxUser.getSpreadUid()); + map.put("推广员关联时间", yxUser.getSpreadTime()); + map.put("用户类型", yxUser.getUserType()); + map.put("是否为推广员", yxUser.getIsPromoter()); + map.put("用户购买次数", yxUser.getPayCount()); + map.put("下级人数", yxUser.getSpreadCount()); + map.put("详细地址", yxUser.getAddres()); + map.put("管理员编号 ", yxUser.getAdminid()); + map.put("用户登陆类型,h5,wechat,routine", yxUser.getLoginType()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + /** + * 更新用户状态 + * @param uid uid + * @param status ShopCommonEnum + */ + @Override + public void onStatus(Long uid, Integer status) { + if(ShopCommonEnum.IS_STATUS_1.getValue().equals(status)){ + status = ShopCommonEnum.IS_STATUS_0.getValue(); + }else{ + status = ShopCommonEnum.IS_STATUS_1.getValue(); + } + yxUserMapper.updateOnstatus(status,uid); + } + + /** + * 修改余额 + * @param param UserMoneyDto + */ + @Override + public void updateMoney(UserMoneyDto param) { + YxUser yxUser = this.getById(param.getUid()); + double newMoney = 0d; + String mark = ""; + if(param.getPtype() == 1){ + mark = "系统增加了"+param.getMoney()+"余额"; + newMoney = NumberUtil.add(yxUser.getNowMoney(),param.getMoney()).doubleValue(); + billService.income(yxUser.getUid(),"系统增加余额", BillDetailEnum.CATEGORY_1.getValue(), + BillDetailEnum.TYPE_6.getValue(),param.getMoney(),newMoney, mark,""); + }else{ + mark = "系统扣除了"+param.getMoney()+"余额"; + newMoney = NumberUtil.sub(yxUser.getNowMoney(),param.getMoney()).doubleValue(); + if(newMoney < 0) { + newMoney = 0d; + } + billService.expend(yxUser.getUid(), "系统减少余额", + BillDetailEnum.CATEGORY_1.getValue(), + BillDetailEnum.TYPE_7.getValue(), + param.getMoney(), newMoney, mark); + } +// YxUser user = new YxUser(); +// user.setUid(yxUser.getUid()); + yxUser.setNowMoney(BigDecimal.valueOf(newMoney)); + saveOrUpdate(yxUser); + } + + /** + * 增加佣金 + * @param price 金额 + * @param uid 用户id + */ + @Override + public void incBrokeragePrice(BigDecimal price, Long uid) { + yxUserMapper.incBrokeragePrice(price,uid); + } +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserSignServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserSignServiceImpl.java new file mode 100644 index 0000000..d4ba53c --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserSignServiceImpl.java @@ -0,0 +1,222 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import co.yixiang.api.YshopException; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.constant.ShopConstants; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.BillDetailEnum; +import co.yixiang.modules.shop.service.YxSystemGroupDataService; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.domain.YxUserBill; +import co.yixiang.modules.user.domain.YxUserSign; +import co.yixiang.modules.user.service.YxUserBillService; +import co.yixiang.modules.user.service.YxUserLevelService; +import co.yixiang.modules.user.service.YxUserService; +import co.yixiang.modules.user.service.YxUserSignService; +import co.yixiang.modules.user.service.mapper.UserBillMapper; +import co.yixiang.modules.user.service.mapper.YxUserSignMapper; +import co.yixiang.modules.user.vo.SignVo; +import co.yixiang.modules.user.vo.YxUserQueryVo; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; +import java.util.List; +import java.util.Map; + + +/** + *

+ * 签到记录表 服务实现类 + *

+ * + * @author hupeng + * @since 2019-12-05 + */ +@Slf4j +@Service +@Transactional(rollbackFor = Exception.class) +public class YxUserSignServiceImpl extends BaseServiceImpl implements YxUserSignService { + + @Autowired + private YxUserSignMapper yxUserSignMapper; + @Autowired + private UserBillMapper userBillMapper; + + @Autowired + private IGenerator generator; + + @Autowired + private YxSystemGroupDataService systemGroupDataService; + @Autowired + private YxUserService yxUserService; + @Autowired + private YxUserBillService billService; + @Autowired + private YxUserLevelService userLevelService; + + + /** + * + * @param yxUser 用户 + * @return 签到积分 + */ + @Override + public int sign(YxUser yxUser) { + List list = systemGroupDataService.getDatas(ShopConstants.YSHOP_SIGN_DAY_NUM); + if(ObjectUtil.isNull(list) || list.isEmpty()) { + throw new YshopException("请先配置签到天数"); + } + + boolean isDaySign = this.getToDayIsSign(yxUser.getUid()); + if(isDaySign) { + throw new YshopException("已签到"); + } + int signNumber = 0; //积分 + int userSignNum = yxUser.getSignNum(); //签到次数 + if(getYesterDayIsSign(yxUser.getUid())){ + if(yxUser.getSignNum() > (list.size() - 1)){ + userSignNum = 0; + } + }else{ + userSignNum = 0; + } + int index = 0; + for (Map map : list) { + if(index == userSignNum){ + signNumber = Integer.valueOf(map.get("sign_num").toString()); + break; + } + index++; + } + + userSignNum += 1; + + YxUserSign userSign = new YxUserSign(); + userSign.setUid(yxUser.getUid()); + String title = "签到奖励"; + if(userSignNum == list.size()){ + title = "连续签到奖励"; + } + userSign.setTitle(title); + userSign.setNumber(signNumber); + userSign.setBalance(yxUser.getIntegral().intValue()); + yxUserSignMapper.insert(userSign); + + //用户积分增加 + YxUser user = YxUser.builder() + .integral(NumberUtil.add(yxUser.getIntegral(),signNumber)) + .uid(yxUser.getUid()) + .signNum(userSignNum) + .build(); + boolean res = yxUserService.updateById(user); + if(!res) { + throw new YshopException("签到失败"); + } + + //插入流水 + billService.income(yxUser.getUid(),title, BillDetailEnum.CATEGORY_2.getValue(), + BillDetailEnum.TYPE_10.getValue(),signNumber,yxUser.getIntegral().doubleValue(), + "",""); + + //检查是否符合会员升级条件 + userLevelService.setLevelComplete(yxUser.getUid()); + return signNumber; + } + + /** + * 分页获取用户签到数据 + * @param uid 用户id + * @param page page + * @param limit limit + * @return list + */ + @Override + public List getSignList(Long uid, int page, int limit) { + Page pageModel = new Page<>(page, limit); + return userBillMapper.getSignList(uid,pageModel); + } + + + /** + * 获取签到用户信息 + * @param yxUser yxUser + * @return YxUserQueryVo + */ + @Override + public YxUserQueryVo userSignInfo(YxUser yxUser) { + YxUserQueryVo userQueryVo = generator.convert(yxUser,YxUserQueryVo.class); + Long uid = yxUser.getUid(); + int sumSignDay = this.getSignSumDay(uid); + boolean isDaySign = this.getToDayIsSign(uid); + boolean isYesterDaySign = this.getYesterDayIsSign(uid); + userQueryVo.setSumSignDay(sumSignDay); + userQueryVo.setIsDaySign(isDaySign); + userQueryVo.setIsYesterDaySign(isYesterDaySign); + if(!isDaySign && !isYesterDaySign) { + userQueryVo.setSignNum(0); + } + return userQueryVo; + } + + /** + * 获取用户今天是否签到 + * @param uid uid + * @return boolean true=YES false=NO + */ + private boolean getToDayIsSign(Long uid) { + Date today = DateUtil.beginOfDay(new Date()); + int count = this.lambdaQuery().eq(YxUserSign::getUid,uid) + .ge(YxUserSign::getCreateTime,today) + .count(); + if(count > 0) { + return true; + } + return false; + } + + /** + * 获取用户昨天是否签到 + * @param uid uid + * @return boolean + */ + private boolean getYesterDayIsSign(Long uid) { + Date today = DateUtil.beginOfDay(new Date()); + Date yesterday = DateUtil.beginOfDay(DateUtil.yesterday()); + + int count = this.lambdaQuery().eq(YxUserSign::getUid,uid) + .lt(YxUserSign::getCreateTime,today) + .ge(YxUserSign::getCreateTime,yesterday) + .count(); + if(count > 0) { + return true; + } + return false; + } + + /** + * 获取用户累计签到次数 + * @param uid 用户id + * @return int + */ + private int getSignSumDay(Long uid) { + return this.lambdaQuery().eq(YxUserSign::getUid,uid).count(); + } + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserTaskFinishServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserTaskFinishServiceImpl.java new file mode 100644 index 0000000..fcf8457 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/impl/YxUserTaskFinishServiceImpl.java @@ -0,0 +1,60 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service.impl; + + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.modules.user.domain.YxUserTaskFinish; +import co.yixiang.modules.user.service.YxUserTaskFinishService; +import co.yixiang.modules.user.service.mapper.YxUserTaskFinishMapper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + + +/** + *

+ * 用户任务完成记录表 服务实现类 + *

+ * + * @author hupeng + * @since 2019-12-07 + */ +@Slf4j +@Service +@AllArgsConstructor +@Transactional(rollbackFor = Exception.class) +public class YxUserTaskFinishServiceImpl extends BaseServiceImpl implements YxUserTaskFinishService { + + private final YxUserTaskFinishMapper yxUserTaskFinishMapper; + + + /** + * 设置任务完成 + * @param uid uid + * @param taskId 任务id + */ + @Override + public void setFinish(Long uid, int taskId) { + int count = this.lambdaQuery() + .eq(YxUserTaskFinish::getUid,uid) + .eq(YxUserTaskFinish::getTaskId,taskId) + .count(); + if(count == 0){ + YxUserTaskFinish userTaskFinish = new YxUserTaskFinish(); + userTaskFinish.setUid(uid); + userTaskFinish.setTaskId(taskId); + yxUserTaskFinishMapper.insert(userTaskFinish); + } + } + + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/SystemUserLevelMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/SystemUserLevelMapper.java new file mode 100644 index 0000000..abbeadb --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/SystemUserLevelMapper.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.shop.domain.YxSystemUserLevel; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface SystemUserLevelMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/SystemUserTaskMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/SystemUserTaskMapper.java new file mode 100644 index 0000000..cbe5fd8 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/SystemUserTaskMapper.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.user.domain.YxSystemUserTask; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface SystemUserTaskMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/UserBillMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/UserBillMapper.java new file mode 100644 index 0000000..eca62b9 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/UserBillMapper.java @@ -0,0 +1,91 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.user.domain.YxUserBill; +import co.yixiang.modules.user.service.dto.BillOrderRecordDto; +import co.yixiang.modules.user.service.dto.MUserBillDto; +import co.yixiang.modules.user.service.dto.YxUserBillDto; +import co.yixiang.modules.user.vo.BillVo; +import co.yixiang.modules.user.vo.SignVo; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface UserBillMapper extends CoreMapper { + + @Select("select IFNULL(sum(number),0) from yx_user_bill " + + "where status=1 and type='sign' and pm=1 and category='integral' " + + "and uid=#{uid}") + double sumIntegral(@Param("uid") Long uid); + + @Select("SELECT DATE_FORMAT(a.create_time,'%Y-%m-%d') as addTime,a.title,a.number " + + "FROM yx_user_bill a INNER JOIN yx_user u ON u.uid=a.uid WHERE a.category = 'integral'" + + " AND a.type = 'sign' AND a.status = 1 AND a.uid = #{uid} " + + "ORDER BY a.create_time DESC") + List getSignList(@Param("uid") Long uid, Page page); + + @Select("SELECT o.order_id as orderId,DATE_FORMAT(b.create_time, '%Y-%m-%d %H:%i') as time," + + "b.number,u.avatar,u.nickname FROM yx_user_bill b " + + "INNER JOIN yx_store_order o ON o.id=b.link_id " + + "RIGHT JOIN yx_user u ON u.uid=o.uid" + + " WHERE b.uid = #{uid} AND ( DATE_FORMAT(b.create_time, '%Y-%m')= #{time} ) AND " + + "b.category = 'now_money' AND b.type = 'brokerage' ORDER BY time DESC") + List getBillOrderRList(@Param("time") String time, @Param("uid") Long uid); + + @Select("SELECT DATE_FORMAT(create_time,'%Y-%m') as time " + + " FROM yx_user_bill ${ew.customSqlSegment}") + List getBillOrderList(@Param(Constants.WRAPPER) Wrapper userWrapper, Page page); + + @Select("SELECT DATE_FORMAT(create_time,'%Y-%m') as time,group_concat(id SEPARATOR ',') ids " + + " FROM yx_user_bill ${ew.customSqlSegment}") + List getBillList(@Param(Constants.WRAPPER) Wrapper userWrapper, Page page); + + @Select("SELECT DATE_FORMAT(create_time,'%Y-%m-%d %H:%i') as add_time,title,number,pm " + + " FROM yx_user_bill ${ew.customSqlSegment}") + List getUserBillList(@Param(Constants.WRAPPER) Wrapper userWrapper); + + @Select("select IFNULL(sum(number),0) from yx_user_bill " + + "where status=1 and type='brokerage' and pm=1 and category='now_money' " + + "and uid=#{uid}") + double sumPrice(@Param("uid") int uid); + + @Select("select IFNULL(sum(number),0) from yx_user_bill " + + "where status=1 and type='recharge' and pm=1 and category='now_money' " + + "and uid=#{uid}") + double sumRechargePrice(@Param("uid") Long uid); + + + @Select("select IFNULL(sum(number),0) from yx_user_bill " + + "where status=1 and type='brokerage' and pm=1 and category='now_money' " + + "and uid=#{uid} and TO_DAYS(NOW()) - TO_DAYS(create_time) <= 1") + double sumYesterdayPrice(@Param("uid") Long uid); + + @Select(" ") + List findAllByQueryCriteria(@Param("category") String category, @Param("type") String type, @Param("nickname") String nickname, @Param("pm") Integer pm, @Param("date")String date, @Param("date1")String date1,@Param("title")String title); +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/UserMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/UserMapper.java new file mode 100644 index 0000000..3756d9d --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/UserMapper.java @@ -0,0 +1,80 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.service.dto.PromUserDto; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; +import org.springframework.stereotype.Repository; + +import java.math.BigDecimal; +import java.util.List; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface UserMapper extends CoreMapper { + + + @Select("") + List getUserSpreadCountList(Page page, + @Param("uids") List uids, + @Param("keyword") String keyword, + @Param("orderByStr") String orderBy); + + @Update("update yx_user set now_money=now_money-#{payPrice}" + + " where uid=#{uid}") + int decPrice(@Param("payPrice") BigDecimal payPrice, @Param("uid") Long uid); +// +// @Update("update yx_user set brokerage_price=brokerage_price+#{brokeragePrice}" + +// " where uid=#{uid}") +// int incBrokeragePrice(@Param("brokeragePrice") double brokeragePrice,@Param("uid") int uid); + + @Update("update yx_user set pay_count=pay_count+1" + + " where uid=#{uid}") + int incPayCount(@Param("uid") Long uid); + + @Update("update yx_user set now_money=now_money+#{price}" + + " where uid=#{uid}") + int incMoney(@Param("uid") Long uid,BigDecimal price); + + @Update("update yx_user set integral=integral-#{integral}" + + " where uid=#{uid}") + int decIntegral(@Param("integral") double integral,@Param("uid") Long uid); + + @Update("update yx_user set integral=integral+#{integral}" + + " where uid=#{uid}") + int incIntegral(@Param("integral") double integral,@Param("uid") Long uid); + + @Update( "update yx_user set status = #{status} where uid = #{id}") + void updateOnstatus(@Param("status") Integer status, @Param("id") Long id); + + @Update( "update yx_user set now_money = now_money + ${money} where uid = #{id}") + void updateMoney(@Param("money") double money, @Param("id") long id); + + @Update("update yx_user set brokerage_price = brokerage_price+ ${price} where uid = #{id}") + void incBrokeragePrice(@Param("price") BigDecimal price,@Param("id") Long id); + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/UserRechargeMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/UserRechargeMapper.java new file mode 100644 index 0000000..d43d001 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/UserRechargeMapper.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.user.domain.YxUserRecharge; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface UserRechargeMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/YxUserAddressMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/YxUserAddressMapper.java new file mode 100644 index 0000000..dafe47b --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/YxUserAddressMapper.java @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service.mapper; + + +import co.yixiang.modules.user.domain.YxUserAddress; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 用户地址表 Mapper 接口 + *

+ * + * @author hupeng + * @since 2019-10-28 + */ +@Repository +public interface YxUserAddressMapper extends BaseMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/YxUserLevelMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/YxUserLevelMapper.java new file mode 100644 index 0000000..255b561 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/YxUserLevelMapper.java @@ -0,0 +1,35 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.user.domain.YxUserLevel; +import co.yixiang.modules.user.service.dto.UserLevelInfoDto; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +/** + *

+ * 用户等级记录表 Mapper 接口 + *

+ * + * @author hupeng + * @since 2019-12-06 + */ +@Repository +public interface YxUserLevelMapper extends CoreMapper { + + @Select("SELECT l.id,a.add_time as addTime,l.discount,a.level_id as levelId,l.name," + + "l.icon,l.grade FROM yx_user_level a INNER JOIN yx_system_user_level l " + + "ON l.id=a.level_id WHERE a.status = 1 AND a.is_del = 0 AND a.id = #{id} LIMIT 1") + UserLevelInfoDto getUserLevelInfo(int id); + + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/YxUserSignMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/YxUserSignMapper.java new file mode 100644 index 0000000..fc30ed9 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/YxUserSignMapper.java @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service.mapper; + + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.user.domain.YxUserSign; +import org.springframework.stereotype.Repository; + +/** + *

+ * 签到记录表 Mapper 接口 + *

+ * + * @author hupeng + * @since 2019-12-05 + */ +@Repository +public interface YxUserSignMapper extends CoreMapper { + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/YxUserTaskFinishMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/YxUserTaskFinishMapper.java new file mode 100644 index 0000000..e722107 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/service/mapper/YxUserTaskFinishMapper.java @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.service.mapper; + + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.user.domain.YxUserTaskFinish; +import org.springframework.stereotype.Repository; + +/** + *

+ * 用户任务完成记录表 Mapper 接口 + *

+ * + * @author hupeng + * @since 2019-12-07 + */ +@Repository +public interface YxUserTaskFinishMapper extends CoreMapper { + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/vo/BillVo.java b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/BillVo.java new file mode 100644 index 0000000..730a664 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/BillVo.java @@ -0,0 +1,20 @@ +package co.yixiang.modules.user.vo; + +import co.yixiang.modules.user.service.dto.MUserBillDto; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.util.List; + +/** + * @ClassName BillVo + * @Author hupeng <610796224@qq.com> + * @Date 2019/11/12 + **/ +@Data +public class BillVo { + private String time; + @JsonIgnore + private String ids; + private List list; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/vo/CityVo.java b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/CityVo.java new file mode 100644 index 0000000..eec82ac --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/CityVo.java @@ -0,0 +1,33 @@ +package co.yixiang.modules.user.vo; + + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import java.io.Serializable; +import java.util.List; + + +/** + * 商城商品分类CateVO + * @author hupeng + * @since 2020-05-07 + */ +@Getter +@Setter +@ToString +public class CityVo implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer v; //id + + private String n; //名称 + + private Integer pid; + + private List c; //子集 + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/vo/OnlineUser.java b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/OnlineUser.java new file mode 100644 index 0000000..0a24adc --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/OnlineUser.java @@ -0,0 +1,40 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author hupeng + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class OnlineUser implements Serializable { + + private String userName; + + private String nickName; + + private String job; + + private String browser; + + private String ip; + + private String address; + + private String key; + + private Date loginTime; + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/vo/SignVo.java b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/SignVo.java new file mode 100644 index 0000000..cbbcfe6 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/SignVo.java @@ -0,0 +1,19 @@ +package co.yixiang.modules.user.vo; + + +import lombok.Data; + +import java.io.Serializable; + + +/** + * @ClassName SignVo + * @Author hupeng <610796224@qq.com> + * @Date 2019/12/5 + **/ +@Data +public class SignVo implements Serializable { + private String addTime; + private String title; + private Integer number; +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxSystemUserLevelQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxSystemUserLevelQueryVo.java new file mode 100644 index 0000000..1d85e19 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxSystemUserLevelQueryVo.java @@ -0,0 +1,66 @@ +package co.yixiang.modules.user.vo; + + +import co.yixiang.modules.user.service.dto.TaskDto; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + *

+ * 设置用户等级表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-12-06 + */ +@Data +@ApiModel(value = "YxSystemUserLevelQueryVo对象", description = "设置用户等级表查询参数") +public class YxSystemUserLevelQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + private Integer id; + + @ApiModelProperty(value = "商户id") + private Integer merId; + + @ApiModelProperty(value = "会员名称") + private String name; + + @ApiModelProperty(value = "购买金额") + private BigDecimal money; + + @ApiModelProperty(value = "有效时间") + private Integer validDate; + + + @ApiModelProperty(value = "会员等级") + private Integer grade; + + @ApiModelProperty(value = "享受折扣") + private BigDecimal discount; + + @ApiModelProperty(value = "会员卡背景") + private String image; + + @ApiModelProperty(value = "会员图标") + private String icon; + + @ApiModelProperty(value = "说明") + private String explain; + + @ApiModelProperty(value = "添加时间") + private Integer addTime; + + private TaskDto taskList; + + private Boolean isClear; + + private Integer isForever; + + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxSystemUserTaskQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxSystemUserTaskQueryVo.java new file mode 100644 index 0000000..5a22592 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxSystemUserTaskQueryVo.java @@ -0,0 +1,62 @@ +package co.yixiang.modules.user.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 等级任务设置 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-12-06 + */ +@Data +@ApiModel(value = "YxSystemUserTaskQueryVo对象", description = "等级任务设置查询参数") +public class YxSystemUserTaskQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + private Integer id; + + @ApiModelProperty(value = "任务名称") + private String name; + + @ApiModelProperty(value = "配置原名") + private String realName; + + @ApiModelProperty(value = "任务类型") + private String taskType; + + @ApiModelProperty(value = "限定数") + private Integer number; + + @ApiModelProperty(value = "等级id") + private Integer levelId; + + @ApiModelProperty(value = "排序") + private Integer sort; + + @ApiModelProperty(value = "是否显示") + private Integer isShow; + + @ApiModelProperty(value = "是否务必达成任务,1务必达成,0=满足其一") + private Integer isMust; + + @ApiModelProperty(value = "任务说明") + private String illustrate; + + @ApiModelProperty(value = "新增时间") + private Integer addTime; + + private Integer newNumber;//已经完成了多少 + + private Integer speed;//进度比例 + + private Integer finish;//是否完成 + + private String taskTypeTitle;//任务类型标题 + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxUserAddressQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxUserAddressQueryVo.java new file mode 100644 index 0000000..679cd34 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxUserAddressQueryVo.java @@ -0,0 +1,59 @@ +package co.yixiang.modules.user.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 用户地址表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-10-28 + */ +@Data +@ApiModel(value = "YxUserAddressQueryVo对象", description = "用户地址表查询参数") +public class YxUserAddressQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "用户地址id") + private Long id; + + @ApiModelProperty(value = "用户id") + private Long uid; + + @ApiModelProperty(value = "收货人姓名") + private String realName; + + @ApiModelProperty(value = "收货人电话") + private String phone; + + @ApiModelProperty(value = "收货人所在省") + private String province; + + @ApiModelProperty(value = "收货人所在市") + private String city; + + @ApiModelProperty(value = "收货人所在区") + private String district; + + @ApiModelProperty(value = "收货人详细地址") + private String detail; + + @ApiModelProperty(value = "邮编") + private Integer postCode; + + @ApiModelProperty(value = "经度") + private String longitude; + + @ApiModelProperty(value = "纬度") + private String latitude; + + @ApiModelProperty(value = "是否默认") + private Integer isDefault; + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxUserBillQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxUserBillQueryVo.java new file mode 100644 index 0000000..77b4145 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxUserBillQueryVo.java @@ -0,0 +1,49 @@ +package co.yixiang.modules.user.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + *

+ * 用户账单表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-10-27 + */ +@Data +@ApiModel(value = "YxUserBillQueryVo对象", description = "用户账单表查询参数") +public class YxUserBillQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "用户账单id") + private Long id; + + + + @ApiModelProperty(value = "0 = 支出 1 = 获得") + private Integer pm; + + @ApiModelProperty(value = "账单标题") + private String title; + + @ApiModelProperty(value = "明细数字") + private BigDecimal number; + + + @ApiModelProperty(value = "备注") + private String mark; + + @ApiModelProperty(value = "添加时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date createTime; + + + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxUserQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxUserQueryVo.java new file mode 100644 index 0000000..79db8e8 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxUserQueryVo.java @@ -0,0 +1,141 @@ +package co.yixiang.modules.user.vo; + + +import co.yixiang.modules.order.vo.UserOrderCountVo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + *

+ * 用户表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-10-16 + */ +@Data +@ApiModel(value = "YxUserQueryVo对象", description = "用户表查询参数") +public class YxUserQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "用户id") + private Long uid; + + @ApiModelProperty(value = "用户账户(跟accout一样)") + private String username; + + @ApiModelProperty(value = "用户账号") + private String account; + + @ApiModelProperty(value = "优惠券数量") + private Integer couponCount = 0; + + @ApiModelProperty(value = "订单详情数据") + private UserOrderCountVo orderStatusNum; + + + private Integer statu; + + @ApiModelProperty(value = "总的签到天数") + private Integer sumSignDay; + + @ApiModelProperty(value = "当天是否签到") + private Boolean isDaySign; + + @ApiModelProperty(value = "昨天是否签到") + private Boolean isYesterDaySign; + + @ApiModelProperty(value = "核销权限") + private Boolean checkStatus; + + + + @ApiModelProperty(value = "真实姓名") + private String realName; + + @ApiModelProperty(value = "生日") + private Integer birthday; + + @ApiModelProperty(value = "身份证号码") + @JsonIgnore + private String cardId; + + @ApiModelProperty(value = "用户备注") + private String mark; + + + @ApiModelProperty(value = "用户昵称") + private String nickname; + + @ApiModelProperty(value = "用户头像") + private String avatar; + + @ApiModelProperty(value = "手机号码") + private String phone; + + @ApiModelProperty(value = "添加ip") + private String addIp; + + @ApiModelProperty(value = "最后一次登录ip") + private String lastIp; + + @ApiModelProperty(value = "用户余额") + private BigDecimal nowMoney; + + @ApiModelProperty(value = "佣金金额") + private BigDecimal brokeragePrice; + + @ApiModelProperty(value = "用户剩余积分") + private BigDecimal integral; + + @ApiModelProperty(value = "连续签到天数") + private Integer signNum; + + @ApiModelProperty(value = "1为正常,0为禁止") + private Boolean status; + + @ApiModelProperty(value = "等级") + private Integer level; + + @ApiModelProperty(value = "推广元id") + private Long spreadUid; + + @ApiModelProperty(value = "用户类型") + private String userType; + + @ApiModelProperty(value = "是否为推广员") + private Integer isPromoter; + + @ApiModelProperty(value = "用户购买次数") + private Integer payCount; + + @ApiModelProperty(value = "下级人数") + private Integer spreadCount; + + @ApiModelProperty(value = "详细地址") + private String addres; + + @ApiModelProperty(value = "管理员编号 ") + private Integer adminid; + + @ApiModelProperty(value = "用户登陆类型,h5,wechat,routine") + private String loginType; + + @ApiModelProperty(value = "是否会员") + private Boolean vip; + + @ApiModelProperty(value = "会员ID") + private Integer vipId; + + @ApiModelProperty(value = "会员图标") + private String vipIcon; + + @ApiModelProperty(value = "会员名称") + private String vipName; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxUserSignQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxUserSignQueryVo.java new file mode 100644 index 0000000..8e32fd8 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxUserSignQueryVo.java @@ -0,0 +1,39 @@ +package co.yixiang.modules.user.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 签到记录表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-12-05 + */ +@Data +@ApiModel(value = "YxUserSignQueryVo对象", description = "签到记录表查询参数") +public class YxUserSignQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + private Integer id; + + @ApiModelProperty(value = "用户uid") + private Integer uid; + + @ApiModelProperty(value = "签到说明") + private String title; + + @ApiModelProperty(value = "获得积分") + private Integer number; + + @ApiModelProperty(value = "剩余积分") + private Integer balance; + + @ApiModelProperty(value = "添加时间") + private Integer addTime; + +} diff --git a/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxUserTaskFinishQueryVo.java b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxUserTaskFinishQueryVo.java new file mode 100644 index 0000000..c5b1083 --- /dev/null +++ b/yshop-mall/src/main/java/co/yixiang/modules/user/vo/YxUserTaskFinishQueryVo.java @@ -0,0 +1,36 @@ +package co.yixiang.modules.user.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 用户任务完成记录表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-12-07 + */ +@Data +@ApiModel(value = "YxUserTaskFinishQueryVo对象", description = "用户任务完成记录表查询参数") +public class YxUserTaskFinishQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + private Integer id; + + @ApiModelProperty(value = "任务id") + private Integer taskId; + + @ApiModelProperty(value = "用户id") + private Integer uid; + + @ApiModelProperty(value = "是否有效") + private Boolean status; + + @ApiModelProperty(value = "添加时间") + private Integer addTime; + +} diff --git a/yshop-message/pom.xml b/yshop-message/pom.xml new file mode 100644 index 0000000..48d3595 --- /dev/null +++ b/yshop-message/pom.xml @@ -0,0 +1,24 @@ + + + + yshop + co.yixiang + 3.2 + + 4.0.0 + + yshop-message + 消息队列模块 + + + + co.yixiang + yshop-mall + 3.2 + + + + + diff --git a/yshop-message/src/main/java/co/yixiang/message/redis/config/RedisConfigProperties.java b/yshop-message/src/main/java/co/yixiang/message/redis/config/RedisConfigProperties.java new file mode 100644 index 0000000..62cff4e --- /dev/null +++ b/yshop-message/src/main/java/co/yixiang/message/redis/config/RedisConfigProperties.java @@ -0,0 +1,32 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.message.redis.config; + + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + + +/** + * reids相关配置 + * @author hupeng + * @since 2020-02-27 + */ +@Data +@Configuration(proxyBeanMethods = false) +@ConfigurationProperties(prefix = "spring.redis") +public class RedisConfigProperties { + + private String host = "host"; + private String port = "port"; + private String password = "password"; + private String database = "database"; + +} diff --git a/yshop-message/src/main/java/co/yixiang/message/redis/config/RedisKeyInitialization.java b/yshop-message/src/main/java/co/yixiang/message/redis/config/RedisKeyInitialization.java new file mode 100644 index 0000000..713cd1a --- /dev/null +++ b/yshop-message/src/main/java/co/yixiang/message/redis/config/RedisKeyInitialization.java @@ -0,0 +1,59 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.message.redis.config; + +import co.yixiang.modules.shop.domain.YxSystemConfig; +import co.yixiang.modules.shop.service.YxSystemConfigService; +import co.yixiang.utils.RedisUtils; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.stereotype.Component; + +import java.util.List; + + +/** + * api服务启动初始化reids + */ +@Slf4j +@Component +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +public class RedisKeyInitialization implements CommandLineRunner { + + + private final YxSystemConfigService systemConfigService; + + + private final RedisUtils redisUtils; + + + /** + * 初始化redis + */ + private void redisKeyInitialization(){ + try { + List systemConfigs = systemConfigService.list(); + for (YxSystemConfig systemConfig : systemConfigs) { + redisUtils.set(systemConfig.getMenuName(),systemConfig.getValue()); + } + + log.info("---------------redisKey初始化成功---------------"); + }catch (Exception e){ + log.error("redisKey初始化失败: {}",e.getMessage()); + } + + } + + @Override + public void run(String... args) throws Exception { + this.redisKeyInitialization(); + } +} diff --git a/yshop-message/src/main/java/co/yixiang/message/redis/config/RedisListenerConfig.java b/yshop-message/src/main/java/co/yixiang/message/redis/config/RedisListenerConfig.java new file mode 100644 index 0000000..4b34cbc --- /dev/null +++ b/yshop-message/src/main/java/co/yixiang/message/redis/config/RedisListenerConfig.java @@ -0,0 +1,49 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.message.redis.config; + + +import cn.hutool.core.util.StrUtil; +import co.yixiang.message.redis.listener.RedisKeyExpirationListener; +import co.yixiang.modules.activity.service.YxStorePinkService; +import co.yixiang.modules.order.service.YxStoreOrderService; +import lombok.AllArgsConstructor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.listener.PatternTopic; +import org.springframework.data.redis.listener.RedisMessageListenerContainer; + +/** + * redis监听配置 + * @author hupeng + * @since 2020-02-27 + */ + +@Configuration(proxyBeanMethods = false) +@AllArgsConstructor +public class RedisListenerConfig { + + private final RedisTemplate redisTemplate; + private final RedisConfigProperties redisConfigProperties; + private final YxStoreOrderService storeOrderService; + private final YxStorePinkService storePinkService; + + @Bean + RedisMessageListenerContainer container(RedisConnectionFactory factory) { + String topic =StrUtil.format("__keyevent@{}__:expired", redisConfigProperties.getDatabase()); + RedisMessageListenerContainer container = new RedisMessageListenerContainer(); + container.setConnectionFactory(factory); + container.addMessageListener(new RedisKeyExpirationListener(redisTemplate,redisConfigProperties + ,storeOrderService,storePinkService), new PatternTopic(topic)); + return container; + } +} + diff --git a/yshop-message/src/main/java/co/yixiang/message/redis/listener/RedisKeyExpirationListener.java b/yshop-message/src/main/java/co/yixiang/message/redis/listener/RedisKeyExpirationListener.java new file mode 100644 index 0000000..66f33fd --- /dev/null +++ b/yshop-message/src/main/java/co/yixiang/message/redis/listener/RedisKeyExpirationListener.java @@ -0,0 +1,109 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.message.redis.listener; + + +import cn.hutool.core.util.StrUtil; +import co.yixiang.constant.ShopConstants; +import co.yixiang.enums.OrderInfoEnum; +import co.yixiang.message.redis.config.RedisConfigProperties; +import co.yixiang.modules.activity.domain.YxStorePink; +import co.yixiang.modules.activity.service.YxStorePinkService; +import co.yixiang.modules.order.domain.YxStoreOrder; +import co.yixiang.modules.order.service.YxStoreOrderService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.redis.connection.Message; +import org.springframework.data.redis.connection.MessageListener; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.RedisSerializer; +import org.springframework.stereotype.Component; + +/** + * redis过期监听 + * @author hupeng + * @since 2020-02-27 + */ +@Component +@Slf4j +public class RedisKeyExpirationListener implements MessageListener { + + private RedisTemplate redisTemplate; + private RedisConfigProperties redisConfigProperties; + private YxStoreOrderService storeOrderService; + private YxStorePinkService storePinkService; + + public RedisKeyExpirationListener(RedisTemplate redisTemplate, + RedisConfigProperties redisConfigProperties, + YxStoreOrderService storeOrderService, + YxStorePinkService storePinkService){ + this.redisTemplate = redisTemplate; + this.redisConfigProperties = redisConfigProperties; + this.storeOrderService = storeOrderService; + this.storePinkService = storePinkService; + } + @Override + public void onMessage(Message message, byte[] bytes) { + RedisSerializer serializer = redisTemplate.getValueSerializer(); + String channel = String.valueOf(serializer.deserialize(message.getChannel())); + String body = String.valueOf(serializer.deserialize(message.getBody())); + //key过期监听 + if(StrUtil.format("__keyevent@{}__:expired", redisConfigProperties.getDatabase()).equals(channel)){ + //订单自动取消 + if(body.contains(ShopConstants.REDIS_ORDER_OUTTIME_UNPAY)) { + body = body.replace(ShopConstants.REDIS_ORDER_OUTTIME_UNPAY, ""); + log.info("body:{}",body); + String orderId = body; + YxStoreOrder order = storeOrderService.getOne(new LambdaQueryWrapper() + .eq(YxStoreOrder::getId, orderId) + .eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_0.getValue())); + //只有待支付的订单能取消 + if(order != null){ + storeOrderService.cancelOrder(order.getOrderId(),null); + log.info("订单id:{},未在规定时间支付取消成功",body); + } + } + //订单自动收货 + if(body.contains(ShopConstants.REDIS_ORDER_OUTTIME_UNCONFIRM)) { + body = body.replace(ShopConstants.REDIS_ORDER_OUTTIME_UNCONFIRM, ""); + log.info("body:{}",body); + String orderId = body; + YxStoreOrder order = storeOrderService.getOne(new LambdaQueryWrapper() + .eq(YxStoreOrder::getId, orderId) + .eq(YxStoreOrder::getPaid,OrderInfoEnum.PAY_STATUS_1.getValue()) + .eq(YxStoreOrder::getStatus,OrderInfoEnum.STATUS_1.getValue())); + + //只有待收货的订单能收货 + if(order != null){ + storeOrderService.takeOrder(order.getOrderId(),null); + log.info("订单id:{},自动收货成功",body); + } + } + + //拼团过期取消 + if(body.contains(ShopConstants.REDIS_PINK_CANCEL_KEY)) { + body = body.replace(ShopConstants.REDIS_PINK_CANCEL_KEY, ""); + log.info("body:{}",body); + String pinkId = body; + YxStorePink storePink = storePinkService.getOne(Wrappers.lambdaQuery() + .eq(YxStorePink::getId,pinkId) + .eq(YxStorePink::getStatus,OrderInfoEnum.PINK_STATUS_1.getValue()) + .eq(YxStorePink::getIsRefund,OrderInfoEnum.PINK_REFUND_STATUS_0.getValue())); + + //取消拼团 + if(storePink != null){ + storePinkService.removePink(storePink.getUid(),storePink.getCid(),storePink.getId()); + log.info("拼团订单id:{},未在规定时间完成取消成功",body); + } + } + } + + } +} diff --git a/yshop-mproot/pom.xml b/yshop-mproot/pom.xml new file mode 100644 index 0000000..13d687d --- /dev/null +++ b/yshop-mproot/pom.xml @@ -0,0 +1,42 @@ + + + + yshop + co.yixiang + 3.2 + + 4.0.0 + MyBatisPlus模块 + yshop-mproot + + + 0.10.6 + 3.4.2 + + + + com.baomidou + mybatis-plus-boot-starter + ${mybatis-plus-boot-starter.version} + + + + + com.github.pagehelper + pagehelper-spring-boot-starter + 1.2.5 + + + mybatis-spring + org.mybatis + + + mybatis + org.mybatis + + + + + diff --git a/yshop-mproot/src/main/java/co/yixiang/annotation/Query.java b/yshop-mproot/src/main/java/co/yixiang/annotation/Query.java new file mode 100644 index 0000000..ec7890c --- /dev/null +++ b/yshop-mproot/src/main/java/co/yixiang/annotation/Query.java @@ -0,0 +1,61 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author Zheng Jie + * @date 2019-6-4 13:52:30 + */ +@Target(ElementType.FIELD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Query { + + // Dong ZhaoYang 2017/8/7 基本对象的属性名 + String propName() default ""; + // Dong ZhaoYang 2017/8/7 查询方式 + Type type() default Type.EQUAL; + + /** + * 多字段模糊搜索,仅支持String类型字段,多个用逗号隔开, 如@Query(blurry = "email,username") + */ + String blurry() default ""; + + enum Type { + // jie 2019/6/4 相等 + EQUAL + // Dong ZhaoYang 2017/8/7 大于等于 + , GREATER_THAN + //大于 + , GREATER_THAN_NQ + // Dong ZhaoYang 2017/8/7 小于等于 + , LESS_THAN + // Dong ZhaoYang 2017/8/7 中模糊查询 + , INNER_LIKE + // Dong ZhaoYang 2017/8/7 左模糊查询 + , LEFT_LIKE + // Dong ZhaoYang 2017/8/7 右模糊查询 + , RIGHT_LIKE + // Dong ZhaoYang 2017/8/7 小于 + , LESS_THAN_NQ + // jie 2019/6/4 包含 + , IN + // 不等于 + ,NOT_EQUAL + // between + ,BETWEEN + // 不为空 + ,NOT_NULL + // 查询时间 + ,UNIX_TIMESTAMP + } + +} + diff --git a/yshop-mproot/src/main/java/co/yixiang/common/entity/BaseEntity.java b/yshop-mproot/src/main/java/co/yixiang/common/entity/BaseEntity.java new file mode 100644 index 0000000..a708ee5 --- /dev/null +++ b/yshop-mproot/src/main/java/co/yixiang/common/entity/BaseEntity.java @@ -0,0 +1,15 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.common.entity; + +import io.swagger.annotations.ApiModel; + +import java.io.Serializable; + + +@ApiModel("BaseEntity") +public abstract class BaseEntity implements Serializable{ +} diff --git a/yshop-mproot/src/main/java/co/yixiang/common/mapper/CoreMapper.java b/yshop-mproot/src/main/java/co/yixiang/common/mapper/CoreMapper.java new file mode 100644 index 0000000..4620f0a --- /dev/null +++ b/yshop-mproot/src/main/java/co/yixiang/common/mapper/CoreMapper.java @@ -0,0 +1,15 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.common.mapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @param + * @author LionCity + */ +public interface CoreMapper extends BaseMapper { + +} diff --git a/yshop-mproot/src/main/java/co/yixiang/common/service/BaseService.java b/yshop-mproot/src/main/java/co/yixiang/common/service/BaseService.java new file mode 100644 index 0000000..a3d6eed --- /dev/null +++ b/yshop-mproot/src/main/java/co/yixiang/common/service/BaseService.java @@ -0,0 +1,13 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.common.service; + +import com.baomidou.mybatisplus.extension.service.IService; + + +public interface BaseService extends IService { + +} diff --git a/yshop-mproot/src/main/java/co/yixiang/common/service/impl/BaseServiceImpl.java b/yshop-mproot/src/main/java/co/yixiang/common/service/impl/BaseServiceImpl.java new file mode 100644 index 0000000..a1b4f73 --- /dev/null +++ b/yshop-mproot/src/main/java/co/yixiang/common/service/impl/BaseServiceImpl.java @@ -0,0 +1,72 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.common.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import co.yixiang.common.service.BaseService; +import co.yixiang.common.web.param.OrderQueryParam; +import co.yixiang.common.web.param.QueryParam; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.github.pagehelper.PageHelper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; + +import java.util.Arrays; +import java.util.List; + +/** + * @author hupeng + * @since 2019-10-16 + */ +@Slf4j +@SuppressWarnings("unchecked") +public abstract class BaseServiceImpl, T> extends ServiceImpl implements BaseService { + + protected Page setPageParam(QueryParam queryParam) { + return setPageParam(queryParam,null); + } + + protected Page setPageParam(QueryParam queryParam, OrderItem defaultOrder) { + Page page = new Page(); + // 设置当前页码 + page.setCurrent(queryParam.getPage()); + // 设置页大小 + page.setSize(queryParam.getLimit()); + /** + * 如果是queryParam是OrderQueryParam,并且不为空,则使用前端排序 + * 否则使用默认排序 + */ + if (queryParam instanceof OrderQueryParam){ + OrderQueryParam orderQueryParam = (OrderQueryParam) queryParam; + List orderItems = orderQueryParam.getOrders(); + if (CollectionUtil.isEmpty(orderItems)){ + page.setOrders(Arrays.asList(defaultOrder)); + }else{ + page.setOrders(orderItems); + } + }else{ + page.setOrders(Arrays.asList(defaultOrder)); + } + + return page; + } + + protected void getPage(Pageable pageable) { + String order=null; + if(pageable.getSort()!=null){ + order= pageable.getSort().toString(); + order=order.replace(":",""); + if("UNSORTED".equals(order)){ + order="id desc"; + } + } + PageHelper.startPage(pageable.getPageNumber()+1, pageable.getPageSize(),order); + } + +} diff --git a/yshop-mproot/src/main/java/co/yixiang/common/utils/QueryHelpPlus.java b/yshop-mproot/src/main/java/co/yixiang/common/utils/QueryHelpPlus.java new file mode 100644 index 0000000..c73632a --- /dev/null +++ b/yshop-mproot/src/main/java/co/yixiang/common/utils/QueryHelpPlus.java @@ -0,0 +1,186 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.common.utils; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; +import co.yixiang.annotation.Query; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import lombok.extern.slf4j.Slf4j; + +import java.lang.reflect.Field; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Date; +import java.util.List; + +/** + * @author Zheng Jie + * @date 2019-6-4 14:59:48 + */ +@Slf4j +@SuppressWarnings({"unchecked", "all"}) +public class QueryHelpPlus { + + public static QueryWrapper getPredicate(R obj, Q query) { + QueryWrapper queryWrapper = new QueryWrapper(); + if (query == null) { + return queryWrapper; + } + try { + List fields = getAllFields(query.getClass(), new ArrayList<>()); + for (Field field : fields) { + boolean accessible = field.isAccessible(); + field.setAccessible(true); + Query q = field.getAnnotation(Query.class); + if (q != null) { + String propName = q.propName(); + String blurry = q.blurry(); + String attributeName = isBlank(propName) ? field.getName() : propName; + attributeName = humpToUnderline(attributeName); + Class fieldType = field.getType(); + Object val = field.get(query); + if (ObjectUtil.isNull(val) || "".equals(val)) { + continue; + } + // 模糊多字段 + if (ObjectUtil.isNotEmpty(blurry)) { + String[] blurrys = blurry.split(","); + //queryWrapper.or(); + queryWrapper.and(wrapper -> { + for (int i=0;i< blurrys.length;i++) { + String column = humpToUnderline(blurrys[i]); + //if(i!=0){ + wrapper.or(); + //} + wrapper.like(column, val.toString()); + } + }); + continue; + } + String finalAttributeName = attributeName; + switch (q.type()) { + case EQUAL: + //queryWrapper.and(wrapper -> wrapper.eq(finalAttributeName, val)); + queryWrapper.eq(attributeName, val); + break; + case GREATER_THAN: + queryWrapper.ge(finalAttributeName, val); + break; + case GREATER_THAN_NQ: + queryWrapper.gt(finalAttributeName, val); + break; + case LESS_THAN: + queryWrapper.le(finalAttributeName, val); + break; + case LESS_THAN_NQ: + queryWrapper.lt(finalAttributeName, val); + break; + case INNER_LIKE: + queryWrapper.like(finalAttributeName, val); + break; + case LEFT_LIKE: + queryWrapper.likeLeft(finalAttributeName, val); + break; + case RIGHT_LIKE: + queryWrapper.likeRight(finalAttributeName, val); + break; + case IN: + if (CollUtil.isNotEmpty((Collection) val)) { + queryWrapper.in(finalAttributeName, (Collection) val); + } + break; + case NOT_EQUAL: + queryWrapper.ne(finalAttributeName, val); + break; + case NOT_NULL: + queryWrapper.isNotNull(finalAttributeName); + break; + case BETWEEN: + List between = new ArrayList<>((List) val); + queryWrapper.between(finalAttributeName, between.get(0), between.get(1)); + break; + case UNIX_TIMESTAMP: + List UNIX_TIMESTAMP = new ArrayList<>((List)val); + if(!UNIX_TIMESTAMP.isEmpty()){ + SimpleDateFormat fm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date time1 = fm.parse(UNIX_TIMESTAMP.get(0).toString()); + Date time2 = fm.parse(UNIX_TIMESTAMP.get(1).toString()); + queryWrapper.between(finalAttributeName, time1, time2); + } + break; + default: + break; + } + } + field.setAccessible(accessible); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + } + + return queryWrapper; + } + + + + private static boolean isBlank(final CharSequence cs) { + int strLen; + if (cs == null || (strLen = cs.length()) == 0) { + return true; + } + for (int i = 0; i < strLen; i++) { + if (!Character.isWhitespace(cs.charAt(i))) { + return false; + } + } + return true; + } + + private static List getAllFields(Class clazz, List fields) { + if (clazz != null) { + fields.addAll(Arrays.asList(clazz.getDeclaredFields())); + getAllFields(clazz.getSuperclass(), fields); + } + return fields; + } + + /*** + * 驼峰命名转为下划线命名 + * + * @param para + * 驼峰命名的字符串 + */ + + public static String humpToUnderline(String para) { + StringBuilder sb = new StringBuilder(para); + int temp = 0;//定位 + if (!para.contains("_")) { + for (int i = 0; i < para.length(); i++) { + if (Character.isUpperCase(para.charAt(i))) { + sb.insert(i + temp, "_"); + temp += 1; + } + } + } + return sb.toString(); + } + +// public static void main(String[] args) { +// QueryWrapper query = new QueryWrapper(); +// //query.or(); +// query.or(wrapper -> wrapper.eq("store_id", 1).or().eq("store_id", 2)); +// //query.like("a",1); +// //query.or(); +// //query.like("b",2); +// //query.and(wrapper->wrapper.eq("c",1)); +// query.eq("1", 1); +// +// System.out.println(query.getSqlSegment()); +// } +} diff --git a/yshop-mproot/src/main/java/co/yixiang/common/web/param/OrderQueryParam.java b/yshop-mproot/src/main/java/co/yixiang/common/web/param/OrderQueryParam.java new file mode 100644 index 0000000..71d1063 --- /dev/null +++ b/yshop-mproot/src/main/java/co/yixiang/common/web/param/OrderQueryParam.java @@ -0,0 +1,39 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.common.web.param; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Arrays; +import java.util.List; + + +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel("可排序查询参数对象") +public abstract class OrderQueryParam extends QueryParam{ + private static final long serialVersionUID = 57714391204790143L; + + @ApiModelProperty(value = "排序") + private List orders; + + public void defaultOrder(OrderItem orderItem){ + this.defaultOrders(Arrays.asList(orderItem)); + } + + public void defaultOrders(List orderItems){ + if (CollectionUtil.isEmpty(orderItems)){ + return; + } + this.orders = orderItems; + } + +} diff --git a/yshop-mproot/src/main/java/co/yixiang/common/web/param/QueryParam.java b/yshop-mproot/src/main/java/co/yixiang/common/web/param/QueryParam.java new file mode 100644 index 0000000..d500afa --- /dev/null +++ b/yshop-mproot/src/main/java/co/yixiang/common/web/param/QueryParam.java @@ -0,0 +1,44 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.common.web.param; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + + +@Data +@ApiModel("查询参数对象") +public abstract class QueryParam implements Serializable{ + private static final long serialVersionUID = -3263921252635611410L; + + @ApiModelProperty(value = "页码,默认为1") + private Integer page =1; + @ApiModelProperty(value = "页大小,默认为10") + private Integer limit = 10; + @ApiModelProperty(value = "搜索字符串") + private String keyword; + + @ApiModelProperty(value = "当前第几页") + public void setCurrent(Integer current) { + if (current == null || current <= 0){ + this.page = 1; + }else{ + this.page = current; + } + } + + public void setSize(Integer size) { + if (size == null || size <= 0){ + this.limit = 10; + }else{ + this.limit = size; + } + } + +} diff --git a/yshop-mproot/src/main/java/co/yixiang/common/web/vo/Paging.java b/yshop-mproot/src/main/java/co/yixiang/common/web/vo/Paging.java new file mode 100644 index 0000000..e92e369 --- /dev/null +++ b/yshop-mproot/src/main/java/co/yixiang/common/web/vo/Paging.java @@ -0,0 +1,65 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.common.web.vo; + +import com.alibaba.fastjson.annotation.JSONField; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.io.Serializable; +import java.util.Collections; +import java.util.List; + + +@ApiModel("分页") +@SuppressWarnings("unchecked") +public class Paging implements Serializable { + private static final long serialVersionUID = -1683800405530086022L; + + @ApiModelProperty("总行数") + @JSONField(name = "total") + @JsonProperty("total") + private long total = 0; + + @ApiModelProperty("数据列表") + @JSONField(name = "records") + @JsonProperty("records") + private List records = Collections.emptyList(); + + public Paging() { + } + + public Paging(IPage page) { + this.total = page.getTotal(); + this.records = page.getRecords(); + } + + public long getTotal() { + return total; + } + + public void setTotal(long total) { + this.total = total; + } + + public List getRecords() { + return records; + } + + public void setRecords(List records) { + this.records = records; + } + + @Override + public String toString() { + return "Paging{" + + "total=" + total + + ", records=" + records + + '}'; + } +} diff --git a/yshop-mproot/src/main/java/co/yixiang/config/MetaHandler.java b/yshop-mproot/src/main/java/co/yixiang/config/MetaHandler.java new file mode 100644 index 0000000..20a5df3 --- /dev/null +++ b/yshop-mproot/src/main/java/co/yixiang/config/MetaHandler.java @@ -0,0 +1,104 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.config; + +/** + * @author :LionCity + * @date :Created in 2020-04-10 15:47 + * @description:自动注入时间处理 + * @modified By: + * @version: + */ + +import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; +import lombok.extern.slf4j.Slf4j; +import org.apache.ibatis.reflection.MetaObject; +import org.springframework.stereotype.Component; + +import java.sql.Timestamp; +import java.util.Date; + +/** + * 处理新增和更新的基础数据填充,配合BaseEntity和MyBatisPlusConfig使用 + */ +@Slf4j +@Component +public class MetaHandler implements MetaObjectHandler { + + + /** + * 新增数据执行 + * + * @param metaObject + */ + @Override + public void insertFill(MetaObject metaObject) { + try { + Timestamp time=new Timestamp(System.currentTimeMillis()); + if (metaObject.hasSetter("createTime")) { + log.debug("自动插入 createTime"); + this.setFieldValByName("createTime", time, metaObject); + } + if (metaObject.hasSetter("updateTime")) { + log.debug("自动插入 updateTime"); + this.setFieldValByName("updateTime", time, metaObject); + } + if (metaObject.hasSetter("createDate")) { + log.debug("自动插入 createDate"); + this.setFieldValByName("createDate", time, metaObject); + } + if (metaObject.hasSetter("updateDate")) { + log.debug("自动插入 updateDate"); + this.setFieldValByName("updateDate", time, metaObject); + } + if (metaObject.hasSetter("delFlag")) { + log.debug("自动插入 delFlag"); + this.setFieldValByName("delFlag", false, metaObject); + } + if (metaObject.hasSetter("isDel")) { + log.debug("自动插入 isDel"); + this.setFieldValByName("isDel", 0, metaObject); + } + if (metaObject.hasSetter("addTime")) { + String timestamp = String.valueOf(System.currentTimeMillis() / 1000); + this.setFieldValByName("addTime", Integer.valueOf(timestamp), metaObject); + } + } catch (Exception e) { + log.error("自动注入失败:{}", e); + } + } + + /** + * 更新数据执行 + * + * @param metaObject + */ + @Override + public void updateFill(MetaObject metaObject) { + try { + Timestamp time=new Timestamp(System.currentTimeMillis()); + if (metaObject.hasSetter("updateTime")) { + log.debug("自动插入 updateTime"); + this.setFieldValByName("updateTime", time, metaObject); + } + if (metaObject.hasSetter("updateDate")) { + log.debug("自动插入 updateDate"); + this.setFieldValByName("updateDate", time, metaObject); + } + if (metaObject.hasSetter("delFlag")) { + log.debug("自动插入 delFlag"); + this.setFieldValByName("delFlag", null, metaObject); + } + if (metaObject.hasSetter("createTime")) { + log.debug("自动插入 createTime"); + this.setFieldValByName("createTime", null, metaObject); + } + } catch (Exception e) { + log.error("自动注入失败:{}", e); + } + } + +} diff --git a/yshop-mproot/src/main/java/co/yixiang/config/MybatisConfig.java b/yshop-mproot/src/main/java/co/yixiang/config/MybatisConfig.java new file mode 100644 index 0000000..5379e89 --- /dev/null +++ b/yshop-mproot/src/main/java/co/yixiang/config/MybatisConfig.java @@ -0,0 +1,40 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.config; + +/** + * @author :LionCity + * @date :Created in 2020-04-10 15:11 + * @description:MybatisConfig + * @modified By: + * @version: + */ + +import com.github.pagehelper.PageHelper; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.Properties; + +@Configuration(proxyBeanMethods = false) +public class MybatisConfig { + /** + * 配置mybatis的分页插件pageHelper + * @return + */ + @Bean + public PageHelper pageHelper(){ + PageHelper pageHelper = new PageHelper(); + Properties properties = new Properties(); + properties.setProperty("offsetAsPageNum","true"); + properties.setProperty("rowBoundsWithCount","true"); + properties.setProperty("reasonable","true"); + //配置mysql数据库的方言 + properties.setProperty("dialect","mysql"); + pageHelper.setProperties(properties); + return pageHelper; + } +} diff --git a/yshop-mproot/src/main/resources/META-INF/spring.factories b/yshop-mproot/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000..66132c8 --- /dev/null +++ b/yshop-mproot/src/main/resources/META-INF/spring.factories @@ -0,0 +1,3 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ + co.yixiang.config.MetaHandler,\ + co.yixiang.config.MybatisConfig \ No newline at end of file diff --git a/yshop-shop/pom.xml b/yshop-shop/pom.xml new file mode 100644 index 0000000..f9cba5d --- /dev/null +++ b/yshop-shop/pom.xml @@ -0,0 +1,27 @@ + + + + yshop + co.yixiang + 3.2 + + 4.0.0 + + yshop-shop + 后台商城模块 + + + 0.9.1 + + + + + co.yixiang + yshop-weixin + 3.2 + + + + diff --git a/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreBargainController.java b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreBargainController.java new file mode 100644 index 0000000..36a55b4 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreBargainController.java @@ -0,0 +1,86 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.rest; + +import cn.hutool.core.util.ObjectUtil; +import co.yixiang.api.YshopException; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.activity.domain.YxStoreBargain; +import co.yixiang.modules.activity.service.YxStoreBargainService; +import co.yixiang.modules.activity.service.dto.YxStoreBargainQueryCriteria; +import co.yixiang.modules.aop.ForbidSubmit; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** +* @author hupeng +* @date 2019-12-22 +*/ +@Api(tags = "商城:砍价管理") +@RestController +@RequestMapping("api") +public class StoreBargainController { + + private final YxStoreBargainService yxStoreBargainService; + + public StoreBargainController(YxStoreBargainService yxStoreBargainService) { + this.yxStoreBargainService = yxStoreBargainService; + } + + @Log("查询砍价") + @ApiOperation(value = "查询砍价") + @GetMapping(value = "/yxStoreBargain") + @PreAuthorize("hasAnyRole('admin','YXSTOREBARGAIN_ALL','YXSTOREBARGAIN_SELECT')") + public ResponseEntity getYxStoreBargains(YxStoreBargainQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxStoreBargainService.queryAll(criteria,pageable),HttpStatus.OK); + } + + + + @Log("修改砍价") + @ApiOperation(value = "修改砍价") + @PutMapping(value = "/yxStoreBargain") + @PreAuthorize("hasAnyRole('admin','YXSTOREBARGAIN_ALL','YXSTOREBARGAIN_EDIT')") + public ResponseEntity update(@Validated @RequestBody YxStoreBargain resources){ + if(resources.getBargainMinPrice().compareTo(resources.getBargainMaxPrice()) >= 0){ + throw new YshopException("单次砍最低价不能高于单次砍最高价"); + } + if(resources.getMinPrice().compareTo(resources.getPrice()) >= 0){ + throw new YshopException("允许砍到最低价不能高于砍价金额"); + } + if(ObjectUtil.isNull(resources.getId())){ + return new ResponseEntity<>(yxStoreBargainService.save(resources),HttpStatus.CREATED); + }else{ + yxStoreBargainService.saveOrUpdate(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + } + + @ForbidSubmit + @Log("删除砍价") + @ApiOperation(value = "删除砍价") + @DeleteMapping(value = "/yxStoreBargain/{id}") + @PreAuthorize("hasAnyRole('admin','YXSTOREBARGAIN_ALL','YXSTOREBARGAIN_DELETE')") + public ResponseEntity delete(@PathVariable Integer id){ + yxStoreBargainService.removeById(id); + return new ResponseEntity(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCombinationController.java b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCombinationController.java new file mode 100644 index 0000000..2bfba1f --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCombinationController.java @@ -0,0 +1,204 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.rest; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.ObjectUtil; +import co.yixiang.constant.ShopConstants; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.SpecTypeEnum; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.activity.domain.YxStoreCombination; +import co.yixiang.modules.activity.service.YxStoreCombinationService; +import co.yixiang.modules.activity.service.dto.YxStoreCombinationDto; +import co.yixiang.modules.activity.service.dto.YxStoreCombinationQueryCriteria; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.product.domain.YxStoreProductAttrResult; +import co.yixiang.modules.product.domain.YxStoreProductAttrValue; +import co.yixiang.modules.product.service.YxStoreProductAttrResultService; +import co.yixiang.modules.product.service.YxStoreProductAttrValueService; +import co.yixiang.modules.product.service.YxStoreProductRuleService; +import co.yixiang.modules.product.service.dto.ProductFormatDto; +import co.yixiang.modules.template.domain.YxShippingTemplates; +import co.yixiang.modules.template.service.YxShippingTemplatesService; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.BeanUtils; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** +* @author hupeng +* @date 2019-11-18 +*/ +@Api(tags = "商城:拼团管理") +@RestController +@RequestMapping("api") +public class StoreCombinationController { + + private final YxStoreCombinationService yxStoreCombinationService; + private final YxShippingTemplatesService yxShippingTemplatesService; + private final YxStoreProductRuleService yxStoreProductRuleService; + private final YxStoreProductAttrResultService yxStoreProductAttrResultService; + private final YxStoreProductAttrValueService storeProductAttrValueService; + private final IGenerator generator; + public StoreCombinationController(YxStoreCombinationService yxStoreCombinationService, YxShippingTemplatesService yxShippingTemplatesService, YxStoreProductRuleService yxStoreProductRuleService, YxStoreProductAttrResultService yxStoreProductAttrResultService, YxStoreProductAttrValueService storeProductAttrValueService, IGenerator generator) { + this.yxStoreCombinationService = yxStoreCombinationService; + this.yxShippingTemplatesService = yxShippingTemplatesService; + this.yxStoreProductRuleService = yxStoreProductRuleService; + this.yxStoreProductAttrResultService = yxStoreProductAttrResultService; + this.storeProductAttrValueService = storeProductAttrValueService; + this.generator = generator; + } + + @Log("查询拼团") + @ApiOperation(value = "查询拼团") + @GetMapping(value = "/yxStoreCombination") + @PreAuthorize("hasAnyRole('admin','YXSTORECOMBINATION_ALL','YXSTORECOMBINATION_SELECT')") + public ResponseEntity getYxStoreCombinations(YxStoreCombinationQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxStoreCombinationService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true) + @Log("新增拼团") + @ApiOperation(value = "新增拼团") + @PostMapping(value = "/yxStoreCombination") + @PreAuthorize("hasAnyRole('admin','YXSTORECOMBINATION_ALL','YXSTORECOMBINATION_EDIT')") + public ResponseEntity add(@Validated @RequestBody YxStoreCombinationDto resources){ + return new ResponseEntity<>(yxStoreCombinationService.saveCombination(resources),HttpStatus.CREATED); + } + + @ApiOperation(value = "获取商品信息") + @GetMapping(value = "/yxStoreCombination/info/{id}") + public ResponseEntity info(@PathVariable Long id){ + Map map = new LinkedHashMap<>(3); + + //运费模板 + List shippingTemplatesList = yxShippingTemplatesService.list(); + map.put("tempList", shippingTemplatesList); + + //商品规格 + map.put("ruleList",yxStoreProductRuleService.list()); + + + if(id == 0){ + return new ResponseEntity<>(map,HttpStatus.OK); + } + + //处理商品详情 + YxStoreCombination yxStoreCombination = yxStoreCombinationService.getById(id); + YxStoreCombinationDto productDto = new YxStoreCombinationDto(); + BeanUtil.copyProperties(yxStoreCombination,productDto,"images"); + productDto.setSliderImage(Arrays.asList(yxStoreCombination.getImages().split(","))); + YxStoreProductAttrResult storeProductAttrResult = yxStoreProductAttrResultService + .getOne(Wrappers.lambdaQuery() + .eq(YxStoreProductAttrResult::getProductId,yxStoreCombination.getProductId()).last("limit 1")); + JSONObject result = JSON.parseObject(storeProductAttrResult.getResult()); + List attrValues = storeProductAttrValueService.list(new LambdaQueryWrapper().eq(YxStoreProductAttrValue::getProductId, yxStoreCombination.getProductId())); + List productFormatDtos =attrValues.stream().map(i ->{ + ProductFormatDto productFormatDto = new ProductFormatDto(); + BeanUtils.copyProperties(i,productFormatDto); + productFormatDto.setPic(i.getImage()); + return productFormatDto; + }).collect(Collectors.toList()); + if(SpecTypeEnum.TYPE_1.getValue().equals(yxStoreCombination.getSpecType())){ + productDto.setAttr(new ProductFormatDto()); + productDto.setAttrs(productFormatDtos); + productDto.setItems(result.getObject("attr",ArrayList.class)); + }else{ + productFormat(productDto, result); + } + + map.put("productInfo",productDto); + + return new ResponseEntity<>(map,HttpStatus.OK); + } + + /** + * 获取商品属性 + * @param productDto + * @param result + */ + private void productFormat(YxStoreCombinationDto productDto, JSONObject result) { + Map mapAttr = (Map) result.getObject("value",ArrayList.class).get(0); + ProductFormatDto productFormatDto = ProductFormatDto.builder() + .pic(mapAttr.get("pic").toString()) + .price(Double.valueOf(mapAttr.get("price").toString())) + .cost(Double.valueOf(mapAttr.get("cost").toString())) + .otPrice(Double.valueOf(mapAttr.get("otPrice").toString())) + .stock(Integer.valueOf(mapAttr.get("stock").toString())) + .barCode(mapAttr.get("barCode").toString()) + .weight(Double.valueOf(mapAttr.get("weight").toString())) + .volume(Double.valueOf(mapAttr.get("volume").toString())) + .value1(mapAttr.get("value1").toString()) + .brokerage(Double.valueOf(mapAttr.get("brokerage").toString())) + .brokerageTwo(Double.valueOf(mapAttr.get("brokerageTwo").toString())) + .pinkPrice(Double.valueOf(mapAttr.get("pinkPrice").toString())) + .pinkStock(Integer.valueOf(mapAttr.get("pinkStock").toString())) + .seckillPrice(Double.valueOf(mapAttr.get("seckillPrice").toString())) + .seckillStock(Integer.valueOf(mapAttr.get("seckillStock").toString())) + .build(); + productDto.setAttr(productFormatDto); + } + + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true) + @Log("修改拼团") + @ApiOperation(value = "新增/修改拼团") + @PutMapping(value = "/yxStoreCombination") + @PreAuthorize("hasAnyRole('admin','YXSTORECOMBINATION_ALL','YXSTORECOMBINATION_EDIT')") + public ResponseEntity update(@Validated @RequestBody YxStoreCombination resources){ + if(ObjectUtil.isNull(resources.getId())){ + return new ResponseEntity<>(yxStoreCombinationService.save(resources),HttpStatus.CREATED); + }else{ + yxStoreCombinationService.saveOrUpdate(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + } + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true) + @ForbidSubmit + @ApiOperation(value = "开启关闭") + @PostMapping(value = "/yxStoreCombination/onsale/{id}") + public ResponseEntity onSale(@PathVariable Long id,@RequestBody String jsonStr){ + JSONObject jsonObject = JSON.parseObject(jsonStr); + Integer status = jsonObject.getInteger("status"); + yxStoreCombinationService.onSale(id,status); + return new ResponseEntity(HttpStatus.OK); + } + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true) + @ForbidSubmit + @Log("删除拼团") + @ApiOperation(value = "删除拼团") + @DeleteMapping(value = "/yxStoreCombination/{id}") + @PreAuthorize("hasAnyRole('admin','YXSTORECOMBINATION_ALL','YXSTORECOMBINATION_DELETE')") + public ResponseEntity delete(@PathVariable Long id){ + yxStoreCombinationService.removeById(id); + return new ResponseEntity(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCouponController.java b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCouponController.java new file mode 100644 index 0000000..c1effcc --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCouponController.java @@ -0,0 +1,95 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.rest; + +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.YshopException; +import co.yixiang.enums.CouponEnum; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.activity.domain.YxStoreCoupon; +import co.yixiang.modules.activity.service.YxStoreCouponService; +import co.yixiang.modules.activity.service.dto.YxStoreCouponQueryCriteria; +import co.yixiang.modules.aop.ForbidSubmit; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** +* @author hupeng +* @date 2019-11-09 +*/ +@Api(tags = "商城:优惠券管理") +@RestController +@RequestMapping("api") +public class StoreCouponController { + + private final YxStoreCouponService yxStoreCouponService; + + public StoreCouponController(YxStoreCouponService yxStoreCouponService) { + this.yxStoreCouponService = yxStoreCouponService; + } + + @Log("查询") + @ApiOperation(value = "查询") + @GetMapping(value = "/yxStoreCoupon") + @PreAuthorize("@el.check('admin','YXSTORECOUPON_ALL','YXSTORECOUPON_SELECT')") + public ResponseEntity getYxStoreCoupons(YxStoreCouponQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxStoreCouponService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("新增") + @ApiOperation(value = "新增") + @PostMapping(value = "/yxStoreCoupon") + @PreAuthorize("@el.check('admin','YXSTORECOUPON_ALL','YXSTORECOUPON_CREATE')") + public ResponseEntity create(@Validated @RequestBody YxStoreCoupon resources){ + if(CouponEnum.TYPE_1.getValue().equals(resources.getType()) + && StrUtil.isEmpty(resources.getProductId())){ + throw new YshopException("请选择商品"); + } + if(resources.getCouponPrice().compareTo(resources.getUseMinPrice()) >= 0) { + throw new YshopException("优惠券金额不能高于最低消费金额"); + } + return new ResponseEntity<>(yxStoreCouponService.save(resources),HttpStatus.CREATED); + } + + @Log("修改") + @ApiOperation(value = "修改") + @PutMapping(value = "/yxStoreCoupon") + @PreAuthorize("@el.check('admin','YXSTORECOUPON_ALL','YXSTORECOUPON_EDIT')") + public ResponseEntity update(@Validated @RequestBody YxStoreCoupon resources){ + if(CouponEnum.TYPE_1.getValue().equals(resources.getType()) + && StrUtil.isEmpty(resources.getProductId())){ + throw new YshopException("请选择商品"); + } + if(resources.getCouponPrice().compareTo(resources.getUseMinPrice()) >= 0) { + throw new YshopException("优惠券金额不能高于最低消费金额"); + } + yxStoreCouponService.saveOrUpdate(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除") + @ApiOperation(value = "删除") + @DeleteMapping(value = "/yxStoreCoupon/{id}") + @PreAuthorize("@el.check('admin','YXSTORECOUPON_ALL','YXSTORECOUPON_DELETE')") + public ResponseEntity delete(@PathVariable Integer id){ + yxStoreCouponService.removeById(id); + return new ResponseEntity(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCouponIssueController.java b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCouponIssueController.java new file mode 100644 index 0000000..7fce8fa --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCouponIssueController.java @@ -0,0 +1,81 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.rest; + +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.activity.domain.YxStoreCouponIssue; +import co.yixiang.modules.activity.service.YxStoreCouponIssueService; +import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueQueryCriteria; +import co.yixiang.modules.aop.ForbidSubmit; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** +* @author hupeng +* @date 2019-11-09 +*/ +@Api(tags = "商城:优惠券发布管理") +@RestController +@RequestMapping("api") +public class StoreCouponIssueController { + + private final YxStoreCouponIssueService yxStoreCouponIssueService; + + public StoreCouponIssueController(YxStoreCouponIssueService yxStoreCouponIssueService) { + this.yxStoreCouponIssueService = yxStoreCouponIssueService; + } + + @Log("查询已发布") + @ApiOperation(value = "查询已发布") + @GetMapping(value = "/yxStoreCouponIssue") + @PreAuthorize("@el.check('admin','YXSTORECOUPONISSUE_ALL','YXSTORECOUPONISSUE_SELECT')") + public ResponseEntity getYxStoreCouponIssues(YxStoreCouponIssueQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxStoreCouponIssueService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("发布") + @ApiOperation(value = "发布") + @PostMapping(value = "/yxStoreCouponIssue") + @PreAuthorize("@el.check('admin','YXSTORECOUPONISSUE_ALL','YXSTORECOUPONISSUE_CREATE')") + public ResponseEntity create(@Validated @RequestBody YxStoreCouponIssue resources){ + if(resources.getTotalCount() > 0) { + resources.setRemainCount(resources.getTotalCount()); + } + return new ResponseEntity<>(yxStoreCouponIssueService.save(resources),HttpStatus.CREATED); + } + + @Log("修改状态") + @ApiOperation(value = "修改状态") + @PutMapping(value = "/yxStoreCouponIssue") + @PreAuthorize("@el.check('admin','YXSTORECOUPONISSUE_ALL','YXSTORECOUPONISSUE_EDIT')") + public ResponseEntity update(@Validated @RequestBody YxStoreCouponIssue resources){ + yxStoreCouponIssueService.saveOrUpdate(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除") + @ApiOperation(value = "删除") + @DeleteMapping(value = "/yxStoreCouponIssue/{id}") + @PreAuthorize("@el.check('admin','YXSTORECOUPONISSUE_ALL','YXSTORECOUPONISSUE_DELETE')") + public ResponseEntity delete(@PathVariable Integer id){ + yxStoreCouponIssueService.removeById(id); + return new ResponseEntity(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCouponIssueUserController.java b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCouponIssueUserController.java new file mode 100644 index 0000000..06e9c48 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCouponIssueUserController.java @@ -0,0 +1,60 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.rest; + +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.activity.service.YxStoreCouponIssueUserService; +import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueUserQueryCriteria; +import co.yixiang.modules.aop.ForbidSubmit; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** +* @author hupeng +* @date 2019-11-09 +*/ +@Api(tags = "商城:优惠券前台用户领取记录管理") +@RestController +@RequestMapping("api") +public class StoreCouponIssueUserController { + + private final YxStoreCouponIssueUserService yxStoreCouponIssueUserService; + + public StoreCouponIssueUserController(YxStoreCouponIssueUserService yxStoreCouponIssueUserService) { + this.yxStoreCouponIssueUserService = yxStoreCouponIssueUserService; + } + + @Log("查询") + @ApiOperation(value = "查询") + @GetMapping(value = "/yxStoreCouponIssueUser") + @PreAuthorize("hasAnyRole('admin','YXSTORECOUPONISSUEUSER_ALL','YXSTORECOUPONISSUEUSER_SELECT')") + public ResponseEntity getYxStoreCouponIssueUsers(YxStoreCouponIssueUserQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxStoreCouponIssueUserService.queryAll(criteria,pageable),HttpStatus.OK); + } + + + @ForbidSubmit + @Log("删除") + @ApiOperation(value = "删除") + @DeleteMapping(value = "/yxStoreCouponIssueUser/{id}") + @PreAuthorize("hasAnyRole('admin','YXSTORECOUPONISSUEUSER_ALL','YXSTORECOUPONISSUEUSER_DELETE')") + public ResponseEntity delete(@PathVariable Integer id){ + yxStoreCouponIssueUserService.removeById(id); + return new ResponseEntity(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCouponUserController.java b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCouponUserController.java new file mode 100644 index 0000000..8ec0fdc --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCouponUserController.java @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.rest; + +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.activity.service.YxStoreCouponUserService; +import co.yixiang.modules.activity.service.dto.YxStoreCouponUserQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** +* @author hupeng +* @date 2019-11-10 +*/ +@Api(tags = "商城:优惠券发放记录管理") +@RestController +@RequestMapping("api") +public class StoreCouponUserController { + + private final YxStoreCouponUserService yxStoreCouponUserService; + + public StoreCouponUserController(YxStoreCouponUserService yxStoreCouponUserService) { + this.yxStoreCouponUserService = yxStoreCouponUserService; + } + + @Log("查询Y") + @ApiOperation(value = "查询") + @GetMapping(value = "/yxStoreCouponUser") + @PreAuthorize("hasAnyRole('admin','YXSTORECOUPONUSER_ALL','YXSTORECOUPONUSER_SELECT')") + public ResponseEntity getYxStoreCouponUsers(YxStoreCouponUserQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity(yxStoreCouponUserService.queryAll(criteria,pageable),HttpStatus.OK); + } + + +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StorePinkController.java b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StorePinkController.java new file mode 100644 index 0000000..9329589 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StorePinkController.java @@ -0,0 +1,45 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.activity.rest; + +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.activity.service.YxStorePinkService; +import co.yixiang.modules.activity.service.dto.YxStorePinkQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** +* @author hupeng +* @date 2019-11-18 +*/ +@Api(tags = "商城:拼团记录管理") +@RestController +@RequestMapping("api") +public class StorePinkController { + + private final YxStorePinkService yxStorePinkService; + + public StorePinkController(YxStorePinkService yxStorePinkService) { + this.yxStorePinkService = yxStorePinkService; + } + + @Log("查询记录") + @ApiOperation(value = "查询记录") + @GetMapping(value = "/yxStorePink") + @PreAuthorize("@el.check('admin','YXSTOREPINK_ALL','YXSTOREPINK_SELECT')") + public ResponseEntity getYxStorePinks(YxStorePinkQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxStorePinkService.queryAll(criteria,pageable),HttpStatus.OK); + } + + +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreSeckillController.java b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreSeckillController.java new file mode 100644 index 0000000..f69183a --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreSeckillController.java @@ -0,0 +1,188 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + */ +package co.yixiang.modules.activity.rest; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.ObjectUtil; +import co.yixiang.constant.ShopConstants; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.SpecTypeEnum; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.activity.domain.YxStoreSeckill; +import co.yixiang.modules.activity.service.YxStoreSeckillService; +import co.yixiang.modules.activity.service.dto.YxStoreSeckillDto; +import co.yixiang.modules.activity.service.dto.YxStoreSeckillQueryCriteria; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.product.domain.YxStoreProductAttrResult; +import co.yixiang.modules.product.domain.YxStoreProductAttrValue; +import co.yixiang.modules.product.service.YxStoreProductAttrResultService; +import co.yixiang.modules.product.service.YxStoreProductAttrValueService; +import co.yixiang.modules.product.service.YxStoreProductRuleService; +import co.yixiang.modules.product.service.dto.ProductFormatDto; +import co.yixiang.modules.template.domain.YxShippingTemplates; +import co.yixiang.modules.template.service.YxShippingTemplatesService; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.BeanUtils; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author hupeng + * @date 2019-12-14 + */ +@Api(tags = "商城:秒杀管理") +@RestController +@RequestMapping("api") +public class StoreSeckillController { + + private final IGenerator generator; + private final YxStoreSeckillService yxStoreSeckillService; + private final YxShippingTemplatesService yxShippingTemplatesService; + private final YxStoreProductRuleService yxStoreProductRuleService; + private final YxStoreProductAttrValueService storeProductAttrValueService; + private final YxStoreProductAttrResultService yxStoreProductAttrResultService; + + public StoreSeckillController(IGenerator generator, YxStoreSeckillService yxStoreSeckillService, YxShippingTemplatesService yxShippingTemplatesService, + YxStoreProductRuleService yxStoreProductRuleService, YxStoreProductAttrValueService storeProductAttrValueService, + YxStoreProductAttrResultService yxStoreProductAttrResultService) { + this.generator = generator; + this.yxStoreSeckillService = yxStoreSeckillService; + this.yxShippingTemplatesService = yxShippingTemplatesService; + this.yxStoreProductRuleService = yxStoreProductRuleService; + this.storeProductAttrValueService = storeProductAttrValueService; + this.yxStoreProductAttrResultService = yxStoreProductAttrResultService; + } + + @Log("列表") + @ApiOperation(value = "列表") + @GetMapping(value = "/yxStoreSeckill") + @PreAuthorize("hasAnyRole('admin','YXSTORESECKILL_ALL','YXSTORESECKILL_SELECT')") + public ResponseEntity getYxStoreSeckills(YxStoreSeckillQueryCriteria criteria, Pageable pageable) { + return new ResponseEntity<>(yxStoreSeckillService.queryAll(criteria, pageable), HttpStatus.OK); + } + + + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY, allEntries = true) + @Log("发布") + @ApiOperation(value = "发布") + @PutMapping(value = "/yxStoreSeckill") + @PreAuthorize("hasAnyRole('admin','YXSTORESECKILL_ALL','YXSTORESECKILL_EDIT')") + public ResponseEntity update(@Validated @RequestBody YxStoreSeckill resources){ + if(ObjectUtil.isNull(resources.getId())){ + return new ResponseEntity<>(yxStoreSeckillService.save(resources),HttpStatus.CREATED); + }else{ + yxStoreSeckillService.saveOrUpdate(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + } + + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY, allEntries = true) + @ForbidSubmit + @Log("删除") + @ApiOperation(value = "删除") + @DeleteMapping(value = "/yxStoreSeckill/{id}") + @PreAuthorize("hasAnyRole('admin','YXSTORESECKILL_ALL','YXSTORESECKILL_DELETE')") + public ResponseEntity delete(@PathVariable Integer id) { + yxStoreSeckillService.removeById(id); + return new ResponseEntity(HttpStatus.OK); + } + + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY, allEntries = true) + @Log("新增秒杀") + @ApiOperation(value = "新增秒杀") + @PostMapping(value = "/yxStoreSeckill") + @PreAuthorize("hasAnyRole('admin','YXSTORESECKILL_ALL','YXSTORESECKILL_EDIT')") + public ResponseEntity add(@Validated @RequestBody YxStoreSeckillDto resources) { + return new ResponseEntity<>(yxStoreSeckillService.saveSeckill(resources), HttpStatus.CREATED); + } + + @ApiOperation(value = "获取商品信息") + @GetMapping(value = "/yxStoreSecKill/info/{id}") + public ResponseEntity info(@PathVariable Long id) { + Map map = new LinkedHashMap<>(3); + + //运费模板 + List shippingTemplatesList = yxShippingTemplatesService.list(); + map.put("tempList", shippingTemplatesList); + + //商品规格 + map.put("ruleList", yxStoreProductRuleService.list()); + + + if (id == 0) { + return new ResponseEntity<>(map, HttpStatus.OK); + } + + //处理商品详情 + YxStoreSeckill yxStoreSeckill = yxStoreSeckillService.getById(id); + YxStoreSeckillDto productDto = new YxStoreSeckillDto(); + BeanUtil.copyProperties(yxStoreSeckill, productDto, "images"); + productDto.setSliderImage(Arrays.asList(yxStoreSeckill.getImages().split(","))); + YxStoreProductAttrResult storeProductAttrResult = yxStoreProductAttrResultService + .getOne(Wrappers.lambdaQuery() + .eq(YxStoreProductAttrResult::getProductId, yxStoreSeckill.getProductId()).last("limit 1")); + JSONObject result = JSON.parseObject(storeProductAttrResult.getResult()); + + List attrValues = storeProductAttrValueService.list(new LambdaQueryWrapper().eq(YxStoreProductAttrValue::getProductId, yxStoreSeckill.getProductId())); + List productFormatDtos = attrValues.stream().map(i -> { + ProductFormatDto productFormatDto = new ProductFormatDto(); + BeanUtils.copyProperties(i, productFormatDto); + productFormatDto.setPic(i.getImage()); + return productFormatDto; + }).collect(Collectors.toList()); + if (SpecTypeEnum.TYPE_1.getValue().equals(yxStoreSeckill.getSpecType())) { + productDto.setAttr(new ProductFormatDto()); + productDto.setAttrs(productFormatDtos); + productDto.setItems(result.getObject("attr", ArrayList.class)); + } else { + productFormat(productDto, result); + } + + + map.put("productInfo", productDto); + + return new ResponseEntity<>(map, HttpStatus.OK); + } + + /** + * 获取商品属性 + * @param productDto + * @param result + */ + private void productFormat(YxStoreSeckillDto productDto, JSONObject result) { + Map mapAttr = (Map) result.getObject("value", ArrayList.class).get(0); + ProductFormatDto productFormatDto = ProductFormatDto.builder() + .pic(mapAttr.get("pic").toString()) + .price(Double.valueOf(mapAttr.get("price").toString())) + .cost(Double.valueOf(mapAttr.get("cost").toString())) + .otPrice(Double.valueOf(mapAttr.get("otPrice").toString())) + .stock(Integer.valueOf(mapAttr.get("stock").toString())) + .barCode(mapAttr.get("barCode").toString()) + .weight(Double.valueOf(mapAttr.get("weight").toString())) + .volume(Double.valueOf(mapAttr.get("volume").toString())) + .value1(mapAttr.get("value1").toString()) + .brokerage(Double.valueOf(mapAttr.get("brokerage").toString())) + .brokerageTwo(Double.valueOf(mapAttr.get("brokerageTwo").toString())) + .pinkPrice(Double.valueOf(mapAttr.get("pinkPrice").toString())) + .pinkStock(Integer.valueOf(mapAttr.get("pinkStock").toString())) + .seckillPrice(Double.valueOf(mapAttr.get("seckillPrice").toString())) + .seckillStock(Integer.valueOf(mapAttr.get("seckillStock").toString())) + .build(); + productDto.setAttr(productFormatDto); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/UserExtractController.java b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/UserExtractController.java new file mode 100644 index 0000000..5499d84 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/activity/rest/UserExtractController.java @@ -0,0 +1,65 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.activity.rest; + +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.activity.domain.YxUserExtract; +import co.yixiang.modules.activity.service.YxUserExtractService; +import co.yixiang.modules.activity.service.dto.YxUserExtractQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** +* @author hupeng +* @date 2019-11-14 +*/ +@Api(tags = "商城:提现管理") +@RestController +@RequestMapping("api") +public class UserExtractController { + + private final YxUserExtractService yxUserExtractService; + + + public UserExtractController(YxUserExtractService yxUserExtractService) { + this.yxUserExtractService = yxUserExtractService; + + } + + @Log("查询") + @ApiOperation(value = "查询") + @GetMapping(value = "/yxUserExtract") + @PreAuthorize("hasAnyRole('admin','YXUSEREXTRACT_ALL','YXUSEREXTRACT_SELECT')") + public ResponseEntity getYxUserExtracts(YxUserExtractQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxUserExtractService.queryAll(criteria,pageable),HttpStatus.OK); + } + + + + @Log("修改审核") + @ApiOperation(value = "修改审核") + @PutMapping(value = "/yxUserExtract") + @PreAuthorize("hasAnyRole('admin','YXUSEREXTRACT_ALL','YXUSEREXTRACT_EDIT')") + public ResponseEntity update(@Validated @RequestBody YxUserExtract resources){ + yxUserExtractService.doExtract(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/aop/ForbidSubmit.java b/yshop-shop/src/main/java/co/yixiang/modules/aop/ForbidSubmit.java new file mode 100644 index 0000000..c03c188 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/aop/ForbidSubmit.java @@ -0,0 +1,21 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.aop; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface ForbidSubmit { + + +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/aop/ForbidSubmitAspect.java b/yshop-shop/src/main/java/co/yixiang/modules/aop/ForbidSubmitAspect.java new file mode 100644 index 0000000..5d386ca --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/aop/ForbidSubmitAspect.java @@ -0,0 +1,47 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.aop; + + +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.springframework.stereotype.Component; + +/** + * 重复提交aop + * @author hupeng + * @since 2020-06-02 + */ +@Aspect +@Component +@Slf4j +public class ForbidSubmitAspect { + + + + + @Pointcut("@annotation(forbidSubmit)") + public void pointCut(ForbidSubmit forbidSubmit) { + } + + @Around("pointCut(forbidSubmit)") + public Object around(ProceedingJoinPoint pjp, ForbidSubmit forbidSubmit) throws Throwable { + + //用于拦截演示环境一些禁止操作 + //throw new YshopException("演示环境禁止操作"); + return pjp.proceed(); + + + } + + +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/canvas/rest/StoreCanvasController.java b/yshop-shop/src/main/java/co/yixiang/modules/canvas/rest/StoreCanvasController.java new file mode 100644 index 0000000..ecf23b2 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/canvas/rest/StoreCanvasController.java @@ -0,0 +1,113 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.canvas.rest; +import java.util.Arrays; + +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.YshopException; +import co.yixiang.constant.ShopConstants; +import co.yixiang.constant.SystemConfigConstants; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.tools.domain.QiniuContent; +import co.yixiang.tools.service.LocalStorageService; +import co.yixiang.tools.service.QiNiuService; +import co.yixiang.tools.service.dto.LocalStorageDto; +import co.yixiang.utils.RedisUtils; +import lombok.AllArgsConstructor; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.canvas.domain.StoreCanvas; +import co.yixiang.modules.canvas.service.StoreCanvasService; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.util.HashMap; +import java.util.Map; +import org.springframework.web.multipart.MultipartFile; + +/** +* @author yshop +* @date 2021-02-01 +*/ +@AllArgsConstructor +@Api(tags = "画布管理") +@RestController +@RequestMapping("/api/canvas") +public class StoreCanvasController { + + private final StoreCanvasService storeCanvasService; + private final LocalStorageService localStorageService; + private final QiNiuService qiNiuService; + private final RedisUtils redisUtils; + + + @PostMapping("/saveCanvas") + @Log("新增或修改画布") + @ApiOperation("新增或修改画布") + public ResponseEntity create(@Validated @RequestBody StoreCanvas resources){ + return new ResponseEntity<>(storeCanvasService.saveOrUpdate(resources),HttpStatus.CREATED); + } + + + @ApiOperation("上传文件") + @PostMapping("/upload") + public ResponseEntity create(@RequestParam(defaultValue = "") String name, + @RequestParam(defaultValue = "") String type, + @RequestParam("file") MultipartFile file) { + + String localUrl = redisUtils.getY(ShopConstants.ADMIN_API_URL); + if(StrUtil.isBlank(type)){ + localUrl = redisUtils.getY(SystemConfigConstants.API_URL) + "/api"; + } + String mode = redisUtils.getY(SystemConfigConstants.FILE_STORE_MODE); + StringBuilder url = new StringBuilder(); + if (ShopCommonEnum.STORE_MODE_1.getValue().toString().equals(mode)) { //存在走本地 + if(StrUtil.isBlank(localUrl)){ + throw new YshopException("本地上传,请先登陆系统配置后台/移动端API地址"); + } + LocalStorageDto localStorageDTO = localStorageService.create(name, file); + if ("".equals(url.toString())) { + url = url.append(localUrl + "/file/" + localStorageDTO.getType() + "/" + localStorageDTO.getRealName()); + } else { + url = url.append(","+localUrl + "/file/" + localStorageDTO.getType() + "/" + localStorageDTO.getRealName()); + } + } else {//走七牛云 + QiniuContent qiniuContent = qiNiuService.upload(file, qiNiuService.find()); + if ("".equals(url.toString())) { + url = url.append(qiniuContent.getUrl()); + }else{ + url = url.append(","+qiniuContent.getUrl()); + } + } + + Map map = new HashMap<>(2); + map.put("errno", 0); + map.put("link", url); + return new ResponseEntity(map, HttpStatus.CREATED); + } + + + @GetMapping("/getCanvas") + @ApiOperation(value = "读取画布数据") + public ResponseEntity getCanvas(StoreCanvas storeCanvas){ + StoreCanvas canvas = storeCanvasService.lambdaQuery().eq(StoreCanvas::getTerminal, storeCanvas.getTerminal()).one(); + return new ResponseEntity<>(canvas,HttpStatus.OK); + } + + @Log("删除画布") + @ApiOperation("删除画布") + @DeleteMapping + public ResponseEntity deleteAll(@RequestBody Long[] ids) { + Arrays.asList(ids).forEach(id->{ + storeCanvasService.removeById(id); + }); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/category/rest/StoreCategoryController.java b/yshop-shop/src/main/java/co/yixiang/modules/category/rest/StoreCategoryController.java new file mode 100644 index 0000000..9d0fc87 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/category/rest/StoreCategoryController.java @@ -0,0 +1,161 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.category.rest; + +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.YshopException; +import co.yixiang.constant.ShopConstants; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.category.domain.YxStoreCategory; +import co.yixiang.modules.category.service.YxStoreCategoryService; +import co.yixiang.modules.category.service.dto.YxStoreCategoryDto; +import co.yixiang.modules.category.service.dto.YxStoreCategoryQueryCriteria; +import co.yixiang.modules.product.domain.YxStoreProduct; +import co.yixiang.modules.product.service.YxStoreProductService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** +* @author hupeng +* @date 2019-10-03 +*/ +@Api(tags = "商城:商品分类管理") +@RestController +@RequestMapping("api") +public class StoreCategoryController { + + + private final YxStoreCategoryService yxStoreCategoryService; + private final YxStoreProductService yxStoreProductService; + + + public StoreCategoryController(YxStoreCategoryService yxStoreCategoryService, + YxStoreProductService yxStoreProductService) { + this.yxStoreCategoryService = yxStoreCategoryService; + this.yxStoreProductService = yxStoreProductService; + } + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/yxStoreCategory/download") + @PreAuthorize("@el.check('admin','YXSTORECATEGORY_SELECT')") + public void download(HttpServletResponse response, YxStoreCategoryQueryCriteria criteria) throws IOException { + yxStoreCategoryService.download(yxStoreCategoryService.queryAll(criteria), response); + } + + + @Log("查询商品分类") + @ApiOperation(value = "查询商品分类") + @GetMapping(value = "/yxStoreCategory") + @PreAuthorize("hasAnyRole('admin','YXSTORECATEGORY_ALL','YXSTORECATEGORY_SELECT')") + public ResponseEntity getYxStoreCategorys(YxStoreCategoryQueryCriteria criteria, Pageable pageable){ + List categoryDTOList = yxStoreCategoryService.queryAll(criteria); + return new ResponseEntity<>(yxStoreCategoryService.buildTree(categoryDTOList),HttpStatus.OK); + } + + @ForbidSubmit + @Log("新增商品分类") + @ApiOperation(value = "新增商品分类") + @PostMapping(value = "/yxStoreCategory") + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true) + @PreAuthorize("hasAnyRole('admin','YXSTORECATEGORY_ALL','YXSTORECATEGORY_CREATE')") + public ResponseEntity create(@Validated @RequestBody YxStoreCategory resources){ + if(resources.getPid() != null && resources.getPid() > 0 && StrUtil.isBlank(resources.getPic())) { + throw new YshopException("子分类图片必传"); + } + + boolean checkResult = yxStoreCategoryService.checkCategory(resources.getPid()); + if(!checkResult) { + throw new YshopException("分类最多能添加2级哦"); + } + + return new ResponseEntity<>(yxStoreCategoryService.save(resources),HttpStatus.CREATED); + } + + @ForbidSubmit + @Log("修改商品分类") + @ApiOperation(value = "修改商品分类") + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true) + @PutMapping(value = "/yxStoreCategory") + @PreAuthorize("hasAnyRole('admin','YXSTORECATEGORY_ALL','YXSTORECATEGORY_EDIT')") + public ResponseEntity update(@Validated @RequestBody YxStoreCategory resources){ + if(resources.getPid() != null && resources.getPid() > 0 && StrUtil.isBlank(resources.getPic())) { + throw new YshopException("子分类图片必传"); + } + + if(resources.getId().equals(resources.getPid())){ + throw new YshopException("自己不能选择自己哦"); + } + + boolean checkResult = yxStoreCategoryService.checkCategory(resources.getPid()); + + if(!checkResult) { + throw new YshopException("分类最多能添加2级哦"); + } + + yxStoreCategoryService.saveOrUpdate(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除商品分类") + @ApiOperation(value = "删除商品分类") + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true) + @DeleteMapping(value = "/yxStoreCategory/{id}") + @PreAuthorize("hasAnyRole('admin','YXSTORECATEGORY_ALL','YXSTORECATEGORY_DELETE')") + public ResponseEntity delete(@PathVariable String id){ + String[] ids = id.split(","); + for (String newId: ids) { + this.delCheck(Integer.valueOf(newId)); + yxStoreCategoryService.removeById(Integer.valueOf(newId)); + } + return new ResponseEntity(HttpStatus.OK); + } + + + /** + * 检测删除分类 + * @param id 分类id + */ + private void delCheck(Integer id){ + int count = yxStoreCategoryService.lambdaQuery() + .eq(YxStoreCategory::getPid,id) + .count(); + if(count > 0) { + throw new YshopException("请先删除子分类"); + } + + int countP = yxStoreProductService.lambdaQuery() + .eq(YxStoreProduct::getCateId,id) + .count(); + + if(countP > 0) { + throw new YshopException("当前分类下有商品不可删除"); + } + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/customer/rest/QrCodeController.java b/yshop-shop/src/main/java/co/yixiang/modules/customer/rest/QrCodeController.java new file mode 100644 index 0000000..4ad69f3 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/customer/rest/QrCodeController.java @@ -0,0 +1,116 @@ +package co.yixiang.modules.customer.rest; + +import cn.hutool.core.util.StrUtil; +import co.yixiang.annotation.AnonymousAccess; +import co.yixiang.constant.ShopConstants; +import co.yixiang.exception.BadRequestException; +import co.yixiang.modules.mp.config.WxMpConfiguration; +import co.yixiang.utils.RecodeUtil; +import co.yixiang.utils.RedisUtil; +import co.yixiang.utils.RedisUtils; +import com.alibaba.fastjson.JSONObject; +import io.swagger.annotations.Api; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.api.WxConsts; +import me.chanjar.weixin.common.bean.WxOAuth2UserInfo; +import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.mp.api.WxMpService; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.net.URLEncoder; + +/** + * @author lioncity + * @date 2020-03-21 + */ +@Slf4j +@Api(tags = "微信") +@Controller +@RequestMapping("/api/wxmp") +@AllArgsConstructor +public class QrCodeController { + + private final RedisUtils redisUtils; + /** + * 生成微信图片二维码 + * + * @param request + * @param response + * @ + */ + @AnonymousAccess + @GetMapping("/qrcode") + public void qrcode(HttpServletRequest request, HttpServletResponse response, @RequestParam("key") String key) { + String adminApiUrl = redisUtils.getY(ShopConstants.ADMIN_API_URL); + if(StrUtil.isBlank(adminApiUrl)){ + throw new BadRequestException("请配置后台-->商城配置-->商城系统配置-->后台Api地址"); + } + final WxMpService wxService = WxMpConfiguration.getWxMpService(); + if (wxService == null) { + throw new IllegalArgumentException("未找到对应配置的服务,请核实!"); + } + String state = key; + String url = adminApiUrl + "/api/wxmp/userInfo"; + String redirectURL = wxService.getOAuth2Service().buildAuthorizationUrl(url, WxConsts.OAuth2Scope.SNSAPI_USERINFO, URLEncoder.encode(state)); + log.info("【微信网页授权】获取code,redirectURL={}", redirectURL); + //调用工具类,生成二维码 + //180为图片高度和宽度 + RecodeUtil.creatRrCode(redirectURL, 180, 180, response); + } + + @AnonymousAccess + @GetMapping("/wechatCode") + public ResponseEntity wechatCode() { + String wechatFollowImg = redisUtils.getY(ShopConstants.WECHAT_FOLLOW_IMG); + if(StrUtil.isBlank(wechatFollowImg)){ + throw new BadRequestException("请配置后台-->微信管理-->公众号配置->关注二维码"); + } + return ResponseEntity.ok(wechatFollowImg); + } + + @AnonymousAccess + @ResponseBody + @GetMapping("/userInfo") + public void userInfo(HttpServletRequest request, @RequestParam("code") String code, + @RequestParam("state") String key) throws Exception { + log.info("【微信网页授权】code={}", code); + log.info("【微信网页授权】state={}", key); + final WxMpService wxService = WxMpConfiguration.getWxMpService(); + if (wxService == null) { + throw new IllegalArgumentException("未找到对应配置的服务,请核实!"); + } + try { + WxOAuth2AccessToken wxOAuth2AccessToken = wxService.getOAuth2Service().getAccessToken(code); + WxOAuth2UserInfo wxOAuth2UserInfo = wxService.getOAuth2Service().getUserInfo(wxOAuth2AccessToken, "zh_CN"); + RedisUtil.set("qrCode:" + key, wxOAuth2UserInfo.getOpenid() + ":" + wxOAuth2UserInfo.getNickname()); + log.info("【微信网页授权】wxMpUser={}", wxOAuth2UserInfo); + } catch (WxErrorException e) { + log.info("【微信网页授权】{}", e); + throw new Exception(e.getError().getErrorMsg()); + } + } + + @ResponseBody + @GetMapping("/getOpenId") + public ResponseEntity userInfo(HttpServletRequest request, @RequestParam("key") String key) { + String openId = RedisUtil.get("qrCode:" + key); + if (openId != null) { + String[] str = openId.split(":"); + JSONObject json = new JSONObject(); + json.put("openId", str[0]); + json.put("nickName", str[1]); + return new ResponseEntity(json, HttpStatus.OK); + } + return new ResponseEntity(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/customer/rest/YxStoreCustomerController.java b/yshop-shop/src/main/java/co/yixiang/modules/customer/rest/YxStoreCustomerController.java new file mode 100644 index 0000000..36a82c4 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/customer/rest/YxStoreCustomerController.java @@ -0,0 +1,95 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.customer.rest; +import java.util.Arrays; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.exception.BadRequestException; +import co.yixiang.modules.aop.ForbidSubmit; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import lombok.AllArgsConstructor; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.customer.domain.YxStoreCustomer; +import co.yixiang.modules.customer.service.YxStoreCustomerService; +import co.yixiang.modules.customer.service.dto.YxStoreCustomerQueryCriteria; +import co.yixiang.modules.customer.service.dto.YxStoreCustomerDto; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import co.yixiang.domain.PageResult; +/** +* @author Bug +* @date 2020-12-10 +*/ +@AllArgsConstructor +@Api(tags = "customer管理") +@RestController +@RequestMapping("/api/yxStoreCustomer") +public class YxStoreCustomerController { + + private final YxStoreCustomerService yxStoreCustomerService; + private final IGenerator generator; + + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('admin','yxStoreCustomer:list')") + public void download(HttpServletResponse response, YxStoreCustomerQueryCriteria criteria) throws IOException { + yxStoreCustomerService.download(generator.convert(yxStoreCustomerService.queryAll(criteria), YxStoreCustomerDto.class), response); + } + + @GetMapping + @Log("查询customer") + @ApiOperation("查询customer") + @PreAuthorize("@el.check('admin','yxStoreCustomer:list')") + public ResponseEntity> getYxStoreCustomers(YxStoreCustomerQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxStoreCustomerService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @ForbidSubmit + @PostMapping + @Log("新增customer") + @ApiOperation("新增customer") + @PreAuthorize("@el.check('admin','yxStoreCustomer:add')") + public ResponseEntity create(@Validated @RequestBody YxStoreCustomer resources){ + int count = yxStoreCustomerService.count(new LambdaQueryWrapper().eq(YxStoreCustomer::getOpenId, resources.getOpenId())); + if (count > 0) { + throw new BadRequestException("当前用户已存在,请勿重复提交"); + } + return new ResponseEntity<>(yxStoreCustomerService.save(resources),HttpStatus.CREATED); + } + + @ForbidSubmit + @PutMapping + @Log("修改customer") + @ApiOperation("修改customer") + @PreAuthorize("@el.check('admin','yxStoreCustomer:edit')") + public ResponseEntity update(@Validated @RequestBody YxStoreCustomer resources){ + yxStoreCustomerService.updateById(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除customer") + @ApiOperation("删除customer") + @PreAuthorize("@el.check('admin','yxStoreCustomer:del')") + @DeleteMapping + public ResponseEntity deleteAll(@RequestBody Long[] ids) { + Arrays.asList(ids).forEach(id->{ + yxStoreCustomerService.removeById(id); + }); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/order/rest/StoreOrderController.java b/yshop-shop/src/main/java/co/yixiang/modules/order/rest/StoreOrderController.java new file mode 100644 index 0000000..6e2fa87 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/order/rest/StoreOrderController.java @@ -0,0 +1,465 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.order.rest; + +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.annotation.AnonymousAccess; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.OrderInfoEnum; +import co.yixiang.enums.OrderLogEnum; +import co.yixiang.enums.ShipperCodeEnum; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.exception.BadRequestException; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.order.domain.YxStoreOrder; +import co.yixiang.modules.order.domain.YxStoreOrderStatus; +import co.yixiang.modules.order.param.ExpressParam; +import co.yixiang.modules.order.service.YxStoreOrderService; +import co.yixiang.modules.order.service.YxStoreOrderStatusService; +import co.yixiang.modules.order.service.dto.*; +import co.yixiang.tools.express.ExpressService; +import co.yixiang.tools.express.config.ExpressAutoConfiguration; +import co.yixiang.tools.express.dao.ExpressInfo; +import com.alibaba.fastjson.JSONArray; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author hupeng + * @date 2019-10-14 + */ +@Api(tags = "商城:订单管理") +@RestController +@RequestMapping("api") +@Slf4j +@SuppressWarnings("unchecked") +public class StoreOrderController { + + @Value("${yshop.apiUrl}") + private String apiUrl; + + private final IGenerator generator; + private final YxStoreOrderService yxStoreOrderService; + private final YxStoreOrderStatusService yxStoreOrderStatusService; + + + public StoreOrderController(IGenerator generator, YxStoreOrderService yxStoreOrderService, + YxStoreOrderStatusService yxStoreOrderStatusService) { + this.generator = generator; + this.yxStoreOrderService = yxStoreOrderService; + this.yxStoreOrderStatusService = yxStoreOrderStatusService; + } + + /**@Valid + * 根据商品分类统计订单占比 + */ + @GetMapping("/yxStoreOrder/orderCount") + @ApiOperation(value = "根据商品分类统计订单占比",notes = "根据商品分类统计订单占比",response = ExpressParam.class) + public ResponseEntity orderCount(){ + OrderCountDto orderCountDto = yxStoreOrderService.getOrderCount(); + return new ResponseEntity<>(orderCountDto, HttpStatus.OK); + } + + /** + * 首页订单/用户等统计 + * @return OrderTimeDataDto + */ + @GetMapping(value = "/data/count") + @AnonymousAccess + public ResponseEntity getCount() { + return new ResponseEntity<>(yxStoreOrderService.getOrderTimeData(), HttpStatus.OK); + } + + /** + * 返回本月订单金额与数量chart + * @return map + */ + @GetMapping(value = "/data/chart") + @AnonymousAccess + public ResponseEntity getChart() { + return new ResponseEntity<>(yxStoreOrderService.chartCount(), HttpStatus.OK); + } + + + @ApiOperation(value = "查询订单") + @GetMapping(value = "/yxStoreOrder") + @PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_SELECT','YXEXPRESS_SELECT')") + public ResponseEntity getYxStoreOrders(YxStoreOrderQueryCriteria criteria, + Pageable pageable, + @RequestParam(name = "orderStatus") String orderStatus, + @RequestParam(name = "orderType") String orderType) { + + YxStoreOrderQueryCriteria newCriteria = this.handleQuery(criteria,orderStatus,orderType); + + return new ResponseEntity<>(yxStoreOrderService.queryAll(newCriteria, pageable), HttpStatus.OK); + } + + @ApiOperation(value = "根据订单id获取订单详情") + @GetMapping(value = "/getStoreOrderDetail/{id}") + @PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_SELECT','YXEXPRESS_SELECT')") + public ResponseEntity getYxStoreOrders(@PathVariable Long id) { + return new ResponseEntity<>(yxStoreOrderService.getOrderDetail(id), HttpStatus.OK); + } + @ApiOperation(value = "查询订单当前状态流程") + @GetMapping(value = "/getNowOrderStatus/{id}") + public ResponseEntity getNowOrderStatus(@PathVariable Long id) { + List statusList = new ArrayList<>(); + statusList.add(OrderLogEnum.CREATE_ORDER.getValue()); + statusList.add(OrderLogEnum.PAY_ORDER_SUCCESS.getValue()); + statusList.add(OrderLogEnum.DELIVERY_GOODS.getValue()); + statusList.add(OrderLogEnum.TAKE_ORDER_DELIVERY.getValue()); + statusList.add(OrderLogEnum.EVAL_ORDER.getValue()); + List orderStatusLogList = yxStoreOrderStatusService.list(new LambdaQueryWrapper().eq(YxStoreOrderStatus::getOid, id).in(YxStoreOrderStatus::getChangeType, statusList).orderByDesc(YxStoreOrderStatus::getChangeTime)); + List dtoList = getOrderStatusDto(orderStatusLogList); + YxOrderNowOrderStatusDto yxOrderNowOrderStatusDto = new YxOrderNowOrderStatusDto(); + yxOrderNowOrderStatusDto.setSize(dtoList.size()); + dtoList.forEach(dto -> { + if (OrderLogEnum.CREATE_ORDER.getDesc().equals(dto.getChangeType())) { + yxOrderNowOrderStatusDto.setCacheKeyCreateOrder(dto.getChangeTime()); + } + if (OrderLogEnum.PAY_ORDER_SUCCESS.getDesc().equals(dto.getChangeType())) { + yxOrderNowOrderStatusDto.setPaySuccess(dto.getChangeTime()); + } + if (OrderLogEnum.DELIVERY_GOODS.getDesc().equals(dto.getChangeType())) { + yxOrderNowOrderStatusDto.setDeliveryGoods(dto.getChangeTime()); + } + if (OrderLogEnum.TAKE_ORDER_DELIVERY.getDesc().equals(dto.getChangeType())) { + yxOrderNowOrderStatusDto.setUserTakeDelivery(dto.getChangeTime()); + yxOrderNowOrderStatusDto.setOrderVerific(dto.getChangeTime()); + } + if (OrderLogEnum.EVAL_ORDER.getDesc().equals(dto.getChangeType())) { + yxOrderNowOrderStatusDto.setCheckOrderOver(dto.getChangeTime()); + } + }); + + + statusList = new ArrayList<>(); + statusList.add(OrderLogEnum.REFUND_ORDER_APPLY.getValue()); + statusList.add(OrderLogEnum.REFUND_ORDER_SUCCESS.getValue()); + orderStatusLogList = yxStoreOrderStatusService.list(new LambdaQueryWrapper().eq(YxStoreOrderStatus::getOid, id).in(YxStoreOrderStatus::getChangeType, statusList).orderByDesc(YxStoreOrderStatus::getChangeTime)); + dtoList = getOrderStatusDto(orderStatusLogList); + dtoList.forEach(dto -> { + if (OrderLogEnum.REFUND_ORDER_APPLY.getDesc().equals(dto.getChangeType())) { + yxOrderNowOrderStatusDto.setApplyRefund(dto.getChangeTime()); + } + if (OrderLogEnum.REFUND_ORDER_SUCCESS.getDesc().equals(dto.getChangeType())) { + yxOrderNowOrderStatusDto.setRefundOrderSuccess(dto.getChangeTime()); + } + + }); + + return new ResponseEntity(yxOrderNowOrderStatusDto, HttpStatus.OK); + } + public List getOrderStatusDto(List orderStatusLogList) { + List dtoList = orderStatusLogList.stream().map(log -> { + YxStoreOrderStatusDto dto = generator.convert(log, YxStoreOrderStatusDto.class); + dto.setChangeType(OrderLogEnum.getDesc(dto.getChangeType())); + dto.setChangeTime(log.getChangeTime()); + return dto; + }).collect(Collectors.toList()); + return dtoList; + } + @ApiOperation(value = "发货") + @PutMapping(value = "/yxStoreOrder") + @PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") + public ResponseEntity update(@Validated @RequestBody YxStoreOrder resources) { + if (StrUtil.isBlank(resources.getDeliveryName())) { + throw new BadRequestException("请选择快递公司"); + } + if (StrUtil.isBlank(resources.getDeliveryId())) { + throw new BadRequestException("快递单号不能为空"); + } + + yxStoreOrderService.orderDelivery(resources.getOrderId(),resources.getDeliveryId(), + resources.getDeliveryName(),resources.getDeliveryType()); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + @ApiOperation(value = "修改快递单号") + @PutMapping(value = "/yxStoreOrder/updateDelivery") + @PreAuthorize("hasAnyAuthority('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") + public ResponseEntity updateDelivery(@Validated @RequestBody YxStoreOrder resources) { + if (StrUtil.isBlank(resources.getDeliveryName())) { + throw new BadRequestException("请选择快递公司"); + } + if (StrUtil.isBlank(resources.getDeliveryId())) { + throw new BadRequestException("快递单号不能为空"); + } + + yxStoreOrderService.updateDelivery(resources.getOrderId(),resources.getDeliveryId(), + resources.getDeliveryName(),resources.getDeliveryType()); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + + + @ApiOperation(value = "订单核销") + @PutMapping(value = "/yxStoreOrder/check") + @PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") + public ResponseEntity check(@Validated @RequestBody YxStoreOrder resources) { + if (StrUtil.isBlank(resources.getVerifyCode())) { + throw new BadRequestException("核销码不能为空"); + } + YxStoreOrderDto storeOrderDTO = generator.convert(yxStoreOrderService.getById(resources.getId()),YxStoreOrderDto.class); + if(!resources.getVerifyCode().equals(storeOrderDTO.getVerifyCode())){ + throw new BadRequestException("核销码不对"); + } + if(OrderInfoEnum.PAY_STATUS_0.getValue().equals(storeOrderDTO.getPaid())){ + throw new BadRequestException("订单未支付"); + } + + yxStoreOrderService.verifyOrder(resources.getVerifyCode(), + OrderInfoEnum.CONFIRM_STATUS_1.getValue(),null); + + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + + @ApiOperation(value = "退款") + @PostMapping(value = "/yxStoreOrder/refund") + @PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") + public ResponseEntity refund(@Validated @RequestBody YxStoreOrder resources) { + yxStoreOrderService.orderRefund(resources.getOrderId(),resources.getPayPrice(), + ShopCommonEnum.AGREE_1.getValue()); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + + @ForbidSubmit + @Log("删除") + @ApiOperation(value = "删除") + @DeleteMapping(value = "/yxStoreOrder/{id}") + @PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_DELETE')") + public ResponseEntity delete(@PathVariable Integer id) { + yxStoreOrderService.removeById(id); + return new ResponseEntity(HttpStatus.OK); + } + + + @Log("修改订单") + @ApiOperation(value = "修改订单") + @PostMapping(value = "/yxStoreOrder/edit") + @PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") + public ResponseEntity editOrder(@RequestBody YxStoreOrder resources) { + if (ObjectUtil.isNull(resources.getPayPrice())) { + throw new BadRequestException("请输入支付金额"); + } + if (resources.getPayPrice().doubleValue() < 0) { + throw new BadRequestException("金额不能低于0"); + } + YxStoreOrderDto storeOrder = generator.convert(yxStoreOrderService.getById(resources.getId()),YxStoreOrderDto.class); + //判断金额是否有变动,生成一个额外订单号去支付 + int res = NumberUtil.compare(storeOrder.getPayPrice().doubleValue(), resources.getPayPrice().doubleValue()); + if (res != 0) { + String orderSn = IdUtil.getSnowflake(0, 0).nextIdStr(); + resources.setExtendOrderId(orderSn); + } + + yxStoreOrderService.saveOrUpdate(resources); + + yxStoreOrderStatusService.create(resources.getId(),OrderLogEnum.ORDER_EDIT.getValue(), + "修改订单价格为:" + resources.getPayPrice()); + return new ResponseEntity(HttpStatus.OK); + } + + + @Log("修改订单备注") + @ApiOperation(value = "修改订单备注") + @PostMapping(value = "/yxStoreOrder/remark") + @PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") + public ResponseEntity editOrderRemark(@RequestBody YxStoreOrder resources) { + if (StrUtil.isBlank(resources.getRemark())) { + throw new BadRequestException("请输入备注"); + } + yxStoreOrderService.saveOrUpdate(resources); + return new ResponseEntity(HttpStatus.OK); + } + + + /** + * 快递查询 + */ + @PostMapping("/yxStoreOrder/express") + @ApiOperation(value = "获取物流信息",notes = "获取物流信息",response = ExpressParam.class) + public ResponseEntity express( @RequestBody ExpressParam expressInfoDo){ + + //顺丰轨迹查询处理 + String lastFourNumber = ""; + if (expressInfoDo.getShipperCode().equals(ShipperCodeEnum.SF.getValue())) { + YxStoreOrderDto yxStoreOrderDto; + yxStoreOrderDto = yxStoreOrderService.getOrderDetail(Long.valueOf(expressInfoDo.getOrderCode())); + lastFourNumber = yxStoreOrderDto.getUserPhone(); + if (lastFourNumber.length()==11) { + lastFourNumber = StrUtil.sub(lastFourNumber,lastFourNumber.length(),-4); + } + } + + ExpressService expressService = ExpressAutoConfiguration.expressService(); + ExpressInfo expressInfo = expressService.getExpressInfo(expressInfoDo.getOrderCode(), + expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode(),lastFourNumber); + if(!expressInfo.isSuccess()) { + throw new BadRequestException(expressInfo.getReason()); + } + return new ResponseEntity<>(expressInfo, HttpStatus.OK); + } + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/yxStoreOrder/download") + @PreAuthorize("hasAnyRole('admin','YXSTOREORDER_SELECT')") + public void download(HttpServletResponse response, + YxStoreOrderQueryCriteria criteria, + Pageable pageable, + @RequestParam(name = "orderStatus") String orderStatus, + @RequestParam(name = "orderType") String orderType, + @RequestParam(name = "listContent") String listContent) throws IOException, ParseException { + List list; + if(StringUtils.isEmpty(listContent)){ + list = (List)getYxStoreList(criteria, pageable, orderStatus, orderType).get("content"); + }else { + List idList = JSONArray.parseArray(listContent).toJavaList(String.class); + list = (List)yxStoreOrderService.queryAll(idList).get("content"); + } + yxStoreOrderService.download(list, response); + } + + /** + * 下载数据 + * @param criteria criteria + * @param pageable pageable + * @param orderStatus orderStatus + * @param orderType orderType + * @return Map + */ + private Map getYxStoreList(YxStoreOrderQueryCriteria criteria, + Pageable pageable, + String orderStatus, + String orderType){ + + YxStoreOrderQueryCriteria newCriteria = this.handleQuery(criteria,orderStatus,orderType); + return yxStoreOrderService.queryAll(newCriteria, pageable); + } + + + + /** + * 处理订单查询 + * @param criteria YxStoreOrderQueryCriteria + * @param orderStatus 订单状态 + * @param orderType 订单类型 + * @return YxStoreOrderQueryCriteria + */ + private YxStoreOrderQueryCriteria handleQuery(YxStoreOrderQueryCriteria criteria,String orderStatus, + String orderType){ + + //默认查询所有快递订单 + criteria.setShippingType(OrderInfoEnum.SHIPPIING_TYPE_1.getValue()); + //订单状态查询 + if (StrUtil.isNotEmpty(orderStatus)) { + switch (orderStatus) { + case "0": + criteria.setPaid(OrderInfoEnum.PAY_STATUS_0.getValue()); + criteria.setStatus(OrderInfoEnum.STATUS_0.getValue()); + criteria.setRefundStatus(OrderInfoEnum.REFUND_STATUS_0.getValue()); + break; + case "1": + criteria.setPaid(OrderInfoEnum.PAY_STATUS_1.getValue()); + criteria.setStatus(OrderInfoEnum.STATUS_0.getValue()); + criteria.setRefundStatus(OrderInfoEnum.REFUND_STATUS_0.getValue()); + break; + case "2": + criteria.setPaid(OrderInfoEnum.PAY_STATUS_1.getValue()); + criteria.setStatus(OrderInfoEnum.STATUS_1.getValue()); + criteria.setRefundStatus(OrderInfoEnum.REFUND_STATUS_0.getValue()); + break; + case "3": + criteria.setPaid(OrderInfoEnum.PAY_STATUS_1.getValue()); + criteria.setStatus(OrderInfoEnum.STATUS_2.getValue()); + criteria.setRefundStatus(OrderInfoEnum.REFUND_STATUS_0.getValue()); + break; + case "4": + criteria.setPaid(OrderInfoEnum.PAY_STATUS_1.getValue()); + criteria.setStatus(OrderInfoEnum.STATUS_3.getValue()); + criteria.setRefundStatus(OrderInfoEnum.REFUND_STATUS_0.getValue()); + break; + case "-1": + criteria.setPaid(OrderInfoEnum.PAY_STATUS_1.getValue()); + criteria.setRefundStatus(OrderInfoEnum.REFUND_STATUS_1.getValue()); + break; + case "-2": + criteria.setPaid(OrderInfoEnum.PAY_STATUS_1.getValue()); + criteria.setRefundStatus(OrderInfoEnum.REFUND_STATUS_2.getValue()); + break; + default: + } + } + //订单类型查询 + if (StrUtil.isNotEmpty(orderType)) { + switch (orderType) { + case "1": + criteria.setBargainId(0); + criteria.setCombinationId(0); + criteria.setSeckillId(0); + break; + case "2": + criteria.setNewCombinationId(0); + break; + case "3": + criteria.setNewSeckillId(0); + break; + case "4": + criteria.setNewBargainId(0); + break; + case "5": + criteria.setShippingType(2); + break; + case "6": + criteria.setPayIntegral(new BigDecimal("0.00")); + break; + default: + } + } + + return criteria; + } + + + +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java b/yshop-shop/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java new file mode 100644 index 0000000..af40fa3 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java @@ -0,0 +1,283 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.rest; + +import cn.hutool.core.bean.BeanUtil; +import co.yixiang.constant.ShopConstants; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.enums.SpecTypeEnum; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.category.domain.YxStoreCategory; +import co.yixiang.modules.category.service.YxStoreCategoryService; +import co.yixiang.modules.category.service.dto.YxStoreCategoryDto; +import co.yixiang.modules.product.domain.YxStoreProduct; +import co.yixiang.modules.product.domain.YxStoreProductAttrResult; +import co.yixiang.modules.product.domain.YxStoreProductAttrValue; +import co.yixiang.modules.product.service.YxStoreProductAttrResultService; +import co.yixiang.modules.product.service.YxStoreProductAttrValueService; +import co.yixiang.modules.product.service.YxStoreProductRuleService; +import co.yixiang.modules.product.service.YxStoreProductService; +import co.yixiang.modules.product.service.dto.ProductDto; +import co.yixiang.modules.product.service.dto.ProductFormatDto; +import co.yixiang.modules.product.service.dto.StoreProductDto; +import co.yixiang.modules.product.service.dto.YxStoreProductQueryCriteria; +import co.yixiang.modules.template.domain.YxShippingTemplates; +import co.yixiang.modules.template.service.YxShippingTemplatesService; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQueryChainWrapper; +import com.google.common.collect.Maps; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.BeanUtils; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author hupeng + * @date 2019-10-04 + */ +@Api(tags = "商城:商品管理") +@RestController +@RequestMapping("api") +public class StoreProductController { + + private final YxStoreProductService yxStoreProductService; + private final YxStoreCategoryService yxStoreCategoryService; + private final YxShippingTemplatesService yxShippingTemplatesService; + private final YxStoreProductRuleService yxStoreProductRuleService; + private final YxStoreProductAttrResultService yxStoreProductAttrResultService; + private final YxStoreProductAttrValueService storeProductAttrValueService; + private final IGenerator generator; + public StoreProductController(YxStoreProductService yxStoreProductService, + YxStoreCategoryService yxStoreCategoryService, + YxShippingTemplatesService yxShippingTemplatesService, + YxStoreProductRuleService yxStoreProductRuleService, + YxStoreProductAttrResultService yxStoreProductAttrResultService, YxStoreProductAttrValueService storeProductAttrValueService, IGenerator generator) { + this.yxStoreProductService = yxStoreProductService; + this.yxStoreCategoryService = yxStoreCategoryService; + this.yxShippingTemplatesService = yxShippingTemplatesService; + this.yxStoreProductRuleService = yxStoreProductRuleService; + this.yxStoreProductAttrResultService = yxStoreProductAttrResultService; + this.storeProductAttrValueService = storeProductAttrValueService; + this.generator = generator; + } + + @Log("查询商品") + @ApiOperation(value = "查询商品") + @GetMapping(value = "/yxStoreProduct") + @PreAuthorize("hasAnyRole('admin','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_SELECT')") + public ResponseEntity getYxStoreProducts(YxStoreProductQueryCriteria criteria, Pageable pageable){ + //商品分类 + List storeCategories = yxStoreCategoryService.lambdaQuery() + .eq(YxStoreCategory::getIsShow, ShopCommonEnum.SHOW_1.getValue()) + .orderByAsc(YxStoreCategory::getPid) + .list(); + List> cateList = new ArrayList<>(); + Map queryAll = yxStoreProductService.queryAll(criteria, pageable); + queryAll.put("cateList", this.makeCate(storeCategories,cateList,0,1)); + return new ResponseEntity<>(queryAll,HttpStatus.OK); + } + + @ForbidSubmit + @Log("新增/修改商品") + @ApiOperation(value = "新增/修改商品") + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true) + @PostMapping(value = "/yxStoreProduct/addOrSave") + @PreAuthorize("hasAnyRole('admin','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_CREATE')") + public ResponseEntity create(@Validated @RequestBody StoreProductDto storeProductDto){ + yxStoreProductService.insertAndEditYxStoreProduct(storeProductDto); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + + @ForbidSubmit + @Log("删除商品") + @ApiOperation(value = "删除商品") + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true) + @DeleteMapping(value = "/yxStoreProduct/{id}") + @PreAuthorize("hasAnyRole('admin','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_DELETE')") + public ResponseEntity delete(@PathVariable Long id){ + yxStoreProductService.removeById(id); + return new ResponseEntity(HttpStatus.OK); + } + + + + @ApiOperation(value = "商品上架/下架") + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true) + @PostMapping(value = "/yxStoreProduct/onsale/{id}") + public ResponseEntity onSale(@PathVariable Long id,@RequestBody String jsonStr){ + JSONObject jsonObject = JSON.parseObject(jsonStr); + Integer status = jsonObject.getInteger("status"); + yxStoreProductService.onSale(id,status); + return new ResponseEntity(HttpStatus.OK); + } + @ApiOperation(value = "生成属性(添加活动产品专用)") + @PostMapping(value = "/yxStoreProduct/isFormatAttrForActivity/{id}") + public ResponseEntity isFormatAttrForActivity(@PathVariable Long id,@RequestBody String jsonStr){ + return new ResponseEntity<>(yxStoreProductService.getFormatAttr(id,jsonStr,true),HttpStatus.OK); + } + + @ApiOperation(value = "生成属性") + @PostMapping(value = "/yxStoreProduct/isFormatAttr/{id}") + public ResponseEntity isFormatAttr(@PathVariable Long id,@RequestBody String jsonStr){ + return new ResponseEntity<>(yxStoreProductService.getFormatAttr(id,jsonStr,false),HttpStatus.OK); + } + + + + @ApiOperation(value = "获取商品信息") + @GetMapping(value = "/yxStoreProduct/info/{id}") + public ResponseEntity info(@PathVariable Long id){ + Map map = new LinkedHashMap<>(3); + + //运费模板 + List shippingTemplatesList = yxShippingTemplatesService.list(); + map.put("tempList", shippingTemplatesList); + + //商品分类 + List storeCategories = yxStoreCategoryService.lambdaQuery() + .eq(YxStoreCategory::getIsShow, ShopCommonEnum.SHOW_1.getValue()) + .orderByAsc(YxStoreCategory::getPid) + .list(); + + List> cateList = new ArrayList<>(); + map.put("cateList", this.makeCate(storeCategories,cateList,0,1)); + + //商品规格 + map.put("ruleList",yxStoreProductRuleService.list()); + + + if(id == 0){ + return new ResponseEntity<>(map,HttpStatus.OK); + } + + //处理商品详情 + YxStoreProduct yxStoreProduct = yxStoreProductService.getById(id); + ProductDto productDto = new ProductDto(); + BeanUtil.copyProperties(yxStoreProduct,productDto,"sliderImage"); + productDto.setSliderImage(Arrays.asList(yxStoreProduct.getSliderImage().split(","))); + YxStoreProductAttrResult storeProductAttrResult = yxStoreProductAttrResultService + .getOne(Wrappers.lambdaQuery() + .eq(YxStoreProductAttrResult::getProductId,id).last("limit 1")); + JSONObject result = JSON.parseObject(storeProductAttrResult.getResult()); + List attrValues = storeProductAttrValueService.list(new LambdaQueryWrapper().eq(YxStoreProductAttrValue::getProductId, yxStoreProduct.getId())); + List productFormatDtos =attrValues.stream().map(i ->{ + ProductFormatDto productFormatDto = new ProductFormatDto(); + BeanUtils.copyProperties(i,productFormatDto); + productFormatDto.setPic(i.getImage()); + return productFormatDto; + }).collect(Collectors.toList()); + if(SpecTypeEnum.TYPE_1.getValue().equals(yxStoreProduct.getSpecType())){ + productDto.setAttr(new ProductFormatDto()); + productDto.setAttrs(productFormatDtos); + productDto.setItems(result.getObject("attr",ArrayList.class)); + }else{ + + productFromat(productDto, result); + } + + map.put("productInfo",productDto); + + return new ResponseEntity<>(map,HttpStatus.OK); + } + + /** + * 获取商品属性 + * @param productDto + * @param result + */ + private void productFromat(ProductDto productDto, JSONObject result) { + Map mapAttr = (Map) result.getObject("value",ArrayList.class).get(0); + ProductFormatDto productFormatDto = ProductFormatDto.builder() + .pic(mapAttr.get("pic").toString()) + .price(Double.valueOf(mapAttr.get("price").toString())) + .cost(Double.valueOf(mapAttr.get("cost").toString())) + .otPrice(Double.valueOf(mapAttr.get("otPrice").toString())) + .stock(Integer.valueOf(mapAttr.get("stock").toString())) + .barCode(mapAttr.get("barCode").toString()) + .weight(Double.valueOf(mapAttr.get("weight").toString())) + .volume(Double.valueOf(mapAttr.get("volume").toString())) + .value1(mapAttr.get("value1").toString()) + .integral(mapAttr.get("integral") !=null ? Integer.valueOf(mapAttr.get("integral").toString()) : 0) + .brokerage(Double.valueOf(mapAttr.get("brokerage").toString())) + .brokerageTwo(Double.valueOf(mapAttr.get("brokerageTwo").toString())) + .pinkPrice(Double.valueOf(mapAttr.get("pinkPrice").toString())) + .pinkStock(Integer.valueOf(mapAttr.get("pinkStock").toString())) + .seckillPrice(Double.valueOf(mapAttr.get("seckillPrice").toString())) + .seckillStock(Integer.valueOf(mapAttr.get("seckillStock").toString())) + .build(); + productDto.setAttr(productFormatDto); + } + + + /** + * 分类递归 + * @param data 分类列表 + * @param pid 附件id + * @param level d等级 + * @return list + */ + private List> makeCate(List data,List> cateList,int pid, int level) + { + String html = "|-----"; + String newHtml = ""; + List storeCategories = yxStoreCategoryService.lambdaQuery().eq(YxStoreCategory::getPid, 0).list(); + + for (int i = 0; i < data.size(); i++) { + YxStoreCategory storeCategory = data.get(i); + int catePid = storeCategory.getPid(); + Map map = new HashMap<>(); + if(catePid == pid){ + newHtml = String.join("", Collections.nCopies(level,html)); + map.put("value",storeCategory.getId()); + map.put("label",newHtml + storeCategory.getCateName()); + if(storeCategory.getPid() == 0){ + map.put("disabled",0); + }else{ + map.put("disabled",1); + } + cateList.add(map); + data.remove(i); + + i--; + if(storeCategory.getPid() > 0){ + this.makeCate(data,cateList,storeCategory.getPid(),level); + }else{ + this.makeCate(data,cateList,storeCategory.getId(),level + 1); + } + + } + } + + + return cateList; + } + +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/product/rest/StoreProductReplyController.java b/yshop-shop/src/main/java/co/yixiang/modules/product/rest/StoreProductReplyController.java new file mode 100644 index 0000000..a246d99 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/product/rest/StoreProductReplyController.java @@ -0,0 +1,80 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.product.rest; + +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.product.domain.YxStoreProductReply; +import co.yixiang.modules.product.service.YxStoreProductReplyService; +import co.yixiang.modules.product.service.dto.YxStoreProductReplyQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Date; + +/** +* @author hupeng +* @date 2019-11-03 +*/ +@Api(tags = "商城:评论管理") +@RestController +@RequestMapping("api") +public class StoreProductReplyController { + + + private final YxStoreProductReplyService yxStoreProductReplyService; + + public StoreProductReplyController(YxStoreProductReplyService yxStoreProductReplyService) { + this.yxStoreProductReplyService = yxStoreProductReplyService; + } + + @Log("查询") + @ApiOperation(value = "查询") + @GetMapping(value = "/yxStoreProductReply") + @PreAuthorize("hasAnyRole('admin','YXSTOREPRODUCTREPLY_ALL','YXSTOREPRODUCTREPLY_SELECT')") + public ResponseEntity getYxStoreProductReplys(YxStoreProductReplyQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxStoreProductReplyService.queryAll(criteria,pageable),HttpStatus.OK); + } + + + + @Log("修改") + @ApiOperation(value = "修改") + @PutMapping(value = "/yxStoreProductReply") + @PreAuthorize("hasAnyRole('admin','YXSTOREPRODUCTREPLY_ALL','YXSTOREPRODUCTREPLY_EDIT')") + public ResponseEntity update(@Validated @RequestBody YxStoreProductReply resources){ + resources.setMerchantReplyTime(new Date()); + resources.setIsReply(ShopCommonEnum.REPLY_1.getValue()); + yxStoreProductReplyService.updateById(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除") + @ApiOperation(value = "删除") + @DeleteMapping(value = "/yxStoreProductReply/{id}") + @PreAuthorize("hasAnyRole('admin','YXSTOREPRODUCTREPLY_ALL','YXSTOREPRODUCTREPLY_DELETE')") + public ResponseEntity delete(@PathVariable Long id){ + yxStoreProductReplyService.removeById(id); + return new ResponseEntity(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/product/rest/StoreProductRuleController.java b/yshop-shop/src/main/java/co/yixiang/modules/product/rest/StoreProductRuleController.java new file mode 100644 index 0000000..0b6be56 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/product/rest/StoreProductRuleController.java @@ -0,0 +1,95 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.product.rest; + +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.product.domain.YxStoreProductRule; +import co.yixiang.modules.product.service.YxStoreProductRuleService; +import co.yixiang.modules.product.service.dto.YxStoreProductRuleDto; +import co.yixiang.modules.product.service.dto.YxStoreProductRuleQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; + +/** +* @author hupeng +* @date 2020-06-28 +*/ +@AllArgsConstructor +@Api(tags = "sku规则管理") +@RestController +@RequestMapping("/api/yxStoreProductRule") +public class StoreProductRuleController { + + private final YxStoreProductRuleService yxStoreProductRuleService; + private final IGenerator generator; + + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('admin','yxStoreProductRule:list')") + public void download(HttpServletResponse response, YxStoreProductRuleQueryCriteria criteria) throws IOException { + yxStoreProductRuleService.download(yxStoreProductRuleService.queryAll(criteria) , response); + } + + @GetMapping + @Log("查询sku规则") + @ApiOperation("查询sku规则") + @PreAuthorize("@el.check('admin','yxStoreProductRule:list')") + public ResponseEntity getYxStoreProductRules(YxStoreProductRuleQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxStoreProductRuleService.queryAll(criteria,pageable),HttpStatus.OK); + } + + + @PostMapping("/save/{id}") + @Log("新增/修改sku规则") + @ApiOperation("新增/修改sku规则") + @PreAuthorize("hasAnyRole('admin','yxStoreProductRule:add','yxStoreProductRule:edit')") + public ResponseEntity create(@Validated @RequestBody YxStoreProductRule resources,@PathVariable Integer id){ + if(id != null && id > 0){ + resources.setId(id); + yxStoreProductRuleService.updateById(resources); + }else{ + yxStoreProductRuleService.save(resources); + } + + return new ResponseEntity<>(HttpStatus.CREATED); + } + + + @ForbidSubmit + @Log("删除sku规则") + @ApiOperation("删除sku规则") + @PreAuthorize("@el.check('admin','yxStoreProductRule:del')") + @DeleteMapping + public ResponseEntity deleteAll(@RequestBody Integer[] ids) { + yxStoreProductRuleService.removeByIds(new ArrayList<>(Arrays.asList(ids))); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/sales/StoreAfterSalesController.java b/yshop-shop/src/main/java/co/yixiang/modules/sales/StoreAfterSalesController.java new file mode 100644 index 0000000..2b547bd --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/sales/StoreAfterSalesController.java @@ -0,0 +1,113 @@ +package co.yixiang.modules.sales; + +import co.yixiang.annotation.AnonymousAccess; +import co.yixiang.domain.PageResult; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.mp.service.WeixinPayService; +import co.yixiang.modules.sales.domain.StoreAfterSales; +import co.yixiang.modules.sales.param.SalesCheckDto; +import co.yixiang.modules.sales.param.YxStoreAfterSalesDto; +import co.yixiang.modules.sales.service.StoreAfterSalesService; +import co.yixiang.modules.sales.param.YxStoreAfterSalesQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; +import java.util.Map; + +/** + * @author : gzlv 2021/6/29 3:48 + */ +@Api(tags = "商城:售后管理") +@RestController +@RequestMapping("/api/yxStoreAfterSales") +@Slf4j +@SuppressWarnings("unchecked") +@AllArgsConstructor +public class StoreAfterSalesController { + + private final StoreAfterSalesService storeAfterSalesService; + private final WeixinPayService weixinPayService; + private final IGenerator generator; + + /** + * 审核 + */ + @Log("审核") + @ApiOperation("审核") + @PreAuthorize("@el.check('admin','yxStoreAfterSales:edit')") + @PostMapping(value = "/salesCheck") + public ResponseEntity salesCheck(@RequestBody SalesCheckDto salesCheckDto) { + return new ResponseEntity<>(storeAfterSalesService.salesCheck(salesCheckDto.getSalesId(), salesCheckDto.getOrderCode(), salesCheckDto.getApprovalStatus(), salesCheckDto.getConsignee(), salesCheckDto.getPhoneNumber(), salesCheckDto.getAddress()), HttpStatus.OK); + } + + /** + * 打款 + */ + @Log("打款") + @ApiOperation("打款") + @PostMapping(value = "/makeMoney") + @PreAuthorize("@el.check('admin','yxStoreAfterSales:edit')") + public ResponseEntity makeMoney(@RequestParam(value = "salesId") Long salesId, @RequestParam("orderCode") String orderCode) { + StoreAfterSales sales = storeAfterSalesService.makeMoney(salesId, orderCode); + BigDecimal bigDecimal = new BigDecimal("100"); + int payPrice = bigDecimal.multiply(sales.getRefundAmount()).intValue(); + weixinPayService.refundOrder(orderCode, payPrice); + return new ResponseEntity<>(HttpStatus.OK); + } + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('admin','yxStoreAfterSales:list')") + public void download(HttpServletResponse response, YxStoreAfterSalesQueryCriteria criteria) throws IOException { + storeAfterSalesService.download(generator.convert(storeAfterSalesService.queryAll(criteria), YxStoreAfterSalesDto.class), response); + } + + @GetMapping(value = "/sales/List") + @Log("查询售后") + @ApiOperation("查询售后") + @PreAuthorize("@el.check('admin','yxStoreAfterSales:list')") + public ResponseEntity> getYxStoreAfterSaless(YxStoreAfterSalesQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(storeAfterSalesService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增售后") + @ApiOperation("新增售后") + @PreAuthorize("@el.check('admin','yxStoreAfterSales:add')") + public ResponseEntity create(@Validated @RequestBody StoreAfterSales resources){ + return new ResponseEntity<>(storeAfterSalesService.save(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改售后") + @ApiOperation("修改售后") + @PreAuthorize("@el.check('admin','yxStoreAfterSales:edit')") + public ResponseEntity update(@Validated @RequestBody StoreAfterSales resources){ + storeAfterSalesService.updateById(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除售后") + @ApiOperation("删除售后") + @PreAuthorize("@el.check('admin','yxStoreAfterSales:del')") + @DeleteMapping + public ResponseEntity deleteAll(@RequestBody Long[] ids) { + Arrays.asList(ids).forEach(storeAfterSalesService::removeById); + return new ResponseEntity<>(HttpStatus.OK); + } + +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/services/WechatArticleService.java b/yshop-shop/src/main/java/co/yixiang/modules/services/WechatArticleService.java new file mode 100644 index 0000000..eb88c22 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/services/WechatArticleService.java @@ -0,0 +1,149 @@ +package co.yixiang.modules.services; + +import cn.hutool.core.util.ReUtil; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONUtil; +import co.yixiang.exception.ErrorRequestException; +import co.yixiang.modules.mp.service.dto.YxArticleDto; +import co.yixiang.modules.mp.config.WxMpConfiguration; +import co.yixiang.modules.mp.utils.URLUtils; +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.api.WxConsts; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.mp.bean.WxMpMassTagMessage; +import me.chanjar.weixin.mp.bean.material.WxMediaImgUploadResult; +import me.chanjar.weixin.mp.bean.material.WxMpMaterial; +import me.chanjar.weixin.mp.bean.material.WxMpMaterialNews; +import me.chanjar.weixin.mp.bean.material.WxMpMaterialUploadResult; +import me.chanjar.weixin.mp.bean.material.WxMpNewsArticle; +import me.chanjar.weixin.mp.bean.result.WxMpMassSendResult; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.util.List; + +/** + * @ClassName WechatArticleService + * @Author hupeng <610796224@qq.com> + * @Date 2020/7/2 + **/ +@Service +@Slf4j +public class WechatArticleService { + + @Value("${file.path}") + private String uploadDirStr; + + /** + * 发布微信图文 + * @param wxNewsArticleItem YxArticleDto + * @throws WxErrorException + */ + public void publish(YxArticleDto wxNewsArticleItem) throws WxErrorException { + WxMpService wxMpService = WxMpConfiguration.getWxMpService(); + + WxMpMaterialNews wxMpMaterialNews = new WxMpMaterialNews(); + + + WxMpNewsArticle article = new WxMpNewsArticle(); + + WxMpMaterialUploadResult wxMpMaterialUploadResult = uploadPhotoToWx( wxMpService, + wxNewsArticleItem.getImageInput() ); + wxNewsArticleItem.setThumbMediaId( wxMpMaterialUploadResult.getMediaId() ); + + article.setAuthor( wxNewsArticleItem.getAuthor() ); + + + //处理content + String content = processContent(wxMpService, wxNewsArticleItem.getContent()); + System.out.println(content); + article.setContent( content ); + article.setContentSourceUrl( wxNewsArticleItem.getUrl() ); + article.setDigest( wxNewsArticleItem.getSynopsis() ); + article.setShowCoverPic( true ); + article.setThumbMediaId( wxNewsArticleItem.getThumbMediaId() ); + article.setTitle( wxNewsArticleItem.getTitle() ); + //TODO 暂时注释掉,测试号没有留言权限 + //article.setNeedOpenComment( wxNewsArticleItem ); + //article.setOnlyFansCanComment( wxNewsArticleItem ); + wxMpMaterialNews.addArticle( article ); + + log.info( "wxMpMaterialNews : {}", JSONUtil.toJsonStr( wxMpMaterialNews ) ); + + WxMpMaterialUploadResult wxMpMaterialUploadResult1 = wxMpService.getMaterialService() + .materialNewsUpload( wxMpMaterialNews ); + + //推送开始 + WxMpMassTagMessage massMessage = new WxMpMassTagMessage(); + massMessage.setMsgType(WxConsts.MassMsgType.MPNEWS); + massMessage.setMediaId(wxMpMaterialUploadResult1.getMediaId()); + massMessage.setSendAll(true); + + WxMpMassSendResult massResult = wxMpService.getMassMessageService() + .massGroupMessageSend(massMessage); + if(!"0".equals(massResult.getErrorCode())) { + log.info("error:"+massResult.getErrorMsg()); + throw new ErrorRequestException("发送失败"); + } + + log.info( "massResult : {}", JSONUtil.toJsonStr( massResult ) ); + + log.info( "wxMpMaterialUploadResult : {}", JSONUtil.toJsonStr( wxMpMaterialUploadResult1 ) ); + } + + + /** + * 上传素材 + * @param wxMpService WxMpService + * @param picPath 图片路径 + * @return WxMpMaterialUploadResult + * @throws WxErrorException + */ + private WxMpMaterialUploadResult uploadPhotoToWx(WxMpService wxMpService, String picPath) throws WxErrorException { + WxMpMaterial wxMpMaterial = new WxMpMaterial(); + + String filename = String.valueOf( (int)System.currentTimeMillis() ) + ".png"; + String downloadPath = uploadDirStr + filename; + long size = HttpUtil.downloadFile(picPath, cn.hutool.core.io.FileUtil.file(downloadPath)); + picPath = downloadPath; + File picFile = new File( picPath ); + wxMpMaterial.setFile( picFile ); + wxMpMaterial.setName( picFile.getName() ); + log.info( "picFile name : {}", picFile.getName() ); + WxMpMaterialUploadResult wxMpMaterialUploadResult = wxMpService.getMaterialService().materialFileUpload( WxConsts.MediaFileType.IMAGE, wxMpMaterial ); + log.info( "wxMpMaterialUploadResult : {}", JSONUtil.toJsonStr( wxMpMaterialUploadResult ) ); + return wxMpMaterialUploadResult; + } + + /** + * 处理内容 + * @param wxMpService WxMpService + * @param content 内容 + * @return String + * @throws WxErrorException + */ + private String processContent(WxMpService wxMpService,String content) throws WxErrorException { + if(StringUtils.isBlank( content )){ + return content; + } + String imgReg = "]+src\\s*=\\s*['\"]([^'\"]+)['\"][^>]*>"; + List imgList = ReUtil.findAllGroup1( imgReg,content); + for (int j = 0; j < imgList.size(); j++) { + String imgSrc = imgList.get( j ); + String filepath = URLUtils.getParam( imgSrc,"filepath" ); + + if(StringUtils.isBlank( filepath )){//网络图片URL,需下载到本地 + String filename = System.currentTimeMillis() + ".png"; + String downloadPath = uploadDirStr + filename; + long size = HttpUtil.downloadFile(imgSrc, cn.hutool.core.io.FileUtil.file(downloadPath)); + filepath = downloadPath; + } + WxMediaImgUploadResult wxMediaImgUploadResult = wxMpService.getMaterialService().mediaImgUpload( new File(filepath) ); + content = StringUtils.replace( content,imgList.get( j ),wxMediaImgUploadResult.getUrl()); + } + return content; + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/ExpressController.java b/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/ExpressController.java new file mode 100644 index 0000000..f608f45 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/ExpressController.java @@ -0,0 +1,84 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.rest; + +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.order.domain.YxExpress; +import co.yixiang.modules.order.service.YxExpressService; +import co.yixiang.modules.order.service.dto.YxExpressQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** +* @author hupeng +* @date 2019-12-12 +*/ +@Api(tags = "商城:快递管理") +@RestController +@RequestMapping("api") +public class ExpressController { + + + private final YxExpressService yxExpressService; + + public ExpressController(YxExpressService yxExpressService) { + this.yxExpressService = yxExpressService; + } + + @Log("查询快递") + @ApiOperation(value = "查询快递") + @GetMapping(value = "/yxExpress") + @PreAuthorize("hasAnyRole('admin','YXEXPRESS_ALL','YXEXPRESS_SELECT')") + public ResponseEntity getYxExpresss(YxExpressQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxExpressService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @ForbidSubmit + @Log("新增快递") + @ApiOperation(value = "新增快递") + @PostMapping(value = "/yxExpress") + @PreAuthorize("hasAnyRole('admin','YXEXPRESS_ALL','YXEXPRESS_CREATE')") + public ResponseEntity create(@Validated @RequestBody YxExpress resources){ + return new ResponseEntity<>(yxExpressService.save(resources),HttpStatus.CREATED); + } + + @ForbidSubmit + @Log("修改快递") + @ApiOperation(value = "修改快递") + @PutMapping(value = "/yxExpress") + @PreAuthorize("hasAnyRole('admin','YXEXPRESS_ALL','YXEXPRESS_EDIT')") + public ResponseEntity update(@Validated @RequestBody YxExpress resources){ + yxExpressService.saveOrUpdate(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除快递") + @ApiOperation(value = "删除快递") + @DeleteMapping(value = "/yxExpress/{id}") + @PreAuthorize("hasAnyRole('admin','YXEXPRESS_ALL','YXEXPRESS_DELETE')") + public ResponseEntity delete(@PathVariable Integer id){ + yxExpressService.removeById(id); + return new ResponseEntity(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/MaterialController.java b/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/MaterialController.java new file mode 100644 index 0000000..d8d0e68 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/MaterialController.java @@ -0,0 +1,83 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.rest; + + +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.shop.domain.YxMaterial; +import co.yixiang.modules.shop.service.YxMaterialService; +import co.yixiang.modules.shop.service.dto.YxMaterialQueryCriteria; +import co.yixiang.utils.SecurityUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** +* @author hupeng +* @date 2020-01-09 +*/ +@Api(tags = "商城:素材管理管理") +@RestController +@RequestMapping("/api/material") +public class MaterialController { + + private final YxMaterialService yxMaterialService; + + public MaterialController(YxMaterialService yxMaterialService) { + this.yxMaterialService = yxMaterialService; + } + + + + @GetMapping(value = "/page") + @Log("查询素材管理") + @ApiOperation("查询素材管理") + public ResponseEntity getYxMaterials(YxMaterialQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxMaterialService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增素材管理") + @ApiOperation("新增素材管理") + public ResponseEntity create(@Validated @RequestBody YxMaterial resources){ + resources.setCreateId(SecurityUtils.getUsername()); + return new ResponseEntity<>(yxMaterialService.save(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改素材管理") + @ApiOperation("修改素材管理") + public ResponseEntity update(@Validated @RequestBody YxMaterial resources){ + yxMaterialService.saveOrUpdate(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除素材管理") + @ApiOperation("删除素材管理") + @DeleteMapping(value = "/{id}") + public ResponseEntity deleteAll(@PathVariable String id) { + yxMaterialService.removeById(id); + return new ResponseEntity<>(HttpStatus.OK); + } + + +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/MaterialGroupController.java b/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/MaterialGroupController.java new file mode 100644 index 0000000..dfb9a38 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/MaterialGroupController.java @@ -0,0 +1,88 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.rest; + +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.shop.domain.YxMaterialGroup; +import co.yixiang.modules.shop.service.YxMaterialGroupService; +import co.yixiang.modules.shop.service.dto.YxMaterialGroupQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** +* @author hupeng +* @date 2020-01-09 +*/ +@Api(tags = "商城:素材分组管理") +@RestController +@RequestMapping("/api/materialgroup") +public class MaterialGroupController { + + private final YxMaterialGroupService yxMaterialGroupService; + + public MaterialGroupController(YxMaterialGroupService yxMaterialGroupService) { + this.yxMaterialGroupService = yxMaterialGroupService; + } + + + + @GetMapping(value = "/page") + @Log("查询素材分组") + @ApiOperation("查询素材分组") + public ResponseEntity getYxMaterialGroups(YxMaterialGroupQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxMaterialGroupService.queryAll(criteria,pageable),HttpStatus.OK); + } + + + @GetMapping(value = "/list") + @Log("查询所有素材分组") + @ApiOperation("查询所有素材分组") + public ResponseEntity getYxMaterialGroupsList(YxMaterialGroupQueryCriteria criteria){ + return new ResponseEntity<>(yxMaterialGroupService.queryAll(criteria),HttpStatus.OK); + } + + + @PostMapping + @Log("新增素材分组") + @ApiOperation("新增素材分组") + public ResponseEntity create(@Validated @RequestBody YxMaterialGroup resources){ + return new ResponseEntity<>(yxMaterialGroupService.save(resources),HttpStatus.CREATED); + } + + @ForbidSubmit + @PutMapping + @Log("修改素材分组") + @ApiOperation("修改素材分组") + public ResponseEntity update(@Validated @RequestBody YxMaterialGroup resources){ + yxMaterialGroupService.saveOrUpdate(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除素材分组") + @ApiOperation("删除素材分组") + @DeleteMapping(value = "/{id}") + public ResponseEntity deleteAll(@PathVariable String id) { + yxMaterialGroupService.removeById(id); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/SystemConfigController.java b/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/SystemConfigController.java new file mode 100644 index 0000000..cca6989 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/SystemConfigController.java @@ -0,0 +1,104 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.rest; + +import cn.hutool.core.util.ObjectUtil; +import co.yixiang.constant.ShopConstants; +import co.yixiang.constant.SystemConfigConstants; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.shop.domain.YxSystemConfig; +import co.yixiang.modules.shop.service.YxSystemConfigService; +import co.yixiang.modules.shop.service.dto.YxSystemConfigQueryCriteria; +import co.yixiang.modules.mp.config.WxMpConfiguration; +import co.yixiang.modules.mp.config.WxPayConfiguration; +import co.yixiang.modules.mp.config.WxMaConfiguration; +import co.yixiang.utils.RedisUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** +* @author hupeng +* @date 2019-10-10 +*/ +@Api(tags = "商城:配置管理") +@RestController +@RequestMapping("api") +public class SystemConfigController { + + private final YxSystemConfigService yxSystemConfigService; + + public SystemConfigController(YxSystemConfigService yxSystemConfigService) { + this.yxSystemConfigService = yxSystemConfigService; + } + + @Log("查询") + @ApiOperation(value = "查询") + @GetMapping(value = "/yxSystemConfig") + @PreAuthorize("hasAnyRole('admin','YXSYSTEMCONFIG_ALL','YXSYSTEMCONFIG_SELECT')") + public ResponseEntity getYxSystemConfigs(YxSystemConfigQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxSystemConfigService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @ForbidSubmit + @Log("新增或修改") + @ApiOperation(value = "新增或修改") + @PostMapping(value = "/yxSystemConfig") + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true) + @PreAuthorize("hasAnyRole('admin','YXSYSTEMCONFIG_ALL','YXSYSTEMCONFIG_CREATE')") + public ResponseEntity create(@RequestBody String jsonStr){ + JSONObject jsonObject = JSON.parseObject(jsonStr); + jsonObject.forEach( + (key,value)->{ + YxSystemConfig yxSystemConfig = yxSystemConfigService.getOne(new LambdaQueryWrapper() + .eq(YxSystemConfig::getMenuName,key)); + YxSystemConfig yxSystemConfigModel = new YxSystemConfig(); + yxSystemConfigModel.setMenuName(key); + yxSystemConfigModel.setValue(value.toString()); + //重新配置微信相关 + if(SystemConfigConstants.WECHAT_APPID.equals(key)){ + WxMpConfiguration.removeWxMpService(); + WxPayConfiguration.removeWxPayService(); + WxMaConfiguration.removeWxMaService(); + } + if(SystemConfigConstants.WXPAY_MCHID.equals(key) || SystemConfigConstants.WXAPP_APPID.equals(key)){ + WxPayConfiguration.removeWxPayService(); + } + if(SystemConfigConstants.EXP_APPID.equals(key)){ + RedisUtil.del(ShopConstants.YSHOP_EXPRESS_SERVICE); + } + RedisUtil.set(key,value.toString(),0); + if(ObjectUtil.isNull(yxSystemConfig)){ + yxSystemConfigService.save(yxSystemConfigModel); + }else{ + yxSystemConfigModel.setId(yxSystemConfig.getId()); + yxSystemConfigService.saveOrUpdate(yxSystemConfigModel); + } + } + ); + + return new ResponseEntity(HttpStatus.CREATED); + } + + + +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/SystemGroupDataController.java b/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/SystemGroupDataController.java new file mode 100644 index 0000000..b50e483 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/SystemGroupDataController.java @@ -0,0 +1,181 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + */ +package co.yixiang.modules.shop.rest; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import co.yixiang.constant.ShopConstants; +import co.yixiang.exception.BadRequestException; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.shop.domain.YxSystemGroupData; +import co.yixiang.modules.shop.service.YxSystemGroupDataService; +import co.yixiang.modules.shop.service.dto.YxSystemGroupDataQueryCriteria; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + +/** + * @author hupeng + * @date 2019-10-18 + */ +@Api(tags = "商城:数据配置管理") +@RestController +@RequestMapping("api") +public class SystemGroupDataController { + + private final YxSystemGroupDataService yxSystemGroupDataService; + + public SystemGroupDataController(YxSystemGroupDataService yxSystemGroupDataService) { + this.yxSystemGroupDataService = yxSystemGroupDataService; + } + + @Log("查询数据配置") + @ApiOperation(value = "查询数据配置") + @GetMapping(value = "/yxSystemGroupData") + @PreAuthorize("hasAnyRole('admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_SELECT')") + public ResponseEntity getYxSystemGroupDatas(YxSystemGroupDataQueryCriteria criteria, + Pageable pageable) { + Sort sort = Sort.by(Sort.Direction.DESC, "sort"); + Pageable pageableT = PageRequest.of(pageable.getPageNumber(), + pageable.getPageSize(), + sort); + return new ResponseEntity<>(yxSystemGroupDataService.queryAll(criteria, pageableT), HttpStatus.OK); + } + + @ForbidSubmit + @Log("新增数据配置") + @ApiOperation(value = "新增数据配置") + @PostMapping(value = "/yxSystemGroupData") + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY, allEntries = true) + @PreAuthorize("hasAnyRole('admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_CREATE')") + public ResponseEntity create(@RequestBody String jsonStr) { + JSONObject jsonObject = JSON.parseObject(jsonStr); + this.checkParam(jsonObject); + + YxSystemGroupData yxSystemGroupData = new YxSystemGroupData(); + yxSystemGroupData.setGroupName(jsonObject.get("groupName").toString()); + jsonObject.remove("groupName"); + yxSystemGroupData.setValue(jsonObject.toJSONString()); + yxSystemGroupData.setStatus(jsonObject.getInteger("status")); + yxSystemGroupData.setSort(jsonObject.getInteger("sort")); + + List yshop_seckill_time = yxSystemGroupDataService.list(Wrappers.lambdaQuery() + .eq(YxSystemGroupData::getGroupName, "yshop_seckill_time")); + if (yxSystemGroupData.getStatus() == 1) { + yshop_seckill_time.forEach(item -> { + Map map = JSONUtil.toBean(item.getValue(), Map.class); + if (jsonObject.getInteger("time").equals(map.get("time"))) { + throw new BadRequestException("不能同时开启同一时间点"); + } + }); + } + + return new ResponseEntity<>(yxSystemGroupDataService.save(yxSystemGroupData), HttpStatus.CREATED); + } + + @ForbidSubmit + @Log("修改数据配置") + @ApiOperation(value = "修改数据配置") + @PutMapping(value = "/yxSystemGroupData") + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY, allEntries = true) + @PreAuthorize("hasAnyRole('admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT')") + public ResponseEntity update(@RequestBody String jsonStr) { + JSONObject jsonObject = JSON.parseObject(jsonStr); + this.checkParam(jsonObject); + + YxSystemGroupData yxSystemGroupData = new YxSystemGroupData(); + + yxSystemGroupData.setGroupName(jsonObject.get("groupName").toString()); + jsonObject.remove("groupName"); + yxSystemGroupData.setValue(jsonObject.toJSONString()); + yxSystemGroupData.setStatus(jsonObject.getInteger("status")); + + List yshop_seckill_time = yxSystemGroupDataService.list(Wrappers.lambdaQuery() + .eq(YxSystemGroupData::getGroupName, "yshop_seckill_time")); + if (yxSystemGroupData.getStatus() == 1 && ObjectUtil.isNotEmpty(jsonObject.getInteger("time"))) { + yshop_seckill_time.forEach(item -> { + Map map = JSONUtil.toBean(item.getValue(), Map.class); + if (jsonObject.getInteger("time").equals(map.get("time"))) { + throw new BadRequestException("不能同时开启同一时间点"); + } + }); + } + + if (jsonObject.getInteger("status") == null) { + yxSystemGroupData.setStatus(1); + } else { + yxSystemGroupData.setStatus(jsonObject.getInteger("status")); + } + + if (jsonObject.getInteger("sort") == null) { + yxSystemGroupData.setSort(0); + } else { + yxSystemGroupData.setSort(jsonObject.getInteger("sort")); + } + + + yxSystemGroupData.setId(Integer.valueOf(jsonObject.get("id").toString())); + yxSystemGroupDataService.saveOrUpdate(yxSystemGroupData); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除数据配置") + @ApiOperation(value = "删除数据配置") + @DeleteMapping(value = "/yxSystemGroupData/{id}") + @PreAuthorize("hasAnyRole('admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_DELETE')") + public ResponseEntity delete(@PathVariable Integer id) { + yxSystemGroupDataService.removeById(id); + return new ResponseEntity(HttpStatus.OK); + } + + /** + * 检测参数 + * + * @param jsonObject + */ + private void checkParam(JSONObject jsonObject) { + if (ObjectUtil.isNotNull(jsonObject.get("name"))) { + if (StrUtil.isEmpty(jsonObject.getString("name"))) { + throw new BadRequestException("名称必须填写"); + } + } + + if (ObjectUtil.isNotNull(jsonObject.get("title"))) { + if (StrUtil.isEmpty(jsonObject.getString("title"))) { + throw new BadRequestException("标题必须填写"); + } + } + + if (ObjectUtil.isNotNull(jsonObject.get("pic"))) { + if (StrUtil.isEmpty(jsonObject.getString("pic"))) { + throw new BadRequestException("图片必须上传"); + } + } + + + if (ObjectUtil.isNotNull(jsonObject.get("info"))) { + if (StrUtil.isEmpty(jsonObject.getString("info"))) { + throw new BadRequestException("简介必须填写"); + } + } + + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/SystemStoreController.java b/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/SystemStoreController.java new file mode 100644 index 0000000..3852bea --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/SystemStoreController.java @@ -0,0 +1,129 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.shop.rest; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONUtil; +import co.yixiang.constant.ShopConstants; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.exception.BadRequestException; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.shop.domain.YxSystemStore; +import co.yixiang.modules.shop.service.YxSystemStoreService; +import co.yixiang.modules.shop.service.dto.YxSystemStoreDto; +import co.yixiang.modules.shop.service.dto.YxSystemStoreQueryCriteria; +import co.yixiang.utils.RedisUtil; +import co.yixiang.utils.ShopKeyUtils; +import co.yixiang.utils.location.GetTencentLocationVO; +import co.yixiang.utils.location.LocationUtils; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; + +/** +* @author hupeng +* @date 2020-03-03 +*/ +@Api(tags = "门店管理") +@RestController +@RequestMapping("/api/yxSystemStore") +public class SystemStoreController { + + private final YxSystemStoreService yxSystemStoreService; + private final IGenerator generator; + public SystemStoreController(YxSystemStoreService yxSystemStoreService, IGenerator generator) { + this.yxSystemStoreService = yxSystemStoreService; + this.generator = generator; + } + + + @Log("所有门店") + @ApiOperation("所有门店") + @GetMapping(value = "/all") + @PreAuthorize("@el.check('yxSystemStore:list')") + public ResponseEntity getAll(YxSystemStoreQueryCriteria criteria) { + return new ResponseEntity<>(yxSystemStoreService.queryAll(criteria),HttpStatus.OK); + } + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('yxSystemStore:list')") + public void download(HttpServletResponse response, YxSystemStoreQueryCriteria criteria) throws IOException { + yxSystemStoreService.download(generator.convert(yxSystemStoreService.queryAll(criteria), YxSystemStoreDto.class), response); + } + + @GetMapping + @Log("查询门店") + @ApiOperation("查询门店") + @PreAuthorize("@el.check('yxSystemStore:list')") + public ResponseEntity getYxSystemStores(YxSystemStoreQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxSystemStoreService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping(value = "/getL") + @Log("获取经纬度") + @ApiOperation("获取经纬度") + @PreAuthorize("@el.check('yxSystemStore:getl')") + public ResponseEntity create(@Validated @RequestBody String jsonStr) { + JSONObject jsonObject = JSON.parseObject(jsonStr); + String addr = jsonObject.getString("addr"); + GetTencentLocationVO locationVO = LocationUtils.getLocation(addr); + if(locationVO.getStatus()!=0){ + throw new BadRequestException(locationVO.getMessage()); + } + return new ResponseEntity<>(locationVO, HttpStatus.CREATED); + } + + @ForbidSubmit + @PostMapping + @Log("新增门店") + @ApiOperation("新增门店") + @PreAuthorize("@el.check('yxSystemStore:add')") + public ResponseEntity create(@Validated @RequestBody YxSystemStore resources){ + return new ResponseEntity<>(yxSystemStoreService.save(resources),HttpStatus.CREATED); + } + + @ForbidSubmit + @PutMapping + @Log("修改门店") + @ApiOperation("修改门店") + @PreAuthorize("@el.check('yxSystemStore:edit')") + public ResponseEntity update(@Validated @RequestBody YxSystemStore resources){ + yxSystemStoreService.saveOrUpdate(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除门店") + @ApiOperation("删除门店") + @PreAuthorize("@el.check('yxSystemStore:del')") + @DeleteMapping + public ResponseEntity deleteAll(@RequestBody Integer[] ids) { + yxSystemStoreService.removeByIds(new ArrayList<>(Arrays.asList(ids))); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/SystemStoreStaffController.java b/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/SystemStoreStaffController.java new file mode 100644 index 0000000..20bcfd4 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/SystemStoreStaffController.java @@ -0,0 +1,109 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.rest; + +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.shop.domain.YxSystemStore; +import co.yixiang.modules.shop.domain.YxSystemStoreStaff; +import co.yixiang.modules.shop.service.YxSystemStoreService; +import co.yixiang.modules.shop.service.YxSystemStoreStaffService; +import co.yixiang.modules.shop.service.dto.YxSystemStoreStaffDto; +import co.yixiang.modules.shop.service.dto.YxSystemStoreStaffQueryCriteria; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; + +/** +* @author hupeng +* @date 2020-03-22 +*/ +@Api(tags = "门店店员管理") +@RestController +@RequestMapping("/api/yxSystemStoreStaff") +public class SystemStoreStaffController { + + private final YxSystemStoreStaffService yxSystemStoreStaffService; + private final YxSystemStoreService yxSystemStoreService; + + private final IGenerator generator; + + public SystemStoreStaffController(YxSystemStoreService yxSystemStoreService,YxSystemStoreStaffService yxSystemStoreStaffService, IGenerator generator) { + this.yxSystemStoreService = yxSystemStoreService; + this.yxSystemStoreStaffService = yxSystemStoreStaffService; + this.generator = generator; + } + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('yxSystemStoreStaff:list')") + public void download(HttpServletResponse response, YxSystemStoreStaffQueryCriteria criteria) throws IOException { + yxSystemStoreStaffService.download(generator.convert(yxSystemStoreStaffService.queryAll(criteria), YxSystemStoreStaffDto.class), response); + } + + @GetMapping + @Log("查询门店店员") + @ApiOperation("查询门店店员") + @PreAuthorize("@el.check('yxSystemStoreStaff:list')") + public ResponseEntity getYxSystemStoreStaffs(YxSystemStoreStaffQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxSystemStoreStaffService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增门店店员") + @ApiOperation("新增门店店员") + @PreAuthorize("@el.check('yxSystemStoreStaff:add')") + public ResponseEntity create(@Validated @RequestBody YxSystemStoreStaff resources){ + YxSystemStore systemStore = yxSystemStoreService.getOne(Wrappers.lambdaQuery() + .eq(YxSystemStore::getId,resources.getStoreId())); + resources.setStoreName(systemStore.getName()); + return new ResponseEntity<>(yxSystemStoreStaffService.save(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改门店店员") + @ApiOperation("修改门店店员") + @PreAuthorize("@el.check('yxSystemStoreStaff:edit')") + public ResponseEntity update(@Validated @RequestBody YxSystemStoreStaff resources){ + YxSystemStore systemStore = yxSystemStoreService.getOne(Wrappers.lambdaQuery() + .eq(YxSystemStore::getId,resources.getStoreId())); + resources.setStoreName(systemStore.getName()); + yxSystemStoreStaffService.saveOrUpdate(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除门店店员") + @ApiOperation("删除门店店员") + @PreAuthorize("@el.check('yxSystemStoreStaff:del')") + @DeleteMapping + public ResponseEntity deleteAll(@RequestBody Integer[] ids) { + yxSystemStoreStaffService.removeByIds(new ArrayList<>(Arrays.asList(ids))); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/YxAppVersionController.java b/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/YxAppVersionController.java new file mode 100644 index 0000000..0b1edd6 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/YxAppVersionController.java @@ -0,0 +1,93 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.shop.rest; + +import co.yixiang.domain.PageResult; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.shop.domain.YxAppVersion; +import co.yixiang.modules.shop.service.YxAppVersionService; +import co.yixiang.modules.shop.service.dto.YxAppVersionDto; +import co.yixiang.modules.shop.service.dto.YxAppVersionQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Arrays; + +/** +* @author lioncity +* @date 2020-12-09 +*/ +@AllArgsConstructor +@Api(tags = "app版本控制管理") +@RestController +@RequestMapping("/api/yxAppVersion") +public class YxAppVersionController { + + private final YxAppVersionService yxAppVersionService; + private final IGenerator generator; + + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('admin','yxAppVersion:list')") + public void download(HttpServletResponse response, YxAppVersionQueryCriteria criteria) throws IOException { + yxAppVersionService.download(generator.convert(yxAppVersionService.queryAll(criteria), YxAppVersionDto.class), response); + } + + @GetMapping + @Log("查询app版本控制") + @ApiOperation("查询app版本控制") + @PreAuthorize("@el.check('admin','yxAppVersion:list')") + public ResponseEntity> getYxAppVersions(YxAppVersionQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxAppVersionService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @ForbidSubmit + @PostMapping + @Log("新增app版本控制") + @ApiOperation("新增app版本控制") + @PreAuthorize("@el.check('admin','yxAppVersion:add')") + public ResponseEntity create(@Validated @RequestBody YxAppVersion resources){ + return new ResponseEntity<>(yxAppVersionService.save(resources),HttpStatus.CREATED); + } + + @ForbidSubmit + @PutMapping + @Log("修改app版本控制") + @ApiOperation("修改app版本控制") + @PreAuthorize("@el.check('admin','yxAppVersion:edit')") + public ResponseEntity update(@Validated @RequestBody YxAppVersion resources){ + yxAppVersionService.updateById(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除app版本控制") + @ApiOperation("删除app版本控制") + @PreAuthorize("@el.check('admin','yxAppVersion:del')") + @DeleteMapping + public ResponseEntity deleteAll(@RequestBody Integer[] ids) { + Arrays.asList(ids).forEach(id->{ + yxAppVersionService.removeById(id); + }); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/YxStoreProductRelationController.java b/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/YxStoreProductRelationController.java new file mode 100644 index 0000000..849ac88 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/YxStoreProductRelationController.java @@ -0,0 +1,87 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.shop.rest; +import java.util.Arrays; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.aop.ForbidSubmit; +import lombok.AllArgsConstructor; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.product.domain.YxStoreProductRelation; +import co.yixiang.modules.product.service.YxStoreProductRelationService; +import co.yixiang.modules.product.service.dto.YxStoreProductRelationQueryCriteria; +import co.yixiang.modules.product.service.dto.YxStoreProductRelationDto; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import co.yixiang.domain.PageResult; +/** + * @author hupeng + * @date 2020-09-03 + */ +@AllArgsConstructor +@Api(tags = "ProductRelation管理") +@RestController +@RequestMapping("/api/yxStoreProductRelation") +public class YxStoreProductRelationController { + + private final YxStoreProductRelationService yxStoreProductRelationService; + private final IGenerator generator; + + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('admin','yxStoreProductRelation:list')") + public void download(HttpServletResponse response, YxStoreProductRelationQueryCriteria criteria) throws IOException { + yxStoreProductRelationService.download(generator.convert(yxStoreProductRelationService.queryAll(criteria), YxStoreProductRelationDto.class), response); + } + + @GetMapping + @Log("查询ProductRelation") + @ApiOperation("查询ProductRelation") + @PreAuthorize("@el.check('admin','yxStoreProductRelation:list')") + public ResponseEntity> getYxStoreProductRelations(YxStoreProductRelationQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxStoreProductRelationService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增ProductRelation") + @ApiOperation("新增ProductRelation") + @PreAuthorize("@el.check('admin','yxStoreProductRelation:add')") + public ResponseEntity create(@Validated @RequestBody YxStoreProductRelation resources){ + return new ResponseEntity<>(yxStoreProductRelationService.save(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改ProductRelation") + @ApiOperation("修改ProductRelation") + @PreAuthorize("@el.check('admin','yxStoreProductRelation:edit')") + public ResponseEntity update(@Validated @RequestBody YxStoreProductRelation resources){ + yxStoreProductRelationService.updateById(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除ProductRelation") + @ApiOperation("删除ProductRelation") + @PreAuthorize("@el.check('admin','yxStoreProductRelation:del')") + @DeleteMapping + public ResponseEntity deleteAll(@RequestBody Long[] ids) { + Arrays.asList(ids).forEach(id->{ + yxStoreProductRelationService.removeById(id); + }); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/template/rest/ShippingTemplatesController.java b/yshop-shop/src/main/java/co/yixiang/modules/template/rest/ShippingTemplatesController.java new file mode 100644 index 0000000..2c61b12 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/template/rest/ShippingTemplatesController.java @@ -0,0 +1,131 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.template.rest; + +import co.yixiang.constant.ShopConstants; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.exception.BadRequestException; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.product.domain.YxStoreProduct; +import co.yixiang.modules.product.service.YxStoreProductService; +import co.yixiang.modules.template.domain.YxSystemCity; +import co.yixiang.modules.template.service.YxShippingTemplatesService; +import co.yixiang.modules.template.service.YxSystemCityService; +import co.yixiang.modules.template.service.dto.ShippingTemplatesDto; +import co.yixiang.modules.template.service.dto.YxShippingTemplatesDto; +import co.yixiang.modules.template.service.dto.YxShippingTemplatesQueryCriteria; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; + +/** +* @author hupeng +* @date 2020-06-29 +*/ +@AllArgsConstructor +@Api(tags = "运费模板管理") +@RestController +@RequestMapping("/api/yxShippingTemplates") +public class ShippingTemplatesController { + + private final YxShippingTemplatesService yxShippingTemplatesService; + private final YxSystemCityService yxSystemCityService; + private final IGenerator generator; + private final YxStoreProductService yxStoreProductService; + + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('admin','yxShippingTemplates:list')") + public void download(HttpServletResponse response, YxShippingTemplatesQueryCriteria criteria) throws IOException { + yxShippingTemplatesService.download(generator.convert(yxShippingTemplatesService.queryAll(criteria), YxShippingTemplatesDto.class), response); + } + + @GetMapping + @Log("查询运费模板") + @ApiOperation("查询运费模板") + @PreAuthorize("@el.check('admin','yxShippingTemplates:list')") + public ResponseEntity getYxShippingTemplatess(YxShippingTemplatesQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxShippingTemplatesService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @ForbidSubmit + @PostMapping("/save/{id}") + @Log("新增/保存运费模板") + @ApiOperation("新增/保存运费模板") + @PreAuthorize("hasAnyRole('admin','yxShippingTemplates:add','yxShippingTemplates:edit')") + public ResponseEntity create(@PathVariable Integer id, + @Validated @RequestBody ShippingTemplatesDto shippingTemplatesDto){ + yxShippingTemplatesService.addAndUpdate(id,shippingTemplatesDto); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + + @ForbidSubmit + @Log("删除运费模板") + @ApiOperation("删除运费模板") + @PreAuthorize("@el.check('admin','yxShippingTemplates:del')") + @DeleteMapping + public ResponseEntity deleteAll(@RequestBody Integer[] ids) { + List productList = yxStoreProductService.list(); + Arrays.asList(ids).forEach(id->{ + for (YxStoreProduct yxStoreProduct : productList) { + if(id.equals(yxStoreProduct.getTempId())){ + throw new BadRequestException("运费模板存在商品关联,请删除对应商品"); + } + } + yxShippingTemplatesService.removeById(id); + }); + return new ResponseEntity<>(HttpStatus.OK); + } + + + /** + * 获取城市列表 + */ + @Cacheable(cacheNames = ShopConstants.YSHOP_REDIS_SYS_CITY_KEY) + @GetMapping("/citys") + public ResponseEntity cityList() + { + List cityList = yxSystemCityService.list(Wrappers.lambdaQuery() + .eq(YxSystemCity::getParentId,0)); + + for (YxSystemCity systemCity : cityList){ + List children = yxSystemCityService.list(Wrappers + .lambdaQuery() + .eq(YxSystemCity::getParentId,systemCity.getCityId())); + + systemCity.setChildren(children); + } + + return new ResponseEntity<>(cityList,HttpStatus.OK); + } + +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/user/rest/MemberController.java b/yshop-shop/src/main/java/co/yixiang/modules/user/rest/MemberController.java new file mode 100644 index 0000000..59477a4 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/user/rest/MemberController.java @@ -0,0 +1,105 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.rest; + +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.user.domain.YxUser; +import co.yixiang.modules.user.service.YxUserService; +import co.yixiang.modules.user.service.dto.UserMoneyDto; +import co.yixiang.modules.user.service.dto.YxUserQueryCriteria; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** +* @author hupeng +* @date 2019-10-06 +*/ +@Api(tags = "商城:会员管理") +@RestController +@RequestMapping("api") +public class MemberController { + + private final YxUserService yxUserService; + + public MemberController(YxUserService yxUserService) { + this.yxUserService = yxUserService; + } + + @Log("查看下级") + @ApiOperation(value = "查看下级") + @PostMapping(value = "/yxUser/spread") + @PreAuthorize("hasAnyRole('admin','YXUSER_ALL','YXUSER_EDIT')") + public ResponseEntity getSpread(@RequestBody YxUserQueryCriteria criteria){ + return new ResponseEntity<>(yxUserService.querySpread(criteria.getUid(),criteria.getGrade()), + HttpStatus.OK); + } + + @Log("查询用户") + @ApiOperation(value = "查询用户") + @GetMapping(value = "/yxUser") + @PreAuthorize("hasAnyRole('admin','YXUSER_ALL','YXUSER_SELECT')") + public ResponseEntity getYxUsers(YxUserQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxUserService.queryAll(criteria,pageable),HttpStatus.OK); + } + + + @Log("修改用户") + @ApiOperation(value = "修改用户") + @PutMapping(value = "/yxUser") + @PreAuthorize("hasAnyRole('admin','YXUSER_ALL','YXUSER_EDIT')") + public ResponseEntity update(@Validated @RequestBody YxUser resources){ + yxUserService.saveOrUpdate(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除用户") + @ApiOperation(value = "删除用户") + @DeleteMapping(value = "/yxUser/{uid}") + @PreAuthorize("hasAnyRole('admin','YXUSER_ALL','YXUSER_DELETE')") + public ResponseEntity delete(@PathVariable Integer uid){ + yxUserService.removeById(uid); + return new ResponseEntity(HttpStatus.OK); + } + + @ForbidSubmit + @ApiOperation(value = "用户禁用启用") + @PostMapping(value = "/yxUser/onStatus/{id}") + public ResponseEntity onStatus(@PathVariable Long id,@RequestBody String jsonStr){ + JSONObject jsonObject = JSON.parseObject(jsonStr); + Integer status = jsonObject.getInteger("status"); + yxUserService.onStatus(id,status); + return new ResponseEntity(HttpStatus.OK); + } + + @ApiOperation(value = "修改余额") + @PostMapping(value = "/yxUser/money") + @PreAuthorize("hasAnyRole('admin','YXUSER_ALL','YXUSER_EDIT')") + public ResponseEntity updatePrice(@Validated @RequestBody UserMoneyDto param){ + yxUserService.updateMoney(param); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/user/rest/SystemUserLevelController.java b/yshop-shop/src/main/java/co/yixiang/modules/user/rest/SystemUserLevelController.java new file mode 100644 index 0000000..eee812b --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/user/rest/SystemUserLevelController.java @@ -0,0 +1,80 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.rest; + +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.shop.domain.YxSystemUserLevel; +import co.yixiang.modules.user.service.YxSystemUserLevelService; +import co.yixiang.modules.user.service.dto.YxSystemUserLevelQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** +* @author hupeng +* @date 2019-12-04 +*/ +@Api(tags = "商城:用户等级管理") +@RestController +@RequestMapping("api") +public class SystemUserLevelController { + + private final YxSystemUserLevelService yxSystemUserLevelService; + + public SystemUserLevelController(YxSystemUserLevelService yxSystemUserLevelService) { + this.yxSystemUserLevelService = yxSystemUserLevelService; + } + + @Log("查询") + @ApiOperation(value = "查询") + @GetMapping(value = "/yxSystemUserLevel") + @PreAuthorize("hasAnyRole('admin','YXSYSTEMUSERLEVEL_ALL','YXSYSTEMUSERLEVEL_SELECT')") + public ResponseEntity getYxSystemUserLevels(YxSystemUserLevelQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxSystemUserLevelService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @ForbidSubmit + @Log("新增") + @ApiOperation(value = "新增") + @PostMapping(value = "/yxSystemUserLevel") + @PreAuthorize("hasAnyRole('admin','YXSYSTEMUSERLEVEL_ALL','YXSYSTEMUSERLEVEL_CREATE')") + public ResponseEntity create(@Validated @RequestBody YxSystemUserLevel resources){ + return new ResponseEntity<>(yxSystemUserLevelService.save(resources),HttpStatus.CREATED); + } + + @ForbidSubmit + @Log("修改") + @ApiOperation(value = "修改") + @PutMapping(value = "/yxSystemUserLevel") + @PreAuthorize("hasAnyRole('admin','YXSYSTEMUSERLEVEL_ALL','YXSYSTEMUSERLEVEL_EDIT')") + public ResponseEntity update(@Validated @RequestBody YxSystemUserLevel resources){ + yxSystemUserLevelService.saveOrUpdate(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除") + @ApiOperation(value = "删除") + @DeleteMapping(value = "/yxSystemUserLevel/{id}") + @PreAuthorize("hasAnyRole('admin','YXSYSTEMUSERLEVEL_ALL','YXSYSTEMUSERLEVEL_DELETE')") + public ResponseEntity delete(@PathVariable Integer id){ + yxSystemUserLevelService.removeById(id); + return new ResponseEntity(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/user/rest/SystemUserTaskController.java b/yshop-shop/src/main/java/co/yixiang/modules/user/rest/SystemUserTaskController.java new file mode 100644 index 0000000..d923929 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/user/rest/SystemUserTaskController.java @@ -0,0 +1,86 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.rest; + +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.user.domain.YxSystemUserTask; +import co.yixiang.modules.user.service.YxSystemUserTaskService; +import co.yixiang.modules.user.service.dto.YxSystemUserTaskQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** +* @author hupeng +* @date 2019-12-04 +*/ +@Api(tags = "商城:用户任务管理") +@RestController +@RequestMapping("api") +public class SystemUserTaskController { + + private final YxSystemUserTaskService yxSystemUserTaskService; + + public SystemUserTaskController(YxSystemUserTaskService yxSystemUserTaskService) { + this.yxSystemUserTaskService = yxSystemUserTaskService; + } + + @Log("查询") + @ApiOperation(value = "查询") + @GetMapping(value = "/yxSystemUserTask") + @PreAuthorize("hasAnyRole('admin','YXSYSTEMUSERTASK_ALL','YXSYSTEMUSERTASK_SELECT')") + public ResponseEntity getYxSystemUserTasks(YxSystemUserTaskQueryCriteria criteria, + Pageable pageable){ + Sort sort = Sort.by(Sort.Direction.ASC, "level_id"); + Pageable pageableT = PageRequest.of(pageable.getPageNumber(), + pageable.getPageSize(), + sort); + return new ResponseEntity(yxSystemUserTaskService.queryAll(criteria,pageableT), + HttpStatus.OK); + } + + @Log("新增") + @ApiOperation(value = "新增") + @PostMapping(value = "/yxSystemUserTask") + @PreAuthorize("hasAnyRole('admin','YXSYSTEMUSERTASK_ALL','YXSYSTEMUSERTASK_CREATE')") + public ResponseEntity create(@Validated @RequestBody YxSystemUserTask resources){ + return new ResponseEntity(yxSystemUserTaskService.save(resources),HttpStatus.CREATED); + } + + @Log("修改") + @ApiOperation(value = "修改") + @PutMapping(value = "/yxSystemUserTask") + @PreAuthorize("hasAnyRole('admin','YXSYSTEMUSERTASK_ALL','YXSYSTEMUSERTASK_EDIT')") + public ResponseEntity update(@Validated @RequestBody YxSystemUserTask resources){ + //if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作"); + yxSystemUserTaskService.saveOrUpdate(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + @Log("删除") + @ApiOperation(value = "删除") + @DeleteMapping(value = "/yxSystemUserTask/{id}") + @PreAuthorize("hasAnyRole('admin','YXSYSTEMUSERTASK_ALL','YXSYSTEMUSERTASK_DELETE')") + public ResponseEntity delete(@PathVariable Integer id){ + //if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作"); + yxSystemUserTaskService.removeById(id); + return new ResponseEntity(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/user/rest/UserBillController.java b/yshop-shop/src/main/java/co/yixiang/modules/user/rest/UserBillController.java new file mode 100644 index 0000000..002fec3 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/user/rest/UserBillController.java @@ -0,0 +1,52 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.user.rest; + +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.user.service.YxUserBillService; +import co.yixiang.modules.user.service.dto.YxUserBillQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** +* @author hupeng +* @date 2019-11-06 +*/ +@Api(tags = "商城:用户账单管理") +@RestController +@RequestMapping("api") +public class UserBillController { + + private final YxUserBillService yxUserBillService; + + public UserBillController(YxUserBillService yxUserBillService) { + this.yxUserBillService = yxUserBillService; + } + + @Log("查询") + @ApiOperation(value = "查询") + @GetMapping(value = "/yxUserBill") + @PreAuthorize("hasAnyRole('admin','YXUSERBILL_ALL','YXUSERBILL_SELECT')") + public ResponseEntity getYxUserBills(YxUserBillQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxUserBillService.queryAll(criteria,pageable),HttpStatus.OK); + } + + + + + + +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/user/rest/UserRechargeController.java b/yshop-shop/src/main/java/co/yixiang/modules/user/rest/UserRechargeController.java new file mode 100644 index 0000000..f8cf69f --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/user/rest/UserRechargeController.java @@ -0,0 +1,75 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.user.rest; + +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.user.service.YxUserRechargeService; +import co.yixiang.modules.user.service.dto.YxUserRechargeDto; +import co.yixiang.modules.user.service.dto.YxUserRechargeQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; + +/** +* @author hupeng +* @date 2020-03-02 +*/ +@Api(tags = "充值管理管理") +@RestController +@RequestMapping("/api/yxUserRecharge") +public class UserRechargeController { + + private final YxUserRechargeService yxUserRechargeService; + private final IGenerator generator; + public UserRechargeController(YxUserRechargeService yxUserRechargeService, IGenerator generator) { + this.yxUserRechargeService = yxUserRechargeService; + this.generator = generator; + } + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('yxUserRecharge:list')") + public void download(HttpServletResponse response, YxUserRechargeQueryCriteria criteria) throws IOException { + yxUserRechargeService.download(generator.convert(yxUserRechargeService.queryAll(criteria), YxUserRechargeDto.class), response); + } + + @GetMapping + @Log("查询充值管理") + @ApiOperation("查询充值管理") + @PreAuthorize("@el.check('yxUserRecharge:list')") + public ResponseEntity getYxUserRecharges(YxUserRechargeQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxUserRechargeService.queryAll(criteria,pageable),HttpStatus.OK); + } + + + + + @ForbidSubmit + @Log("删除充值管理") + @ApiOperation("删除充值管理") + @PreAuthorize("@el.check('yxUserRecharge:del')") + @DeleteMapping + public ResponseEntity deleteAll(@RequestBody Integer[] ids) { + yxUserRechargeService.removeByIds(new ArrayList<>(Arrays.asList(ids))); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/WechatArticleController.java b/yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/WechatArticleController.java new file mode 100644 index 0000000..bfa69d6 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/WechatArticleController.java @@ -0,0 +1,100 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.wechat.rest; + +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.services.WechatArticleService; +import co.yixiang.modules.mp.domain.YxArticle; +import co.yixiang.modules.mp.service.YxArticleService; +import co.yixiang.modules.mp.service.dto.YxArticleDto; +import co.yixiang.modules.mp.service.dto.YxArticleQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.BeanUtils; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** +* @author hupeng +* @date 2019-10-07 +*/ +@Api(tags = "商城:微信图文管理") +@RestController +@RequestMapping("api") +public class WechatArticleController { + + private final YxArticleService yxArticleService; + private final WechatArticleService wechatArticleService; + + public WechatArticleController(YxArticleService yxArticleService,WechatArticleService wechatArticleService) { + this.yxArticleService = yxArticleService; + this.wechatArticleService = wechatArticleService; + } + + @ApiOperation(value = "查询单条信息") + @GetMapping(value = "/yxArticle/info/{id}") + @PreAuthorize("hasAnyRole('admin','YXARTICLE_ALL','YXARTICLE_GET')") + public ResponseEntity getInfo(@PathVariable Integer id){ + return new ResponseEntity<>(yxArticleService.getById(id),HttpStatus.OK); + } + + @ApiOperation(value = "查询") + @GetMapping(value = "/yxArticle") + @PreAuthorize("hasAnyRole('admin','YXARTICLE_ALL','YXARTICLE_SELECT')") + public ResponseEntity getYxArticles(YxArticleQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxArticleService.queryAll(criteria,pageable),HttpStatus.OK); + } + + + @ApiOperation(value = "新增") + @PostMapping(value = "/yxArticle") + @PreAuthorize("hasAnyRole('admin','YXARTICLE_ALL','YXARTICLE_CREATE')") + public ResponseEntity create(@Validated @RequestBody YxArticle resources){ + return new ResponseEntity<>(yxArticleService.save(resources),HttpStatus.CREATED); + } + + + @ApiOperation(value = "修改") + @PutMapping(value = "/yxArticle") + @PreAuthorize("hasAnyRole('admin','YXARTICLE_ALL','YXARTICLE_EDIT')") + public ResponseEntity update(@Validated @RequestBody YxArticle resources){ + yxArticleService.saveOrUpdate(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @ApiOperation(value = "删除") + @DeleteMapping(value = "/yxArticle/{id}") + @PreAuthorize("hasAnyRole('admin','YXARTICLE_ALL','YXARTICLE_DELETE')") + public ResponseEntity delete(@PathVariable Integer id){ + yxArticleService.removeById(id); + return new ResponseEntity(HttpStatus.OK); + } + + @ForbidSubmit + @ApiOperation(value = "发布文章") + @GetMapping(value = "/yxArticle/publish/{id}") + @PreAuthorize("hasAnyRole('admin','YXARTICLE_ALL','YXARTICLE_DELETE')") + public ResponseEntity publish(@PathVariable Integer id) throws Exception{ + YxArticleDto yxArticleDTO= new YxArticleDto(); + YxArticle yxArticle = yxArticleService.getById(id); + BeanUtils.copyProperties(yxArticle,yxArticleDTO); + wechatArticleService.publish(yxArticleDTO); + return new ResponseEntity(HttpStatus.OK); + } + +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/WechatMenuController.java b/yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/WechatMenuController.java new file mode 100644 index 0000000..c5b4f16 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/WechatMenuController.java @@ -0,0 +1,96 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.wechat.rest; + + +import co.yixiang.constant.ShopConstants; +import co.yixiang.exception.BadRequestException; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.mp.domain.YxWechatMenu; +import co.yixiang.modules.mp.service.YxWechatMenuService; +import co.yixiang.modules.mp.config.WxMpConfiguration; +import co.yixiang.utils.OrderUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import me.chanjar.weixin.common.bean.menu.WxMenu; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.mp.api.WxMpService; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** +* @author hupeng +* @date 2019-10-06 +*/ +@Api(tags = "商城:微信菜單") +@RestController +@RequestMapping("api") +@SuppressWarnings("unchecked") +public class WechatMenuController { + + private final YxWechatMenuService YxWechatMenuService; + + public WechatMenuController(YxWechatMenuService YxWechatMenuService) { + this.YxWechatMenuService = YxWechatMenuService; + } + + @ApiOperation(value = "查询菜单") + @GetMapping(value = "/YxWechatMenu") + @PreAuthorize("hasAnyRole('admin','YxWechatMenu_ALL','YxWechatMenu_SELECT')") + public ResponseEntity getYxWechatMenus(){ + return new ResponseEntity(YxWechatMenuService.getOne(new LambdaQueryWrapper() + .eq(YxWechatMenu::getKey,ShopConstants.WECHAT_MENUS)),HttpStatus.OK); + } + + @ForbidSubmit + @ApiOperation(value = "创建菜单") + @PostMapping(value = "/YxWechatMenu") + @PreAuthorize("hasAnyRole('admin','YxWechatMenu_ALL','YxWechatMenu_CREATE')") + public ResponseEntity create( @RequestBody String jsonStr){ + JSONObject jsonObject = JSON.parseObject(jsonStr); + String jsonButton = jsonObject.get("buttons").toString(); + YxWechatMenu YxWechatMenu = new YxWechatMenu(); + Boolean isExist = YxWechatMenuService.isExist(ShopConstants.WECHAT_MENUS); + WxMenu menu = JSONObject.parseObject(jsonStr,WxMenu.class); + + WxMpService wxService = WxMpConfiguration.getWxMpService(); + if(isExist){ + YxWechatMenu.setKey(ShopConstants.WECHAT_MENUS); + YxWechatMenu.setResult(jsonButton); + YxWechatMenuService.saveOrUpdate(YxWechatMenu); + }else { + YxWechatMenu.setKey(ShopConstants.WECHAT_MENUS); + YxWechatMenu.setResult(jsonButton); + YxWechatMenu.setAddTime(OrderUtil.getSecondTimestampTwo()); + YxWechatMenuService.save(YxWechatMenu); + } + + + //创建菜单 + try { + wxService.getMenuService().menuDelete(); + wxService.getMenuService().menuCreate(menu); + } catch (WxErrorException e) { + throw new BadRequestException(e.getMessage()); + // e.printStackTrace(); + } + + return new ResponseEntity(HttpStatus.OK); + } + + + + +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/WechatReplyController.java b/yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/WechatReplyController.java new file mode 100644 index 0000000..1176e93 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/WechatReplyController.java @@ -0,0 +1,74 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.wechat.rest; + +import cn.hutool.core.util.ObjectUtil; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.mp.domain.YxWechatReply; +import co.yixiang.modules.mp.service.YxWechatReplyService; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** +* @author hupeng +* @date 2019-10-10 +*/ +@Api(tags = "商城:微信回復管理") +@RestController +@RequestMapping("api") +public class WechatReplyController { + + private final YxWechatReplyService yxWechatReplyService; + + public WechatReplyController(YxWechatReplyService yxWechatReplyService) { + this.yxWechatReplyService = yxWechatReplyService; + } + + @ApiOperation(value = "查询") + @GetMapping(value = "/yxWechatReply") + @PreAuthorize("@el.check('admin','YXWECHATREPLY_ALL','YXWECHATREPLY_SELECT')") + public ResponseEntity getYxWechatReplys(){ + return new ResponseEntity<>(yxWechatReplyService.isExist("subscribe"),HttpStatus.OK); + } + + + @ForbidSubmit + @ApiOperation(value = "新增自动回复") + @PostMapping(value = "/yxWechatReply") + @PreAuthorize("@el.check('admin','YXWECHATREPLY_ALL','YXWECHATREPLY_CREATE')") + public ResponseEntity create(@RequestBody String jsonStr){ + JSONObject jsonObject = JSON.parseObject(jsonStr); + YxWechatReply yxWechatReply = new YxWechatReply(); + YxWechatReply isExist = yxWechatReplyService.isExist(jsonObject.get("key").toString()); + yxWechatReply.setKey(jsonObject.get("key").toString()); + yxWechatReply.setStatus(Integer.valueOf(jsonObject.get("status").toString())); + yxWechatReply.setData(jsonObject.get("data").toString()); + yxWechatReply.setType(jsonObject.get("type").toString()); + if(ObjectUtil.isNull(isExist)){ + yxWechatReplyService.create(yxWechatReply); + }else{ + yxWechatReply.setId(isExist.getId()); + yxWechatReplyService.upDate(yxWechatReply); + } + + return new ResponseEntity(HttpStatus.CREATED); + } + + + + + +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/WechatTemplateController.java b/yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/WechatTemplateController.java new file mode 100644 index 0000000..36c1c6b --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/WechatTemplateController.java @@ -0,0 +1,88 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.wechat.rest; + +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.mp.domain.YxWechatTemplate; +import co.yixiang.modules.mp.service.YxWechatTemplateService; +import co.yixiang.modules.mp.service.dto.YxWechatTemplateDto; +import co.yixiang.modules.mp.service.dto.YxWechatTemplateQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** +* @author hupeng +* @date 2019-12-10 +*/ +@Api(tags = "商城:微信模板管理") +@RestController +@RequestMapping("/api/yxWechatTemplate") +@AllArgsConstructor +public class WechatTemplateController { + + + private final YxWechatTemplateService yxWechatTemplateService; + private final IGenerator generator; + + + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('admin','yxWechatTemplate:list')") + public void download(HttpServletResponse response, YxWechatTemplateQueryCriteria criteria) throws IOException { + yxWechatTemplateService.download(generator.convert(yxWechatTemplateService.queryAll(criteria), YxWechatTemplateDto.class), response); + } + + @GetMapping + @ApiOperation("查询微信模板消息") + @PreAuthorize("@el.check('admin','yxWechatTemplate:list')") + public ResponseEntity getYxWechatTemplates(YxWechatTemplateQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxWechatTemplateService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @ForbidSubmit + @PostMapping + @ApiOperation("新增微信模板消息") + @PreAuthorize("@el.check('admin','yxWechatTemplate:add')") + public ResponseEntity create(@Validated @RequestBody YxWechatTemplate resources){ + return new ResponseEntity<>(yxWechatTemplateService.save(resources),HttpStatus.CREATED); + } + + @ForbidSubmit + @PutMapping + @ApiOperation("修改微信模板消息") + @PreAuthorize("@el.check('admin','yxWechatTemplate:edit')") + public ResponseEntity update(@Validated @RequestBody YxWechatTemplate resources){ + yxWechatTemplateService.updateById(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @ApiOperation("删除微信模板消息") + @PreAuthorize("@el.check('admin','yxWechatTemplate:del')") + @DeleteMapping("/{id}") + public ResponseEntity deleteAll(@PathVariable Integer id) { + yxWechatTemplateService.removeById(id); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/YxWechatLiveController.java b/yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/YxWechatLiveController.java new file mode 100644 index 0000000..dc9a29e --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/YxWechatLiveController.java @@ -0,0 +1,122 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.wechat.rest; + +import co.yixiang.constant.ShopConstants; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.mp.domain.YxWechatLive; +import co.yixiang.modules.mp.service.YxWechatLiveService; +import co.yixiang.modules.mp.service.dto.UpdateGoodsDto; +import co.yixiang.modules.mp.service.dto.YxWechatLiveDto; +import co.yixiang.modules.mp.service.dto.YxWechatLiveQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Arrays; + +/** +* @author hupeng +* @date 2020-08-10 +*/ +@AllArgsConstructor +@Api(tags = "wxlive管理") +@RestController +@RequestMapping("/api/yxWechatLive") +public class YxWechatLiveController { + + private final YxWechatLiveService yxWechatLiveService; + private final IGenerator generator; + + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('admin','yxWechatLive:list')") + public void download(HttpServletResponse response, YxWechatLiveQueryCriteria criteria) throws IOException { + yxWechatLiveService.download(generator.convert(yxWechatLiveService.queryAll(criteria), YxWechatLiveDto.class), response); + } + + @GetMapping + @Log("查询wxlive") + @ApiOperation("查询wxlive") + @PreAuthorize("@el.check('admin','yxWechatLive:list')") + public ResponseEntity getYxWechatLives(YxWechatLiveQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxWechatLiveService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true) + @ForbidSubmit + @PostMapping + @Log("新增wxlive") + @ApiOperation("新增wxlive") + @PreAuthorize("@el.check('admin','yxWechatLive:add')") + public ResponseEntity create(@Validated @RequestBody YxWechatLive resources){ + return new ResponseEntity<>(yxWechatLiveService.saveLive(resources),HttpStatus.CREATED); + } + + + @ForbidSubmit + @PostMapping("/addGoods") + @Log("添加商品") + @ApiOperation("添加商品") + @PreAuthorize("@el.check('admin','yxWechatLive:add')") + public ResponseEntity addGoods(@Validated @RequestBody UpdateGoodsDto resources){ + return new ResponseEntity<>(yxWechatLiveService.addGoods(resources),HttpStatus.CREATED); + } + + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true) + @ForbidSubmit + @PutMapping + @Log("修改wxlive") + @ApiOperation("修改wxlive") + @PreAuthorize("@el.check('admin','yxWechatLive:edit')") + public ResponseEntity update(@Validated @RequestBody YxWechatLive resources){ + yxWechatLiveService.updateById(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true) + @ForbidSubmit + @Log("删除wxlive") + @ApiOperation("删除wxlive") + @PreAuthorize("@el.check('admin','yxWechatLive:del')") + @DeleteMapping + public ResponseEntity deleteAll(@RequestBody Long[] ids) { + Arrays.asList(ids).forEach(id->{ + yxWechatLiveService.removeById(id); + }); + return new ResponseEntity<>(HttpStatus.OK); + } + + @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true) + @ApiOperation("同步数据") + @GetMapping("/synchro") + public ResponseEntity synchroWxOlLive() { + yxWechatLiveService.synchroWxOlLive(); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/YxWechatLiveGoodsController.java b/yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/YxWechatLiveGoodsController.java new file mode 100644 index 0000000..91eb795 --- /dev/null +++ b/yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/YxWechatLiveGoodsController.java @@ -0,0 +1,104 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.wechat.rest; + +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.modules.aop.ForbidSubmit; +import co.yixiang.modules.mp.domain.YxWechatLiveGoods; +import co.yixiang.modules.mp.service.YxWechatLiveGoodsService; +import co.yixiang.modules.mp.service.dto.YxWechatLiveGoodsDto; +import co.yixiang.modules.mp.service.dto.YxWechatLiveGoodsQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Arrays; + +/** +* @author hupeng +* @date 2020-08-11 +*/ +@AllArgsConstructor +@Api(tags = "yxWechatLiveGoods管理") +@RestController +@RequestMapping("/api/yxWechatLiveGoods") +public class YxWechatLiveGoodsController { + + private final YxWechatLiveGoodsService yxWechatLiveGoodsService; + private final IGenerator generator; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('admin','yxWechatLiveGoods:list')") + public void download(HttpServletResponse response, YxWechatLiveGoodsQueryCriteria criteria) throws IOException { + yxWechatLiveGoodsService.download(generator.convert(yxWechatLiveGoodsService.queryAll(criteria), YxWechatLiveGoodsDto.class), response); + } + + @GetMapping + @Log("查询yxWechatLiveGoods") + @ApiOperation("查询yxWechatLiveGoods") + @PreAuthorize("@el.check('admin','yxWechatLiveGoods:list')") + public ResponseEntity getYxWechatLiveGoodss(YxWechatLiveGoodsQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(yxWechatLiveGoodsService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @ForbidSubmit + @PostMapping + @Log("新增yxWechatLiveGoods") + @ApiOperation("新增yxWechatLiveGoods") + @PreAuthorize("@el.check('admin','yxWechatLiveGoods:add')") + public ResponseEntity create(@Validated @RequestBody YxWechatLiveGoods resources){ + return new ResponseEntity<>(yxWechatLiveGoodsService.saveGoods(resources),HttpStatus.CREATED); + } + + @ForbidSubmit + @PutMapping + @Log("修改yxWechatLiveGoods") + @ApiOperation("修改yxWechatLiveGoods") + @PreAuthorize("@el.check('admin','yxWechatLiveGoods:edit')") + public ResponseEntity update(@Validated @RequestBody YxWechatLiveGoods resources){ + yxWechatLiveGoodsService.updateGoods(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @ForbidSubmit + @Log("删除yxWechatLiveGoods") + @ApiOperation("删除yxWechatLiveGoods") + @PreAuthorize("@el.check('admin','yxWechatLiveGoods:del')") + @DeleteMapping + public ResponseEntity deleteAll(@RequestBody Long[] ids) { + Arrays.asList(ids).forEach(id->{ + yxWechatLiveGoodsService.removeGoods(id); + }); + return new ResponseEntity<>(HttpStatus.OK); + } + + @ApiOperation("同步数据") + @PostMapping("/synchro") + public ResponseEntity synchroWxOlLiveGoods(@RequestBody Integer[] ids) { + yxWechatLiveGoodsService.synchroWxOlLive(Arrays.asList(ids)); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-tools/pom.xml b/yshop-tools/pom.xml new file mode 100644 index 0000000..5ccb3f8 --- /dev/null +++ b/yshop-tools/pom.xml @@ -0,0 +1,50 @@ + + + + yshop + co.yixiang + 3.2 + + 4.0.0 + + yshop-tools + 工具模块 + + + 1.4.7 + [7.2.0, 7.2.99] + 3.1.0 + + + + + + co.yixiang + yshop-logging + 3.2 + + + + + javax.mail + mail + ${mail.version} + + + + + com.qiniu + qiniu-java-sdk + ${qiniu.version} + + + + + com.alipay.sdk + alipay-sdk-java + ${alipay.version} + + + diff --git a/yshop-tools/src/main/java/co/yixiang/tools/config/MultipartConfig.java b/yshop-tools/src/main/java/co/yixiang/tools/config/MultipartConfig.java new file mode 100644 index 0000000..67d8bca --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/config/MultipartConfig.java @@ -0,0 +1,36 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.config; + +import org.springframework.boot.web.servlet.MultipartConfigFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import javax.servlet.MultipartConfigElement; +import java.io.File; + +/** + * @date 2018-12-28 + * @author https://blog.csdn.net/llibin1024530411/article/details/79474953 + */ +@Configuration(proxyBeanMethods = false) +public class MultipartConfig { + + /** + * 文件上传临时路径 + */ + @Bean + MultipartConfigElement multipartConfigElement() { + MultipartConfigFactory factory = new MultipartConfigFactory(); + String location = System.getProperty("user.home") + "/.yshop/file/tmp"; + File tmpFile = new File(location); + if (!tmpFile.exists()) { + tmpFile.mkdirs(); + } + factory.setLocation(location); + return factory.createMultipartConfig(); + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/domain/AlipayConfig.java b/yshop-tools/src/main/java/co/yixiang/tools/domain/AlipayConfig.java new file mode 100644 index 0000000..e0af7ec --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/domain/AlipayConfig.java @@ -0,0 +1,85 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-13 +*/ + +@Data +@TableName("alipay_config") +public class AlipayConfig implements Serializable { + + /** 主键 */ + @TableId + //@GeneratedValue(strategy = GenerationType.IDENTITY) + // @Column(name = "id") + private Long id; + + + /** 应用ID */ + // @Column(name = "app_id") + private String appId; + + + /** 编码 */ + // @Column(name = "charset") + private String charset; + + + /** 类型 固定格式json */ + // @Column(name = "format") + private String format; + + + /** 网关地址 */ + // @Column(name = "gateway_url") + private String gatewayUrl; + + + /** 异步回调 */ + // @Column(name = "notify_url") + private String notifyUrl; + + + /** 私钥 */ + // @Column(name = "private_key") + private String privateKey; + + + /** 公钥 */ + // @Column(name = "public_key") + private String publicKey; + + + /** 回调地址 */ + // @Column(name = "return_url") + private String returnUrl; + + + /** 签名方式 */ + // @Column(name = "sign_type") + private String signType; + + + /** 商户号 */ + // @Column(name = "sys_service_provider_id") + private String sysServiceProviderId; + + + public void copy(AlipayConfig source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/domain/EmailConfig.java b/yshop-tools/src/main/java/co/yixiang/tools/domain/EmailConfig.java new file mode 100644 index 0000000..b3300b1 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/domain/EmailConfig.java @@ -0,0 +1,60 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-13 +*/ + +@Data +@TableName("email_config") +public class EmailConfig implements Serializable { + + /** ID */ + @TableId + //@GeneratedValue(strategy = GenerationType.IDENTITY) + // @Column(name = "id") + private Long id; + + + /** 收件人 */ + // @Column(name = "from_user") + private String fromUser; + + + /** 邮件服务器SMTP地址 */ + // @Column(name = "host") + private String host; + + + /** 密码 */ + // @Column(name = "pass") + private String pass; + + + /** 端口 */ + // @Column(name = "port") + private String port; + + + /** 发件者用户名 */ + // @Column(name = "user") + private String user; + + + public void copy(EmailConfig source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/domain/LocalStorage.java b/yshop-tools/src/main/java/co/yixiang/tools/domain/LocalStorage.java new file mode 100644 index 0000000..ab737e3 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/domain/LocalStorage.java @@ -0,0 +1,90 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @author hupeng +* @date 2020-05-13 +*/ + +@Getter +@Setter +@TableName("local_storage") +public class LocalStorage implements Serializable { + + @TableId + //@GeneratedValue(strategy = GenerationType.IDENTITY) + // @Column(name = "id") + private Long id; + + + /** 文件真实的名称 */ + // @Column(name = "real_name") + private String realName; + + + /** 文件名 */ + // @Column(name = "name") + private String name; + + + /** 后缀 */ + // @Column(name = "suffix") + private String suffix; + + + /** 路径 */ + // @Column(name = "path") + private String path; + + + /** 类型 */ + // @Column(name = "type") + private String type; + + + /** 大小 */ + // @Column(name = "size") + private String size; + + + /** 操作人 */ + // @Column(name = "operate") + private String operate; + + + /** 创建日期 */ + // @Column(name = "create_time") + @TableField(fill= FieldFill.INSERT) + private Timestamp createTime; + + + public LocalStorage(String realName,String name, String suffix, String path, String type, String size, String operate) { + this.realName = realName; + this.name = name; + this.suffix = suffix; + this.path = path; + this.type = type; + this.size = size; + this.operate = operate; + } + + public void copy(LocalStorage source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/domain/Picture.java b/yshop-tools/src/main/java/co/yixiang/tools/domain/Picture.java new file mode 100644 index 0000000..df95062 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/domain/Picture.java @@ -0,0 +1,83 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @author hupeng +* @date 2020-05-13 +*/ + +@Data +@TableName("picture") +public class Picture implements Serializable { + + /** ID */ + @TableId + //@GeneratedValue(strategy = GenerationType.IDENTITY) + // @Column(name = "id") + private Long id; + + + /** 上传日期 */ + // @Column(name = "create_time") + @TableField(fill= FieldFill.INSERT) + private Timestamp createTime; + + + /** 删除的URL */ + // @Column(name = "delete_url") + private String deleteUrl; + + + /** 图片名称 */ + // @Column(name = "filename") + private String filename; + + + /** 图片高度 */ + // @Column(name = "height") + private String height; + + + /** 图片大小 */ + // @Column(name = "size") + private String size; + + + /** 图片地址 */ + // @Column(name = "url") + private String url; + + + /** 用户名称 */ + // @Column(name = "username") + private String username; + + + /** 图片宽度 */ + // @Column(name = "width") + private String width; + + + /** 文件的MD5值 */ + // @Column(name = "md5code") + private String md5code; + + public void copy(Picture source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/domain/QiniuConfig.java b/yshop-tools/src/main/java/co/yixiang/tools/domain/QiniuConfig.java new file mode 100644 index 0000000..a4bc50e --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/domain/QiniuConfig.java @@ -0,0 +1,65 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-13 +*/ + +@Data +@TableName("qiniu_config") +public class QiniuConfig implements Serializable { + + /** ID */ + @TableId + //@GeneratedValue(strategy = GenerationType.IDENTITY) + // @Column(name = "id") + private Long id; + + + /** accessKey */ + // @Column(name = "access_key") + private String accessKey; + + + /** Bucket 识别符 */ + // @Column(name = "bucket") + private String bucket; + + + /** 外链域名 */ + // @Column(name = "host",nullable = false) + private String host; + + + /** secretKey */ + // @Column(name = "secret_key") + private String secretKey; + + + /** 空间类型 */ + // @Column(name = "type") + private String type; + + + /** 机房 */ + // @Column(name = "zone") + private String zone; + + + public void copy(QiniuConfig source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/domain/QiniuContent.java b/yshop-tools/src/main/java/co/yixiang/tools/domain/QiniuContent.java new file mode 100644 index 0000000..698b320 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/domain/QiniuContent.java @@ -0,0 +1,73 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @author hupeng +* @date 2020-05-13 +*/ + +@Data +@TableName("qiniu_content") +public class QiniuContent implements Serializable { + + /** ID */ + @TableId + //@GeneratedValue(strategy = GenerationType.IDENTITY) + // @Column(name = "id") + private Long id; + + + /** Bucket 识别符 */ + // @Column(name = "bucket") + private String bucket; + + + /** 文件名称 */ + @TableField("name") + private String name; + + + /** 文件大小 */ + // @Column(name = "size") + private String size; + + + /** 文件类型:私有或公开 */ + // @Column(name = "type") + private String type; + + + /** 上传或同步的时间 */ + // @Column(name = "update_time") + @TableField(fill= FieldFill.INSERT_UPDATE) + private Timestamp updateTime; + + + /** 文件url */ + // @Column(name = "url") + private String url; + + + // @Column(name = "suffix") + private String suffix; + + + public void copy(QiniuContent source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/domain/VerificationCode.java b/yshop-tools/src/main/java/co/yixiang/tools/domain/VerificationCode.java new file mode 100644 index 0000000..b6187ff --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/domain/VerificationCode.java @@ -0,0 +1,59 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.domain; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * @author hupeng + * @date 2018-12-26 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@TableName("verification_code") +public class VerificationCode implements Serializable { + + @TableId + //@GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private String code; + + /** 使用场景,自己定义 */ + private String scenes; + + /** true 为有效,false 为无效,验证时状态+时间+具体的邮箱或者手机号 */ + private Boolean status = true; + + /** 类型 :phone 和 email */ + private String type; + + /** 具体的phone与email */ + private String value; + + /** 创建日期 */ + @TableField(fill= FieldFill.INSERT) + // @Column(name = "create_time") + private Timestamp createTime; + + public VerificationCode(String code, String scenes, @NotBlank String type, @NotBlank String value) { + this.code = code; + this.scenes = scenes; + this.type = type; + this.value = value; + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/domain/vo/EmailVo.java b/yshop-tools/src/main/java/co/yixiang/tools/domain/vo/EmailVo.java new file mode 100644 index 0000000..7adf432 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/domain/vo/EmailVo.java @@ -0,0 +1,35 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.domain.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.util.List; + +/** + * 发送邮件时,接收参数的类 + * @author 郑杰 + * @date 2018/09/28 12:02:14 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class EmailVo { + + /** 收件人,支持多个收件人 */ + @NotEmpty + private List tos; + + @NotBlank + private String subject; + + @NotBlank + private String content; +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/domain/vo/TradeVo.java b/yshop-tools/src/main/java/co/yixiang/tools/domain/vo/TradeVo.java new file mode 100644 index 0000000..b7173d2 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/domain/vo/TradeVo.java @@ -0,0 +1,54 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.domain.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.sql.Date; +import java.sql.Timestamp; + +/** + * 交易详情,按需应该存入数据库,这里存入数据库,仅供临时测试 + * @author hupeng + * @date 2018-12-31 + */ +@Data +public class TradeVo { + + /** (必填)商品描述 */ + @NotBlank + private String body; + + /** (必填)商品名称 */ + @NotBlank + private String subject; + + /** (必填)商户订单号,应该由后台生成 */ + @ApiModelProperty(hidden = true) + private String outTradeNo; + + /** (必填)第三方订单号 */ + @ApiModelProperty(hidden = true) + private String tradeNo; + + /** (必填)价格 */ + @NotBlank + private String totalAmount; + + /** 订单状态,已支付,未支付,作废 */ + @ApiModelProperty(hidden = true) + private String state; + + /** 创建时间,存入数据库时需要 */ + @ApiModelProperty(hidden = true) + private Timestamp createTime; + + /** 作废时间,存入数据库时需要 */ + @ApiModelProperty(hidden = true) + private Date cancelTime; +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/express/ExpressService.java b/yshop-tools/src/main/java/co/yixiang/tools/express/ExpressService.java new file mode 100644 index 0000000..c7a6c8b --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/express/ExpressService.java @@ -0,0 +1,159 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.express; + +import cn.hutool.http.HttpUtil; +import co.yixiang.enums.ShipperCodeEnum; +import co.yixiang.tools.express.config.ExpressProperties; +import co.yixiang.tools.express.dao.ExpressInfo; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.util.Base64Utils; + +import java.io.Serializable; +import java.net.URLEncoder; +import java.security.MessageDigest; +import java.util.HashMap; +import java.util.Map; + +/** + * 物流查询服务 + *

+ * 快递鸟即时查询API http://www.kdniao.com/api-track + */ +public class ExpressService implements Serializable { + + private final Log logger = LogFactory.getLog(ExpressService.class); + //请求url + private String ReqURL = "http://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx"; + + private ExpressProperties properties; + + public ExpressProperties getProperties() { + return properties; + } + + public void setProperties(ExpressProperties properties) { + this.properties = properties; + } + + /** + * 获取物流供应商名 + * + * @param vendorCode + * @return + */ + public String getVendorName(String vendorCode) { + for (Map item : properties.getVendors()) { + if (item.get("code").equals(vendorCode)) { + return item.get("name"); + } + } + return null; + } + + /** + * 获取物流信息 + * + * @param OrderCode + * @param ShipperCode + * @return + */ + public ExpressInfo getExpressInfo(String OrderCode,String ShipperCode, String LogisticCode,String lastFourNumber) { + try { + String result = getOrderTracesByJson(OrderCode,ShipperCode, LogisticCode,lastFourNumber); + ObjectMapper objMap = new ObjectMapper(); + ExpressInfo ei = objMap.readValue(result, ExpressInfo.class); + ei.setShipperName(getVendorName(ShipperCode)); + return ei; + } catch (Exception e) { + logger.error(e.getMessage(), e); + } + + return null; + } + + /** + * Json方式 查询订单物流轨迹 + * + * @throws Exception + */ + private String getOrderTracesByJson(String OrderCode,String ShipperCode, String LogisticCode,String lastFourNumber) throws Exception { + if (!properties.isEnable()) { + return null; + } + + //处理顺丰查询轨迹需手机号码后4位 + String requestData; + if (ShipperCode.equals(ShipperCodeEnum.SF.getValue())) { + requestData = "{'OrderCode':'" + OrderCode + "','ShipperCode':'" + ShipperCode + "','LogisticCode':'" + LogisticCode + "','CustomerName':'" + lastFourNumber + "'}"; + } else { + requestData = "{'OrderCode':'" + OrderCode + "','ShipperCode':'" + ShipperCode + "','LogisticCode':'" + LogisticCode + "'}"; + } + + Map params = new HashMap<>(); + params.put("RequestData", URLEncoder.encode(requestData, "UTF-8")); + params.put("EBusinessID", properties.getAppId()); + params.put("RequestType", "1002"); + String dataSign = encrypt(requestData, properties.getAppKey(), "UTF-8"); + params.put("DataSign", URLEncoder.encode(dataSign, "UTF-8")); + params.put("DataType", "2"); + + String result = HttpUtil.post(ReqURL, params); + + //根据公司业务处理返回的信息...... + + return result; + } + + /** + * MD5加密 + * + * @param str 内容 + * @param charset 编码方式 + * @throws Exception + */ + private String MD5(String str, String charset) throws Exception { + MessageDigest md = MessageDigest.getInstance("MD5"); + md.update(str.getBytes(charset)); + byte[] result = md.digest(); + StringBuilder sb = new StringBuilder(32); + for (int i = 0; i < result.length; i++) { + int val = result[i] & 0xff; + if (val <= 0xf) { + sb.append("0"); + } + sb.append(Integer.toHexString(val)); + } + return sb.toString().toLowerCase(); + } + + /** + * Sign签名生成 + * + * @param content 内容 + * @param keyValue Appkey + * @param charset 编码方式 + * @return DataSign签名 + */ + private String encrypt(String content, String keyValue, String charset) { + if (keyValue != null) { + content = content + keyValue; + } + byte[] src; + try { + src = MD5(content, charset).getBytes(charset); + return Base64Utils.encodeToString(src); + } catch (Exception e) { + logger.error(e.getMessage(), e); + } + + return null; + } + + +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/express/config/ExpressAutoConfiguration.java b/yshop-tools/src/main/java/co/yixiang/tools/express/config/ExpressAutoConfiguration.java new file mode 100644 index 0000000..8cbe69c --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/express/config/ExpressAutoConfiguration.java @@ -0,0 +1,54 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.tools.express.config; + + +import co.yixiang.constant.ShopConstants; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.tools.express.ExpressService; +import co.yixiang.utils.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; + +@Configuration(proxyBeanMethods = false) +public class ExpressAutoConfiguration { + + + private static RedisUtils redisUtil; + + @Autowired + public ExpressAutoConfiguration(RedisUtils redisUtil) { + ExpressAutoConfiguration.redisUtil = redisUtil; + } + + public static ExpressService expressService() { + ExpressService expressService = (ExpressService)redisUtil.get(ShopConstants.YSHOP_EXPRESS_SERVICE); + if(expressService != null) { + return expressService; + } + + ExpressProperties properties = new ExpressProperties(); + String enable = redisUtil.getY("exp_enable"); + String appId = redisUtil.getY("exp_appId"); + String appKey = redisUtil.getY("exp_appKey"); + properties.setAppId(appId); + properties.setAppKey(appKey); + + if(ShopCommonEnum.ENABLE_2.getValue().toString().equals(enable)){ + properties.setEnable(false); + }else{ + properties.setEnable(true); + } + ExpressService service = new ExpressService(); + service.setProperties(properties); + redisUtil.set(ShopConstants.YSHOP_EXPRESS_SERVICE,service); + return service; + } + +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/express/config/ExpressProperties.java b/yshop-tools/src/main/java/co/yixiang/tools/express/config/ExpressProperties.java new file mode 100644 index 0000000..23aaa0b --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/express/config/ExpressProperties.java @@ -0,0 +1,49 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.express.config; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class ExpressProperties { + private boolean enable; + private String appId; + private String appKey; + private List> vendors = new ArrayList<>(); + + public boolean isEnable() { + return enable; + } + + public void setEnable(boolean enable) { + this.enable = enable; + } + + public List> getVendors() { + return vendors; + } + + public void setVendors(List> vendors) { + this.vendors = vendors; + } + + public String getAppKey() { + return appKey; + } + + public void setAppKey(String appKey) { + this.appKey = appKey; + } + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/express/dao/ExpressInfo.java b/yshop-tools/src/main/java/co/yixiang/tools/express/dao/ExpressInfo.java new file mode 100644 index 0000000..bbaed48 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/express/dao/ExpressInfo.java @@ -0,0 +1,65 @@ +/** + * Copyright 2018 bejson.com + */ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.express.dao; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * Auto-generated: 2018-07-19 22:27:22 + * + * @author bejson.com (i@bejson.com) + * @website http://www.bejson.com/java2pojo/ + */ +@Data +public class ExpressInfo { + + @JsonProperty("LogisticCode") + @ApiModelProperty(value = "物流运单号") + private String LogisticCode; + + @JsonProperty("ShipperCode") + @ApiModelProperty(value = "快递公司编码") + private String ShipperCode; + + + @JsonProperty("Traces") + @ApiModelProperty(value = "物流轨迹") + private List Traces; + + + @JsonProperty("State") + @ApiModelProperty(value = "物流状态:2-在途中,3-签收,4-问题件") + private String State; + + @JsonProperty("EBusinessID") + @ApiModelProperty(value = "用户ID") + private String EBusinessID; + + + @JsonProperty("Success") + @ApiModelProperty(value = "成功与否") + private boolean Success; + + + @JsonProperty("Reason") + @ApiModelProperty(value = "失败原因") + private String Reason; + + private String ShipperName; + + @JsonProperty("OrderCode") + @ApiModelProperty(value = "订单编号") + private String OrderCode; + + +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/express/dao/Traces.java b/yshop-tools/src/main/java/co/yixiang/tools/express/dao/Traces.java new file mode 100644 index 0000000..60d6ac3 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/express/dao/Traces.java @@ -0,0 +1,46 @@ +/** + * Copyright 2018 bejson.com + */ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.express.dao; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +/** + * Auto-generated: 2018-07-19 22:27:22 + * + * @author bejson.com (i@bejson.com) + * @website http://www.bejson.com/java2pojo/ + */ +public class Traces { + + @JsonProperty("AcceptStation") + @ApiModelProperty(value = "描述") + private String AcceptStation; + + @JsonProperty("AcceptTime") + @ApiModelProperty(value = "时间") + private String AcceptTime; + + public String getAcceptStation() { + return AcceptStation; + } + + public void setAcceptStation(String AcceptStation) { + this.AcceptStation = AcceptStation; + } + + public String getAcceptTime() { + return AcceptTime; + } + + public void setAcceptTime(String AcceptTime) { + this.AcceptTime = AcceptTime; + } + +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/rest/AliPayController.java b/yshop-tools/src/main/java/co/yixiang/tools/rest/AliPayController.java new file mode 100644 index 0000000..0657ebc --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/rest/AliPayController.java @@ -0,0 +1,136 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.rest; + +import co.yixiang.annotation.AnonymousAccess; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.tools.domain.AlipayConfig; +import co.yixiang.tools.domain.vo.TradeVo; +import co.yixiang.tools.service.AlipayConfigService; +import co.yixiang.tools.utils.AliPayStatusEnum; +import co.yixiang.tools.utils.AlipayUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import springfox.documentation.annotations.ApiIgnore; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.nio.charset.StandardCharsets; +import java.util.Map; + +/** + * @author hupeng + * @date 2018-12-31 + */ +@Slf4j +@RestController +@RequestMapping("/api/aliPay") +@Api(tags = "工具:支付宝管理") +public class AliPayController { + + private final AlipayUtils alipayUtils; + + private final AlipayConfigService alipayService; + + public AliPayController(AlipayUtils alipayUtils, AlipayConfigService alipayService) { + this.alipayUtils = alipayUtils; + this.alipayService = alipayService; + } + + @GetMapping + public ResponseEntity get(){ + return new ResponseEntity<>(alipayService.find(),HttpStatus.OK); + } + + @Log("配置支付宝") + @ApiOperation("配置支付宝") + @PutMapping + public ResponseEntity payConfig(@Validated @RequestBody AlipayConfig alipayConfig){ + alipayConfig.setId(1L); + alipayService.update(alipayConfig); + return new ResponseEntity<>(HttpStatus.OK); + } + + @Log("支付宝PC网页支付") + @ApiOperation("PC网页支付") + @PostMapping(value = "/toPayAsPC") + public ResponseEntity toPayAsPc(@Validated@RequestBody TradeVo trade) throws Exception{ + AlipayConfig aliPay = alipayService.find(); + trade.setOutTradeNo(alipayUtils.getOrderCode()); + String payUrl = alipayService.toPayAsPc(aliPay,trade); + return ResponseEntity.ok(payUrl); + } + + @Log("支付宝手机网页支付") + @ApiOperation("手机网页支付") + @PostMapping(value = "/toPayAsWeb") + public ResponseEntity toPayAsWeb(@Validated @RequestBody TradeVo trade) throws Exception{ + AlipayConfig alipay = alipayService.find(); + trade.setOutTradeNo(alipayUtils.getOrderCode()); + String payUrl = alipayService.toPayAsWeb(alipay,trade); + return ResponseEntity.ok(payUrl); + } + + @ApiIgnore + @GetMapping("/return") + @AnonymousAccess + @ApiOperation("支付之后跳转的链接") + public ResponseEntity returnPage(HttpServletRequest request, HttpServletResponse response){ + AlipayConfig alipay = alipayService.find(); + response.setContentType("text/html;charset=" + alipay.getCharset()); + //内容验签,防止黑客篡改参数 + if(alipayUtils.rsaCheck(request,alipay)){ + //商户订单号 + String outTradeNo = new String(request.getParameter("out_trade_no").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); + //支付宝交易号 + String tradeNo = new String(request.getParameter("trade_no").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); + System.out.println("商户订单号"+outTradeNo+" "+"第三方交易号"+tradeNo); + + // 根据业务需要返回数据,这里统一返回OK + return new ResponseEntity<>("payment successful",HttpStatus.OK); + }else{ + // 根据业务需要返回数据 + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + } + + @ApiIgnore + @RequestMapping("/notify") + @AnonymousAccess + @SuppressWarnings("all") + @ApiOperation("支付异步通知(要公网访问),接收异步通知,检查通知内容app_id、out_trade_no、total_amount是否与请求中的一致,根据trade_status进行后续业务处理") + public ResponseEntity notify(HttpServletRequest request){ + AlipayConfig alipay = alipayService.find(); + Map parameterMap = request.getParameterMap(); + //内容验签,防止黑客篡改参数 + if (alipayUtils.rsaCheck(request,alipay)) { + //交易状态 + String tradeStatus = new String(request.getParameter("trade_status").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); + // 商户订单号 + String outTradeNo = new String(request.getParameter("out_trade_no").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); + //支付宝交易号 + String tradeNo = new String(request.getParameter("trade_no").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); + //付款金额 + String totalAmount = new String(request.getParameter("total_amount").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); + //验证 + if(tradeStatus.equals(AliPayStatusEnum.SUCCESS.getValue())||tradeStatus.equals(AliPayStatusEnum.FINISHED.getValue())){ + // 验证通过后应该根据业务需要处理订单 + } + return new ResponseEntity<>(HttpStatus.OK); + } + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/rest/EmailController.java b/yshop-tools/src/main/java/co/yixiang/tools/rest/EmailController.java new file mode 100644 index 0000000..6aa03ab --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/rest/EmailController.java @@ -0,0 +1,60 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.rest; + +import co.yixiang.logging.aop.log.Log; +import co.yixiang.tools.domain.EmailConfig; +import co.yixiang.tools.domain.vo.EmailVo; +import co.yixiang.tools.service.EmailConfigService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 发送邮件 + * @author 郑杰 + * @date 2018/09/28 6:55:53 + */ +@RestController +@RequestMapping("api/email") +@Api(tags = "工具:邮件管理") +public class EmailController { + + private final EmailConfigService emailService; + + public EmailController(EmailConfigService emailService) { + this.emailService = emailService; + } + + @GetMapping + public ResponseEntity get(){ + return new ResponseEntity<>(emailService.find(),HttpStatus.OK); + } + + @Log("配置邮件") + @PutMapping + @ApiOperation("配置邮件") + public ResponseEntity emailConfig(@Validated @RequestBody EmailConfig emailConfig){ + emailService.update(emailConfig,emailService.find()); + return new ResponseEntity<>(HttpStatus.OK); + } + + @Log("发送邮件") + @PostMapping + @ApiOperation("发送邮件") + public ResponseEntity send(@Validated @RequestBody EmailVo emailVo) throws Exception { + emailService.send(emailVo,emailService.find()); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/rest/LocalStorageController.java b/yshop-tools/src/main/java/co/yixiang/tools/rest/LocalStorageController.java new file mode 100644 index 0000000..8a6b132 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/rest/LocalStorageController.java @@ -0,0 +1,92 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.rest; + +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.tools.service.LocalStorageService; +import co.yixiang.tools.service.dto.LocalStorageDto; +import co.yixiang.tools.service.dto.LocalStorageQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Arrays; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@AllArgsConstructor +@Api(tags = "文件管理") +@RestController +@RequestMapping("/api/localStorage") +public class LocalStorageController { + + private final LocalStorageService localStorageService; + private final IGenerator generator; + + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('admin','storage:list')") + public void download(HttpServletResponse response, LocalStorageQueryCriteria criteria) throws IOException { + localStorageService.download(generator.convert(localStorageService.queryAll(criteria), LocalStorageDto.class), response); + } + + @GetMapping + @Log("查询文件") + @ApiOperation("查询文件") + @PreAuthorize("@el.check('admin','storage:list')") + public ResponseEntity getLocalStorages(LocalStorageQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(localStorageService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增文件") + @ApiOperation("新增文件") + @PreAuthorize("@el.check('admin','storage:add')") + public ResponseEntity create(@RequestParam String name, @RequestParam("file") MultipartFile file){ + return new ResponseEntity<>(localStorageService.create(name,file),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改文件") + @ApiOperation("修改文件") + @PreAuthorize("@el.check('admin','storage:edit')") + public ResponseEntity update(@Validated @RequestBody LocalStorageDto resources){ + localStorageService.updateLocalStorage(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除文件") + @ApiOperation("删除文件") + @PreAuthorize("@el.check('admin','storage:del')") + @DeleteMapping + public ResponseEntity deleteAll(@RequestBody Long[] ids) { + Arrays.asList(ids).forEach(id->{ + localStorageService.removeById(id); + }); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/rest/PictureController.java b/yshop-tools/src/main/java/co/yixiang/tools/rest/PictureController.java new file mode 100644 index 0000000..c07f3c8 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/rest/PictureController.java @@ -0,0 +1,91 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.rest; + +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.logging.aop.log.Log; +import co.yixiang.tools.domain.Picture; +import co.yixiang.tools.service.PictureService; +import co.yixiang.tools.service.dto.PictureDto; +import co.yixiang.tools.service.dto.PictureQueryCriteria; +import co.yixiang.utils.SecurityUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @author hupeng + * @date 2018/09/20 14:13:32 + */ +@RestController +@RequestMapping("/api/pictures") +@Api(tags = "工具:免费图床管理") +public class PictureController { + private final IGenerator generator; + private final PictureService pictureService; + + public PictureController(IGenerator generator, PictureService pictureService) { + this.generator = generator; + this.pictureService = pictureService; + } + + @Log("查询图片") + @PreAuthorize("@el.check('pictures:list')") + @GetMapping + @ApiOperation("查询图片") + public ResponseEntity getRoles(PictureQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(pictureService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('pictures:list')") + public void download(HttpServletResponse response, PictureQueryCriteria criteria) throws IOException { + pictureService.download(generator.convert(pictureService.queryAll(criteria), PictureDto.class), response); + } + + @Log("上传图片") + @PreAuthorize("@el.check('pictures:add')") + @PostMapping + @ApiOperation("上传图片") + public ResponseEntity upload(@RequestParam MultipartFile file){ + String userName = SecurityUtils.getUsername(); + Picture picture = pictureService.upload(file,userName); + return new ResponseEntity<>(picture,HttpStatus.OK); + } + + @Log("同步图床数据") + @ApiOperation("同步图床数据") + @PostMapping(value = "/synchronize") + public ResponseEntity synchronize(){ + pictureService.synchronize(); + return new ResponseEntity<>(HttpStatus.OK); + } + + @Log("多选删除图片") + @ApiOperation("多选删除图片") + @PreAuthorize("@el.check('pictures:del')") + @DeleteMapping + public ResponseEntity deleteAll(@RequestBody Long[] ids) { + pictureService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/rest/QiniuController.java b/yshop-tools/src/main/java/co/yixiang/tools/rest/QiniuController.java new file mode 100644 index 0000000..d722753 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/rest/QiniuController.java @@ -0,0 +1,125 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.rest; + +import co.yixiang.logging.aop.log.Log; +import co.yixiang.tools.domain.QiniuConfig; +import co.yixiang.tools.domain.QiniuContent; +import co.yixiang.tools.service.QiNiuService; +import co.yixiang.tools.service.dto.QiniuQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** + * 发送邮件 + * @author 郑杰 + * @date 2018/09/28 6:55:53 + */ +@Slf4j +@RestController +@RequestMapping("/api/qiNiuContent") +@Api(tags = "工具:七牛云存储管理") +public class QiniuController { + + private final QiNiuService qiNiuService; + + public QiniuController(QiNiuService qiNiuService) { + this.qiNiuService = qiNiuService; + } + + @GetMapping(value = "/config") + public ResponseEntity get(){ + return new ResponseEntity<>(qiNiuService.find(), HttpStatus.OK); + } + + @Log("配置七牛云存储") + @ApiOperation("配置七牛云存储") + @PutMapping(value = "/config") + public ResponseEntity emailConfig(@Validated @RequestBody QiniuConfig qiniuConfig){ + qiNiuService.update(qiniuConfig); + qiNiuService.update(qiniuConfig.getType()); + return new ResponseEntity<>(HttpStatus.OK); + } + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + public void download(HttpServletResponse response, QiniuQueryCriteria criteria) throws IOException { + qiNiuService.downloadList(qiNiuService.queryAll(criteria), response); + } + + @Log("查询文件") + @ApiOperation("查询文件") + @GetMapping + public ResponseEntity getRoles(QiniuQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(qiNiuService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("上传文件") + @ApiOperation("上传文件") + @PostMapping + public ResponseEntity upload(@RequestParam MultipartFile file){ + QiniuContent qiniuContent = qiNiuService.upload(file,qiNiuService.find()); + Map map = new HashMap<>(3); + map.put("id",qiniuContent.getId()); + map.put("errno",0); + map.put("data",new String[]{qiniuContent.getUrl()}); + return new ResponseEntity<>(map,HttpStatus.OK); + } + + @Log("同步七牛云数据") + @ApiOperation("同步七牛云数据") + @PostMapping(value = "/synchronize") + public ResponseEntity synchronize(){ + qiNiuService.synchronize(qiNiuService.find()); + return new ResponseEntity<>(HttpStatus.OK); + } + + @Log("下载文件") + @ApiOperation("下载文件") + @GetMapping(value = "/download/{id}") + public ResponseEntity download(@PathVariable Long id){ + Map map = new HashMap<>(1); + map.put("url", qiNiuService.download(qiNiuService.findByContentId(id),qiNiuService.find())); + return new ResponseEntity<>(map,HttpStatus.OK); + } + + @Log("删除文件") + @ApiOperation("删除文件") + @DeleteMapping(value = "/{id}") + public ResponseEntity delete(@PathVariable Long id){ + qiNiuService.delete(qiNiuService.findByContentId(id),qiNiuService.find()); + return new ResponseEntity<>(HttpStatus.OK); + } + + @Log("删除多张图片") + @ApiOperation("删除多张图片") + @DeleteMapping + public ResponseEntity deleteAll(@RequestBody Long[] ids) { + qiNiuService.deleteAll(ids, qiNiuService.find()); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/rest/UploadController.java b/yshop-tools/src/main/java/co/yixiang/tools/rest/UploadController.java new file mode 100644 index 0000000..0c99fc7 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/rest/UploadController.java @@ -0,0 +1,98 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.rest; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import co.yixiang.api.YshopException; +import co.yixiang.constant.ShopConstants; +import co.yixiang.constant.SystemConfigConstants; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.tools.domain.QiniuContent; +import co.yixiang.tools.service.LocalStorageService; +import co.yixiang.tools.service.QiNiuService; +import co.yixiang.tools.service.dto.LocalStorageDto; +import co.yixiang.utils.RedisUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author hupeng + * @date 2020-01-09 + */ +@Api(tags = "上传统一管理") +@RestController +@RequestMapping("/api/upload") +@Slf4j +@SuppressWarnings("unchecked") +public class UploadController { + + private final LocalStorageService localStorageService; + private final QiNiuService qiNiuService; + private final RedisUtils redisUtils; + + public UploadController(LocalStorageService localStorageService, QiNiuService qiNiuService, + RedisUtils redisUtils) { + this.localStorageService = localStorageService; + this.qiNiuService = qiNiuService; + this.redisUtils = redisUtils; + } + + + @ApiOperation("上传文件") + @PostMapping + public ResponseEntity create(@RequestParam(defaultValue = "") String name, + @RequestParam(defaultValue = "") String type, + @RequestParam("file") MultipartFile[] files) { + + String localUrl = redisUtils.getY(ShopConstants.ADMIN_API_URL); + if(StrUtil.isBlank(type)){ + localUrl = redisUtils.getY(SystemConfigConstants.API_URL) + "/api"; + } + String mode = redisUtils.getY(SystemConfigConstants.FILE_STORE_MODE); + StringBuilder url = new StringBuilder(); + if (ShopCommonEnum.STORE_MODE_1.getValue().toString().equals(mode)) { //存在走本地 + if(StrUtil.isBlank(localUrl)){ + throw new YshopException("本地上传,请先登陆系统配置后台/移动端API地址"); + } + for (MultipartFile file : files) { + LocalStorageDto localStorageDTO = localStorageService.create(name, file); + if ("".equals(url.toString())) { + url = url.append(localUrl + "/file/" + localStorageDTO.getType() + "/" + localStorageDTO.getRealName()); + } else { + url = url.append(","+localUrl + "/file/" + localStorageDTO.getType() + "/" + localStorageDTO.getRealName()); + } + } + } else {//走七牛云 + for (MultipartFile file : files) { + QiniuContent qiniuContent = qiNiuService.upload(file, qiNiuService.find()); + if ("".equals(url.toString())) { + url = url.append(qiniuContent.getUrl()); + }else{ + url = url.append(","+qiniuContent.getUrl()); + } + } + } + + Map map = new HashMap<>(2); + map.put("errno", 0); + map.put("link", url); + return new ResponseEntity(map, HttpStatus.CREATED); + } + + +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/rest/VerificationCodeController.java b/yshop-tools/src/main/java/co/yixiang/tools/rest/VerificationCodeController.java new file mode 100644 index 0000000..3cb4753 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/rest/VerificationCodeController.java @@ -0,0 +1,69 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.rest; + +import co.yixiang.tools.domain.VerificationCode; +import co.yixiang.tools.domain.vo.EmailVo; +import co.yixiang.tools.service.EmailConfigService; +import co.yixiang.tools.service.VerificationCodeService; +import co.yixiang.utils.YshopConstant; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author hupeng + * @date 2018-12-26 + */ +@RestController +@RequestMapping("/api/code") +@Api(tags = "工具:验证码管理") +public class VerificationCodeController { + + private final VerificationCodeService verificationCodeService; + + private final EmailConfigService emailService; + + public VerificationCodeController(VerificationCodeService verificationCodeService, EmailConfigService emailService) { + this.verificationCodeService = verificationCodeService; + this.emailService = emailService; + } + + @PostMapping(value = "/resetEmail") + @ApiOperation("重置邮箱,发送验证码") + public ResponseEntity resetEmail(@RequestBody VerificationCode code) throws Exception { + code.setScenes(YshopConstant.RESET_MAIL); + EmailVo emailVo = verificationCodeService.sendEmail(code); + emailService.send(emailVo,emailService.find()); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping(value = "/email/resetPass") + @ApiOperation("重置密码,发送验证码") + public ResponseEntity resetPass(@RequestParam String email) throws Exception { + VerificationCode code = new VerificationCode(); + code.setType("email"); + code.setValue(email); + code.setScenes(YshopConstant.RESET_MAIL); + EmailVo emailVo = verificationCodeService.sendEmail(code); + emailService.send(emailVo,emailService.find()); + return new ResponseEntity<>(HttpStatus.OK); + } + + @GetMapping(value = "/validated") + @ApiOperation("验证码验证") + public ResponseEntity validated(VerificationCode code){ + verificationCodeService.validated(code); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/AlipayConfigService.java b/yshop-tools/src/main/java/co/yixiang/tools/service/AlipayConfigService.java new file mode 100644 index 0000000..d5bef75 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/AlipayConfigService.java @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.tools.domain.AlipayConfig; +import co.yixiang.tools.domain.vo.TradeVo; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +public interface AlipayConfigService extends BaseService{ + + /** + * 处理来自PC的交易请求 + * @param alipay 支付宝配置 + * @param trade 交易详情 + * @return String + * @throws Exception 异常 + */ + String toPayAsPc(AlipayConfig alipay, TradeVo trade) throws Exception; + + /** + * 处理来自手机网页的交易请求 + * @param alipay 支付宝配置 + * @param trade 交易详情 + * @return String + * @throws Exception 异常 + */ + String toPayAsWeb(AlipayConfig alipay, TradeVo trade) throws Exception; + + /** + * 查询配置 + * @return AlipayConfig + */ + AlipayConfig find(); + + /** + * 更新配置 + * @param alipayConfig 支付宝配置 + * @return AlipayConfig + */ + void update(AlipayConfig alipayConfig); +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/EmailConfigService.java b/yshop-tools/src/main/java/co/yixiang/tools/service/EmailConfigService.java new file mode 100644 index 0000000..eb08119 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/EmailConfigService.java @@ -0,0 +1,40 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.tools.domain.EmailConfig; +import co.yixiang.tools.domain.vo.EmailVo; +import org.springframework.scheduling.annotation.Async; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +public interface EmailConfigService extends BaseService{ + /** + * 更新邮件配置 + * @param emailConfig 邮件配置 + * @param old 旧的配置 + * @return EmailConfig + */ + void update(EmailConfig emailConfig, EmailConfig old); + + /** + * 查询配置 + * @return EmailConfig 邮件配置 + */ + EmailConfig find(); + + /** + * 发送邮件 + * @param emailVo 邮件发送的内容 + * @param emailConfig 邮件配置 + * @throws Exception / + */ + @Async + void send(EmailVo emailVo, EmailConfig emailConfig) throws Exception; +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/LocalStorageService.java b/yshop-tools/src/main/java/co/yixiang/tools/service/LocalStorageService.java new file mode 100644 index 0000000..5f358c4 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/LocalStorageService.java @@ -0,0 +1,76 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.tools.domain.LocalStorage; +import co.yixiang.tools.service.dto.LocalStorageDto; +import co.yixiang.tools.service.dto.LocalStorageQueryCriteria; +import org.springframework.data.domain.Pageable; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +public interface LocalStorageService extends BaseService{ + + /** + * 分页查询 + * @param criteria 条件 + * @param pageable 分页参数 + * @return / + */ + Map queryAll(LocalStorageQueryCriteria criteria, Pageable pageable); + + /** + * 查询全部数据 + * @param criteria 条件 + * @return / + */ + List queryAll(LocalStorageQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id / + * @return / + */ + LocalStorageDto findById(Long id); + + /** + * 上传 + * @param name 文件名称 + * @param file 文件 + * @return / + */ + LocalStorageDto create(String name, MultipartFile file); + + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param localStorageDtos 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List localStorageDtos, HttpServletResponse response) throws IOException; + + /** + * 修改文件 + * @param resources + */ + void updateLocalStorage(LocalStorageDto resources); +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/PictureService.java b/yshop-tools/src/main/java/co/yixiang/tools/service/PictureService.java new file mode 100644 index 0000000..1821f29 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/PictureService.java @@ -0,0 +1,76 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.tools.domain.Picture; +import co.yixiang.tools.service.dto.PictureDto; +import co.yixiang.tools.service.dto.PictureQueryCriteria; +import org.springframework.data.domain.Pageable; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +public interface PictureService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(PictureQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(PictureQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + + /** + * 上传文件 + * @param file / + * @param username / + * @return / + */ + Picture upload(MultipartFile file, String username); + + /** + * 根据ID查询 + * @param id / + * @return / + */ + Picture findById(Long id); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + + /** + * 同步数据 + */ + void synchronize(); +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/QiNiuService.java b/yshop-tools/src/main/java/co/yixiang/tools/service/QiNiuService.java new file mode 100644 index 0000000..1581ffd --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/QiNiuService.java @@ -0,0 +1,108 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service; + +import co.yixiang.tools.domain.QiniuConfig; +import co.yixiang.tools.domain.QiniuContent; +import co.yixiang.tools.service.dto.QiniuQueryCriteria; +import org.springframework.data.domain.Pageable; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + * @author hupeng + * @date 2018-12-31 + */ +public interface QiNiuService { + + /** + * 分页查询 + * @param criteria 条件 + * @param pageable 分页参数 + * @return / + */ + Object queryAll(QiniuQueryCriteria criteria, Pageable pageable); + + /** + * 查询全部 + * @param criteria 条件 + * @return / + */ + List queryAll(QiniuQueryCriteria criteria); + + /** + * 查配置 + * @return QiniuConfig + */ + QiniuConfig find(); + + /** + * 修改配置 + * @param qiniuConfig 配置 + * @return QiniuConfig + */ + QiniuConfig update(QiniuConfig qiniuConfig); + + /** + * 上传文件 + * @param file 文件 + * @param qiniuConfig 配置 + * @return QiniuContent + */ + QiniuContent upload(MultipartFile file, QiniuConfig qiniuConfig); + + /** + * 查询文件 + * @param id 文件ID + * @return QiniuContent + */ + QiniuContent findByContentId(Long id); + + /** + * 下载文件 + * @param content 文件信息 + * @param config 配置 + * @return String + */ + String download(QiniuContent content, QiniuConfig config); + + /** + * 删除文件 + * @param content 文件 + * @param config 配置 + */ + void delete(QiniuContent content, QiniuConfig config); + + /** + * 同步数据 + * @param config 配置 + */ + void synchronize(QiniuConfig config); + + /** + * 删除文件 + * @param ids 文件ID数组 + * @param config 配置 + */ + void deleteAll(Long[] ids, QiniuConfig config); + + /** + * 更新数据 + * @param type 类型 + */ + void update(String type); + + /** + * 导出数据 + * @param queryAll / + * @param response / + * @throws IOException / + */ + void downloadList(List queryAll, HttpServletResponse response) throws IOException; +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/QiniuConfigService.java b/yshop-tools/src/main/java/co/yixiang/tools/service/QiniuConfigService.java new file mode 100644 index 0000000..38c3e9c --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/QiniuConfigService.java @@ -0,0 +1,50 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.tools.domain.QiniuConfig; +import co.yixiang.tools.service.dto.QiniuConfigDto; +import co.yixiang.tools.service.dto.QiniuQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +public interface QiniuConfigService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(QiniuQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(QiniuQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + + void update(String type); +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/QiniuContentService.java b/yshop-tools/src/main/java/co/yixiang/tools/service/QiniuContentService.java new file mode 100644 index 0000000..e3152bb --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/QiniuContentService.java @@ -0,0 +1,47 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.tools.domain.QiniuContent; +import co.yixiang.tools.service.dto.QiniuContentDto; +import co.yixiang.tools.service.dto.QiniuQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +public interface QiniuContentService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(QiniuQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(QiniuQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/VerificationCodeService.java b/yshop-tools/src/main/java/co/yixiang/tools/service/VerificationCodeService.java new file mode 100644 index 0000000..7e1e9b7 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/VerificationCodeService.java @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service; + +import co.yixiang.tools.domain.VerificationCode; +import co.yixiang.tools.domain.vo.EmailVo; + +/** + * @author hupeng + * @date 2018-12-26 + */ +public interface VerificationCodeService { + + /** + * 发送邮件验证码 + * @param code 验证码 + * @return EmailVo + */ + EmailVo sendEmail(VerificationCode code); + + /** + * 验证 + * @param code 验证码 + */ + void validated(VerificationCode code); +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/dto/LocalStorageDto.java b/yshop-tools/src/main/java/co/yixiang/tools/service/dto/LocalStorageDto.java new file mode 100644 index 0000000..7a40002 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/dto/LocalStorageDto.java @@ -0,0 +1,36 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class LocalStorageDto implements Serializable { + private Long id; + + private String realName; + + private String name; + + private String suffix; + + private String path; + + private String type; + + private String size; + + private String operate; + + private Timestamp createTime; +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/dto/LocalStorageQueryCriteria.java b/yshop-tools/src/main/java/co/yixiang/tools/service/dto/LocalStorageQueryCriteria.java new file mode 100644 index 0000000..5033051 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/dto/LocalStorageQueryCriteria.java @@ -0,0 +1,26 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +import java.sql.Timestamp; +import java.util.List; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class LocalStorageQueryCriteria{ + + @Query(blurry = "name,suffix,type,operate,size") + private String blurry; + + @Query(type = Query.Type.BETWEEN) + private List createTime; +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/dto/PictureDto.java b/yshop-tools/src/main/java/co/yixiang/tools/service/dto/PictureDto.java new file mode 100644 index 0000000..b99c33f --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/dto/PictureDto.java @@ -0,0 +1,49 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class PictureDto implements Serializable { + + /** ID */ + private Long id; + + /** 上传日期 */ + private Timestamp createTime; + + /** 删除的URL */ + private String deleteUrl; + + /** 图片名称 */ + private String filename; + + /** 图片高度 */ + private String height; + + /** 图片大小 */ + private String size; + + /** 图片地址 */ + private String url; + + /** 用户名称 */ + private String username; + + /** 图片宽度 */ + private String width; + + /** 文件的MD5值 */ + private String md5code; +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/dto/PictureQueryCriteria.java b/yshop-tools/src/main/java/co/yixiang/tools/service/dto/PictureQueryCriteria.java new file mode 100644 index 0000000..6537c72 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/dto/PictureQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class PictureQueryCriteria{ +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/dto/QiniuConfigDto.java b/yshop-tools/src/main/java/co/yixiang/tools/service/dto/QiniuConfigDto.java new file mode 100644 index 0000000..b22fe4b --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/dto/QiniuConfigDto.java @@ -0,0 +1,39 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class QiniuConfigDto implements Serializable { + + /** ID */ + private Long id; + + /** accessKey */ + private String accessKey; + + /** Bucket 识别符 */ + private String bucket; + + /** 外链域名 */ + private String host; + + /** secretKey */ + private String secretKey; + + /** 空间类型 */ + private String type; + + /** 机房 */ + private String zone; +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/dto/QiniuConfigQueryCriteria.java b/yshop-tools/src/main/java/co/yixiang/tools/service/dto/QiniuConfigQueryCriteria.java new file mode 100644 index 0000000..f475094 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/dto/QiniuConfigQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class QiniuConfigQueryCriteria{ +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/dto/QiniuContentDto.java b/yshop-tools/src/main/java/co/yixiang/tools/service/dto/QiniuContentDto.java new file mode 100644 index 0000000..ad6ad7d --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/dto/QiniuContentDto.java @@ -0,0 +1,46 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class QiniuContentDto implements Serializable { + + /** ID */ + private Long id; + + /** Bucket 识别符 */ + private String bucket; + + /** 文件名称 */ + private String name; + + /** 文件大小 */ + private String size; + + /** 文件类型:私有或公开 */ + private String type; + + /** 上传或同步的时间 */ + private Timestamp updateTime; + + /** 文件url */ + private String url; + + private String suffix; + + public String getKey(){ + return this.name; + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/dto/QiniuContentQueryCriteria.java b/yshop-tools/src/main/java/co/yixiang/tools/service/dto/QiniuContentQueryCriteria.java new file mode 100644 index 0000000..68c003b --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/dto/QiniuContentQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Data +public class QiniuContentQueryCriteria{ +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/dto/QiniuQueryCriteria.java b/yshop-tools/src/main/java/co/yixiang/tools/service/dto/QiniuQueryCriteria.java new file mode 100644 index 0000000..139fe81 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/dto/QiniuQueryCriteria.java @@ -0,0 +1,26 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +import java.sql.Timestamp; +import java.util.List; + +/** + * @author hupeng + * @date 2019-6-4 09:54:37 + */ +@Data +public class QiniuQueryCriteria{ + + @Query(type = Query.Type.INNER_LIKE) + private String name; + + @Query(type = Query.Type.BETWEEN) + private List createTime; +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/impl/AlipayConfigServiceImpl.java b/yshop-tools/src/main/java/co/yixiang/tools/service/impl/AlipayConfigServiceImpl.java new file mode 100644 index 0000000..f625f9f --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/impl/AlipayConfigServiceImpl.java @@ -0,0 +1,109 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.exception.BadRequestException; +import co.yixiang.tools.domain.AlipayConfig; +import co.yixiang.tools.domain.vo.TradeVo; +import co.yixiang.tools.service.AlipayConfigService; +import co.yixiang.tools.service.mapper.AlipayConfigMapper; +import com.alipay.api.AlipayClient; +import com.alipay.api.DefaultAlipayClient; +import com.alipay.api.request.AlipayTradePagePayRequest; +import com.alipay.api.request.AlipayTradeWapPayRequest; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; + + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Service +@AllArgsConstructor +//@CacheConfig(cacheNames = "alipayConfig") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class AlipayConfigServiceImpl extends BaseServiceImpl implements AlipayConfigService { + @Override + public String toPayAsPc(AlipayConfig alipay, TradeVo trade) throws Exception { + + if(alipay.getId() == null){ + throw new BadRequestException("请先添加相应配置,再操作"); + } + AlipayClient alipayClient = new DefaultAlipayClient(alipay.getGatewayUrl(), alipay.getAppId(), alipay.getPrivateKey(), alipay.getFormat(), alipay.getCharset(), alipay.getPublicKey(), alipay.getSignType()); + + // 创建API对应的request(电脑网页版) + AlipayTradePagePayRequest request = new AlipayTradePagePayRequest(); + + // 订单完成后返回的页面和异步通知地址 + request.setReturnUrl(alipay.getReturnUrl()); + request.setNotifyUrl(alipay.getNotifyUrl()); + // 填充订单参数 + request.setBizContent("{" + + " \"out_trade_no\":\""+trade.getOutTradeNo()+"\"," + + " \"product_code\":\"FAST_INSTANT_TRADE_PAY\"," + + " \"total_amount\":"+trade.getTotalAmount()+"," + + " \"subject\":\""+trade.getSubject()+"\"," + + " \"body\":\""+trade.getBody()+"\"," + + " \"extend_params\":{" + + " \"sys_service_provider_id\":\""+alipay.getSysServiceProviderId()+"\"" + + " }"+ + " }");//填充业务参数 + // 调用SDK生成表单, 通过GET方式,口可以获取url + return alipayClient.pageExecute(request, "GET").getBody(); + + } + + @Override + public String toPayAsWeb(AlipayConfig alipay, TradeVo trade) throws Exception { + if(alipay.getId() == null){ + throw new BadRequestException("请先添加相应配置,再操作"); + } + AlipayClient alipayClient = new DefaultAlipayClient(alipay.getGatewayUrl(), alipay.getAppId(), alipay.getPrivateKey(), alipay.getFormat(), alipay.getCharset(), alipay.getPublicKey(), alipay.getSignType()); + + double money = Double.parseDouble(trade.getTotalAmount()); + double maxMoney = 5000; + if(money <= 0 || money >= maxMoney){ + throw new BadRequestException("测试金额过大"); + } + // 创建API对应的request(手机网页版) + AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest(); + request.setReturnUrl(alipay.getReturnUrl()); + request.setNotifyUrl(alipay.getNotifyUrl()); + request.setBizContent("{" + + " \"out_trade_no\":\""+trade.getOutTradeNo()+"\"," + + " \"product_code\":\"FAST_INSTANT_TRADE_PAY\"," + + " \"total_amount\":"+trade.getTotalAmount()+"," + + " \"subject\":\""+trade.getSubject()+"\"," + + " \"body\":\""+trade.getBody()+"\"," + + " \"extend_params\":{" + + " \"sys_service_provider_id\":\""+alipay.getSysServiceProviderId()+"\"" + + " }"+ + " }"); + return alipayClient.pageExecute(request, "GET").getBody(); + } + + @Override +// @Cacheable(key = "'1'") + public AlipayConfig find() { + AlipayConfig alipayConfig = this.list().get(0); + return alipayConfig; + } + + @Override +// @CachePut(key = "'1'") + @Transactional(rollbackFor = Exception.class) + public void update(AlipayConfig alipayConfig) { + this.save(alipayConfig); + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/impl/EmailConfigServiceImpl.java b/yshop-tools/src/main/java/co/yixiang/tools/service/impl/EmailConfigServiceImpl.java new file mode 100644 index 0000000..a1df65d --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/impl/EmailConfigServiceImpl.java @@ -0,0 +1,103 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.impl; + +import cn.hutool.extra.mail.Mail; +import cn.hutool.extra.mail.MailAccount; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.exception.BadRequestException; +import co.yixiang.tools.domain.EmailConfig; +import co.yixiang.tools.domain.vo.EmailVo; +import co.yixiang.tools.service.EmailConfigService; +import co.yixiang.tools.service.mapper.EmailConfigMapper; +import co.yixiang.utils.EncryptUtils; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; + + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Service +@AllArgsConstructor +//@CacheConfig(cacheNames = "emailConfig") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class EmailConfigServiceImpl extends BaseServiceImpl implements EmailConfigService { + + private final IGenerator generator; + + @Override +// @CachePut(key = "'1'") + @Transactional(rollbackFor = Exception.class) + public void update(EmailConfig emailConfig, EmailConfig old) { + try { + if(!emailConfig.getPass().equals(old.getPass())){ + // 对称加密 + emailConfig.setPass(EncryptUtils.desEncrypt(emailConfig.getPass())); + } + } catch (Exception e) { + e.printStackTrace(); + } + this.saveOrUpdate(emailConfig); + } + + @Override +// @Cacheable(key = "'1'") + public EmailConfig find() { + EmailConfig emailConfig = this.list().get(0); + return emailConfig; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void send(EmailVo emailVo, EmailConfig emailConfig){ + if(emailConfig == null){ + throw new BadRequestException("请先配置,再操作"); + } + // 封装 + MailAccount account = new MailAccount(); + // 设置用户 + String user = emailConfig.getFromUser().split("@")[0]; + account.setUser(user); + account.setHost(emailConfig.getHost()); + account.setPort(Integer.parseInt(emailConfig.getPort())); + account.setAuth(true); + try { + // 对称解密 + account.setPass(EncryptUtils.desDecrypt(emailConfig.getPass())); + } catch (Exception e) { + throw new BadRequestException(e.getMessage()); + } + account.setFrom(emailConfig.getUser()+"<"+emailConfig.getFromUser()+">"); + // ssl方式发送 + account.setSslEnable(true); + // 使用STARTTLS安全连接 + account.setStarttlsEnable(true); + String content = emailVo.getContent(); + // 发送 + try { + int size = emailVo.getTos().size(); + Mail.create(account) + .setTos(emailVo.getTos().toArray(new String[size])) + .setTitle(emailVo.getSubject()) + .setContent(content) + .setHtml(true) + //关闭session + .setUseGlobalSession(false) + .send(); + }catch (Exception e){ + throw new BadRequestException(e.getMessage()); + } + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/impl/LocalStorageServiceImpl.java b/yshop-tools/src/main/java/co/yixiang/tools/service/impl/LocalStorageServiceImpl.java new file mode 100644 index 0000000..f76010f --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/impl/LocalStorageServiceImpl.java @@ -0,0 +1,150 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.exception.BadRequestException; +import co.yixiang.tools.domain.LocalStorage; +import co.yixiang.tools.service.LocalStorageService; +import co.yixiang.tools.service.dto.LocalStorageDto; +import co.yixiang.tools.service.dto.LocalStorageQueryCriteria; +import co.yixiang.tools.service.mapper.LocalStorageMapper; +import co.yixiang.utils.FileUtil; +import co.yixiang.utils.SecurityUtils; +import co.yixiang.utils.StringUtils; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Service +//@CacheConfig(cacheNames = "localStorage") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class LocalStorageServiceImpl extends BaseServiceImpl implements LocalStorageService { + + private final IGenerator generator; + @Value("${file.path}") + private String path; + + @Value("${file.maxSize}") + private long maxSize; + + public LocalStorageServiceImpl(IGenerator generator) { + this.generator = generator; + } + + @Override + //@Cacheable + public Map queryAll(LocalStorageQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(baseMapper.selectList(QueryHelpPlus.getPredicate(LocalStorage.class, criteria))); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), LocalStorageDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(LocalStorageQueryCriteria criteria){ + return generator.convert(baseMapper.selectList(QueryHelpPlus.getPredicate(LocalStorage.class, criteria)),LocalStorageDto.class); + } + + @Override + public LocalStorageDto findById(Long id) { + LocalStorage localStorage = this.getById(id); + return generator.convert(localStorage,LocalStorageDto.class); + } + + @Override + public LocalStorageDto create(String name, MultipartFile multipartFile) { + FileUtil.checkSize(maxSize, multipartFile.getSize()); + String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename()); + String type = FileUtil.getFileType(suffix); + File file = FileUtil.upload(multipartFile, path + type + File.separator); + if(ObjectUtil.isNull(file)){ + throw new BadRequestException("上传失败"); + } + try { + name = StringUtils.isBlank(name) ? FileUtil.getFileNameNoEx(multipartFile.getOriginalFilename()) : name; + LocalStorage localStorage = new LocalStorage( + file.getName(), + name, + suffix, + file.getPath(), + type, + FileUtil.getSize(multipartFile.getSize()), + "yshop" + ); + this.save(localStorage); + return generator.convert(localStorage,LocalStorageDto.class); + }catch (Exception e){ + FileUtil.del(file); + throw e; + } + } + + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + LocalStorage storage = this.getById(id); + FileUtil.del(storage.getPath()); + this.removeById(id); + } + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (LocalStorageDto localStorage : all) { + Map map = new LinkedHashMap<>(); + map.put("文件真实的名称", localStorage.getRealName()); + map.put("文件名", localStorage.getName()); + map.put("后缀", localStorage.getSuffix()); +// map.put("路径", localStorage.getPath()); + map.put("类型", localStorage.getType()); + map.put("大小", localStorage.getSize()); + map.put("操作人", localStorage.getOperate()); + map.put("创建日期", localStorage.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + public void updateLocalStorage(LocalStorageDto resources) { + LocalStorage localStorage = this.getById(resources.getId()); + BeanUtils.copyProperties(resources,localStorage); + this.saveOrUpdate(localStorage); + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/impl/PictureServiceImpl.java b/yshop-tools/src/main/java/co/yixiang/tools/service/impl/PictureServiceImpl.java new file mode 100644 index 0000000..91392da --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/impl/PictureServiceImpl.java @@ -0,0 +1,185 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.impl; + +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.exception.BadRequestException; +import co.yixiang.tools.domain.Picture; +import co.yixiang.tools.service.PictureService; +import co.yixiang.tools.service.dto.PictureDto; +import co.yixiang.tools.service.dto.PictureQueryCriteria; +import co.yixiang.tools.service.mapper.PictureMapper; +import co.yixiang.utils.FileUtil; +import co.yixiang.utils.TranslatorUtil; +import co.yixiang.utils.ValidationUtil; +import co.yixiang.utils.YshopConstant; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Service +//@AllArgsConstructor +//@CacheConfig(cacheNames = "picture") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class PictureServiceImpl extends BaseServiceImpl implements PictureService { + + private final IGenerator generator; + + @Value("${smms.token}") + private String token; + + + private static final String SUCCESS = "success"; + + private static final String CODE = "code"; + + private static final String MSG = "message"; + + public PictureServiceImpl(IGenerator generator) { + this.generator = generator; + } + + @Override + //@Cacheable + public Map queryAll(PictureQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), PictureDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(PictureQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(Picture.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (PictureDto picture : all) { + Map map = new LinkedHashMap<>(); + map.put("上传日期", picture.getCreateTime()); + map.put("删除的URL", picture.getDeleteUrl()); + map.put("图片名称", picture.getFilename()); + map.put("图片高度", picture.getHeight()); + map.put("图片大小", picture.getSize()); + map.put("图片地址", picture.getUrl()); + map.put("用户名称", picture.getUsername()); + map.put("图片宽度", picture.getWidth()); + map.put("文件的MD5值", picture.getMd5code()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + @Transactional(rollbackFor = Throwable.class) + public Picture upload(MultipartFile multipartFile, String username) { + File file = FileUtil.toFile(multipartFile); + // 验证是否重复上传 + Picture picture = this.getOne(new LambdaQueryWrapper().eq(Picture::getMd5code,FileUtil.getMd5(file))); + if(picture != null){ + return picture; + } + HashMap paramMap = new HashMap<>(1); + paramMap.put("smfile", file); + // 上传文件 + String result= HttpRequest.post(YshopConstant.Url.SM_MS_URL + "/v2/upload") + .header("Authorization", token) + .form(paramMap) + .timeout(20000) + .execute().body(); + JSONObject jsonObject = JSONUtil.parseObj(result); + if(!jsonObject.get(CODE).toString().equals(SUCCESS)){ + throw new BadRequestException(TranslatorUtil.translate(jsonObject.get(MSG).toString())); + } + picture = JSON.parseObject(jsonObject.get("data").toString(), Picture.class); + picture.setSize(FileUtil.getSize(Integer.parseInt(picture.getSize()))); + picture.setUsername(username); + picture.setMd5code(FileUtil.getMd5(file)); + picture.setFilename(FileUtil.getFileNameNoEx(multipartFile.getOriginalFilename())+"."+FileUtil.getExtensionName(multipartFile.getOriginalFilename())); + this.save(picture); + //删除临时文件 + FileUtil.del(file); + return picture; + + } + + @Override + public Picture findById(Long id) { + Picture picture = this.getById(id); + ValidationUtil.isNull(picture.getId(),"Picture","id",id); + return picture; + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + Picture picture = findById(id); + try { + HttpUtil.get(picture.getDeleteUrl()); + this.removeById(id); + } catch(Exception e){ + this.removeById(id); + } + } + } + + @Override + public void synchronize() { + //链式构建请求 + String result = HttpRequest.get(YshopConstant.Url.SM_MS_URL + "/v2/upload_history") + //头信息,多个头信息多次调用此方法即可 + .header("Authorization", token) + .timeout(20000) + .execute().body(); + JSONObject jsonObject = JSONUtil.parseObj(result); + List pictures = JSON.parseArray(jsonObject.get("data").toString(), Picture.class); + for (Picture picture : pictures) { + if(this.getOne(new LambdaQueryWrapper().eq(Picture::getUrl,picture.getUrl()))==null){ + picture.setSize(FileUtil.getSize(Integer.parseInt(picture.getSize()))); + picture.setUsername("System Sync"); + picture.setMd5code(null); + this.save(picture); + } + } + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/impl/QiNiuServiceImpl.java b/yshop-tools/src/main/java/co/yixiang/tools/service/impl/QiNiuServiceImpl.java new file mode 100644 index 0000000..529c093 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/impl/QiNiuServiceImpl.java @@ -0,0 +1,247 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.impl; + +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.exception.BadRequestException; +import co.yixiang.tools.domain.QiniuConfig; +import co.yixiang.tools.domain.QiniuContent; +import co.yixiang.tools.service.QiNiuService; +import co.yixiang.tools.service.QiniuConfigService; +import co.yixiang.tools.service.QiniuContentService; +import co.yixiang.tools.service.dto.QiniuQueryCriteria; +import co.yixiang.tools.utils.QiNiuUtil; +import co.yixiang.utils.FileUtil; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.qiniu.common.QiniuException; +import com.qiniu.http.Response; +import com.qiniu.storage.BucketManager; +import com.qiniu.storage.Configuration; +import com.qiniu.storage.UploadManager; +import com.qiniu.storage.model.DefaultPutRet; +import com.qiniu.storage.model.FileInfo; +import com.qiniu.util.Auth; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * @author hupeng + * @date 2018-12-31 + */ +@Service +//@CacheConfig(cacheNames = "qiNiu") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class QiNiuServiceImpl implements QiNiuService { + + private final QiniuConfigService qiniuConfigService; + + private final QiniuContentService qiniuContentService; + + private final IGenerator generator; + + @Value("${qiniu.max-size}") + private Long maxSize; + + public QiNiuServiceImpl(QiniuConfigService qiniuConfigService, QiniuContentService qiniuContentService, IGenerator generator) { + this.qiniuConfigService = qiniuConfigService; + this.qiniuContentService = qiniuContentService; + this.generator = generator; + } + + @Override +// @Cacheable + public Object queryAll(QiniuQueryCriteria criteria, Pageable pageable){ + return qiniuContentService.queryAll(criteria,pageable); + } + + @Override + public List queryAll(QiniuQueryCriteria criteria) { + return qiniuContentService.queryAll(criteria); + } + + @Override +// @Cacheable(key = "'1'") + public QiniuConfig find() { + QiniuConfig qiniuConfig = qiniuConfigService.getOne(new LambdaQueryWrapper().orderByAsc(QiniuConfig::getId).last("limit 1")); + return qiniuConfig; + } + + @Override +// @CachePut(cacheNames = "qiNiuConfig", key = "'1'") + @Transactional(rollbackFor = Exception.class) + public QiniuConfig update(QiniuConfig qiniuConfig) { + String http = "http://", https = "https://"; + if (!(qiniuConfig.getHost().toLowerCase().startsWith(http)||qiniuConfig.getHost().toLowerCase().startsWith(https))) { + throw new BadRequestException("外链域名必须以http://或者https://开头"); + } + qiniuConfig.setId(1L); + qiniuConfigService.saveOrUpdate(qiniuConfig); + return qiniuConfig; + } + + @Override +// @CacheEvict(allEntries = true) + @Transactional(rollbackFor = Exception.class) + public QiniuContent upload(MultipartFile file, QiniuConfig qiniuConfig) { + FileUtil.checkSize(maxSize, file.getSize()); + if(qiniuConfig.getId() == null){ + throw new BadRequestException("请先添加相应配置,再操作"); + } + // 构造一个带指定Zone对象的配置类 + Configuration cfg = new Configuration(QiNiuUtil.getRegion(qiniuConfig.getZone())); + UploadManager uploadManager = new UploadManager(cfg); + Auth auth = Auth.create(qiniuConfig.getAccessKey(), qiniuConfig.getSecretKey()); + String upToken = auth.uploadToken(qiniuConfig.getBucket()); + try { + String key = file.getOriginalFilename(); + if(qiniuContentService.getOne(new LambdaQueryWrapper().eq(QiniuContent::getName,key)) != null) { + key = QiNiuUtil.getKey(key); + } + Response response = uploadManager.put(file.getBytes(), key, upToken); + //解析上传成功的结果 + + DefaultPutRet putRet = JSON.parseObject(response.bodyString(), DefaultPutRet.class); + + QiniuContent content = qiniuContentService.getOne(new LambdaQueryWrapper().eq(QiniuContent::getName,FileUtil.getFileNameNoEx(putRet.key))); + if (content == null) { + //存入数据库 + QiniuContent qiniuContent = new QiniuContent(); + qiniuContent.setSuffix(FileUtil.getExtensionName(putRet.key)); + qiniuContent.setBucket(qiniuConfig.getBucket()); + qiniuContent.setType(qiniuConfig.getType()); + qiniuContent.setName(FileUtil.getFileNameNoEx(putRet.key)); + qiniuContent.setUrl(qiniuConfig.getHost()+"/"+putRet.key); + qiniuContent.setSize(FileUtil.getSize(Integer.parseInt(file.getSize()+""))); + qiniuContentService.save(qiniuContent); + return qiniuContent; + } + return content; + } catch (Exception e) { + throw new BadRequestException(e.getMessage()); + } + } + + @Override +// @Cacheable + public QiniuContent findByContentId(Long id) { + QiniuContent qiniuContent = qiniuContentService.getById(id); + return qiniuContent; + } + + @Override +// @Cacheable + public String download(QiniuContent content,QiniuConfig config){ + String finalUrl; + String type = "公开"; + if(type.equals(content.getType())){ + finalUrl = content.getUrl(); + } else { + Auth auth = Auth.create(config.getAccessKey(), config.getSecretKey()); + // 1小时,可以自定义链接过期时间 + long expireInSeconds = 3600; + finalUrl = auth.privateDownloadUrl(content.getUrl(), expireInSeconds); + } + return finalUrl; + } + + @Override +// @CacheEvict(allEntries = true) + @Transactional(rollbackFor = Exception.class) + public void delete(QiniuContent content, QiniuConfig config) { + //构造一个带指定Zone对象的配置类 + Configuration cfg = new Configuration(QiNiuUtil.getRegion(config.getZone())); + Auth auth = Auth.create(config.getAccessKey(), config.getSecretKey()); + BucketManager bucketManager = new BucketManager(auth, cfg); + try { + bucketManager.delete(content.getBucket(), content.getName() + "." + content.getSuffix()); + qiniuContentService.removeById(content.getId()); + } catch (QiniuException ex) { + qiniuConfigService.removeById(content.getId()); + } + } + + @Override +// @CacheEvict(allEntries = true) + @Transactional(rollbackFor = Exception.class) + public void synchronize(QiniuConfig config) { + if(config.getId() == null){ + throw new BadRequestException("请先添加相应配置,再操作"); + } + //构造一个带指定Zone对象的配置类 + Configuration cfg = new Configuration(QiNiuUtil.getRegion(config.getZone())); + Auth auth = Auth.create(config.getAccessKey(), config.getSecretKey()); + BucketManager bucketManager = new BucketManager(auth, cfg); + //文件名前缀 + String prefix = ""; + //每次迭代的长度限制,最大1000,推荐值 1000 + int limit = 1000; + //指定目录分隔符,列出所有公共前缀(模拟列出目录效果)。缺省值为空字符串 + String delimiter = ""; + //列举空间文件列表 + BucketManager.FileListIterator fileListIterator = bucketManager.createFileListIterator(config.getBucket(), prefix, limit, delimiter); + while (fileListIterator.hasNext()) { + //处理获取的file list结果 + QiniuContent qiniuContent; + FileInfo[] items = fileListIterator.next(); + for (FileInfo item : items) { + if(qiniuContentService.getOne(new LambdaQueryWrapper().eq(QiniuContent::getName,FileUtil.getFileNameNoEx(item.key))) + == null){ + qiniuContent = new QiniuContent(); + qiniuContent.setSize(FileUtil.getSize(Integer.parseInt(item.fsize+""))); + qiniuContent.setSuffix(FileUtil.getExtensionName(item.key)); + qiniuContent.setName(FileUtil.getFileNameNoEx(item.key)); + qiniuContent.setType(config.getType()); + qiniuContent.setBucket(config.getBucket()); + qiniuContent.setUrl(config.getHost()+"/"+item.key); + qiniuContentService.save(qiniuContent); + } + } + } + } + + @Override +// @CacheEvict(allEntries = true) + public void deleteAll(Long[] ids, QiniuConfig config) { + for (Long id : ids) { + delete(findByContentId(id), config); + } + } + + @Override +// @CacheEvict(allEntries = true) + @Transactional(rollbackFor = Exception.class) + public void update(String type) { + qiniuConfigService.update(type); + } + + @Override + public void downloadList(List queryAll, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (QiniuContent content : queryAll) { + Map map = new LinkedHashMap<>(); + map.put("文件名", content.getName()); + map.put("文件类型", content.getSuffix()); + map.put("空间名称", content.getBucket()); + map.put("文件大小", content.getSize()); + map.put("空间类型", content.getType()); + map.put("创建日期", content.getUpdateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/impl/QiniuConfigServiceImpl.java b/yshop-tools/src/main/java/co/yixiang/tools/service/impl/QiniuConfigServiceImpl.java new file mode 100644 index 0000000..1170ed8 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/impl/QiniuConfigServiceImpl.java @@ -0,0 +1,88 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.tools.domain.QiniuConfig; +import co.yixiang.tools.service.QiniuConfigService; +import co.yixiang.tools.service.dto.QiniuConfigDto; +import co.yixiang.tools.service.dto.QiniuQueryCriteria; +import co.yixiang.tools.service.mapper.QiniuConfigMapper; +import co.yixiang.utils.FileUtil; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Service +@AllArgsConstructor +//@CacheConfig(cacheNames = "qiniuConfig") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class QiniuConfigServiceImpl extends BaseServiceImpl implements QiniuConfigService { + + private final IGenerator generator; + + private final QiniuConfigMapper qiniuConfigMapper; + @Override + //@Cacheable + public Map queryAll(QiniuQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), QiniuConfigDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(QiniuQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(QiniuConfig.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (QiniuConfigDto qiniuConfig : all) { + Map map = new LinkedHashMap<>(); + map.put("accessKey", qiniuConfig.getAccessKey()); + map.put("Bucket 识别符", qiniuConfig.getBucket()); + map.put("外链域名", qiniuConfig.getHost()); + map.put("secretKey", qiniuConfig.getSecretKey()); + map.put("空间类型", qiniuConfig.getType()); + map.put("机房", qiniuConfig.getZone()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + public void update(String type) { + qiniuConfigMapper.updateType(type); + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/impl/QiniuContentServiceImpl.java b/yshop-tools/src/main/java/co/yixiang/tools/service/impl/QiniuContentServiceImpl.java new file mode 100644 index 0000000..64c89ac --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/impl/QiniuContentServiceImpl.java @@ -0,0 +1,79 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.tools.domain.QiniuContent; +import co.yixiang.tools.service.QiniuContentService; +import co.yixiang.tools.service.dto.QiniuContentDto; +import co.yixiang.tools.service.dto.QiniuQueryCriteria; +import co.yixiang.tools.service.mapper.QiniuContentMapper; +import co.yixiang.utils.FileUtil; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Service +@AllArgsConstructor +@SuppressWarnings("unchecked") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class QiniuContentServiceImpl extends BaseServiceImpl implements QiniuContentService { + + private final IGenerator generator; + + @Override + //@Cacheable + public Map queryAll(QiniuQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), QiniuContentDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(QiniuQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(QiniuContent.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (QiniuContentDto qiniuContent : all) { + Map map = new LinkedHashMap<>(); + map.put("Bucket 识别符", qiniuContent.getBucket()); + map.put("文件名称", qiniuContent.getKey()); + map.put("文件大小", qiniuContent.getSize()); + map.put("文件类型:私有或公开", qiniuContent.getType()); + map.put("上传或同步的时间", qiniuContent.getUpdateTime()); + map.put("文件url", qiniuContent.getUrl()); + map.put(" suffix", qiniuContent.getSuffix()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/impl/VerificationCodeServiceImpl.java b/yshop-tools/src/main/java/co/yixiang/tools/service/impl/VerificationCodeServiceImpl.java new file mode 100644 index 0000000..c838ee9 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/impl/VerificationCodeServiceImpl.java @@ -0,0 +1,98 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.impl; + +import cn.hutool.core.lang.Dict; +import cn.hutool.core.util.RandomUtil; +import cn.hutool.extra.template.Template; +import cn.hutool.extra.template.TemplateConfig; +import cn.hutool.extra.template.TemplateEngine; +import cn.hutool.extra.template.TemplateUtil; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.exception.BadRequestException; +import co.yixiang.tools.domain.VerificationCode; +import co.yixiang.tools.domain.vo.EmailVo; +import co.yixiang.tools.service.VerificationCodeService; +import co.yixiang.tools.service.mapper.VerificationCodeMapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.apache.commons.lang3.concurrent.BasicThreadFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Collections; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * @author hupeng + * @date 2018-12-26 + */ +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class VerificationCodeServiceImpl extends BaseServiceImpl implements VerificationCodeService { + + @Value("${code.expiration}") + private Integer expiration; + + + @Override + @Transactional(rollbackFor = Exception.class) + public EmailVo sendEmail(VerificationCode code) { + EmailVo emailVo; + String content; + VerificationCode verificationCode = this.getOne(new LambdaQueryWrapper() + .eq(VerificationCode::getScenes,code.getScenes()).eq(VerificationCode::getType,code.getType()).eq(VerificationCode::getValue,code.getValue())); + // 如果不存在有效的验证码,就创建一个新的 + TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH)); + Template template = engine.getTemplate("email/email.ftl"); + if(verificationCode == null){ + code.setCode(RandomUtil.randomNumbers (6)); + content = template.render(Dict.create().set("code",code.getCode())); + emailVo = new EmailVo(Collections.singletonList(code.getValue()),"yshop后台管理系统",content); + this.save(code); + timedDestruction(code); + // 存在就再次发送原来的验证码 + } else { + content = template.render(Dict.create().set("code",verificationCode.getCode())); + emailVo = new EmailVo(Collections.singletonList(verificationCode.getValue()),"yshop后台管理系统",content); + } + return emailVo; + } + + @Override + public void validated(VerificationCode code) { + VerificationCode verificationCode = this.getOne(new LambdaQueryWrapper() + .eq(VerificationCode::getScenes,code.getScenes()).eq(VerificationCode::getType,code.getType()).eq(VerificationCode::getValue,code.getValue()) + .eq(VerificationCode::getStatus,true)); + if(verificationCode == null || !verificationCode.getCode().equals(code.getCode())){ + throw new BadRequestException("无效验证码"); + } else { + verificationCode.setStatus(false); + this.save(verificationCode); + } + } + + /** + * 定时任务,指定分钟后改变验证码状态 + * @param verifyCode 验证码 + */ + private void timedDestruction(VerificationCode verifyCode) { + //以下示例为程序调用结束继续运行 + ScheduledExecutorService executorService = new ScheduledThreadPoolExecutor(1, + new BasicThreadFactory.Builder().namingPattern("verifyCode-schedule-pool-%d").daemon(true).build()); + try { + executorService.schedule(() -> { + verifyCode.setStatus(false); + this.save(verifyCode); + }, expiration * 60 * 1000L, TimeUnit.MILLISECONDS); + }catch (Exception e){ + e.printStackTrace(); + } + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/AlipayConfigMapper.java b/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/AlipayConfigMapper.java new file mode 100644 index 0000000..ea4173d --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/AlipayConfigMapper.java @@ -0,0 +1,21 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.tools.domain.AlipayConfig; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Repository +@Mapper +public interface AlipayConfigMapper extends CoreMapper { + +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/EmailConfigMapper.java b/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/EmailConfigMapper.java new file mode 100644 index 0000000..79c91a7 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/EmailConfigMapper.java @@ -0,0 +1,21 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.tools.domain.EmailConfig; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Repository +@Mapper +public interface EmailConfigMapper extends CoreMapper { + +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/LocalStorageMapper.java b/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/LocalStorageMapper.java new file mode 100644 index 0000000..101bc6c --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/LocalStorageMapper.java @@ -0,0 +1,21 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.tools.domain.LocalStorage; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Repository +@Mapper +public interface LocalStorageMapper extends CoreMapper { + +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/PictureMapper.java b/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/PictureMapper.java new file mode 100644 index 0000000..30f1c92 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/PictureMapper.java @@ -0,0 +1,21 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.tools.domain.Picture; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Repository +@Mapper +public interface PictureMapper extends CoreMapper { + +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/QiniuConfigMapper.java b/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/QiniuConfigMapper.java new file mode 100644 index 0000000..0bb4616 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/QiniuConfigMapper.java @@ -0,0 +1,26 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.tools.domain.QiniuConfig; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Update; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Repository +@Mapper +public interface QiniuConfigMapper extends CoreMapper { + + + @Update("update qiniu_config set type = #{type} ") + void updateType(@Param("type") String type); +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/QiniuContentMapper.java b/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/QiniuContentMapper.java new file mode 100644 index 0000000..48a04bc --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/QiniuContentMapper.java @@ -0,0 +1,21 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.tools.domain.QiniuContent; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-13 +*/ +@Repository +@Mapper +public interface QiniuContentMapper extends CoreMapper { + +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/VerificationCodeMapper.java b/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/VerificationCodeMapper.java new file mode 100644 index 0000000..8cdbedc --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/service/mapper/VerificationCodeMapper.java @@ -0,0 +1,18 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.service.mapper; + + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.tools.domain.VerificationCode; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +@Repository +@Mapper +public interface VerificationCodeMapper extends CoreMapper { + +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/utils/AliPayStatusEnum.java b/yshop-tools/src/main/java/co/yixiang/tools/utils/AliPayStatusEnum.java new file mode 100644 index 0000000..e201a81 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/utils/AliPayStatusEnum.java @@ -0,0 +1,36 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.utils; + +/** + * 支付状态 + * @author zhengjie + * @date 2018/08/01 16:45:43 + */ +public enum AliPayStatusEnum { + + /** 交易成功 */ + FINISHED("交易成功", "TRADE_FINISHED"), + + /** 支付成功 */ + SUCCESS("支付成功", "TRADE_SUCCESS"), + + /** 交易创建 */ + BUYER_PAY("交易创建", "WAIT_BUYER_PAY"), + + /** 交易关闭 */ + CLOSED("交易关闭", "TRADE_CLOSED"); + + private String value; + + AliPayStatusEnum(String name, String value) { + this.value = value; + } + + public String getValue() { + return value; + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/utils/AlipayUtils.java b/yshop-tools/src/main/java/co/yixiang/tools/utils/AlipayUtils.java new file mode 100644 index 0000000..61374d8 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/utils/AlipayUtils.java @@ -0,0 +1,76 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.utils; + +import co.yixiang.tools.domain.AlipayConfig; +import com.alipay.api.AlipayApiException; +import com.alipay.api.internal.util.AlipaySignature; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * 支付宝工具类 + * @author zhengjie + * @date 2018/09/30 14:04:35 + */ +@Component +public class AlipayUtils { + + /** + * 生成订单号 + * @return String + */ + public String getOrderCode() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + int a = (int)(Math.random() * 9000.0D) + 1000; + System.out.println(a); + Date date = new Date(); + String str = sdf.format(date); + String[] split = str.split("-"); + String s = split[0] + split[1] + split[2]; + String[] split1 = s.split(" "); + String s1 = split1[0] + split1[1]; + String[] split2 = s1.split(":"); + return split2[0] + split2[1] + split2[2] + a; + } + + /** + * 校验签名 + * @param request HttpServletRequest + * @param alipay 阿里云配置 + * @return boolean + */ + public boolean rsaCheck(HttpServletRequest request, AlipayConfig alipay){ + + // 获取支付宝POST过来反馈信息 + Map params = new HashMap<>(1); + Map requestParams = request.getParameterMap(); + for (Object o : requestParams.keySet()) { + String name = (String) o; + String[] values = (String[]) requestParams.get(name); + String valueStr = ""; + for (int i = 0; i < values.length; i++) { + valueStr = (i == values.length - 1) ? valueStr + values[i] + : valueStr + values[i] + ","; + } + params.put(name, valueStr); + } + + try { + return AlipaySignature.rsaCheckV1(params, + alipay.getPublicKey(), + alipay.getCharset(), + alipay.getSignType()); + } catch (AlipayApiException e) { + return false; + } + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/utils/JacksonUtil.java b/yshop-tools/src/main/java/co/yixiang/tools/utils/JacksonUtil.java new file mode 100644 index 0000000..4df4d08 --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/utils/JacksonUtil.java @@ -0,0 +1,184 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.utils; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + +public class JacksonUtil { + + private static final Log logger = LogFactory.getLog(JacksonUtil.class); + + public static String parseString(String body, String field) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode node; + try { + node = mapper.readTree(body); + JsonNode leaf = node.get(field); + if (leaf != null) { + return leaf.asText(); + } + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + return null; + } + + + public static List parseStringList(String body, String field) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode node; + try { + node = mapper.readTree(body); + JsonNode leaf = node.get(field); + + if (leaf != null) { + return mapper.convertValue(leaf, new TypeReference>() { + }); + } + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + return null; + } + + public static Integer parseInteger(String body, String field) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode node; + try { + node = mapper.readTree(body); + JsonNode leaf = node.get(field); + if (leaf != null) { + return leaf.asInt(); + } + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + return null; + } + + public static List parseIntegerList(String body, String field) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode node; + try { + node = mapper.readTree(body); + JsonNode leaf = node.get(field); + + if (leaf != null) { + return mapper.convertValue(leaf, new TypeReference>() { + }); + } + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + return null; + } + + + public static Boolean parseBoolean(String body, String field) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode node; + try { + node = mapper.readTree(body); + JsonNode leaf = node.get(field); + if (leaf != null) { + return leaf.asBoolean(); + } + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + return null; + } + + public static Short parseShort(String body, String field) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode node; + try { + node = mapper.readTree(body); + JsonNode leaf = node.get(field); + if (leaf != null) { + Integer value = leaf.asInt(); + return value.shortValue(); + } + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + return null; + } + + public static Byte parseByte(String body, String field) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode node; + try { + node = mapper.readTree(body); + JsonNode leaf = node.get(field); + if (leaf != null) { + Integer value = leaf.asInt(); + return value.byteValue(); + } + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + return null; + } + + public static T parseObject(String body, String field, Class clazz) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode node; + try { + node = mapper.readTree(body); + node = node.get(field); + return mapper.treeToValue(node, clazz); + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + return null; + } + + public static Object toNode(String json) { + if (json == null) { + return null; + } + ObjectMapper mapper = new ObjectMapper(); + try { + + return mapper.readTree(json); + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + + return null; + } + + public static Map toMap(String data) { + ObjectMapper objectMapper = new ObjectMapper(); + try { + return objectMapper.readValue(data, new TypeReference>() { + }); + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + return null; + } + + public static String toJson(Object data) { + ObjectMapper objectMapper = new ObjectMapper(); + try { + return objectMapper.writeValueAsString(data); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/yshop-tools/src/main/java/co/yixiang/tools/utils/QiNiuUtil.java b/yshop-tools/src/main/java/co/yixiang/tools/utils/QiNiuUtil.java new file mode 100644 index 0000000..fa0f67e --- /dev/null +++ b/yshop-tools/src/main/java/co/yixiang/tools/utils/QiNiuUtil.java @@ -0,0 +1,63 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.tools.utils; + +import co.yixiang.utils.FileUtil; +import com.qiniu.storage.Region; + +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * 七牛云存储工具类 + * @author hupeng + * @date 2018-12-31 + */ +public class QiNiuUtil { + + private static final String HUAD = "华东"; + + private static final String HUAB = "华北"; + + private static final String HUAN = "华南"; + + private static final String BEIM = "北美"; + + /** + * 得到机房的对应关系 + * @param zone 机房名称 + * @return Region + */ + public static Region getRegion(String zone){ + + if(HUAD.equals(zone)){ + return Region.huadong(); + } else if(HUAB.equals(zone)){ + return Region.huabei(); + } else if(HUAN.equals(zone)){ + return Region.huanan(); + } else if (BEIM.equals(zone)){ + return Region.beimei(); + // 否则就是东南亚 + } else { + return Region.qvmHuadong(); + } + } + + /** + * 默认不指定key的情况下,以文件内容的hash值作为文件名 + * @param file 文件名 + * @return String + */ + public static String getKey(String file){ + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); + Date date = new Date(); + return FileUtil.getFileNameNoEx(file) + "-" + + sdf.format(date) + + "." + + FileUtil.getExtensionName(file); + } +} diff --git a/yshop-weixin/pom.xml b/yshop-weixin/pom.xml new file mode 100644 index 0000000..d1fd3ad --- /dev/null +++ b/yshop-weixin/pom.xml @@ -0,0 +1,24 @@ + + + + yshop + co.yixiang + 3.2 + + 4.0.0 + + yshop-weixin + 微信模块 + + + + co.yixiang + yshop-mall + 3.2 + + + + + diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/builder/AbstractBuilder.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/builder/AbstractBuilder.java new file mode 100644 index 0000000..81476fb --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/builder/AbstractBuilder.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.builder; + +import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; +import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Binary Wang(https://github.com/binarywang) + */ +public abstract class AbstractBuilder { + protected final Logger logger = LoggerFactory.getLogger(getClass()); + + public abstract WxMpXmlOutMessage build(String content, + WxMpXmlMessage wxMessage, WxMpService service); +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/builder/ImageBuilder.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/builder/ImageBuilder.java new file mode 100644 index 0000000..4ee5a34 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/builder/ImageBuilder.java @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.builder; + +import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; +import me.chanjar.weixin.mp.bean.message.WxMpXmlOutImageMessage; +import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; + +/** + * @author Binary Wang(https://github.com/binarywang) + */ +public class ImageBuilder extends AbstractBuilder { + + @Override + public WxMpXmlOutMessage build(String content, WxMpXmlMessage wxMessage, + WxMpService service) { + + WxMpXmlOutImageMessage m = WxMpXmlOutMessage.IMAGE().mediaId(content) + .fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser()) + .build(); + + return m; + } + +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/builder/TextBuilder.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/builder/TextBuilder.java new file mode 100644 index 0000000..3741f3f --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/builder/TextBuilder.java @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.builder; + +import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; +import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; +import me.chanjar.weixin.mp.bean.message.WxMpXmlOutTextMessage; + +/** + * @author Binary Wang(https://github.com/binarywang) + */ +public class TextBuilder extends AbstractBuilder { + + @Override + public WxMpXmlOutMessage build(String content, WxMpXmlMessage wxMessage, + WxMpService service) { + WxMpXmlOutTextMessage m = WxMpXmlOutMessage.TEXT().content(content) + .fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser()) + .build(); + return m; + } + +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/config/WxMaConfiguration.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/config/WxMaConfiguration.java new file mode 100644 index 0000000..0d36bbd --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/config/WxMaConfiguration.java @@ -0,0 +1,78 @@ +package co.yixiang.modules.mp.config; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; +import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; +import cn.binarywang.wx.miniapp.message.WxMaMessageHandler; +import cn.binarywang.wx.miniapp.message.WxMaMessageRouter; +import co.yixiang.constant.SystemConfigConstants; +import co.yixiang.utils.RedisUtil; +import co.yixiang.utils.RedisUtils; +import co.yixiang.utils.ShopKeyUtils; +import com.google.common.collect.Maps; +import me.chanjar.weixin.common.api.WxConsts; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; + +import java.util.Map; + +/** + * @author Binary Wang + */ +@Configuration(proxyBeanMethods = false) +public class WxMaConfiguration { + private static Map maServices = Maps.newHashMap(); + private static Map routers = Maps.newHashMap(); + private static RedisUtils redisUtils; + private static WxMaMessageHandler wxMaMessageHandler; + + public static WxMaMessageRouter getRouter(String appid) { + return routers.get(appid); + } + @Autowired + public WxMaConfiguration(RedisUtils redisUtils) { + WxMaConfiguration.redisUtils = redisUtils; + } + + public static WxMaService getWxMaService() { + WxMaService wxMaService = maServices.get(ShopKeyUtils.getYshopWeiXinMaSevice()); + //增加一个redis标识 + if(wxMaService == null || redisUtils.get(ShopKeyUtils.getYshopWeiXinMaSevice()) == null){ + WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); + config.setMsgDataFormat("JSON"); + config.setAppid(RedisUtil.get(ShopKeyUtils.getWxAppAppId())); + config.setSecret(RedisUtil.get(ShopKeyUtils.getWxAppSecret())); + config.setToken(RedisUtil.get(ShopKeyUtils.getWechatMaToken())); + config.setAesKey(RedisUtil.get(ShopKeyUtils.getWechatMaEncodingAESKey())); + wxMaService = new WxMaServiceImpl(); + wxMaService.setWxMaConfig(config); + maServices.put(ShopKeyUtils.getYshopWeiXinMaSevice(), wxMaService); + routers.put(ShopKeyUtils.getYshopWeiXinMaSevice(), newRouter(wxMaService)); + //增加标识 + redisUtils.set(ShopKeyUtils.getYshopWeiXinMaSevice(),"yshop"); + + } + return wxMaService; + } + /** + * 移除WxMpService + */ + public static void removeWxMaService(){ + redisUtils.del(ShopKeyUtils.getYshopWeiXinMaSevice()); + maServices.remove(ShopKeyUtils.getYshopWeiXinMaSevice()); + routers.remove(ShopKeyUtils.getYshopWeiXinMaSevice()); + } + private static WxMaMessageRouter newRouter(WxMaService service) { + final WxMaMessageRouter router = new WxMaMessageRouter(service); + router + .rule().handler(wxMaMessageHandler).next() + .rule().async(false).msgType(WxConsts.XmlMsgType.EVENT).event(SystemConfigConstants.BINDSTATECHANGE).handler(BINDSTATECHANGE_HANDLER).end(); + return router; + } + private static final WxMaMessageHandler BINDSTATECHANGE_HANDLER = (wxMessage, context, service, sessionManager) -> { + wxMessage.getFromUser(); + wxMessage.getContent(); + return null; + }; +} + diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/config/WxMpConfiguration.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/config/WxMpConfiguration.java new file mode 100644 index 0000000..16b3cd7 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/config/WxMpConfiguration.java @@ -0,0 +1,178 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.config; + +import co.yixiang.modules.mp.handler.KfSessionHandler; +import co.yixiang.modules.mp.handler.LocationHandler; +import co.yixiang.modules.mp.handler.LogHandler; +import co.yixiang.modules.mp.handler.MenuHandler; +import co.yixiang.modules.mp.handler.MsgHandler; +import co.yixiang.modules.mp.handler.NullHandler; +import co.yixiang.modules.mp.handler.ScanHandler; +import co.yixiang.modules.mp.handler.StoreCheckNotifyHandler; +import co.yixiang.modules.mp.handler.SubscribeHandler; +import co.yixiang.modules.mp.handler.UnsubscribeHandler; +import co.yixiang.utils.RedisUtil; +import co.yixiang.utils.RedisUtils; +import co.yixiang.utils.ShopKeyUtils; +import com.google.common.collect.Maps; +import me.chanjar.weixin.common.api.WxConsts; +import me.chanjar.weixin.mp.api.WxMpMessageRouter; +import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; +import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl; +import me.chanjar.weixin.mp.constant.WxMpEventConstants; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; + +import java.util.Map; + +import static me.chanjar.weixin.common.api.WxConsts.EventType; +import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType; + +/** + * 公众号配置 + * @author hupeng + * @date 2020/01/20 + */ +@Configuration(proxyBeanMethods = false) +public class WxMpConfiguration { + + private static Map mpServices = Maps.newHashMap(); + private static Map routers = Maps.newHashMap(); + + private static LogHandler logHandler; + private static NullHandler nullHandler; + private static KfSessionHandler kfSessionHandler; + private static StoreCheckNotifyHandler storeCheckNotifyHandler; + private static LocationHandler locationHandler; + private static MenuHandler menuHandler; + private static MsgHandler msgHandler; + private static UnsubscribeHandler unsubscribeHandler; + private static SubscribeHandler subscribeHandler; + private static ScanHandler scanHandler; + private static RedisUtils redisUtils; + + @Autowired + public WxMpConfiguration(LogHandler logHandler,NullHandler nullHandler,KfSessionHandler kfSessionHandler, + StoreCheckNotifyHandler storeCheckNotifyHandler,LocationHandler locationHandler, + MenuHandler menuHandler,MsgHandler msgHandler,UnsubscribeHandler unsubscribeHandler, + SubscribeHandler subscribeHandler,ScanHandler scanHandler, + RedisUtils redisUtils){ + WxMpConfiguration.logHandler = logHandler; + WxMpConfiguration.nullHandler = nullHandler; + WxMpConfiguration.kfSessionHandler = kfSessionHandler; + WxMpConfiguration.storeCheckNotifyHandler = storeCheckNotifyHandler; + WxMpConfiguration.locationHandler = locationHandler; + WxMpConfiguration.menuHandler = menuHandler; + WxMpConfiguration.msgHandler = msgHandler; + WxMpConfiguration.unsubscribeHandler = unsubscribeHandler; + WxMpConfiguration.subscribeHandler = subscribeHandler; + WxMpConfiguration.scanHandler = scanHandler; + WxMpConfiguration.redisUtils = redisUtils; + } + + + /** + * 获取WxMpService + * @return + */ + public static WxMpService getWxMpService() { + + WxMpService wxMpService = mpServices.get(ShopKeyUtils.getYshopWeiXinMpSevice()); + //增加一个redis标识 + if(wxMpService == null || redisUtils.get(ShopKeyUtils.getYshopWeiXinMpSevice()) == null) { + WxMpDefaultConfigImpl configStorage = new WxMpDefaultConfigImpl(); + configStorage.setAppId(RedisUtil.get(ShopKeyUtils.getWechatAppId())); + configStorage.setSecret(RedisUtil.get(ShopKeyUtils.getWechatAppSecret())); + configStorage.setToken(RedisUtil.get(ShopKeyUtils.getWechatToken())); + configStorage.setAesKey(RedisUtil.get(ShopKeyUtils.getWechatEncodingAESKey())); + wxMpService = new WxMpServiceImpl(); + wxMpService.setWxMpConfigStorage(configStorage); + mpServices.put(ShopKeyUtils.getYshopWeiXinMpSevice(), wxMpService); + routers.put(ShopKeyUtils.getYshopWeiXinMpSevice(), newRouter(wxMpService)); + + //增加标识 + redisUtils.set(ShopKeyUtils.getYshopWeiXinMpSevice(),"yshop"); + } + return wxMpService; + } + + /** + * 移除WxMpService + */ + public static void removeWxMpService(){ + redisUtils.del(ShopKeyUtils.getYshopWeiXinMpSevice()); + mpServices.remove(ShopKeyUtils.getYshopWeiXinMpSevice()); + routers.remove(ShopKeyUtils.getYshopWeiXinMpSevice()); + } + + /** + * 获取WxMpMessageRouter + */ + public static WxMpMessageRouter getWxMpMessageRouter() { + WxMpMessageRouter wxMpMessageRouter = routers.get(ShopKeyUtils.getYshopWeiXinMpSevice()); + return wxMpMessageRouter; + } + + private static WxMpMessageRouter newRouter(WxMpService wxMpService) { + final WxMpMessageRouter newRouter = new WxMpMessageRouter(wxMpService); + + // 记录所有事件的日志 (异步执行) + newRouter.rule().handler(logHandler).next(); + + // 接收客服会话管理事件 + newRouter.rule().async(false).msgType(XmlMsgType.EVENT) + .event(WxMpEventConstants.CustomerService.KF_CREATE_SESSION) + .handler(kfSessionHandler).end(); + newRouter.rule().async(false).msgType(XmlMsgType.EVENT) + .event(WxMpEventConstants.CustomerService.KF_CLOSE_SESSION) + .handler(kfSessionHandler) + .end(); + newRouter.rule().async(false).msgType(XmlMsgType.EVENT) + .event(WxMpEventConstants.CustomerService.KF_SWITCH_SESSION) + .handler(kfSessionHandler).end(); + + // 门店审核事件 + newRouter.rule().async(false).msgType(XmlMsgType.EVENT) + .event(WxMpEventConstants.POI_CHECK_NOTIFY) + .handler(storeCheckNotifyHandler).end(); + + // 自定义菜单事件 + newRouter.rule().async(false).msgType(XmlMsgType.EVENT) + .event(WxConsts.MenuButtonType.CLICK).handler(menuHandler).end(); + + // 点击菜单连接事件 + newRouter.rule().async(false).msgType(XmlMsgType.EVENT) + .event(WxConsts.MenuButtonType.VIEW).handler(menuHandler).end(); + + // 扫码事件 + newRouter.rule().async(false).msgType(XmlMsgType.EVENT) + .event(EventType.SCANCODE_WAITMSG).handler(menuHandler).end(); + + // 关注事件 + newRouter.rule().async(false).msgType(XmlMsgType.EVENT) + .event(EventType.SUBSCRIBE).handler(subscribeHandler) + .end(); + + // 取消关注事件 + newRouter.rule().async(false).msgType(XmlMsgType.EVENT) + .event(EventType.UNSUBSCRIBE) + .handler(unsubscribeHandler).end(); + + // 上报地理位置事件 + newRouter.rule().async(false).msgType(XmlMsgType.EVENT) + .event(EventType.LOCATION).handler(locationHandler) + .end(); + + + // 默认 + newRouter.rule().async(false).handler(msgHandler).end(); + + return newRouter; + } + +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/config/WxPayConfiguration.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/config/WxPayConfiguration.java new file mode 100644 index 0000000..af561fc --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/config/WxPayConfiguration.java @@ -0,0 +1,134 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.config; + +import co.yixiang.enums.PayMethodEnum; +import co.yixiang.utils.RedisUtil; +import co.yixiang.utils.RedisUtils; +import co.yixiang.utils.ShopKeyUtils; +import com.github.binarywang.wxpay.config.WxPayConfig; +import com.github.binarywang.wxpay.service.WxPayService; +import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl; +import com.google.common.collect.Maps; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; + +import java.util.Map; + +/** + * 支付配置 + * @author hupeng + * @date 2020/03/01 + */ +@Slf4j +@Configuration(proxyBeanMethods = false) +public class WxPayConfiguration { + + private static Map payServices = Maps.newHashMap(); + + private static RedisUtils redisUtils; + + @Autowired + public WxPayConfiguration(RedisUtils redisUtils) { + WxPayConfiguration.redisUtils = redisUtils; + } + + /** + * 获取WxPayService + * @return + */ + public static WxPayService getPayService(PayMethodEnum payMethodEnum) { + WxPayService wxPayService = payServices.get(ShopKeyUtils.getYshopWeiXinPayService()+payMethodEnum.getValue()); + if(wxPayService == null || redisUtils.get(ShopKeyUtils.getYshopWeiXinPayService()) == null) { + WxPayConfig payConfig = new WxPayConfig(); + switch (payMethodEnum){ + case WECHAT: + payConfig.setAppId(redisUtils.getY(ShopKeyUtils.getWechatAppId())); + break; + case WXAPP: + payConfig.setAppId(RedisUtil.get(ShopKeyUtils.getWxAppAppId())); + break; + case APP: + payConfig.setAppId(RedisUtil.get(ShopKeyUtils.getWxNativeAppAppId())); + break; + default: + } + + payConfig.setMchId(redisUtils.getY(ShopKeyUtils.getWxPayMchId())); + payConfig.setMchKey(redisUtils.getY(ShopKeyUtils.getWxPayMchKey())); + payConfig.setKeyPath(redisUtils.getY(ShopKeyUtils.getWxPayKeyPath())); + // 可以指定是否使用沙箱环境 + payConfig.setUseSandboxEnv(false); + wxPayService = new WxPayServiceImpl(); + wxPayService.setConfig(payConfig); + payServices.put(ShopKeyUtils.getYshopWeiXinPayService()+payMethodEnum.getValue(), wxPayService); + + //增加标识 + redisUtils.set(ShopKeyUtils.getYshopWeiXinPayService(),"yshop"); + } + return wxPayService; + } + +// /** +// * 获取小程序WxAppPayService +// * @return +// */ +// public static WxPayService getWxAppPayService() { +// WxPayService wxPayService = payServices.get(ShopKeyUtils.getYshopWeiXinMiniPayService()); +// if(wxPayService == null || RedisUtil.get(ShopKeyUtils.getYshopWeiXinPayService()) == null) { +// WxPayConfig payConfig = new WxPayConfig(); +// payConfig.setAppId(RedisUtil.get(ShopKeyUtils.getWxAppAppId())); +// payConfig.setMchId(RedisUtil.get(ShopKeyUtils.getWxPayMchId())); +// payConfig.setMchKey(RedisUtil.get(ShopKeyUtils.getWxPayMchKey())); +// payConfig.setKeyPath(RedisUtil.get(ShopKeyUtils.getWxPayKeyPath())); +// // 可以指定是否使用沙箱环境 +// payConfig.setUseSandboxEnv(false); +// wxPayService = new WxPayServiceImpl(); +// wxPayService.setConfig(payConfig); +// payServices.put(ShopKeyUtils.getYshopWeiXinMiniPayService(), wxPayService); +// +// //增加标识 +// RedisUtil.set(ShopKeyUtils.getYshopWeiXinPayService(),"yshop"); +// } +// return wxPayService; +// } + +// /** +// * 获取APPPayService +// * @return +// */ +// public static WxPayService getAppPayService() { +// WxPayService wxPayService = payServices.get(ShopKeyUtils.getYshopWeiXinAppPayService()); +// if(wxPayService == null || RedisUtil.get(ShopKeyUtils.getYshopWeiXinPayService()) == null) { +// WxPayConfig payConfig = new WxPayConfig(); +// payConfig.setAppId(RedisUtil.get(ShopKeyUtils.getWxNativeAppAppId())); +// payConfig.setMchId(RedisUtil.get(ShopKeyUtils.getWxPayMchId())); +// payConfig.setMchKey(RedisUtil.get(ShopKeyUtils.getWxPayMchKey())); +// payConfig.setKeyPath(RedisUtil.get(ShopKeyUtils.getWxPayKeyPath())); +// // 可以指定是否使用沙箱环境 +// payConfig.setUseSandboxEnv(false); +// wxPayService = new WxPayServiceImpl(); +// wxPayService.setConfig(payConfig); +// payServices.put(ShopKeyUtils.getYshopWeiXinAppPayService(), wxPayService); +// +// //增加标识 +// RedisUtil.set(ShopKeyUtils.getYshopWeiXinPayService(),"yshop"); +// } +// return wxPayService; +// } + + /** + * 移除WxPayService + */ + public static void removeWxPayService(){ + redisUtils.del(ShopKeyUtils.getYshopWeiXinPayService()); + payServices.remove(ShopKeyUtils.getYshopWeiXinPayService()); + //payServices.remove(ShopKeyUtils.getYshopWeiXinMiniPayService()); + //payServices.remove(ShopKeyUtils.getYshopWeiXinAppPayService()); + } + +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/domain/YxArticle.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/domain/YxArticle.java new file mode 100644 index 0000000..93553b3 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/domain/YxArticle.java @@ -0,0 +1,112 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("yx_article") +public class YxArticle extends BaseDomain { + + /** 文章管理ID */ + @TableId + private Integer id; + + + /** 分类id */ + private String cid; + + + /** 文章标题 */ + @NotBlank(message = "请输入文章标题") + private String title; + + + /** 文章作者 */ + @NotBlank(message = "请输入文章作者") + private String author; + + + /** 文章图片 */ + @NotBlank(message = "请上传文章图片") + private String imageInput; + + + /** 文章简介 */ + @NotBlank(message = "请填写文章简介") + private String synopsis; + + + @NotBlank(message = "请填写文章详情") + private String content; + + + /** 文章分享标题 */ + private String shareTitle; + + + /** 文章分享简介 */ + private String shareSynopsis; + + + /** 浏览次数 */ + private String visit; + + + /** 排序 */ + private Integer sort; + + + /** 原文链接 */ + private String url; + + + /** 状态 */ + private Integer status; + + + + /** 是否隐藏 */ + private Integer hide; + + + /** 管理员id */ + private Integer adminId; + + + /** 商户id */ + private Integer merId; + + + /** 产品关联id */ + private Integer productId; + + + /** 是否热门(小程序) */ + private Integer isHot; + + + /** 是否轮播图(小程序) */ + private Integer isBanner; + + + public void copy(YxArticle source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/domain/YxWechatLive.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/domain/YxWechatLive.java new file mode 100644 index 0000000..cd57ffe --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/domain/YxWechatLive.java @@ -0,0 +1,143 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.mp.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-08-10 +*/ +@Data +@TableName("yx_wechat_live") +public class YxWechatLive implements Serializable { + + /** 直播间id */ + @TableId(type = IdType.INPUT) + private Long roomId; + + + /** 直播间标题 */ + @NotBlank + private String name; + + + /** 背景图 */ + @TableField(exist = false) + private String coverImg; + + + /** 分享图片 */ + @TableField(exist = false) + private String shareImg; + + /** 背景图 */ + @NotBlank + private String coverImge; + + + /** 分享图片 */ + @NotBlank + private String shareImge; + + /** 主播头像 */ + private String anchorImge; + + /** + * 101:直播中,102:未开始,103已结束,104禁播,105:暂停,106:异常,107:已过期 + */ + /** 直播间状态 */ + private Integer liveStatus; + + + /** 开始时间 */ + private Long startTime; + + + /** 预计结束时间 */ + private Long endTime; + + + /** 开始时间 */ + @NotNull + @TableField(exist = false) + private Date startDate; + + + /** 预计结束时间 */ + @NotNull + @TableField(exist = false) + private Date endDate; + /** 主播昵称 */ + @NotBlank + private String anchorName; + + + /** 主播微信号 */ + @NotBlank + private String anchorWechat; + + + /** 主播头像 */ + @TableField(exist = false) + private String anchorImg; + + + /** 直播间类型 1:推流 0:手机直播 */ + @NotNull + private Integer type; + + + /** 横屏、竖屏 【1:横屏,0:竖屏】 */ + @NotNull + private Integer screenType; + + + /** 是否关闭点赞 【0:开启,1:关闭】 */ + @NotNull + private Integer closeLike; + + + /** 是否关闭货架 【0:开启,1:关闭】 */ + @NotNull + private Integer closeGoods; + + /** 是否关闭评论 【0:开启,1:关闭】 */ + @NotNull + private Integer closeComment; + @NotNull + private Integer closeReplay ; // 是否关闭回放 1 关闭 + @NotNull + private Integer closeShare ; // 是否关闭分享 1 关闭 + @NotNull + private Integer closeKf ; // 是否关闭客服,1 关闭 + + private String productId; + + /** + * 购物直播封面图 ,建议尺寸800*800 + */ + @TableField(exist = false) + private String feedsImg; + + public void copy(YxWechatLive source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/domain/YxWechatLiveGoods.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/domain/YxWechatLiveGoods.java new file mode 100644 index 0000000..48deb2e --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/domain/YxWechatLiveGoods.java @@ -0,0 +1,85 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.mp.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-08-11 +*/ +@Data +@TableName("yx_wechat_live_goods") +public class YxWechatLiveGoods implements Serializable { + + /** 直播商品id */ + @TableId(type = IdType.INPUT) + private Long goodsId; + + + /** 关联商品id */ + private Long productId; + + + /** 商品图片 */ + @TableField(exist = false) + private String coverImgUrl; + + + /** 商品图片 */ + @NotBlank + private String coverImgeUrl; + + /** 商品小程序路径 */ + @NotBlank + private String url; + + + /** 价格类型 1:一口价(只需要传入price,price2不传) 2:价格区间(price字段为左边界,price2字段为右边界,price和price2必传) 3:显示折扣价(price字段为原价,price2字段为现价, price和price2必传) */ + @NotBlank + private String priceType; + + + @NotBlank + private String price; + + + private String price2; + + + /** 商品名称 */ + @NotBlank + private String name; + + + /** 1, 2:表示是为api添加商品,否则是直播控制台添加的商品 */ + private String thirdPartyTag; + + + /** 审核单id */ + private Long auditId; + + + /** 审核状态 0:未审核,1:审核中,2:审核通过,3审核失败 */ + private Integer auditStatus; + + + public void copy(YxWechatLiveGoods source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/domain/YxWechatMenu.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/domain/YxWechatMenu.java new file mode 100644 index 0000000..4c82f95 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/domain/YxWechatMenu.java @@ -0,0 +1,42 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +@TableName("yx_wechat_menu") +public class YxWechatMenu implements Serializable { + + @TableId(value = "`key`") + private String key; + + + /** 缓存数据 */ + private String result; + + + /** 缓存时间 */ + @TableField(fill= FieldFill.INSERT) + private Integer addTime; + + + public void copy(YxWechatMenu source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/domain/YxWechatReply.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/domain/YxWechatReply.java new file mode 100644 index 0000000..85d07c8 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/domain/YxWechatReply.java @@ -0,0 +1,54 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +@TableName("yx_wechat_reply") +public class YxWechatReply implements Serializable { + + /** 微信关键字回复id */ + @TableId + private Integer id; + + + /** 关键字 */ + @TableField(value = "`key`") + private String key; + + + /** 回复类型 */ + private String type; + + + /** 回复数据 */ + private String data; + + + /** 0=不可用 1 =可用 */ + private Integer status; + + + /** 是否隐藏 */ + private Integer hide; + + + public void copy(YxWechatReply source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/domain/YxWechatTemplate.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/domain/YxWechatTemplate.java new file mode 100644 index 0000000..c3aff2a --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/domain/YxWechatTemplate.java @@ -0,0 +1,56 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import co.yixiang.domain.BaseDomain; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("yx_wechat_template") +public class YxWechatTemplate extends BaseDomain { + + /** 模板id */ + @TableId + private Integer id; + + + /** 模板编号 */ + private String tempkey; + + + /** 模板名 */ + private String name; + + + /** 回复内容 */ + private String content; + + + /** 模板ID */ + private String tempid; + + + + /** 状态 */ + private Integer status; + + /** 类型:template:模板消息 subscribe:订阅消息 */ + private String type; + + public void copy(YxWechatTemplate source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/enums/WechatTempateEnum.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/enums/WechatTempateEnum.java new file mode 100644 index 0000000..cd1768c --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/enums/WechatTempateEnum.java @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.mp.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author hupeng + * 微信公众号模板枚举 + */ +@Getter +@AllArgsConstructor +public enum WechatTempateEnum { + PAY_SUCCESS("pay_success","支付成功通知"), + DELIVERY_SUCCESS("delivery_success","发货成功通知"), + REFUND_SUCCESS("refund_success","退款成功通知"), + RECHARGE_SUCCESS("recharge_success","充值成功通知"); + + private String value; //模板编号 + private String desc; //模板id +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/error/ErrorController.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/error/ErrorController.java new file mode 100644 index 0000000..b11d9f0 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/error/ErrorController.java @@ -0,0 +1,32 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.error; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + *
+ * 出错页面控制器
+ * 
+ * + */ +@Controller +@RequestMapping("/error") +public class ErrorController { + + @GetMapping(value = "/404") + public String error404() { + return "error"; + } + + @GetMapping(value = "/500") + public String error500() { + return "error"; + } + +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/error/ErrorPageConfiguration.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/error/ErrorPageConfiguration.java new file mode 100644 index 0000000..a9a627c --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/error/ErrorPageConfiguration.java @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.error; + +import org.springframework.boot.web.server.ErrorPage; +import org.springframework.boot.web.server.ErrorPageRegistrar; +import org.springframework.boot.web.server.ErrorPageRegistry; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Component; + +/** + *
+ * Created by Binary Wang on 2018/8/25.
+ *
+ */
+@Component
+public class ErrorPageConfiguration implements ErrorPageRegistrar {
+  @Override
+  public void registerErrorPages(ErrorPageRegistry errorPageRegistry) {
+    errorPageRegistry.addErrorPages(
+        new ErrorPage(HttpStatus.NOT_FOUND, "/error/404"),
+        new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/error/500")
+    );
+  }
+
+}
diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/AbstractHandler.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/AbstractHandler.java
new file mode 100644
index 0000000..fa4c43d
--- /dev/null
+++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/AbstractHandler.java
@@ -0,0 +1,15 @@
+/**
+ * Copyright (C) 2018-2021
+ * All rights reserved, Designed By www.yixiang.co
+
+ */
+package co.yixiang.modules.mp.handler;
+
+import me.chanjar.weixin.mp.api.WxMpMessageHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public abstract class AbstractHandler implements WxMpMessageHandler {
+    protected Logger logger = LoggerFactory.getLogger(getClass());
+}
diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/KfSessionHandler.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/KfSessionHandler.java
new file mode 100644
index 0000000..e050b6b
--- /dev/null
+++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/KfSessionHandler.java
@@ -0,0 +1,28 @@
+/**
+ * Copyright (C) 2018-2021
+ * All rights reserved, Designed By www.yixiang.co
+
+ */
+package co.yixiang.modules.mp.handler;
+
+import me.chanjar.weixin.common.session.WxSessionManager;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+
+@Component
+public class KfSessionHandler extends AbstractHandler {
+
+    @Override
+    public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
+                                    Map context, WxMpService wxMpService,
+                                    WxSessionManager sessionManager) {
+        //TODO 对会话做处理
+        return null;
+    }
+
+}
diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/LocationHandler.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/LocationHandler.java
new file mode 100644
index 0000000..038f559
--- /dev/null
+++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/LocationHandler.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright (C) 2018-2021
+ * All rights reserved, Designed By www.yixiang.co
+
+ */
+package co.yixiang.modules.mp.handler;
+
+import co.yixiang.modules.mp.builder.TextBuilder;
+import me.chanjar.weixin.common.session.WxSessionManager;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType;
+
+
+@Component
+public class LocationHandler extends AbstractHandler {
+
+    @Override
+    public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
+                                    Map context, WxMpService wxMpService,
+                                    WxSessionManager sessionManager) {
+        if (wxMessage.getMsgType().equals(XmlMsgType.LOCATION)) {
+            //TODO 接收处理用户发送的地理位置消息
+            try {
+                String content = "感谢反馈,您的的地理位置已收到!";
+                return new TextBuilder().build(content, wxMessage, null);
+            } catch (Exception e) {
+                this.logger.error("位置消息接收处理失败", e);
+                return null;
+            }
+        }
+
+        //上报地理位置事件
+        this.logger.info("上报地理位置,纬度 : {},经度 : {},精度 : {}",
+            wxMessage.getLatitude(), wxMessage.getLongitude(), String.valueOf(wxMessage.getPrecision()));
+
+        //TODO  可以将用户地理位置信息保存到本地数据库,以便以后使用
+
+        return null;
+    }
+
+}
diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/LogHandler.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/LogHandler.java
new file mode 100644
index 0000000..7f77b1b
--- /dev/null
+++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/LogHandler.java
@@ -0,0 +1,26 @@
+/**
+ * Copyright (C) 2018-2021
+ * All rights reserved, Designed By www.yixiang.co
+
+ */
+package co.yixiang.modules.mp.handler;
+
+import me.chanjar.weixin.common.session.WxSessionManager;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+@Component
+public class LogHandler extends AbstractHandler {
+    @Override
+    public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
+                                    Map context, WxMpService wxMpService,
+                                    WxSessionManager sessionManager) {
+        //this.logger.info("\n接收到请求消息,内容:{}", JsonUtils.toJson(wxMessage));
+        return null;
+    }
+
+}
diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/MenuHandler.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/MenuHandler.java
new file mode 100644
index 0000000..c10354d
--- /dev/null
+++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/MenuHandler.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright (C) 2018-2021
+ * All rights reserved, Designed By www.yixiang.co
+
+ */
+package co.yixiang.modules.mp.handler;
+
+import me.chanjar.weixin.common.session.WxSessionManager;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+import static me.chanjar.weixin.common.api.WxConsts.MenuButtonType;
+
+
+@Component
+public class MenuHandler extends AbstractHandler {
+
+    @Override
+    public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
+                                    Map context, WxMpService weixinService,
+                                    WxSessionManager sessionManager) {
+
+        String msg = String.format("type:%s, event:%s, key:%s",
+            wxMessage.getMsgType(), wxMessage.getEvent(),
+            wxMessage.getEventKey());
+        if (MenuButtonType.VIEW.equals(wxMessage.getEvent())) {
+            return null;
+        }
+
+        return WxMpXmlOutMessage.TEXT().content(msg)
+            .fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser())
+            .build();
+    }
+
+}
diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/MsgHandler.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/MsgHandler.java
new file mode 100644
index 0000000..d1b7ba9
--- /dev/null
+++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/MsgHandler.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright (C) 2018-2021
+ * All rights reserved, Designed By www.yixiang.co
+
+ */
+package co.yixiang.modules.mp.handler;
+
+import co.yixiang.modules.mp.builder.TextBuilder;
+import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.common.session.WxSessionManager;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType;
+
+@Component
+public class MsgHandler extends AbstractHandler {
+
+    @Override
+    public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
+                                    Map context, WxMpService weixinService,
+                                    WxSessionManager sessionManager) {
+
+        if (!wxMessage.getMsgType().equals(XmlMsgType.EVENT)) {
+            //TODO 可以选择将消息保存到本地
+        }
+
+        //当用户输入关键词如“你好”,“客服”等,并且有客服在线时,把消息转发给在线客服
+        try {
+            if (StringUtils.startsWithAny(wxMessage.getContent(), "你好", "客服")
+                && weixinService.getKefuService().kfOnlineList()
+                .getKfOnlineList().size() > 0) {
+                return WxMpXmlOutMessage.TRANSFER_CUSTOMER_SERVICE()
+                    .fromUser(wxMessage.getToUser())
+                    .toUser(wxMessage.getFromUser()).build();
+            }
+        } catch (WxErrorException e) {
+            e.printStackTrace();
+        }
+
+        //TODO 组装回复消息
+        String content = "yshop收到信息内容:" + wxMessage.getContent();
+
+        return new TextBuilder().build(content, wxMessage, weixinService);
+
+    }
+
+}
diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/NullHandler.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/NullHandler.java
new file mode 100644
index 0000000..b3fecc0
--- /dev/null
+++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/NullHandler.java
@@ -0,0 +1,26 @@
+/**
+ * Copyright (C) 2018-2021
+ * All rights reserved, Designed By www.yixiang.co
+
+ */
+package co.yixiang.modules.mp.handler;
+
+import me.chanjar.weixin.common.session.WxSessionManager;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+@Component
+public class NullHandler extends AbstractHandler {
+
+    @Override
+    public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
+                                    Map context, WxMpService wxMpService,
+                                    WxSessionManager sessionManager) {
+        return null;
+    }
+
+}
diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/RedisHandler.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/RedisHandler.java
new file mode 100644
index 0000000..e54b9f9
--- /dev/null
+++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/RedisHandler.java
@@ -0,0 +1,36 @@
+/**
+ * Copyright (C) 2018-2021
+ * All rights reserved, Designed By www.yixiang.co
+
+ */
+package co.yixiang.modules.mp.handler;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Component;
+
+
+@Component
+public class RedisHandler{
+
+    @Autowired
+    RedisTemplate redisTemplate;
+
+
+    public String getVal(String key) {
+        try {
+            String value = redisTemplate.opsForValue().get(key).toString();
+            return value;
+        }catch (Exception e){
+            return "";
+        }
+    }
+
+
+    public Object getObj(String key) {
+        return redisTemplate.opsForValue().get(key);
+    }
+
+
+}
diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/ScanHandler.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/ScanHandler.java
new file mode 100644
index 0000000..db5ddbc
--- /dev/null
+++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/ScanHandler.java
@@ -0,0 +1,26 @@
+/**
+ * Copyright (C) 2018-2021
+ * All rights reserved, Designed By www.yixiang.co
+
+ */
+package co.yixiang.modules.mp.handler;
+
+import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.common.session.WxSessionManager;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+@Component
+public class ScanHandler extends AbstractHandler {
+
+    @Override
+    public WxMpXmlOutMessage handle(WxMpXmlMessage wxMpXmlMessage, Map map,
+                                    WxMpService wxMpService, WxSessionManager wxSessionManager) throws WxErrorException {
+        // 扫码事件处理
+        return null;
+    }
+}
diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/StoreCheckNotifyHandler.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/StoreCheckNotifyHandler.java
new file mode 100644
index 0000000..62435e4
--- /dev/null
+++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/StoreCheckNotifyHandler.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright (C) 2018-2021
+ * All rights reserved, Designed By www.yixiang.co
+
+ */
+package co.yixiang.modules.mp.handler;
+
+import me.chanjar.weixin.common.session.WxSessionManager;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * 门店审核事件处理
+ *
+ */
+@Component
+public class StoreCheckNotifyHandler extends AbstractHandler {
+
+    @Override
+    public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
+                                    Map context, WxMpService wxMpService,
+                                    WxSessionManager sessionManager) {
+        // TODO 处理门店审核事件
+        return null;
+    }
+
+}
diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/SubscribeHandler.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/SubscribeHandler.java
new file mode 100644
index 0000000..673a125
--- /dev/null
+++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/SubscribeHandler.java
@@ -0,0 +1,59 @@
+/**
+ * Copyright (C) 2018-2021
+ * All rights reserved, Designed By www.yixiang.co
+
+ */
+package co.yixiang.modules.mp.handler;
+
+import cn.hutool.core.util.ObjectUtil;
+import co.yixiang.modules.mp.domain.YxWechatReply;
+import co.yixiang.modules.mp.service.YxWechatReplyService;
+import com.alibaba.fastjson.JSONObject;
+import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.common.session.WxSessionManager;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+
+@Component
+public class SubscribeHandler extends AbstractHandler {
+
+    @Autowired
+    private YxWechatReplyService yxWechatReplyService;
+
+    @Override
+    public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
+                                    Map context, WxMpService weixinService,
+                                    WxSessionManager sessionManager) throws WxErrorException {
+
+
+        String str = "你好,欢迎关注yshop!";
+        YxWechatReply wechatReply = yxWechatReplyService.isExist("subscribe");
+        if(!ObjectUtil.isNull(wechatReply)){
+            str = JSONObject.parseObject(wechatReply.getData()).getString("content");
+        }
+
+        try {
+            WxMpXmlOutMessage msg= WxMpXmlOutMessage.TEXT()
+                    .content(str)
+                    .fromUser(wxMessage.getToUser())
+                    .toUser(wxMessage.getFromUser())
+                    .build();
+            return msg;
+        } catch (Exception e) {
+            this.logger.error(e.getMessage(), e);
+        }
+
+
+
+        return null;
+    }
+
+
+
+}
diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/UnsubscribeHandler.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/UnsubscribeHandler.java
new file mode 100644
index 0000000..b28bb9a
--- /dev/null
+++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/handler/UnsubscribeHandler.java
@@ -0,0 +1,30 @@
+/**
+ * Copyright (C) 2018-2021
+ * All rights reserved, Designed By www.yixiang.co
+
+ */
+package co.yixiang.modules.mp.handler;
+
+import me.chanjar.weixin.common.session.WxSessionManager;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+
+@Component
+public class UnsubscribeHandler extends AbstractHandler {
+
+    @Override
+    public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
+                                    Map context, WxMpService wxMpService,
+                                    WxSessionManager sessionManager) {
+        String openId = wxMessage.getFromUser();
+        this.logger.info("取消关注用户 OPENID: " + openId);
+        // TODO 可以更新本地数据库为取消关注状态
+        return null;
+    }
+
+}
diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/listener/TemplateListener.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/listener/TemplateListener.java
new file mode 100644
index 0000000..6add536
--- /dev/null
+++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/listener/TemplateListener.java
@@ -0,0 +1,182 @@
+/**
+ * Copyright (C) 2018-2021
+ * All rights reserved, Designed By www.yixiang.co
+ * 注意:
+ * 本软件为www.yixiang.co开发研制,未经购买不得使用
+ * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
+ * 一经发现盗用、分享等行为,将追究法律责任,后果自负
+ */
+package co.yixiang.modules.mp.listener;
+
+
+import cn.hutool.core.util.NumberUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import co.yixiang.constant.ShopConstants;
+import co.yixiang.enums.BillDetailEnum;
+import co.yixiang.enums.PayTypeEnum;
+import co.yixiang.event.TemplateBean;
+import co.yixiang.event.TemplateEvent;
+import co.yixiang.event.TemplateListenEnum;
+import co.yixiang.modules.activity.domain.YxUserExtract;
+import co.yixiang.modules.activity.service.YxUserExtractService;
+import co.yixiang.modules.customer.domain.YxStoreCustomer;
+import co.yixiang.modules.customer.service.YxStoreCustomerService;
+import co.yixiang.modules.mp.service.WeiXinSubscribeService;
+import co.yixiang.modules.mp.service.WeixinPayService;
+import co.yixiang.modules.mp.service.WeixinTemplateService;
+import co.yixiang.modules.user.domain.YxUser;
+import co.yixiang.modules.user.service.YxUserBillService;
+import co.yixiang.modules.user.service.YxUserService;
+import co.yixiang.modules.user.service.dto.WechatUserDto;
+import com.github.binarywang.wxpay.exception.WxPayException;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationEvent;
+import org.springframework.context.event.SmartApplicationListener;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * @author hupeng
+ * 异步监听模板通知事件
+ */
+@Slf4j
+@Component
+public class TemplateListener implements SmartApplicationListener {
+    @Autowired
+    private YxUserService userService;
+    @Autowired
+    private WeixinTemplateService weixinTemplateService;
+    @Autowired
+    private WeixinPayService weixinPayService;
+    @Autowired
+    private WeiXinSubscribeService weiXinSubscribeService;
+    @Autowired
+    private YxUserExtractService yxUserExtractService;
+    @Autowired
+    private WeixinPayService payService;
+    @Autowired
+    private YxUserBillService billService;
+    @Autowired
+    private YxStoreCustomerService yxStoreCustomerService;
+    //@Autowired
+    //private MqProducer mqProducer;
+
+    @Override
+    public boolean supportsEventType(Class aClass) {
+        return aClass == TemplateEvent.class;
+    }
+
+    @Async
+    @Override
+    public void onApplicationEvent(ApplicationEvent applicationEvent) {
+        //转换事件类型
+        TemplateEvent templateEvent = (TemplateEvent) applicationEvent;
+        //获取注册用户对象信息
+        TemplateBean templateBean = templateEvent.getTemplateBean();
+        log.info("模板事件类型:{}", templateBean.getTemplateType());
+        switch (TemplateListenEnum.toType(templateBean.getTemplateType())) {
+            case TYPE_1:
+                weixinTemplateService.paySuccessNotice(templateBean.getOrderId()
+                        , templateBean.getPrice(), templateBean.getUid());
+                weiXinSubscribeService.paySuccessNotice(templateBean.getOrderId()
+                        , templateBean.getPrice(), templateBean.getUid());
+                /**************给客服发送消息**************/
+                try {
+                    List yxStoreCustomers = yxStoreCustomerService.lambdaQuery().eq(YxStoreCustomer::getIsEnable, ShopConstants.YSHOP_ONE_NUM).list();
+                    yxStoreCustomers.forEach(msg -> {
+                        if (StrUtil.isNotBlank(msg.getOpenId())) {
+                         weixinTemplateService.paySuccessNoticeToKefu(templateBean.getOrderId()
+                                 , templateBean.getPrice(), msg.getOpenId());
+                        }
+                    });
+                } catch (Exception e) {
+                    log.error("消息发送失败:{}", e);
+                }
+                break;
+            case TYPE_2:
+                //处理退款与消息
+                if (PayTypeEnum.WEIXIN.getValue().equals(templateBean.getPayType())) {
+                    BigDecimal bigDecimal = new BigDecimal("100");
+                    int payPrice = bigDecimal.multiply(new BigDecimal(templateBean.getPrice())).intValue();
+                    weixinPayService.refundOrder(templateBean.getOrderId(), payPrice);
+                }
+
+                weixinTemplateService.refundSuccessNotice("您的订单退款申请被通过,钱款将很快还至您的支付账户。",templateBean.getOrderId(), templateBean.getPrice(),
+                        templateBean.getUid(), templateBean.getTime());
+                break;
+            case TYPE_3:
+                weixinTemplateService.deliverySuccessNotice(templateBean.getOrderId(), templateBean.getDeliveryName(),
+                        templateBean.getDeliveryId(), templateBean.getUid());
+                break;
+            case TYPE_4:
+                weixinTemplateService.rechargeSuccessNotice(templateBean.getTime(), templateBean.getPrice(),
+                        templateBean.getUid());
+                break;
+            case TYPE_7:
+                //使用MQ延时消息
+                //mqProducer.sendMsg("yshop-topic", templateBean.getOrderId());
+                log.info("投递延时订单id: [{}]:", templateBean.getOrderId());
+                break;
+            case TYPE_8:
+                YxUserExtract resources = yxUserExtractService.getById(templateBean.getExtractId());
+                Boolean success = false;
+                YxUser user = userService.getById(resources.getUid());
+                if (user != null) {
+                    WechatUserDto wechatUser = user.getWxProfile();
+                    if (ObjectUtil.isNotNull(wechatUser) && ObjectUtil.isNotNull(wechatUser.getRoutineOpenid())) {
+                        try {
+                            String nonce_str = UUID.randomUUID().toString().replace("-", "");
+                            payService.entPay(wechatUser.getRoutineOpenid(), nonce_str,
+                                    resources.getRealName(),
+                                    resources.getExtractPrice().multiply(new BigDecimal(100)).intValue());
+                            success = true;
+                        } catch (WxPayException e) {
+                            log.error("退款失败,原因:{}", e.getMessage());
+                        }
+                    }
+                }
+                if (!success) {
+                    String mark = "提现失败,退回佣金" + resources.getExtractPrice() + "元";
+                    double balance = NumberUtil.add(user.getBrokeragePrice(), resources.getExtractPrice()).doubleValue();
+                    //插入流水
+                    billService.income(resources.getUid(), "提现失败", BillDetailEnum.CATEGORY_1.getValue(),
+                            BillDetailEnum.TYPE_4.getValue(), resources.getExtractPrice().doubleValue(), balance,
+                            mark, resources.getId().toString());
+                    //返回提现金额
+                    userService.incBrokeragePrice(resources.getExtractPrice(), resources.getUid());
+                    resources.setFailTime(new Date());
+                    yxUserExtractService.updateById(resources);
+                }
+
+
+                break;
+            case TYPE_9:
+                weixinTemplateService.refundSuccessNotice("您的订单退款申请已提交,等待审核。",templateBean.getOrderId(), templateBean.getPrice(),
+                        templateBean.getUid(), templateBean.getTime());
+                /**************给客服发送消息**************/
+                try {
+                    List yxStoreCustomers = yxStoreCustomerService.lambdaQuery().eq(YxStoreCustomer::getIsEnable, ShopConstants.YSHOP_ONE_NUM).list();
+                    yxStoreCustomers.forEach(msg -> {
+                        if (StrUtil.isNotBlank(msg.getOpenId())) {
+                            weixinTemplateService.refundSuccessNoticeToKefu("尊敬的客服,您有新的退款申请待处理!",templateBean.getOrderId()
+                                    , templateBean.getPrice(), msg.getOpenId(), templateBean.getTime());
+                        }
+                    });
+                } catch (Exception e) {
+                    log.error("消息发送失败:{}", e);
+                }
+                break;
+            default:
+                //todo
+        }
+
+
+    }
+}
diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/WeiXinSubscribeService.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/WeiXinSubscribeService.java
new file mode 100644
index 0000000..c5a360b
--- /dev/null
+++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/WeiXinSubscribeService.java
@@ -0,0 +1,206 @@
+package co.yixiang.modules.mp.service;
+
+import cn.binarywang.wx.miniapp.api.WxMaService;
+import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
+import cn.hutool.core.util.StrUtil;
+import co.yixiang.api.YshopException;
+import co.yixiang.constant.ShopConstants;
+import co.yixiang.enums.ShopCommonEnum;
+import co.yixiang.modules.mp.domain.YxWechatTemplate;
+import co.yixiang.modules.user.domain.YxUser;
+import co.yixiang.modules.user.service.YxUserService;
+import co.yixiang.modules.user.service.dto.WechatUserDto;
+import co.yixiang.modules.mp.enums.WechatTempateEnum;
+import co.yixiang.modules.mp.config.WxMaConfiguration;
+import me.chanjar.weixin.common.error.WxErrorException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 小程序订阅消息通知
+ */
+@Service
+public class WeiXinSubscribeService {
+
+    @Autowired
+    private YxUserService userService;
+    @Autowired
+    private YxWechatTemplateService yxWechatTemplateService;
+    /**
+     * 充值成功通知
+     * @param time 时间
+     * @param price 金额
+     * @param uid uid
+     */
+    public void rechargeSuccessNotice(String time,String price,Long uid){
+        String openid = this.getUserOpenid(uid);
+
+        if(StrUtil.isBlank(openid)) {
+            return;
+        }
+
+        Map map = new HashMap<>();
+        map.put("first","您的账户金币发生变动,详情如下:");
+        map.put("keyword1","充值");
+        map.put("keyword2",time);
+        map.put("keyword3",price);
+        map.put("remark", ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
+        String tempId = this.getTempId(WechatTempateEnum.RECHARGE_SUCCESS.getValue());
+        if(StrUtil.isNotBlank(tempId)) {
+            this.sendSubscribeMsg( openid, tempId, "/user/account",map);
+        }
+    }
+
+
+    /**
+     * 支付成功通知
+     * @param orderId 订单号
+     * @param price 金额
+     * @param uid uid
+     */
+    public void paySuccessNotice(String orderId,String price,Long uid){
+
+        String openid = this.getUserOpenid(uid);
+        if(StrUtil.isBlank(openid)) {
+            return;
+        }
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
+        Map map = new HashMap<>();
+        map.put("amount1",price);
+        map.put("date2", simpleDateFormat.format(new Date()));
+        map.put("character_string3",orderId);
+        map.put("time4",simpleDateFormat.format(new Date()));
+        map.put("thing5","yshop购买商品");
+        String tempId = this.getTempId(WechatTempateEnum.PAY_SUCCESS.getValue());
+        if(StrUtil.isNotBlank(tempId)) {
+            this.sendSubscribeMsg( openid,tempId, "/order/detail/"+orderId,map);
+        }
+    }
+
+    /**
+     * 退款成功通知
+     * @param orderId 订单号
+     * @param price 金额
+     * @param uid uid
+     * @param time 时间
+     */
+    public void refundSuccessNotice(String orderId,String price,Long uid,String time){
+
+        String openid = this.getUserOpenid(uid);
+
+        if(StrUtil.isBlank(openid)) {
+            return;
+        }
+
+        Map map = new HashMap<>();
+        map.put("first","您的订单退款申请被通过,钱款将很快还至您的支付账户。");
+        //订单号
+        map.put("keyword1",orderId);
+        map.put("keyword2",price);
+        map.put("keyword3", time);
+        map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
+        String tempId = this.getTempId(WechatTempateEnum.REFUND_SUCCESS.getValue());
+        if(StrUtil.isNotBlank(tempId)) {
+            this.sendSubscribeMsg( openid,tempId, "/order/detail/"+orderId,map);
+        }
+    }
+
+    /**
+     * 发货成功通知
+     * @param orderId 单号
+     * @param deliveryName 快递公司
+     * @param deliveryId 快递单号
+     * @param uid uid
+     */
+    public void deliverySuccessNotice(String orderId,String deliveryName,
+                                      String deliveryId,Long uid){
+
+        String openid = this.getUserOpenid(uid);
+
+        if(StrUtil.isEmpty(openid)) {
+            return;
+        }
+
+        Map map = new HashMap<>();
+        map.put("first","亲,宝贝已经启程了,好想快点来到你身边。");
+        map.put("keyword2",deliveryName);
+        map.put("keyword1",orderId);
+        map.put("keyword3",deliveryId);
+        map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
+        String tempId = this.getTempId(WechatTempateEnum.DELIVERY_SUCCESS.getValue());
+        if(StrUtil.isNotBlank(tempId)) {
+            this.sendSubscribeMsg( openid,tempId, "/order/detail/"+orderId,map);
+        }
+    }
+
+
+    /**
+     * 构建小程序一次性订阅消息
+     * @param openId 单号
+     * @param templateId 模板id
+     * @param page 跳转页面
+     * @param map map内容
+     * @return String
+     */
+    private void sendSubscribeMsg(String openId, String templateId, String page, Map map){
+        WxMaSubscribeMessage wxMaSubscribeMessage = WxMaSubscribeMessage.builder()
+                .toUser(openId)
+                .templateId(templateId)
+                .page(page)
+                .build();
+        map.forEach( (k,v)-> { wxMaSubscribeMessage.addData(new WxMaSubscribeMessage.MsgData(k, v));} );
+        WxMaService wxMaService = WxMaConfiguration.getWxMaService();
+        try {
+            wxMaService.getMsgService().sendSubscribeMsg(wxMaSubscribeMessage);
+        } catch (WxErrorException e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 获取模板消息id
+     * @param key 模板key
+     * @return string
+     */
+    private String getTempId(String key){
+        YxWechatTemplate yxWechatTemplate = yxWechatTemplateService.lambdaQuery()
+                .eq(YxWechatTemplate::getType,"subscribe")
+                .eq(YxWechatTemplate::getTempkey,key)
+                .one();
+        if (yxWechatTemplate == null) {
+            throw new YshopException("请后台配置key:" + key + "订阅消息id");
+        }
+        if(ShopCommonEnum.IS_STATUS_0.getValue().equals(yxWechatTemplate.getStatus())){
+            return "";
+        }
+        return yxWechatTemplate.getTempid();
+    }
+
+
+    /**
+     * 获取openid
+     * @param uid uid
+     * @return String
+     */
+    private String getUserOpenid(Long uid){
+        YxUser yxUser = userService.getById(uid);
+        if(yxUser == null) {
+            return "";
+        }
+
+        WechatUserDto wechatUserDto = yxUser.getWxProfile();
+        if(wechatUserDto == null) {
+            return "";
+        }
+        if(StrUtil.isBlank(wechatUserDto.getRoutineOpenid())) {
+            return "";
+        }
+        return wechatUserDto.getRoutineOpenid();
+
+    }
+}
diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/WeixinPayService.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/WeixinPayService.java
new file mode 100644
index 0000000..71eeb18
--- /dev/null
+++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/WeixinPayService.java
@@ -0,0 +1,233 @@
+/**
+ * Copyright (C) 2018-2021
+ * All rights reserved, Designed By www.yixiang.co
+ * 注意:
+ * 本软件为www.yixiang.co开发研制,未经购买不得使用
+ * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
+ * 一经发现盗用、分享等行为,将追究法律责任,后果自负
+ */
+package co.yixiang.modules.mp.service;
+import cn.hutool.core.lang.UUID;
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import co.yixiang.api.BusinessException;
+import co.yixiang.api.YshopException;
+import co.yixiang.enums.AppFromEnum;
+import co.yixiang.enums.BillDetailEnum;
+import co.yixiang.enums.OrderInfoEnum;
+import co.yixiang.enums.PayMethodEnum;
+import co.yixiang.enums.PayTypeEnum;
+import co.yixiang.modules.order.service.YxStoreOrderService;
+import co.yixiang.modules.order.vo.YxStoreOrderQueryVo;
+import co.yixiang.modules.user.domain.YxUser;
+import co.yixiang.modules.user.domain.YxUserRecharge;
+import co.yixiang.modules.user.service.YxUserRechargeService;
+import co.yixiang.modules.user.service.YxUserService;
+import co.yixiang.modules.user.service.dto.WechatUserDto;
+import co.yixiang.modules.mp.config.WxPayConfiguration;
+import co.yixiang.utils.IpUtil;
+import co.yixiang.utils.RedisUtils;
+import co.yixiang.utils.ShopKeyUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;
+import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
+import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
+import com.github.binarywang.wxpay.exception.WxPayException;
+import com.github.binarywang.wxpay.service.WxPayService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+
+/**
+ * @ClassName 微信支付WeixinPayService
+ * @Author hupeng <610796224@qq.com>
+ * @Date 2020/6/27
+ **/
+@Service
+@Slf4j
+public class WeixinPayService {
+
+    @Autowired
+    private RedisUtils redisUtils;
+
+    @Autowired
+    private YxUserService userService;
+    @Autowired
+    private YxStoreOrderService storeOrderService;
+    @Autowired
+    private YxUserRechargeService userRechargeService;
+
+
+    /**
+     * 统一支付入口
+     * @param orderId 单号
+     * @param from 来源
+     * @param attach 备注 普通支付还是充值
+     * @param body 内容
+     * @return Object
+     */
+    public Object unifyPay(String orderId, String from, String attach, String body) {
+        long uid = 0;
+        int payPrice = 0;
+        BigDecimal bigDecimal = new BigDecimal(100);
+        //普通支付
+        if(BillDetailEnum.TYPE_3.getValue().equals(attach)){
+            YxStoreOrderQueryVo orderInfo = storeOrderService.getOrderInfo(orderId,null);
+            if(ObjectUtil.isNull(orderInfo)) {
+                throw new YshopException("订单不存在");
+            }
+            if(orderInfo.getPaid().equals(OrderInfoEnum.PAY_STATUS_1.getValue())) {
+                throw new YshopException("该订单已支付");
+            }
+
+            if(orderInfo.getPayPrice().compareTo(BigDecimal.ZERO) <= 0) {
+                throw new YshopException("该支付无需支付");
+            }
+
+            uid = orderInfo.getUid().intValue();
+            //计算分
+            payPrice = bigDecimal.multiply(orderInfo.getPayPrice()).intValue();
+        }else{ //充值
+            YxUserRecharge userRecharge = userRechargeService.getOne(Wrappers.lambdaQuery()
+                    .eq(YxUserRecharge::getOrderId,orderId));
+            if(userRecharge == null) {
+                throw new BusinessException("充值订单不存在");
+            }
+
+            if(userRecharge.getPaid().equals(OrderInfoEnum.PAY_STATUS_1.getValue())) {
+                throw new YshopException("该订单已支付");
+            }
+            uid = userRecharge.getUid();
+            payPrice = bigDecimal.multiply(userRecharge.getPrice()).intValue();
+        }
+
+
+        YxUser yxUser = userService.getById(uid);
+        if(yxUser == null) {
+            throw new YshopException("用户错误");
+        }
+
+
+        WechatUserDto wechatUserDto = yxUser.getWxProfile();
+
+        WxPayService wxPayService = null;
+        if(AppFromEnum.ROUNTINE.getValue().equals(from)){
+            wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WXAPP);
+        }else if(AppFromEnum.APP.getValue().equals(from) || AppFromEnum.PC.getValue().equals(from)){
+            wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.APP);
+        }else{
+            wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WECHAT);
+        }
+        WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
+        orderRequest.setOutTradeNo(orderId);
+        orderRequest.setTotalFee(payPrice);
+        orderRequest.setSpbillCreateIp(IpUtil.getLocalIP());
+        orderRequest.setNotifyUrl(this.getApiUrl() + "/api/wechat/notify");
+        orderRequest.setBody(body);
+        orderRequest.setAttach(attach);
+
+        if(AppFromEnum.WEIXIN_H5.getValue().equals(from)){
+            orderRequest.setTradeType("MWEB");
+        }else if(AppFromEnum.APP.getValue().equals(from)){
+            orderRequest.setTradeType("APP");
+        }else if(AppFromEnum.PC.getValue().equals(from)){
+            orderRequest.setTradeType("NATIVE");
+            orderRequest.setProductId( UUID.fastUUID().toString());
+        } else{
+            orderRequest.setTradeType("JSAPI");
+            if(AppFromEnum.ROUNTINE.getValue().equals(from)){
+                orderRequest.setOpenid(wechatUserDto.getRoutineOpenid());
+            }else {
+                orderRequest.setOpenid(wechatUserDto.getOpenid());
+            }
+        }
+        try {
+            return wxPayService.createOrder(orderRequest);
+        }catch (WxPayException e) {
+            log.info("支付错误信息:{}",e.getMessage());
+            throw new BusinessException(e.getMessage());
+        }
+
+
+    }
+
+
+
+
+    /**
+     * 退款
+     * @param orderId orderId
+     * @param refundFee totalFee 单位分
+     */
+    public void refundOrder(String orderId, Integer refundFee) {
+
+        YxStoreOrderQueryVo orderInfo = storeOrderService.getOrderInfo(orderId,null);
+        if(PayTypeEnum.YUE.getValue().equals(orderInfo.getPayType())) {
+            return;
+        }
+        if(orderInfo.getExtendOrderId()!=null){
+            orderId=orderInfo.getExtendOrderId();
+        }
+        WxPayService wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WECHAT);
+        WxPayRefundRequest wxPayRefundRequest = new WxPayRefundRequest();
+        BigDecimal bigDecimal = new BigDecimal("100");
+        int totalFee = bigDecimal.multiply(orderInfo.getPayPrice()).intValue();
+        //订单总金额
+        wxPayRefundRequest.setTotalFee(totalFee);
+        wxPayRefundRequest.setOutTradeNo(orderId);
+        //生成退款单号
+        String orderSn = IdUtil.getSnowflake(0,0).nextIdStr();
+        wxPayRefundRequest.setOutRefundNo(orderSn);
+        //退款金额
+        wxPayRefundRequest.setRefundFee(refundFee);
+        wxPayRefundRequest.setNotifyUrl(this.getApiUrl() + "/api/notify/refund");
+        try {
+            wxPayService.refundV2(wxPayRefundRequest);
+        } catch (WxPayException e) {
+            log.info("退款错误信息:{}",e.getMessage());
+            throw new BusinessException(e.getMessage());
+        }
+    }
+
+
+    /**
+     * 企业打款
+     * @param openid 微信openid
+     * @param no 单号
+     * @param userName 用户姓名
+     * @param amount 金额
+     * @throws WxPayException
+     */
+    public void entPay(String openid,String no,String userName,Integer amount) throws WxPayException {
+        WxPayService wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WECHAT);
+        EntPayRequest entPayRequest = new EntPayRequest();
+
+        entPayRequest.setOpenid(openid);
+        entPayRequest.setPartnerTradeNo(no);
+        entPayRequest.setCheckName("FORCE_CHECK");
+        entPayRequest.setReUserName(userName);
+        entPayRequest.setAmount(amount);
+        entPayRequest.setDescription("提现");
+        entPayRequest.setSpbillCreateIp(IpUtil.getLocalIP());
+        wxPayService.getEntPayService().entPay(entPayRequest);
+
+    }
+
+
+    /**
+     * 返回H5 url
+     * @return url
+     */
+    private String getApiUrl(){
+        String apiUrl = redisUtils.getY(ShopKeyUtils.getApiUrl());
+        if(StrUtil.isBlank(apiUrl)){
+            throw new YshopException("请配置移动端api地址");
+        }
+        return apiUrl;
+    }
+
+
+}
diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/WeixinTemplateService.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/WeixinTemplateService.java
new file mode 100644
index 0000000..cb706f5
--- /dev/null
+++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/WeixinTemplateService.java
@@ -0,0 +1,330 @@
+/**
+ * Copyright (C) 2018-2021
+ * All rights reserved, Designed By www.yixiang.co
+ * 注意:
+ * 本软件为www.yixiang.co开发研制,未经购买不得使用
+ * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
+ * 一经发现盗用、分享等行为,将追究法律责任,后果自负
+ */
+package co.yixiang.modules.mp.service;
+
+import cn.hutool.core.util.StrUtil;
+import co.yixiang.api.YshopException;
+import co.yixiang.constant.ShopConstants;
+import co.yixiang.enums.ShopCommonEnum;
+import co.yixiang.modules.mp.config.WxMpConfiguration;
+import co.yixiang.modules.mp.domain.YxWechatTemplate;
+import co.yixiang.modules.user.domain.YxUser;
+import co.yixiang.modules.user.service.YxUserService;
+import co.yixiang.modules.user.service.dto.WechatUserDto;
+import co.yixiang.modules.mp.enums.WechatTempateEnum;
+import co.yixiang.utils.RedisUtil;
+import co.yixiang.utils.RedisUtils;
+import co.yixiang.utils.ShopKeyUtils;
+import lombok.extern.slf4j.Slf4j;
+import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
+import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @ClassName 微信公众号模板通知
+ * @Author hupeng <610796224@qq.com>
+ * @Date 2020/6/27
+ **/
+@Slf4j
+@Service
+public class WeixinTemplateService {
+
+    @Autowired
+    private RedisUtils redisUtils;
+
+    @Autowired
+    private YxUserService userService;
+    @Autowired
+    private YxWechatTemplateService yxWechatTemplateService;
+
+
+
+
+    /**
+     * 充值成功通知
+     * @param time 时间
+     * @param price 金额
+     * @param uid uid
+     */
+    public void rechargeSuccessNotice(String time,String price,Long uid){
+        String openid = this.getUserOpenid(uid);
+
+        if(StrUtil.isBlank(openid)) {
+            return;
+        }
+
+        Map map = new HashMap<>();
+        map.put("first","您的账户金币发生变动,详情如下:");
+        map.put("keyword1","充值");
+        map.put("keyword2",time);
+        map.put("keyword3",price);
+        map.put("remark", ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
+        String tempId = this.getTempId(WechatTempateEnum.RECHARGE_SUCCESS.getValue());
+        if(StrUtil.isNotBlank(tempId)) {
+            this.sendWxMpTemplateMessage( openid, tempId, this.getSiteUrl()+"/user/account",map);
+        }
+    }
+
+
+    /**
+     * 支付成功通知
+     * @param orderId 订单号
+     * @param price 金额
+     * @param uid uid
+     */
+    public void paySuccessNotice(String orderId,String price,Long uid){
+
+        String openid = this.getUserOpenid(uid);
+
+        if(StrUtil.isBlank(openid)) {
+            return;
+        }
+
+        Map map = new HashMap<>();
+        map.put("first","您的订单已支付成功,我们会尽快为您发货。");
+        //订单号
+        map.put("keyword1",orderId);
+        map.put("keyword2",price);
+        map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
+        String tempId = this.getTempId(WechatTempateEnum.PAY_SUCCESS.getValue());
+        if(StrUtil.isNotBlank(tempId)) {
+            this.sendWxMpTemplateMessage( openid,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
+        }
+    }
+
+
+    /**
+     * 支付成功通知给客服
+     *
+     * @param orderId
+     * @param price
+     * @param openId
+     */
+    public void paySuccessNoticeToKefu(String orderId,String price,String openId) {
+        Map map = new HashMap<>();
+        map.put("first", "尊敬的客服,您有新订单了");
+        map.put("keyword1",orderId);
+        map.put("keyword2",price);
+        map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
+        String tempId = this.getTempId(WechatTempateEnum.PAY_SUCCESS.getValue());
+        String appId=RedisUtil.get(ShopKeyUtils.getWxAppAppId());
+        if(StrUtil.isNotBlank(tempId)) {
+            if(StrUtil.isBlank(appId)){
+                this.sendWxMpTemplateMessage( openId,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
+            }else{
+                WxMpTemplateMessage.MiniProgram miniProgram = new WxMpTemplateMessage.MiniProgram();
+                miniProgram.setAppid(RedisUtil.get(ShopKeyUtils.getWxAppAppId()));
+                miniProgram.setPagePath("pages/orderAdmin/AdminOrder/index?oid=" + orderId);
+                this.sendWxMpTemplateMessageToWx(openId, tempId, miniProgram, map);
+            }
+        }
+
+
+
+    }
+
+
+    /**
+     * 退款成功通知
+     * @param orderId 订单号
+     * @param price 金额
+     * @param uid uid
+     * @param time 时间
+     */
+    public void refundSuccessNotice(String title,String orderId,String price,Long uid,String time){
+
+        String openid = this.getUserOpenid(uid);
+
+        if(StrUtil.isBlank(openid)) {
+            return;
+        }
+
+        Map map = new HashMap<>();
+        map.put("first",title);
+        //订单号
+        map.put("keyword1",orderId);
+        map.put("keyword2",price);
+        map.put("keyword3", time);
+        map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
+        String tempId = this.getTempId(WechatTempateEnum.REFUND_SUCCESS.getValue());
+        if(StrUtil.isNotBlank(tempId)) {
+            this.sendWxMpTemplateMessage( openid,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
+        }
+    }
+
+    /**
+     * 发送退款申请给客服
+     * @param orderId 订单号
+     * @param price 金额
+     * @param openId openId
+     * @param time 时间
+     */
+    public void refundSuccessNoticeToKefu(String title,String orderId,String price,String openId,String time){
+
+        Map map = new HashMap<>();
+        map.put("first",title);
+        //订单号
+        map.put("keyword1",orderId);
+        map.put("keyword2",price);
+        map.put("keyword3", time);
+        map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
+        String tempId = this.getTempId(WechatTempateEnum.REFUND_SUCCESS.getValue());
+        String appId=RedisUtil.get(ShopKeyUtils.getWxAppAppId());
+        if(StrUtil.isNotBlank(tempId)) {
+            if(StrUtil.isBlank(appId)){
+                this.sendWxMpTemplateMessage( openId,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
+            }else{
+                WxMpTemplateMessage.MiniProgram miniProgram = new WxMpTemplateMessage.MiniProgram();
+                miniProgram.setAppid(RedisUtil.get(ShopKeyUtils.getWxAppAppId()));
+                miniProgram.setPagePath("pages/orderAdmin/AdminOrder/index?oid=" + orderId);
+                this.sendWxMpTemplateMessageToWx(openId, tempId, miniProgram, map);
+            }
+        }
+    }
+
+    /**
+     * 发货成功通知
+     * @param orderId 单号
+     * @param deliveryName 快递公司
+     * @param deliveryId 快递单号
+     * @param uid uid
+     */
+    public void deliverySuccessNotice(String orderId,String deliveryName,
+                                      String deliveryId,Long uid){
+
+        String openid = this.getUserOpenid(uid);
+
+        if(StrUtil.isEmpty(openid)) {
+            return;
+        }
+
+        Map map = new HashMap<>();
+        map.put("first","亲,宝贝已经启程了,好想快点来到你身边。");
+        map.put("keyword2",deliveryName);
+        map.put("keyword1",orderId);
+        map.put("keyword3",deliveryId);
+        map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
+        String tempId = this.getTempId(WechatTempateEnum.DELIVERY_SUCCESS.getValue());
+        if(StrUtil.isNotBlank(tempId)) {
+            this.sendWxMpTemplateMessage( openid,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
+        }
+    }
+
+
+    /**
+     * 构建微信模板通知
+     * @param openId 单号
+     * @param templateId 模板id
+     * @param url 跳转url
+     * @param map map内容
+     * @return String
+     */
+    private String sendWxMpTemplateMessage(String openId, String templateId, String url, Map map){
+        WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
+                .toUser(openId)
+                .templateId(templateId)
+                .url(url)
+                .build();
+        map.forEach( (k,v)-> { templateMessage.addData(new WxMpTemplateData(k, v, "#000000"));} );
+        String msgId = null;
+        WxMpService wxService = WxMpConfiguration.getWxMpService();
+        try {
+            msgId =   wxService.getTemplateMsgService().sendTemplateMsg(templateMessage);
+        } catch (WxErrorException e) {
+            e.printStackTrace();
+        }
+        return msgId;
+    }
+
+
+
+
+    public String sendWxMpTemplateMessageToWx(String openId, String templateId, WxMpTemplateMessage.MiniProgram miniProgram, Map map) {
+        WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
+                .toUser(openId)
+                .templateId(templateId)
+                .miniProgram(miniProgram)
+                .build();
+        map.forEach((k, v) -> {
+            templateMessage.addData(new WxMpTemplateData(k, v, "#000000"));
+        });
+        String msgId = null;
+        WxMpService wxService = WxMpConfiguration.getWxMpService();
+        try {
+            msgId = wxService.getTemplateMsgService().sendTemplateMsg(templateMessage);
+        } catch (WxErrorException e) {
+            log.error(e.getMessage(), e);
+        }
+        return msgId;
+    }
+
+
+    /**
+     * 获取模板消息id
+     * @param key 模板key
+     * @return string
+     */
+    private String getTempId(String key){
+        YxWechatTemplate yxWechatTemplate = yxWechatTemplateService.lambdaQuery()
+                .eq(YxWechatTemplate::getType,"template")
+                .eq(YxWechatTemplate::getTempkey,key)
+                .one();
+        if (yxWechatTemplate == null) {
+            throw new YshopException("请后台配置key:" + key + "模板消息id");
+        }
+
+        if(ShopCommonEnum.IS_STATUS_0.getValue().equals(yxWechatTemplate.getStatus())){
+            return "";
+        }
+
+        return yxWechatTemplate.getTempid();
+    }
+
+    /**
+     * 返回H5 url
+     * @return url
+     */
+    private String getSiteUrl(){
+        String apiUrl = redisUtils.getY(ShopKeyUtils.getSiteUrl());
+        if(StrUtil.isBlank(apiUrl)){
+            return "";
+        }
+        return apiUrl;
+    }
+
+    /**
+     * 获取openid
+     * @param uid uid
+     * @return String
+     */
+    private String getUserOpenid(Long uid){
+        YxUser yxUser = userService.getById(uid);
+        if(yxUser == null) {
+            return "";
+        }
+
+        WechatUserDto wechatUserDto = yxUser.getWxProfile();
+        if(wechatUserDto == null) {
+            return "";
+        }
+        if(StrUtil.isBlank(wechatUserDto.getOpenid())) {
+            return "";
+        }
+        return wechatUserDto.getOpenid();
+
+    }
+
+
+}
diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/YxArticleService.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/YxArticleService.java
new file mode 100644
index 0000000..b766220
--- /dev/null
+++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/YxArticleService.java
@@ -0,0 +1,70 @@
+/**
+ * Copyright (C) 2018-2021
+ * All rights reserved, Designed By www.yixiang.co
+ * 注意:
+ * 本软件为www.yixiang.co开发研制,未经购买不得使用
+ * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
+ * 一经发现盗用、分享等行为,将追究法律责任,后果自负
+ */
+package co.yixiang.modules.mp.service;
+
+import co.yixiang.common.service.BaseService;
+import co.yixiang.modules.mp.service.dto.YxArticleDto;
+import co.yixiang.modules.mp.service.dto.YxArticleQueryCriteria;
+import co.yixiang.modules.mp.domain.YxArticle;
+import co.yixiang.modules.mp.vo.YxArticleQueryVo;
+import org.springframework.data.domain.Pageable;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+/**
+* @author hupeng
+* @date 2020-05-12
+*/
+public interface YxArticleService  extends BaseService{
+
+    /**
+     * 获取文章列表
+     * @param page 页码
+     * @param limit 条数
+     * @return List
+     */
+    List getList(int page, int limit);
+
+    /**
+     * 获取文章详情
+     * @param id id
+     * @return YxArticleQueryVo
+     */
+    YxArticleQueryVo getDetail(int id);
+
+    void incVisitNum(int id);
+
+    /**
+    * 查询数据分页
+    * @param criteria 条件
+    * @param pageable 分页参数
+    * @return Map
+    */
+    Map queryAll(YxArticleQueryCriteria criteria, Pageable pageable);
+
+    /**
+    * 查询所有数据不分页
+    * @param criteria 条件参数
+    * @return List
+    */
+    List queryAll(YxArticleQueryCriteria criteria);
+
+    /**
+    * 导出数据
+    * @param all 待导出的数据
+    * @param response /
+    * @throws IOException /
+    */
+    void download(List all, HttpServletResponse response) throws IOException;
+
+
+}
diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/YxWechatLiveGoodsService.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/YxWechatLiveGoodsService.java
new file mode 100644
index 0000000..11c055d
--- /dev/null
+++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/YxWechatLiveGoodsService.java
@@ -0,0 +1,76 @@
+/**
+* Copyright (C) 2018-2021
+* All rights reserved, Designed By www.yixiang.co
+* 注意:
+* 本软件为www.yixiang.co开发研制,未经购买不得使用
+* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
+* 一经发现盗用、分享等行为,将追究法律责任,后果自负
+*/
+package co.yixiang.modules.mp.service;
+
+import co.yixiang.common.service.BaseService;
+import co.yixiang.modules.mp.service.dto.YxWechatLiveGoodsDto;
+import co.yixiang.modules.mp.service.dto.YxWechatLiveGoodsQueryCriteria;
+import co.yixiang.modules.mp.domain.YxWechatLiveGoods;
+import org.springframework.data.domain.Pageable;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+/**
+* @author hupeng
+* @date 2020-08-11
+*/
+public interface YxWechatLiveGoodsService  extends BaseService{
+
+/**
+    * 查询数据分页
+    * @param criteria 条件
+    * @param pageable 分页参数
+    * @return Map
+    */
+    Map queryAll(YxWechatLiveGoodsQueryCriteria criteria, Pageable pageable);
+
+    /**
+    * 查询所有数据不分页
+    * @param criteria 条件参数
+    * @return List
+    */
+    List queryAll(YxWechatLiveGoodsQueryCriteria criteria);
+
+    /**
+    * 导出数据
+    * @param all 待导出的数据
+    * @param response /
+    * @throws IOException /
+    */
+    void download(List all, HttpServletResponse response) throws IOException;
+
+    /**
+     * 保存直播商品信息
+     * @param resources
+     * @return
+     */
+    boolean saveGoods(YxWechatLiveGoods resources);
+
+    /**
+     * 同步商品更新审核状态
+     * @param goodsIds
+     * @return
+     */
+    boolean synchroWxOlLive(List goodsIds);
+
+    /**
+     * 根据id删除直播商品信息
+     * @param id
+     */
+    void removeGoods(Long id);
+
+    /**
+     * 更新直播商品信息
+     * @param resources
+     */
+    void updateGoods(YxWechatLiveGoods resources);
+}
diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/YxWechatLiveService.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/YxWechatLiveService.java
new file mode 100644
index 0000000..0233a0f
--- /dev/null
+++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/YxWechatLiveService.java
@@ -0,0 +1,100 @@
+/**
+* Copyright (C) 2018-2021
+* All rights reserved, Designed By www.yixiang.co
+* 注意:
+* 本软件为www.yixiang.co开发研制,未经购买不得使用
+* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
+* 一经发现盗用、分享等行为,将追究法律责任,后果自负
+*/
+package co.yixiang.modules.mp.service;
+
+import cn.binarywang.wx.miniapp.bean.live.WxMaLiveResult;
+import co.yixiang.common.service.BaseService;
+import co.yixiang.modules.mp.service.dto.UpdateGoodsDto;
+import co.yixiang.modules.mp.service.dto.WxMaLiveInfo;
+import co.yixiang.modules.mp.service.dto.YxWechatLiveDto;
+import co.yixiang.modules.mp.service.dto.YxWechatLiveQueryCriteria;
+import co.yixiang.modules.mp.vo.WechatLiveVo;
+import co.yixiang.modules.mp.domain.YxWechatLive;
+import me.chanjar.weixin.common.error.WxErrorException;
+import org.springframework.data.domain.Pageable;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+
+/**
+* @author hupeng
+* @date 2020-08-10
+*/
+public interface YxWechatLiveService  extends BaseService{
+
+
+
+
+    /**
+     * 同步直播间
+     * @return
+     */
+    boolean synchroWxOlLive();
+
+    /**
+    * 查询数据分页
+    * @param criteria 条件
+    * @param pageable 分页参数
+    * @return Map
+    */
+    WechatLiveVo queryAll(YxWechatLiveQueryCriteria criteria, Pageable pageable);
+
+    /**
+    * 查询所有数据不分页
+    * @param criteria 条件参数
+    * @return List
+    */
+    List queryAll(YxWechatLiveQueryCriteria criteria);
+
+
+    boolean saveLive(YxWechatLive resources);
+
+    /**
+    * 导出数据
+    * @param all 待导出的数据
+    * @param response /
+    * @throws IOException /
+    */
+    void download(List all, HttpServletResponse response) throws IOException;
+
+
+    /**
+     * 创建直播间
+     * 
+     * 调用此接口创建直播间,创建成功后将在直播间列表展示,调用额度:10000次/一天
+     * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/studio-api.html#1
+     * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/create?access_token=ACCESS_TOKEN
+     * 
+ * + * @param roomInfo 直播间信息 + * @return . + * @throws WxErrorException . + */ + Integer createRoom(WxMaLiveInfo.RoomInfo roomInfo) throws WxErrorException; + + /** + * 获取直播回放 + * @param roomId + * @return + */ + List getLiveReplay(Integer roomId); + + + /** + * 商品列表 + * @param page 页码 + * @param limit 条数 + * @param order ProductEnum + * @return List + */ + List getList(int page, int limit, int order); + + boolean addGoods(UpdateGoodsDto resources); +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/YxWechatMenuService.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/YxWechatMenuService.java new file mode 100644 index 0000000..75c086e --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/YxWechatMenuService.java @@ -0,0 +1,49 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.mp.service.dto.YxWechatMenuDto; +import co.yixiang.modules.mp.service.dto.YxWechatMenuQueryCriteria; +import co.yixiang.modules.mp.domain.YxWechatMenu; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxWechatMenuService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxWechatMenuQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxWechatMenuQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + Boolean isExist(String wechat_menus); +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/YxWechatReplyService.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/YxWechatReplyService.java new file mode 100644 index 0000000..0af8339 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/YxWechatReplyService.java @@ -0,0 +1,53 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.mp.service.dto.YxWechatReplyDto; +import co.yixiang.modules.mp.service.dto.YxWechatReplyQueryCriteria; +import co.yixiang.modules.mp.domain.YxWechatReply; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxWechatReplyService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxWechatReplyQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxWechatReplyQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + YxWechatReply isExist(String subscribe); + + void create(YxWechatReply yxWechatReply); + + void upDate(YxWechatReply yxWechatReply); +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/YxWechatTemplateService.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/YxWechatTemplateService.java new file mode 100644 index 0000000..a2639d7 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/YxWechatTemplateService.java @@ -0,0 +1,49 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.service; + +import co.yixiang.common.service.BaseService; +import co.yixiang.modules.mp.service.dto.YxWechatTemplateQueryCriteria; +import co.yixiang.modules.mp.domain.YxWechatTemplate; +import co.yixiang.modules.mp.service.dto.YxWechatTemplateDto; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +public interface YxWechatTemplateService extends BaseService{ + +/** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(YxWechatTemplateQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(YxWechatTemplateQueryCriteria criteria); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + YxWechatTemplate findByTempkey(String recharge_success_key); +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/UpdateGoodsDto.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/UpdateGoodsDto.java new file mode 100644 index 0000000..5d645fd --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/UpdateGoodsDto.java @@ -0,0 +1,11 @@ +package co.yixiang.modules.mp.service.dto; + +import lombok.Data; + +@Data +public class UpdateGoodsDto { + + private Integer roomId; + + private String productId; +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/WxMaLiveInfo.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/WxMaLiveInfo.java new file mode 100644 index 0000000..941cd51 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/WxMaLiveInfo.java @@ -0,0 +1,59 @@ +package co.yixiang.modules.mp.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class WxMaLiveInfo { + + private static final long serialVersionUID = 7285263767524755887L; + + /** + * 直播列表 + */ + @Data + public static class RoomInfo implements Serializable { + private static final long serialVersionUID = 7745775280267417154L; + private String name; + private Integer roomid; + private String coverImg; + private String shareImg; + private String feedsImg; + private Integer liveStatus; + private Long startTime; + private Long endTime; + private String anchorName; + private String anchorWechat; + private String anchorImg; + private Integer type; + private Integer screenType; + private Integer closeLike; + private Integer closeGoods; + private Integer closeComment; + private Integer closeReplay ; // 是否关闭回放 1 关闭 + private Integer closeShare ; // 是否关闭分享 1 关闭 + private Integer closeKf ; // 是否关闭客服,1 关闭 + private List goods; + } + + /** + * 商品列表 + */ + @Data + public static class Goods implements Serializable { + private static final long serialVersionUID = 5769245932149287574L; + private Integer goodsId; + private String coverImgUrl; + private String url; + private Integer priceType; + private String price; + private String price2; + private String name; + /** + * 1, 2:表示是为api添加商品,否则是在MP添加商品 + */ + private String thirdPartyTag; + } +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/WxMaLiveResult.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/WxMaLiveResult.java new file mode 100644 index 0000000..c4d6b71 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/WxMaLiveResult.java @@ -0,0 +1,131 @@ +package co.yixiang.modules.mp.service.dto; + +import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + *
+ * 直播间操作返回结果
+ * Created by lipengjun on 2020/6/29.
+ * 
+ * + * @author lipengjun (939961241@qq.com) + */ +@Data +public class WxMaLiveResult implements Serializable { + private static final long serialVersionUID = 1L; + private Integer errcode; + private String errmsg; + private Integer total; + private Integer auditId; + private Integer goodsId; + private List goods; + + /** + * 直播间列表 + */ + @SerializedName("room_info") + private List roomInfos; + + /** + * 获取回放源视频列表 + */ + @SerializedName("live_replay") + private List liveReplay; + + public static cn.binarywang.wx.miniapp.bean.live.WxMaLiveResult fromJson(String json) { + return WxMaGsonBuilder.create().fromJson(json, cn.binarywang.wx.miniapp.bean.live.WxMaLiveResult.class); + } + + /** + * 商品列表 + */ + @Data + public static class Goods implements Serializable { + private static final long serialVersionUID = 5769245932149287574L; + @SerializedName("goods_id") + private Integer goodsId; + /** + * 获取商品列表返回的商品图片 + */ + @SerializedName("cover_img_url") + private String coverImgUrl; + /** + * 获取直播间列表返回的商品图片 + */ + @SerializedName("cover_img") + private String coverImg; + private String name; + private String url; + @SerializedName("price_type") + private Integer priceType; + /** + * 0:未审核,1:审核中,2:审核通过,3审核失败 + */ + @SerializedName("audit_status") + private Integer auditStatus; + private String price; + private String price2; + /** + * 1, 2:表示是为api添加商品,否则是在MP添加商品 + */ + @SerializedName("third_party_tag") + private String thirdPartyTag; + } + + /** + * 直播列表 + */ + @Data + public static class RoomInfo implements Serializable { + private static final long serialVersionUID = 7745775280267417154L; + private String name; + @SerializedName("roomid") + private Integer roomId; + @SerializedName("cover_img") + private String coverImg; + @SerializedName("share_img") + private String shareImg; + @SerializedName("live_status") + private Integer liveStatus; + @SerializedName("start_time") + private Long startTime; + @SerializedName("end_time") + private Long endTime; + @SerializedName("anchor_name") + private String anchorName; + @SerializedName("anchor_wechat") + private String anchorWechat; + @SerializedName("anchor_img") + private String anchorImg; + private Integer type; + @SerializedName("screen_type") + private Integer screenType; + @SerializedName("close_like") + private Integer closeLike; + @SerializedName("closeGoods") + private Integer closeGoods; + @SerializedName("close_comment") + private Integer closeComment; + private List goods; + } + + /** + * 回放数据列表 + */ + @Data + public static class LiveReplay implements Serializable { + private static final long serialVersionUID = 7683927205627536320L; + @SerializedName("expire_time") + private String expireTime; + @SerializedName("create_time") + private String createTime; + @SerializedName("media_url") + private String mediaUrl; + } +} + diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxArticleDto.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxArticleDto.java new file mode 100644 index 0000000..806419c --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxArticleDto.java @@ -0,0 +1,82 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.service.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxArticleDto implements Serializable { + + /** 文章管理ID */ + private Integer id; + + /** 分类id */ + private String cid; + + /** 文章标题 */ + private String title; + + /** 文章作者 */ + private String author; + + /** 文章图片 */ + private String imageInput; + + /** 文章简介 */ + private String synopsis; + + private String content; + + /** 文章分享标题 */ + private String shareTitle; + + /** 文章分享简介 */ + private String shareSynopsis; + + /** 浏览次数 */ + private String visit; + + /** 排序 */ + private Integer sort; + + /** 原文链接 */ + private String url; + + /** 状态 */ + private Integer status; + + /** 添加时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date createTime; + + /** 是否隐藏 */ + private Integer hide; + + /** 管理员id */ + private Integer adminId; + + /** 商户id */ + private Integer merId; + + /** 产品关联id */ + private Integer productId; + + /** 是否热门(小程序) */ + private Integer isHot; + + /** 是否轮播图(小程序) */ + private Integer isBanner; + + private String thumbMediaId; +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxArticleQueryCriteria.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxArticleQueryCriteria.java new file mode 100644 index 0000000..376c685 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxArticleQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxArticleQueryCriteria{ +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatLiveDto.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatLiveDto.java new file mode 100644 index 0000000..1cc527b --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatLiveDto.java @@ -0,0 +1,105 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.mp.service.dto; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** +* @author hupeng +* @date 2020-08-10 +*/ +@Data +public class YxWechatLiveDto implements Serializable { + + + + /** 直播间id */ + /** 防止精度丢失 */ + @JsonSerialize(using= ToStringSerializer.class) + @ApiModelProperty(value = "直播间id") + private Long roomId; + + private Long id; + + /** 直播间标题 */ + @ApiModelProperty(value = "直播间标题") + private String name; + + /** 背景图 */ + @ApiModelProperty(value = "背景图") + private String coverImge; + + /** 分享图片 */ + @ApiModelProperty(value = "分享图片") + private String shareImge; + + /** 直播间状态 */ + @ApiModelProperty(value = "直播间状态 101:直播中,102:未开始,103 已结束,104 禁播,105:暂停,106:异常,107:已过期") + private Integer liveStatus; + + /** 开始时间 */ + @ApiModelProperty(value = "开始时间") + private Long startTime; + + /** 预计结束时间 */ + @ApiModelProperty(value = "预计结束时间") + private Long endTime; + + /** 主播昵称 */ + @ApiModelProperty(value = "主播昵称") + private String anchorName; + + /** 主播微信号 */ + @ApiModelProperty(value = "主播微信号") + private String anchorWechat; + + /** 主播头像 */ + @ApiModelProperty(value = "主播头像") + private String anchorImge; + + /** 直播间类型 1:推流 0:手机直播 */ + @ApiModelProperty(value = "直播间类型 1:推流 0:手机直播") + private Integer type; + + /** 横屏、竖屏 【1:横屏,0:竖屏】 */ + @ApiModelProperty(value = "横屏、竖屏 【1:横屏,0:竖屏】") + private Integer screenType; + + /** 是否关闭点赞 【0:开启,1:关闭】 */ + @ApiModelProperty(value = "是否关闭点赞 【0:开启,1:关闭】") + private Integer closeLike; + + /** 是否关闭评论 【0:开启,1:关闭】 */ + @ApiModelProperty(value = "是否关闭评论 【0:开启,1:关闭】") + private Integer closeComment; + + /** 是否关闭货架 【0:开启,1:关闭】 */ + @ApiModelProperty(value = "是否关闭货架 【0:开启,1:关闭】") + private Integer closeGoods; + + private Integer closeReplay ; // 是否关闭回放 1 关闭 + + private Integer closeShare ; // 是否关闭分享 1 关闭 + + private Integer closeKf ; // 是否关闭客服,1 关闭 + /** + * 关联商品id多个,隔开 + */ + + private String productId; + + @ApiModelProperty(value = "商品信息") + private List product; +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatLiveGoodsDto.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatLiveGoodsDto.java new file mode 100644 index 0000000..18aca58 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatLiveGoodsDto.java @@ -0,0 +1,59 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.mp.service.dto; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-08-11 +*/ +@Data +public class YxWechatLiveGoodsDto implements Serializable { + + + private Long id; + + /** 直播商品id */ + /** 防止精度丢失 */ + @JsonSerialize(using= ToStringSerializer.class) + private Long goodsId; + + /** 关联商品id */ + private Long productId; + + /** 商品图片 */ + private String coverImgeUrl; + + /** 商品小程序路径 */ + private String url; + + /** 价格类型 1:一口价(只需要传入price,price2不传) 2:价格区间(price字段为左边界,price2字段为右边界,price和price2必传) 3:显示折扣价(price字段为原价,price2字段为现价, price和price2必传) */ + private String priceType; + + private String price; + + private String price2; + + /** 商品名称 */ + private String name; + + /** 1, 2:表示是为api添加商品,否则是直播控制台添加的商品 */ + private String thirdPartyTag; + + /** 审核单id */ + private Long auditId; + + /** 审核状态 0:未审核,1:审核中,2:审核通过,3审核失败 */ + private Integer auditStatus; +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatLiveGoodsQueryCriteria.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatLiveGoodsQueryCriteria.java new file mode 100644 index 0000000..373c803 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatLiveGoodsQueryCriteria.java @@ -0,0 +1,24 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.mp.service.dto; + +import co.yixiang.annotation.Query; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-08-11 +*/ +@Data +public class YxWechatLiveGoodsQueryCriteria{ + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String name; +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatLiveQueryCriteria.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatLiveQueryCriteria.java new file mode 100644 index 0000000..047c14c --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatLiveQueryCriteria.java @@ -0,0 +1,24 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.mp.service.dto; + +import co.yixiang.annotation.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** +* @author hupeng +* @date 2020-08-10 +*/ +@Data +public class YxWechatLiveQueryCriteria{ + @ApiModelProperty(value = "直播间状态 101:直播中,102:未开始,103 已结束,104 禁播,105:暂停,106:异常,107:已过期") + @Query + private Integer liveStatus; +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatMenuDto.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatMenuDto.java new file mode 100644 index 0000000..6b63ba5 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatMenuDto.java @@ -0,0 +1,26 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxWechatMenuDto implements Serializable { + + private String key; + + /** 缓存数据 */ + private String result; + + /** 缓存时间 */ + private Integer addTime; +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatMenuQueryCriteria.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatMenuQueryCriteria.java new file mode 100644 index 0000000..fdb5df5 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatMenuQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxWechatMenuQueryCriteria{ +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatReplyDto.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatReplyDto.java new file mode 100644 index 0000000..3ff4cd4 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatReplyDto.java @@ -0,0 +1,36 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxWechatReplyDto implements Serializable { + + /** 微信关键字回复id */ + private Integer id; + + /** 关键字 */ + private String key; + + /** 回复类型 */ + private String type; + + /** 回复数据 */ + private String data; + + /** 0=不可用 1 =可用 */ + private Integer status; + + /** 是否隐藏 */ + private Integer hide; +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatReplyQueryCriteria.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatReplyQueryCriteria.java new file mode 100644 index 0000000..171ed16 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatReplyQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxWechatReplyQueryCriteria{ +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatTemplateDto.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatTemplateDto.java new file mode 100644 index 0000000..2cab22a --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatTemplateDto.java @@ -0,0 +1,41 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxWechatTemplateDto implements Serializable { + + /** 模板id */ + private Integer id; + + /** 模板编号 */ + private String tempkey; + + /** 模板名 */ + private String name; + + /** 回复内容 */ + private String content; + + /** 模板ID */ + private String tempid; + + /** 添加时间 */ + private String addTime; + + /** 状态 */ + private Integer status; + /** 类型:template:模板消息 subscribe:订阅消息 */ + private String type; +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatTemplateQueryCriteria.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatTemplateQueryCriteria.java new file mode 100644 index 0000000..fe829ed --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/dto/YxWechatTemplateQueryCriteria.java @@ -0,0 +1,16 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.service.dto; + +import lombok.Data; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Data +public class YxWechatTemplateQueryCriteria{ +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/impl/YxArticleServiceImpl.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/impl/YxArticleServiceImpl.java new file mode 100644 index 0000000..0d83667 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/impl/YxArticleServiceImpl.java @@ -0,0 +1,142 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.mp.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.mp.service.mapper.ArticleMapper; +import co.yixiang.modules.mp.domain.YxArticle; +import co.yixiang.modules.mp.service.YxArticleService; +import co.yixiang.modules.mp.service.dto.YxArticleDto; +import co.yixiang.modules.mp.service.dto.YxArticleQueryCriteria; +import co.yixiang.modules.mp.vo.YxArticleQueryVo; +import co.yixiang.utils.FileUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Slf4j +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxArticleServiceImpl extends BaseServiceImpl implements YxArticleService { + + private final IGenerator generator; + private final ArticleMapper articleMapper; + @Value("${file.path}") + private String uploadDirStr; + + public YxArticleServiceImpl(IGenerator generator,ArticleMapper articleMapper) { + this.generator = generator; + this.articleMapper = articleMapper; + } + + /** + * 获取文章列表 + * @param page 页码 + * @param limit 条数 + * @return List + */ + @Override + public List getList(int page, int limit){ + Page pageModel = new Page<>(page, limit); + + IPage pageList = articleMapper.selectPage(pageModel, Wrappers.lambdaQuery() + .orderByDesc(YxArticle::getId)); + + return generator.convert(pageList.getRecords(),YxArticleQueryVo.class); + } + + /** + * 获取文章详情 + * @param id id + * @return YxArticleQueryVo + */ + @Override + public YxArticleQueryVo getDetail(int id){ + return generator.convert(this.getById(id),YxArticleQueryVo.class); + } + + + @Override + public void incVisitNum(int id) { + articleMapper.incVisitNum(id); + } + + @Override + //@Cacheable + public Map queryAll(YxArticleQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxArticleDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxArticleQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxArticle.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxArticleDto yxArticle : all) { + Map map = new LinkedHashMap<>(); + map.put("分类id", yxArticle.getCid()); + map.put("文章标题", yxArticle.getTitle()); + map.put("文章作者", yxArticle.getAuthor()); + map.put("文章图片", yxArticle.getImageInput()); + map.put("文章简介", yxArticle.getSynopsis()); + map.put(" content", yxArticle.getContent()); + map.put("文章分享标题", yxArticle.getShareTitle()); + map.put("文章分享简介", yxArticle.getShareSynopsis()); + map.put("浏览次数", yxArticle.getVisit()); + map.put("排序", yxArticle.getSort()); + map.put("原文链接", yxArticle.getUrl()); + map.put("状态", yxArticle.getStatus()); + map.put("是否隐藏", yxArticle.getHide()); + map.put("管理员id", yxArticle.getAdminId()); + map.put("商户id", yxArticle.getMerId()); + map.put("产品关联id", yxArticle.getProductId()); + map.put("是否热门(小程序)", yxArticle.getIsHot()); + map.put("是否轮播图(小程序)", yxArticle.getIsBanner()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + + + +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatLiveGoodsServiceImpl.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatLiveGoodsServiceImpl.java new file mode 100644 index 0000000..47bc8fa --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatLiveGoodsServiceImpl.java @@ -0,0 +1,226 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.mp.service.impl; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.bean.live.WxMaLiveGoodInfo; +import cn.binarywang.wx.miniapp.bean.live.WxMaLiveResult; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONUtil; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.LiveGoodsEnum; +import co.yixiang.exception.BadRequestException; +import co.yixiang.modules.mp.service.dto.WxMaLiveInfo; +import co.yixiang.modules.mp.service.mapper.YxWechatLiveGoodsMapper; +import co.yixiang.modules.mp.domain.YxWechatLiveGoods; +import co.yixiang.modules.mp.service.YxWechatLiveGoodsService; +import co.yixiang.modules.mp.service.dto.YxWechatLiveGoodsDto; +import co.yixiang.modules.mp.service.dto.YxWechatLiveGoodsQueryCriteria; +import co.yixiang.modules.mp.config.WxMaConfiguration; +import co.yixiang.utils.FileUtil; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.api.WxConsts; +import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; +import me.chanjar.weixin.common.error.WxErrorException; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** +* @author hupeng +* @date 2020-08-11 +*/ +@Slf4j +@Service +//@CacheConfig(cacheNames = "yxWechatLiveGoods") +@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = Exception.class) +public class YxWechatLiveGoodsServiceImpl extends BaseServiceImpl implements YxWechatLiveGoodsService { + + private final IGenerator generator; + @Value("${file.path}") + private String uploadDirStr; + public YxWechatLiveGoodsServiceImpl(IGenerator generator) { + this.generator = generator; + } + + + /** + * 同步商品更新审核状态 + * @return + */ + //@Cacheable + @Override + public boolean synchroWxOlLive(List goodsIds) { + try { + WxMaService wxMaService = WxMaConfiguration.getWxMaService(); + WxMaLiveResult liveInfos = wxMaService.getLiveGoodsService().getGoodsWareHouse(goodsIds); + List convert = generator.convert(liveInfos.getGoods(), YxWechatLiveGoods.class); + this.saveOrUpdateBatch(convert); + } catch (WxErrorException e) { + e.printStackTrace(); + } + return true; + } + + @Override + public void removeGoods(Long id) { + this.removeById(id); + try { + WxMaService wxMaService = WxMaConfiguration.getWxMaService(); + wxMaService.getLiveGoodsService().deleteGoods(id.intValue()); + } catch (WxErrorException e) { + e.printStackTrace(); + } + } + + + /** + * 更新直播商品信息 + * @param resources + */ + @Override + public void updateGoods(YxWechatLiveGoods resources) { + YxWechatLiveGoods wechatLiveGoods = this.getById(resources.getGoodsId()); + try { + WxMaService wxMaService = WxMaConfiguration.getWxMaService(); + WxMaLiveGoodInfo goods = generator.convert(resources, WxMaLiveGoodInfo.class); + if(ObjectUtil.isNotEmpty(wechatLiveGoods)){ + /** 审核状态 0:未审核,1:审核中,2:审核通过,3审核失败 */ + if(LiveGoodsEnum.IS_Audit_2.getValue().equals(wechatLiveGoods.getAuditStatus())){ + }else if(LiveGoodsEnum.IS_Audit_0.getValue().equals(wechatLiveGoods.getAuditStatus())){ + resources.setCoverImgUrl(uploadPhotoToWx(wxMaService,resources.getCoverImgeUrl()).getMediaId()); + }else if(LiveGoodsEnum.IS_Audit_1.getValue().equals(wechatLiveGoods.getAuditStatus())){ + throw new BadRequestException("商品审核中不允许修改"); + }else if(LiveGoodsEnum.IS_Audit_3.getValue().equals(wechatLiveGoods.getAuditStatus())){ + resources.setCoverImgUrl(uploadPhotoToWx(wxMaService,resources.getCoverImgeUrl()).getMediaId()); + wxMaService.getLiveGoodsService().updateGoods(goods); + wxMaService.getLiveGoodsService().auditGoods(goods.getGoodsId()); + return; + } + } + + boolean wxMaLiveResult = wxMaService.getLiveGoodsService().updateGoods(goods); + this.saveOrUpdate(resources); + } catch (WxErrorException e) { + throw new BadRequestException(e.toString()); + } + } + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + @Override + //@Cacheable + public Map queryAll(YxWechatLiveGoodsQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + List goodsDtos = generator.convert(page.getList(), YxWechatLiveGoodsDto.class); + goodsDtos.forEach(i ->{ + i.setId(i.getGoodsId()); + }); + map.put("content",goodsDtos); + map.put("totalElements", page.getTotal()); + return map; + } + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + @Override + //@Cacheable + public List queryAll(YxWechatLiveGoodsQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxWechatLiveGoods.class, criteria)); + } + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxWechatLiveGoodsDto yxWechatLiveGoods : all) { + Map map = new LinkedHashMap<>(); + map.put("关联商品id", yxWechatLiveGoods.getProductId()); + map.put("商品图片", yxWechatLiveGoods.getCoverImgeUrl()); + map.put("商品小程序路径", yxWechatLiveGoods.getUrl()); + map.put("价格类型 1:一口价(只需要传入price,price2不传) 2:价格区间(price字段为左边界,price2字段为右边界,price和price2必传) 3:显示折扣价(price字段为原价,price2字段为现价, price和price2必传)", yxWechatLiveGoods.getPriceType()); + map.put(" price", yxWechatLiveGoods.getPrice()); + map.put(" price2", yxWechatLiveGoods.getPrice2()); + map.put("商品名称", yxWechatLiveGoods.getName()); + map.put("1, 2:表示是为api添加商品,否则是直播控制台添加的商品", yxWechatLiveGoods.getThirdPartyTag()); + map.put("审核单id", yxWechatLiveGoods.getAuditId()); + map.put("审核状态 0:未审核,1:审核中,2:审核通过,3审核失败", yxWechatLiveGoods.getAuditStatus()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + /** + * 保存直播商品信息 + * @param resources + * @return + */ + @Override + public boolean saveGoods(YxWechatLiveGoods resources) { + WxMaService wxMaService = WxMaConfiguration.getWxMaService(); + try { + resources.setCoverImgUrl(uploadPhotoToWx(wxMaService,resources.getCoverImgeUrl()).getMediaId()); + WxMaLiveGoodInfo goods = generator.convert(resources, WxMaLiveGoodInfo.class); + WxMaLiveResult wxMaLiveResult = wxMaService.getLiveGoodsService().addGoods(goods); + resources.setGoodsId(Long.valueOf(wxMaLiveResult.getGoodsId())); + resources.setAuditId(Long.valueOf(wxMaLiveResult.getAuditId())); + this.save(resources); + } catch (WxErrorException e) { + throw new BadRequestException(e.toString()); + } + return true; + } + + /** + * 上传临时素材 + * @param wxMaService WxMaService + * @param picPath 图片路径 + * @return WxMpMaterialUploadResult + * @throws WxErrorException + */ + private WxMediaUploadResult uploadPhotoToWx(WxMaService wxMaService, String picPath) throws WxErrorException { + String filename = (int) System.currentTimeMillis() + ".png"; + String downloadPath = uploadDirStr + filename; + long size = HttpUtil.downloadFile(picPath, cn.hutool.core.io.FileUtil.file(downloadPath)); + picPath = downloadPath; + File picFile = new File( picPath ); + log.info( "picFile name : {}", picFile.getName() ); + WxMediaUploadResult wxMediaUploadResult = wxMaService.getMediaService().uploadMedia( WxConsts.MediaFileType.IMAGE, picFile ); + log.info( "wxMpMaterialUploadResult : {}", JSONUtil.toJsonStr( wxMediaUploadResult ) ); + return wxMediaUploadResult; + } +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatLiveServiceImpl.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatLiveServiceImpl.java new file mode 100644 index 0000000..97105e0 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatLiveServiceImpl.java @@ -0,0 +1,285 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.mp.service.impl; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.bean.live.WxMaLiveResult; +import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONUtil; +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.exception.BadRequestException; +import co.yixiang.modules.mp.domain.YxWechatLiveGoods; +import co.yixiang.modules.mp.service.YxWechatLiveGoodsService; +import co.yixiang.modules.mp.service.YxWechatLiveService; +import co.yixiang.modules.mp.service.dto.*; +import co.yixiang.modules.mp.service.mapper.YxWechatLiveMapper; +import co.yixiang.modules.mp.vo.WechatLiveVo; +import co.yixiang.modules.mp.domain.YxWechatLive; +import co.yixiang.modules.mp.config.WxMaConfiguration; +import co.yixiang.modules.product.domain.YxStoreProduct; +import co.yixiang.modules.product.vo.YxStoreProductQueryVo; +import co.yixiang.utils.FileUtil; +import co.yixiang.utils.OrderUtil; +import co.yixiang.utils.StringUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.google.gson.JsonObject; +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.api.WxConsts; +import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; +import me.chanjar.weixin.common.enums.WxType; +import me.chanjar.weixin.common.error.WxError; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.common.util.json.GsonParser; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Broadcast.Room.CREATE_ROOM; + + +/** +* @author hupeng +* @date 2020-08-10 +*/ +@Service +//@CacheConfig(cacheNames = "yxWechatLive") +@Slf4j +@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = Exception.class) +public class YxWechatLiveServiceImpl extends BaseServiceImpl implements YxWechatLiveService { + + private final IGenerator generator; + @Value("${file.path}") + private String uploadDirStr; + private final YxWechatLiveGoodsService wechatLiveGoodsService; + + private final YxWechatLiveMapper wechatLiveMapper; + + public YxWechatLiveServiceImpl(IGenerator generator, YxWechatLiveGoodsService wechatLiveGoodsService, YxWechatLiveMapper wechatLiveMapper) { + this.generator = generator; + this.wechatLiveGoodsService = wechatLiveGoodsService; + this.wechatLiveMapper = wechatLiveMapper; + } + + /** + * 同步直播间 + * @return + */ + //@Cacheable + @Override + public boolean synchroWxOlLive() { + try { + WxMaService wxMaService = WxMaConfiguration.getWxMaService(); + List liveInfos = wxMaService.getLiveService().getLiveInfos(); + List convert = generator.convert(liveInfos, YxWechatLive.class); + this.saveOrUpdateBatch(convert); + } catch (WxErrorException e) { + e.printStackTrace(); + } + return true; + } + @Override + //@Cacheable + public WechatLiveVo queryAll(YxWechatLiveQueryCriteria criteria, Pageable pageable) { + String order=null; + if(pageable.getSort()!=null){ + order= pageable.getSort().toString(); + order=order.replace(":",""); + if("UNSORTED".equals(order)){ + order="start_time desc"; + } + } + PageHelper.startPage(pageable.getPageNumber()+1, pageable.getPageSize(),order); + PageInfo page = new PageInfo<>(queryAll(criteria)); + WechatLiveVo wechatLiveVo = new WechatLiveVo(); +// List liveInfos = wxMaLiveService.getLiveInfos(); + List liveDtos = generator.convert(page.getList(), YxWechatLiveDto.class); + //获取所有商品 + liveDtos.forEach(i ->{ + if(StringUtils.isNotBlank(i.getProductId())){ + List wechatLiveGoodsDtos = generator.convert( + wechatLiveGoodsService.list(new LambdaQueryWrapper().in(YxWechatLiveGoods::getGoodsId,i.getProductId().split(","))) + ,YxWechatLiveGoodsDto.class); + i.setProduct(wechatLiveGoodsDtos); + } + i.setId(i.getRoomId()); + }); + wechatLiveVo.setContent(liveDtos); + wechatLiveVo.setTotalElements(page.getTotal()); + wechatLiveVo.setPageNumber(page.getPageNum()); + wechatLiveVo.setLastPage(page.getPages()); + return wechatLiveVo; + } + + @Override + public boolean addGoods(UpdateGoodsDto resources) { + YxWechatLive wechatLive = new YxWechatLive(); + + WxMaService wxMaService = WxMaConfiguration.getWxMaService(); + if(StringUtils.isNotBlank(resources.getProductId())){ + wechatLive.setRoomId(Long.valueOf(resources.getRoomId())); + wechatLive.setProductId(resources.getProductId()); + String[] productIds = resources.getProductId().split(","); + List pids = new ArrayList<>(); + for (String productId : productIds) { + pids.add(Integer.valueOf(productId)); + } + //添加商品 + try { + wxMaService.getLiveService().addGoodsToRoom(resources.getRoomId().intValue(), pids); + this.saveOrUpdate(wechatLive); + } catch (WxErrorException e) { + e.printStackTrace(); + } + } + return true; + } + @Override + public boolean saveLive(YxWechatLive resources){ + WxMaService wxMaService = WxMaConfiguration.getWxMaService(); + try { + resources.setFeedsImg(uploadPhotoToWx(wxMaService,resources.getFeedsImg()).getMediaId()); + resources.setStartTime(Long.valueOf(OrderUtil.dateToTimestamp(resources.getStartDate()))); + resources.setEndTime(Long.valueOf(OrderUtil.dateToTimestamp(resources.getEndDate()))); + resources.setAnchorImg(uploadPhotoToWx(wxMaService,resources.getAnchorImge()).getMediaId()); + resources.setCoverImg(uploadPhotoToWx(wxMaService,resources.getCoverImge()).getMediaId()); + resources.setShareImg(uploadPhotoToWx(wxMaService,resources.getShareImge()).getMediaId()); + WxMaLiveInfo.RoomInfo roomInfo = generator.convert(resources, WxMaLiveInfo.RoomInfo.class); + Integer status = this.createRoom(roomInfo); + resources.setRoomId(Long.valueOf(status)); + if(StringUtils.isNotBlank(resources.getProductId())){ + String[] productIds = resources.getProductId().split(","); + List pids = new ArrayList<>(); + for (String productId : productIds) { + pids.add(Integer.valueOf(productId)); + } + //添加商品 + wxMaService.getLiveService().addGoodsToRoom(status, pids); + } + this.save(resources); + } catch (WxErrorException e) { + e.printStackTrace(); + throw new BadRequestException(e.toString()); + } + return false; + } + + @Override + //@Cacheable + public List queryAll(YxWechatLiveQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxWechatLive.class, criteria)); + } + + @Override + //@Cacheable + public List getLiveReplay(Integer roomId){ + WxMaService wxMaService = WxMaConfiguration.getWxMaService(); + WxMaLiveResult get_replay = new WxMaLiveResult(); + try { + get_replay = wxMaService.getLiveService().getLiveReplay("get_replay", roomId, 0, 100); + } catch (WxErrorException e) { + e.printStackTrace(); + } + return get_replay.getLiveReplay(); + } + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxWechatLiveDto yxWechatLive : all) { + Map map = new LinkedHashMap<>(); + map.put("直播间标题", yxWechatLive.getName()); + map.put("背景图", yxWechatLive.getCoverImge()); + map.put("分享图片", yxWechatLive.getShareImge()); + map.put("直播间状态", yxWechatLive.getLiveStatus()); + map.put("开始时间", yxWechatLive.getStartTime()); + map.put("预计结束时间", yxWechatLive.getEndTime()); + map.put("主播昵称", yxWechatLive.getAnchorName()); + map.put("主播微信号", yxWechatLive.getAnchorWechat()); + map.put("主播头像", yxWechatLive.getAnchorImge()); + map.put("直播间类型 1:推流 0:手机直播", yxWechatLive.getType()); + map.put("横屏、竖屏 【1:横屏,0:竖屏】", yxWechatLive.getScreenType()); + map.put("是否关闭货架 【0:开启,1:关闭】", yxWechatLive.getCloseLike()); + map.put("是否关闭评论 【0:开启,1:关闭】", yxWechatLive.getCloseComment()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + + @Override + public Integer createRoom(WxMaLiveInfo.RoomInfo roomInfo) throws WxErrorException { + WxMaService wxMaService = WxMaConfiguration.getWxMaService(); + String responseContent = wxMaService.post(CREATE_ROOM, WxMaGsonBuilder.create().toJson(roomInfo)); + JsonObject jsonObject = GsonParser.parse(responseContent); + if (jsonObject.get("errcode").getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp)); + } + return jsonObject.get("roomId").getAsInt(); + } + /** + * 上传临时素材 + * @param wxMaService WxMaService + * @param picPath 图片路径 + * @return WxMpMaterialUploadResult + * @throws WxErrorException + */ + private WxMediaUploadResult uploadPhotoToWx(WxMaService wxMaService, String picPath) throws WxErrorException { + String filename = (int) System.currentTimeMillis() + ".png"; + String downloadPath = uploadDirStr + filename; + long size = HttpUtil.downloadFile(picPath, cn.hutool.core.io.FileUtil.file(downloadPath)); + picPath = downloadPath; + File picFile = new File( picPath ); + log.info( "picFile name : {}", picFile.getName() ); + WxMediaUploadResult wxMediaUploadResult = wxMaService.getMediaService().uploadMedia( WxConsts.MediaFileType.IMAGE, picFile ); + log.info( "wxMpMaterialUploadResult : {}", JSONUtil.toJsonStr( wxMediaUploadResult ) ); + return wxMediaUploadResult; + } + + + /** + * 直播间列表 + * @param page 页码 + * @param limit 条数 + * @param order ProductEnum + * @return List + */ + @Override + public List getList(int page, int limit, int order) { + //todo 添加状态判断 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.orderByDesc(YxWechatLive::getStartTime); + + + Page pageModel = new Page<>(page, limit); + + IPage pageList = wechatLiveMapper.selectPage(pageModel,wrapper); + + + return generator.convert(pageList.getRecords(),YxWechatLiveDto.class); + } + + +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatMenuServiceImpl.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatMenuServiceImpl.java new file mode 100644 index 0000000..23b83b6 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatMenuServiceImpl.java @@ -0,0 +1,89 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.mp.service.mapper.WechatMenuMapper; +import co.yixiang.modules.mp.domain.YxWechatMenu; +import co.yixiang.modules.mp.service.YxWechatMenuService; +import co.yixiang.modules.mp.service.dto.YxWechatMenuDto; +import co.yixiang.modules.mp.service.dto.YxWechatMenuQueryCriteria; +import co.yixiang.utils.FileUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@AllArgsConstructor +//@CacheConfig(cacheNames = "yxWechatMenu") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxWechatMenuServiceImpl extends BaseServiceImpl implements YxWechatMenuService { + + private final IGenerator generator; + + @Override + //@Cacheable + public Map queryAll(YxWechatMenuQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxWechatMenuDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxWechatMenuQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxWechatMenu.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxWechatMenuDto yxWechatMenu : all) { + Map map = new LinkedHashMap<>(); + map.put("缓存数据", yxWechatMenu.getResult()); + map.put("缓存时间", yxWechatMenu.getAddTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + public Boolean isExist(String wechat_menus) { + YxWechatMenu yxWechatMenu = this.getOne(new LambdaQueryWrapper() + .eq(YxWechatMenu::getKey,wechat_menus)); + if(yxWechatMenu == null){ + return false; + } + return true; + } +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatReplyServiceImpl.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatReplyServiceImpl.java new file mode 100644 index 0000000..00f2669 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatReplyServiceImpl.java @@ -0,0 +1,110 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.exception.EntityExistException; +import co.yixiang.modules.mp.service.mapper.WechatReplyMapper; +import co.yixiang.modules.mp.domain.YxWechatReply; +import co.yixiang.modules.mp.service.YxWechatReplyService; +import co.yixiang.modules.mp.service.dto.YxWechatReplyDto; +import co.yixiang.modules.mp.service.dto.YxWechatReplyQueryCriteria; +import co.yixiang.utils.FileUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@AllArgsConstructor +//@CacheConfig(cacheNames = "yxWechatReply") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxWechatReplyServiceImpl extends BaseServiceImpl implements YxWechatReplyService { + + private final IGenerator generator; + + @Override + //@Cacheable + public Map queryAll(YxWechatReplyQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxWechatReplyDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxWechatReplyQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxWechatReply.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxWechatReplyDto yxWechatReply : all) { + Map map = new LinkedHashMap<>(); + map.put("关键字", yxWechatReply.getKey()); + map.put("回复类型", yxWechatReply.getType()); + map.put("回复数据", yxWechatReply.getData()); + map.put("0=不可用 1 =可用", yxWechatReply.getStatus()); + map.put("是否隐藏", yxWechatReply.getHide()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + public YxWechatReply isExist(String key) { + YxWechatReply yxWechatReply = this.getOne(new LambdaQueryWrapper() + .eq(YxWechatReply::getKey,key)); + return yxWechatReply; + } + + @Override + public void create(YxWechatReply yxWechatReply) { + if(this.isExist(yxWechatReply.getKey()) != null){ + throw new EntityExistException(YxWechatReply.class,"key",yxWechatReply.getKey()); + } + this.save(yxWechatReply); + } + + @Override + public void upDate(YxWechatReply resources) { + YxWechatReply yxWechatReply = this.getById(resources.getId()); + YxWechatReply yxWechatReply1; + yxWechatReply1 = this.isExist(resources.getKey()); + if(yxWechatReply1 != null && !yxWechatReply1.getId().equals(yxWechatReply.getId())){ + throw new EntityExistException(YxWechatReply.class,"key",resources.getKey()); + } + yxWechatReply.copy(resources); + this.saveOrUpdate(yxWechatReply); + } +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatTemplateServiceImpl.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatTemplateServiceImpl.java new file mode 100644 index 0000000..25cebd4 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatTemplateServiceImpl.java @@ -0,0 +1,89 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.service.impl; + +import co.yixiang.common.service.impl.BaseServiceImpl; +import co.yixiang.common.utils.QueryHelpPlus; +import co.yixiang.dozer.service.IGenerator; +import co.yixiang.modules.mp.domain.YxWechatTemplate; +import co.yixiang.modules.mp.service.YxWechatTemplateService; +import co.yixiang.modules.mp.service.dto.YxWechatTemplateQueryCriteria; +import co.yixiang.modules.mp.service.dto.YxWechatTemplateDto; +import co.yixiang.modules.mp.service.mapper.WechatTemplateMapper; +import co.yixiang.utils.FileUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +// 默认不使用缓存 +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Service +@AllArgsConstructor +//@CacheConfig(cacheNames = "yxWechatTemplate") +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class YxWechatTemplateServiceImpl extends BaseServiceImpl implements YxWechatTemplateService { + + private final IGenerator generator; + + @Override + //@Cacheable + public Map queryAll(YxWechatTemplateQueryCriteria criteria, Pageable pageable) { + getPage(pageable); + PageInfo page = new PageInfo<>(queryAll(criteria)); + Map map = new LinkedHashMap<>(2); + map.put("content", generator.convert(page.getList(), YxWechatTemplateDto.class)); + map.put("totalElements", page.getTotal()); + return map; + } + + + @Override + //@Cacheable + public List queryAll(YxWechatTemplateQueryCriteria criteria){ + return baseMapper.selectList(QueryHelpPlus.getPredicate(YxWechatTemplate.class, criteria)); + } + + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (YxWechatTemplateDto yxWechatTemplate : all) { + Map map = new LinkedHashMap<>(); + map.put("模板编号", yxWechatTemplate.getTempkey()); + map.put("模板名", yxWechatTemplate.getName()); + map.put("回复内容", yxWechatTemplate.getContent()); + map.put("模板ID", yxWechatTemplate.getTempid()); + map.put("添加时间", yxWechatTemplate.getAddTime()); + map.put("状态", yxWechatTemplate.getStatus()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + public YxWechatTemplate findByTempkey(String recharge_success_key) { + return this.getOne(new LambdaQueryWrapper() + .eq(YxWechatTemplate::getTempkey,recharge_success_key)); + } +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/mapper/ArticleMapper.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/mapper/ArticleMapper.java new file mode 100644 index 0000000..5645cd1 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/mapper/ArticleMapper.java @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.mp.domain.YxArticle; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Update; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface ArticleMapper extends CoreMapper { + @Update("update yx_article set visit=visit+1 " + + "where id=#{id}") + int incVisitNum(@Param("id") int id); + +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/mapper/WechatMenuMapper.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/mapper/WechatMenuMapper.java new file mode 100644 index 0000000..d5b5e08 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/mapper/WechatMenuMapper.java @@ -0,0 +1,19 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.mp.domain.YxWechatMenu; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface WechatMenuMapper extends CoreMapper { + +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/mapper/WechatReplyMapper.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/mapper/WechatReplyMapper.java new file mode 100644 index 0000000..f08aa60 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/mapper/WechatReplyMapper.java @@ -0,0 +1,19 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.mp.domain.YxWechatReply; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface WechatReplyMapper extends CoreMapper { + +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/mapper/WechatTemplateMapper.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/mapper/WechatTemplateMapper.java new file mode 100644 index 0000000..fd39bb4 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/mapper/WechatTemplateMapper.java @@ -0,0 +1,19 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.mp.domain.YxWechatTemplate; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-05-12 +*/ +@Repository +public interface WechatTemplateMapper extends CoreMapper { + +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/mapper/YxWechatLiveGoodsMapper.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/mapper/YxWechatLiveGoodsMapper.java new file mode 100644 index 0000000..bf8762d --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/mapper/YxWechatLiveGoodsMapper.java @@ -0,0 +1,22 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.mp.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.mp.domain.YxWechatLiveGoods; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-08-11 +*/ +@Repository +public interface YxWechatLiveGoodsMapper extends CoreMapper { + +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/mapper/YxWechatLiveMapper.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/mapper/YxWechatLiveMapper.java new file mode 100644 index 0000000..1b16b9f --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/service/mapper/YxWechatLiveMapper.java @@ -0,0 +1,22 @@ +/** +* Copyright (C) 2018-2021 +* All rights reserved, Designed By www.yixiang.co +* 注意: +* 本软件为www.yixiang.co开发研制,未经购买不得使用 +* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) +* 一经发现盗用、分享等行为,将追究法律责任,后果自负 +*/ +package co.yixiang.modules.mp.service.mapper; + +import co.yixiang.common.mapper.CoreMapper; +import co.yixiang.modules.mp.domain.YxWechatLive; +import org.springframework.stereotype.Repository; + +/** +* @author hupeng +* @date 2020-08-10 +*/ +@Repository +public interface YxWechatLiveMapper extends CoreMapper { + +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/utils/JsonUtils.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/utils/JsonUtils.java new file mode 100644 index 0000000..6415807 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/utils/JsonUtils.java @@ -0,0 +1,21 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.utils; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +/** + * @author Binary Wang(https://github.com/binarywang) + */ +public class JsonUtils { + public static String toJson(Object obj) { + Gson gson = new GsonBuilder() + .setPrettyPrinting() + .create(); + return gson.toJson(obj); + } +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/utils/URLUtils.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/utils/URLUtils.java new file mode 100644 index 0000000..c8be242 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/utils/URLUtils.java @@ -0,0 +1,81 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + + */ +package co.yixiang.modules.mp.utils; + +import java.util.HashMap; +import java.util.Map; + +/** + * URLUtils + * @author Kevin + * @date 2019-03-20 13:39 + */ +public class URLUtils { + + /** + * 获取URL中的某个参数 + * @param url + * @param name + * @return + */ + public static String getParam(String url, String name) { + return urlSplit(url).get( name ); + } + + /** + * 去掉url中的路径,留下请求参数部分 + * @param strURL url地址 + * @return url请求参数部分 + */ + private static String truncateUrlPage(String strURL){ + String strAllParam=null; + String[] arrSplit=null; + strURL=strURL.trim().toLowerCase(); + arrSplit=strURL.split("[?]"); + if(strURL.length()>1){ + if(arrSplit.length>1){ + for (int i=1;i urlSplit(String URL){ + Map mapRequest = new HashMap(); + String[] arrSplit=null; + String strUrlParam= truncateUrlPage(URL); + if(strUrlParam==null){ + return mapRequest; + } + arrSplit=strUrlParam.split("[&]"); + for(String strSplit:arrSplit){ + String[] arrSplitEqual=null; + arrSplitEqual= strSplit.split("[=]"); + //解析出键值 + if(arrSplitEqual.length>1){ + //正确解析 + mapRequest.put(arrSplitEqual[0], arrSplitEqual[1]); + }else{ + if(arrSplitEqual[0]!=""){ + //只有参数没有值,不加入 + mapRequest.put(arrSplitEqual[0], ""); + } + } + } + return mapRequest; + } + + +} + diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/utils/YshopUtils.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/utils/YshopUtils.java new file mode 100644 index 0000000..57be5bf --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/utils/YshopUtils.java @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2018-2021 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ +package co.yixiang.modules.mp.utils; + + +import co.yixiang.modules.user.service.dto.WechatUserDto; +import com.alibaba.fastjson.JSONObject; + +/** + * @ClassName YshopUtils + * @Author hupeng <610796224@qq.com> + * @Date 2020/6/27 + **/ +public class YshopUtils { + public static WechatUserDto getWechtUser(String str) { + return JSONObject.parseObject(str,WechatUserDto.class); + } +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/vo/WechatLiveVo.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/vo/WechatLiveVo.java new file mode 100644 index 0000000..a06901e --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/vo/WechatLiveVo.java @@ -0,0 +1,20 @@ +package co.yixiang.modules.mp.vo; + +import co.yixiang.modules.mp.service.dto.YxWechatLiveDto; +import lombok.Data; + +import java.util.List; + +@Data +public class WechatLiveVo { + + private List content; + + private Long totalElements; + + private Integer pageNumber; + + private Integer lastPage; + + +} diff --git a/yshop-weixin/src/main/java/co/yixiang/modules/mp/vo/YxArticleQueryVo.java b/yshop-weixin/src/main/java/co/yixiang/modules/mp/vo/YxArticleQueryVo.java new file mode 100644 index 0000000..1d45962 --- /dev/null +++ b/yshop-weixin/src/main/java/co/yixiang/modules/mp/vo/YxArticleQueryVo.java @@ -0,0 +1,65 @@ +package co.yixiang.modules.mp.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 文章管理表 查询结果对象 + *

+ * + * @author hupeng + * @date 2019-10-02 + */ +@Data +@ApiModel(value = "YxArticleQueryVo对象", description = "文章管理表查询参数") +public class YxArticleQueryVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "文章管理ID") + private Integer id; + + @ApiModelProperty(value = "文章标题") + private String title; + + @ApiModelProperty(value = "文章作者") + private String author; + + @ApiModelProperty(value = "文章图片") + private String imageInput; + + @ApiModelProperty(value = "文章简介") + private String synopsis; + + @ApiModelProperty(value = "文章分享标题") + private String shareTitle; + + @ApiModelProperty(value = "文章分享简介") + private String shareSynopsis; + + @ApiModelProperty(value = "浏览次数") + private String visit; + + @ApiModelProperty(value = "排序") + private Integer sort; + + @ApiModelProperty(value = "原文链接") + private String url; + + @ApiModelProperty(value = "状态") + private Boolean status; + + @ApiModelProperty(value = "添加时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + @JsonProperty(value = "addTime") + private String createTime; + + @ApiModelProperty(value = "文章内容") + private String content; + +}