From 087ce92cbfab29a1b0fcab71d2a1c27922835f1d Mon Sep 17 00:00:00 2001
From: wangh <9483>
Date: Fri, 22 Dec 2023 15:33:38 +0800
Subject: [PATCH] =?UTF-8?q?=E4=B8=AD=E5=8F=B0=E5=A4=84=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
fuintAdmin/src/api/login.js | 10 +
fuintAdmin/src/permission.js | 28 +-
fuintAdmin/src/router/index.js | 21 +-
fuintAdmin/src/store/modules/user.js | 7 +-
fuintAdmin/src/utils/auth.js | 2 +-
.../src/views/indexcomponents/bottomindex.vue | 33 +-
.../views/indexcomponents/centenrindex.vue | 35 +-
fuintAdmin/src/views/integral/gift/index.vue | 52 +-
fuintAdmin_zt/package.json | 1 +
.../src/api/payConfig/merchantconfig.js | 18 +
fuintAdmin_zt/src/api/payConfig/oilconfig.js | 52 ++
fuintAdmin_zt/src/api/service/service.js | 29 +
fuintAdmin_zt/src/api/staff/user/user.js | 78 +++
fuintAdmin_zt/src/api/system/Site/site.js | 18 +-
fuintAdmin_zt/src/permission.js | 10 +-
fuintAdmin_zt/src/store/index.js | 4 +-
fuintAdmin_zt/src/store/modules/token.js | 29 +
fuintAdmin_zt/src/utils/auth.js | 53 +-
fuintAdmin_zt/src/views/Service/details.vue | 11 +-
fuintAdmin_zt/src/views/Service/index.vue | 44 +-
fuintAdmin_zt/src/views/Site/index.vue | 202 +++++--
.../src/views/components/Service/index.vue | 498 +++++++++++++++++-
.../src/views/components/Service/payment.vue | 430 +++++++++++++++
.../order/mapper/xml/OilOrderMapper.xml | 2 +-
.../controller/BackendStoreController.java | 38 ++
.../fuint/business/store/entity/MtStore.java | 4 +
.../business/store/mapper/MtStoreMapper.java | 3 +
.../store/mapper/xml/ExportExcelService.xml | 14 +
.../business/store/service/StoreService.java | 4 +
.../store/service/impl/StoreServiceImpl.java | 107 ++++
.../com/fuint/common/config/WebConfig.java | 1 +
.../java/com/fuint/common/dto/RoleDto.java | 12 +
.../java/com/fuint/common/dto/StoreDto.java | 26 +
.../fuint/common/service/AccountService.java | 2 +-
.../service/impl/AccountServiceImpl.java | 12 +-
.../fuint/common/shiroConfig/ShiroConfig.java | 1 +
.../controller/BackendDutyController.java | 1 +
.../com/fuint/system/role/entity/TDuty.java | 3 +
.../controller/BackendAccountController.java | 53 +-
.../main/resources/mapper/TAccountMapper.xml | 4 +
40 files changed, 1783 insertions(+), 169 deletions(-)
create mode 100644 fuintAdmin_zt/src/api/payConfig/merchantconfig.js
create mode 100644 fuintAdmin_zt/src/api/payConfig/oilconfig.js
create mode 100644 fuintAdmin_zt/src/api/staff/user/user.js
create mode 100644 fuintAdmin_zt/src/store/modules/token.js
create mode 100644 fuintAdmin_zt/src/views/components/Service/payment.vue
diff --git a/fuintAdmin/src/api/login.js b/fuintAdmin/src/api/login.js
index 3809ffe2c..06b263893 100644
--- a/fuintAdmin/src/api/login.js
+++ b/fuintAdmin/src/api/login.js
@@ -60,3 +60,13 @@ export function getCodeImg() {
method: 'get'
})
}
+
+
+// 单点登录
+export function loginVerificationApi(data) {
+ return request({
+ url: 'backendApi/store/loginVerification',
+ method: 'post',
+ data:data
+ })
+}
diff --git a/fuintAdmin/src/permission.js b/fuintAdmin/src/permission.js
index 0e2cc4107..924ff0389 100644
--- a/fuintAdmin/src/permission.js
+++ b/fuintAdmin/src/permission.js
@@ -3,28 +3,50 @@ import store from './store'
import { Message } from 'element-ui'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
-import { getToken } from '@/utils/auth'
+import {getToken, removeToken, setToken} from '@/utils/auth'
import { isRelogin } from '@/utils/request'
+import { loginVerificationApi } from '@/api/login'
+// import BigNumber from 'bignumber.js';
NProgress.configure({ showSpinner: false })
const whiteList = ['/login', '/auth-redirect']
-router.beforeEach((to, from, next) => {
+router.beforeEach(async (to, from, next) => {
NProgress.start()
+ console.log(to,from,next)
+ if (to.query.entrance) {
+ try {
+ const res = await loginVerificationApi(to.query.entrance);
+ if (res.data.token) {
+ setToken(res.data.token);
+ to.meta.title = "系统首页";
+ }
+ } catch (error) {
+ console.error("An error occurred:", error);
+ }
+ }
if (getToken()) {
to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
/* has token*/
if (to.path === '/login') {
+
next({ path: '/' })
NProgress.done()
- } else {
+ }else {
+ console.log("111113",store.getters.roles)
+
if (store.getters.roles.length === 0) {
+ console.log("111114")
isRelogin.show = true
// 判断当前用户是否已拉取完user_info信息
store.dispatch('GetInfo').then(() => {
+ console.log("111116")
+
isRelogin.show = false
store.dispatch('GenerateRoutes').then(accessRoutes => {
+ console.log("111117")
+
// 根据roles权限生成可访问的路由表
router.addRoutes(accessRoutes) // 动态添加可访问路由表
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
diff --git a/fuintAdmin/src/router/index.js b/fuintAdmin/src/router/index.js
index 3fbc1454c..3a28994ea 100644
--- a/fuintAdmin/src/router/index.js
+++ b/fuintAdmin/src/router/index.js
@@ -46,6 +46,11 @@ export const constantRoutes = [
component: () => import('@/views/login'),
hidden: true
},
+ // {
+ // path: '/jumpInTheMiddleOffice',
+ // component: () => import('@/views/index'),
+ // hidden: true
+ // },
{
path: '/404',
component: () => import('@/views/error/404'),
@@ -56,6 +61,20 @@ export const constantRoutes = [
component: () => import('@/views/error/401'),
hidden: true
},
+ // {
+ // path: '/jumpInTheMiddleOffice',
+ // component: Layout,
+ // redirect: 'index',
+ // children: [
+ // {
+ // path: 'index',
+ // component: () => import('@/views/index'),
+ // name: 'Index',
+ // meta: { title: '系统首页', icon: 'dashboard', affix: true }
+ // }
+ // ]
+ // },
+
{
path: '',
component: Layout,
@@ -201,7 +220,7 @@ Router.prototype.push = function push(location) {
}
export default new Router({
- // mode: 'history', // 去掉url中的#
+ mode: 'history', // 去掉url中的#
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
})
diff --git a/fuintAdmin/src/store/modules/user.js b/fuintAdmin/src/store/modules/user.js
index 17f870a49..42da8d47c 100644
--- a/fuintAdmin/src/store/modules/user.js
+++ b/fuintAdmin/src/store/modules/user.js
@@ -81,6 +81,8 @@ const user = {
GetInfo({ commit, state }) {
return new Promise((resolve, reject) => {
getInfo().then(res => {
+ console.log("22222223")
+
const user = res.data.accountInfo
const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/avatar.png") : process.env.VUE_APP_BASE_API + user.avatar;
if (res.data.roles && res.data.roles.length > 0) { // 验证返回的roles是否是一个非空数组
@@ -96,9 +98,10 @@ const user = {
commit('SET_STORE_ID', user.storeId)
commit('SET_STORE_NAME', user.storeName)
resolve(res)
- }).catch(error => {
- reject(error)
})
+ // .catch(error => {
+ // reject(error)
+ // })
})
},
diff --git a/fuintAdmin/src/utils/auth.js b/fuintAdmin/src/utils/auth.js
index 4fb70fabb..85aef825b 100644
--- a/fuintAdmin/src/utils/auth.js
+++ b/fuintAdmin/src/utils/auth.js
@@ -11,7 +11,7 @@ export function setToken(token) {
return Cookies.set(TokenKey, token)
}
-export function removeToken() {
+ export function removeToken() {
return Cookies.remove(TokenKey)
}
diff --git a/fuintAdmin/src/views/indexcomponents/bottomindex.vue b/fuintAdmin/src/views/indexcomponents/bottomindex.vue
index 500609672..831619c25 100644
--- a/fuintAdmin/src/views/indexcomponents/bottomindex.vue
+++ b/fuintAdmin/src/views/indexcomponents/bottomindex.vue
@@ -76,7 +76,7 @@ export default {
this.getMerchandiseSales()
this.getPrepaidCardSales()
// this.getTunFuelCardSales()
-
+
},
methods:{
@@ -91,17 +91,22 @@ export default {
this.goodsSum = 0
let dataList = res.data
if (this.goodsRadio === '7天' && dataList.length >= 7) {
- dataList = dataList.slice(0, 7);
+ // dataList = dataList.slice(0, 7);
+ dataList = dataList.slice(-7);
} else if (this.goodsRadio === '15天' && dataList.length >= 15) {
- dataList = dataList.slice(0, 15);
+ // dataList = dataList.slice(0, 15);
+ dataList = dataList.slice(-15);
} else if (this.goodsRadio === '30天' && dataList.length >= 30) {
- dataList = dataList.slice(0, 30);
+ // dataList = dataList.slice(0, 30);
+ dataList = dataList.slice(-30);
}
dataList.forEach(element => {
this.goodsTimeDate.push(parseTime(element.sales_day,'{y}-{m}-{d}'));
this.goodsDate.push(element.total_sales);
this.goodsSum+=element.total_sales
+ this.goodsSum = parseFloat(this.goodsSum.toFixed(2));
+
});
this.initChart()
this.goodsLoading = false
@@ -120,17 +125,22 @@ export default {
this.cardSum = 0
let dataList = res.data
if (this.cardRadio === '7天' && dataList.length >= 7) {
- dataList = dataList.slice(0, 7);
+ dataList = dataList.slice(-7);
+ // dataList = dataList.slice(0, 7);
} else if (this.cardRadio === '15天' && dataList.length >= 15) {
- dataList = dataList.slice(0, 15);
+ dataList = dataList.slice(-15);
+ // dataList = dataList.slice(0, 15);
} else if (this.cardRadio === '30天' && dataList.length >= 30) {
- dataList = dataList.slice(0, 30);
+ dataList = dataList.slice(-30);
+ // dataList = dataList.slice(0, 30);
}
dataList.forEach(element => {
this.cardTimeDate.push(parseTime(element.sales_day,'{y}-{m}-{d}'));
this.cardDate.push(element.total_sales);
this.cardSum+=element.total_sales
+ this.cardSum = parseFloat(this.cardSum.toFixed(2));
+
});
this.getTunFuelCardSales()
// this.changeLabel();
@@ -146,11 +156,14 @@ export default {
// this.cardSum = 0
let dataList = res.data
if (this.cardRadio === '7天' && dataList.length >= 7) {
- dataList = dataList.slice(0, 7);
+ // dataList = dataList.slice(0, 7);
+ dataList = dataList.slice(- 7);
} else if (this.cardRadio === '15天' && dataList.length >= 15) {
- dataList = dataList.slice(0, 15);
+ // dataList = dataList.slice(0, 15);
+ dataList = dataList.slice(-15);
} else if (this.cardRadio === '30天' && dataList.length >= 30) {
- dataList = dataList.slice(0, 30);
+ // dataList = dataList.slice(0, 30);
+ dataList = dataList.slice(- 30);
}
dataList.forEach(element => {
diff --git a/fuintAdmin/src/views/indexcomponents/centenrindex.vue b/fuintAdmin/src/views/indexcomponents/centenrindex.vue
index 7047df839..fa08e0930 100644
--- a/fuintAdmin/src/views/indexcomponents/centenrindex.vue
+++ b/fuintAdmin/src/views/indexcomponents/centenrindex.vue
@@ -46,7 +46,7 @@
{{item.totalSum}}
-
+
@@ -92,17 +92,25 @@ export default {
this.sum = 0
let dataList = res.data
if (this.radio === '7天' && dataList.length >= 7) {
- dataList = dataList.slice(0, 7);
+ // dataList = dataList.slice(0, 7);
+ dataList = dataList.slice(-7);
+
} else if (this.radio === '15天' && dataList.length >= 15) {
- dataList = dataList.slice(0, 15);
+ // dataList = dataList.slice(0, 15);
+ dataList = dataList.slice(-15);
+
} else if (this.radio === '30天' && dataList.length >= 30) {
- dataList = dataList.slice(0, 30);
+ // dataList = dataList.slice(0, 30);
+ dataList = dataList.slice(-30);
+
}
dataList.forEach(element => {
this.timeDate.push(parseTime(element.sales_day,'{y}-{m}-{d}'));
this.oilDate.push(element.total_sales);
this.sum+=element.total_sales
+ this.sum = parseFloat(this.sum.toFixed(2));
+
});
this.initChart()
// this.changeLabel();
@@ -130,14 +138,21 @@ export default {
changeLabel() {
if (this.radio === '7天' && this.timeDate.length >= 7) {
- this.timeDate = this.timeDate.slice(0, 7);
- this.oilDate = this.oilDate.slice(0, 7);
+ // this.timeDate = this.timeDate.slice(0, 7);
+ // this.oilDate = this.oilDate.slice(0, 7);
+
+ this.timeDate = this.timeDate.slice(-7);
+ this.oilDate = this.oilDate.slice(-7);
} else if (this.radio === '15天' && this.timeDate.length >= 15) {
- this.timeDate = this.timeDate.slice(0, 15);
- this.oilDate = this.oilDate.slice(0, 15);
+ // this.timeDate = this.timeDate.slice(0, 15);
+ // this.oilDate = this.oilDate.slice(0, 15);
+ this.timeDate = this.timeDate.slice(-15);
+ this.oilDate = this.oilDate.slice(-15);
} else if (this.radio === '30天' && this.timeDate.length >= 30) {
- this.timeDate = this.timeDate.slice(0, 30);
- this.oilDate = this.oilDate.slice(0, 30);
+ // this.timeDate = this.timeDate.slice(0, 30);
+ // this.oilDate = this.oilDate.slice(0, 30);
+ this.timeDate = this.timeDate.slice(-30);
+ this.oilDate = this.oilDate.slice(-30);
}
this.initChart()
},
diff --git a/fuintAdmin/src/views/integral/gift/index.vue b/fuintAdmin/src/views/integral/gift/index.vue
index e0c238140..7f0f7eff4 100644
--- a/fuintAdmin/src/views/integral/gift/index.vue
+++ b/fuintAdmin/src/views/integral/gift/index.vue
@@ -1,6 +1,6 @@
-
+
搜索
重置
-
-
+
+
@@ -43,7 +43,7 @@
+ :default-sort="defaultSort">
{{ scope.row.categoryName==null? '不分类': scope.row.categoryName}}
@@ -162,7 +162,7 @@
@@ -209,7 +209,7 @@
+
@@ -24,7 +26,8 @@
+
+
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/OilOrderMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/OilOrderMapper.xml
index b73a29781..7d65eaaea 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/OilOrderMapper.xml
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/OilOrderMapper.xml
@@ -210,7 +210,7 @@
GROUP BY
date_range.date
ORDER BY
- date_range.date;
+ date_range.date
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/controller/BackendStoreController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/controller/BackendStoreController.java
index 0b1d48d71..4ea4c0ffb 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/controller/BackendStoreController.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/controller/BackendStoreController.java
@@ -9,6 +9,7 @@ import com.fuint.common.service.MerchantService;
import com.fuint.common.service.SettingService;
import com.fuint.business.store.service.StoreService;
import com.fuint.common.util.CommonUtil;
+import com.fuint.common.util.RedisUtil;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.exception.BusinessCheckException;
import com.fuint.framework.pagination.PaginationRequest;
@@ -21,11 +22,15 @@ import com.fuint.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
/**
* 店铺管理类controller
@@ -293,4 +298,37 @@ public class BackendStoreController extends BaseController {
StoreDto storeInfo = storeService.queryStoreDtoById(id);
return getSuccessResult(storeInfo);
}
+
+ /**
+ * 修改店铺信息
+ * @return
+ * @throws BusinessCheckException
+ */
+ @PostMapping("editStoreInfo")
+ public ResponseObject editStoreInfo( @RequestBody MtStore mtStore) throws BusinessCheckException {
+
+ return getSuccessResult( storeService.editStoreInfo(mtStore));
+ }
+
+ @Autowired
+ public RedisTemplate redisTemplate;
+
+ /**
+ * 单点登陆时使用
+ *
+ * singleSignOn
+ * @return
+ */
+ @PostMapping("singleSignOn")
+ public ResponseObject singleSignOn(@RequestBody String flag) {
+ redisTemplate.opsForValue().set(flag,flag,300, TimeUnit.SECONDS);
+// Object codeInRedis = redisTemplate.opsForValue().get(flag);
+ Boolean aBoolean = redisTemplate.hasKey(flag);
+ return getSuccessResult(aBoolean);
+ }
+
+ @PostMapping("loginVerification")
+ public ResponseObject loginVerification(@RequestBody String flag) {
+ return getSuccessResult(storeService.loginVerification(flag));
+ }
}
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/entity/MtStore.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/entity/MtStore.java
index e5c74ab07..5b6030964 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/entity/MtStore.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/entity/MtStore.java
@@ -7,6 +7,7 @@ import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
import com.fuint.repository.model.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -82,4 +83,7 @@ public class MtStore extends BaseEntity implements Serializable {
@ApiModelProperty("门头照")
private String doorstepPhoto;
+ @ApiModelProperty("服务到期时间")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private Date expirationTime;
}
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/mapper/MtStoreMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/mapper/MtStoreMapper.java
index 7fb814b77..8752238f3 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/mapper/MtStoreMapper.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/mapper/MtStoreMapper.java
@@ -23,4 +23,7 @@ public interface MtStoreMapper extends BaseMapper {
List queryByDistance(@Param("merchantId") Integer merchantId, @Param("keyword") String keyword, @Param("latitude") String latitude, @Param("longitude") String longitude);
+ int editStoreInfo(@Param("mtStore") MtStore mtStore);
+
+// getAccountByRole
}
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/mapper/xml/ExportExcelService.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/mapper/xml/ExportExcelService.xml
index 6c36b3cb0..be87d579f 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/mapper/xml/ExportExcelService.xml
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/mapper/xml/ExportExcelService.xml
@@ -25,4 +25,18 @@
ORDER BY distance LIMIT 0,1000
+
+
+ update mt_store
+
+ name =#{mtStore.name}
+ address =#{mtStore.address}
+ expiration_time = #{vexpirationTime}
+ status=#{mtStore.status}
+ logo=#{mtStore.logo}
+
+ where id = #{mtStore.id}
+
+
+
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/service/StoreService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/service/StoreService.java
index 2f794eafc..9e9176d98 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/service/StoreService.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/service/StoreService.java
@@ -100,4 +100,8 @@ public interface StoreService extends IService {
* @return
* */
List queryByDistance(String merchantNo, String keyword, String latitude, String longitude) throws BusinessCheckException;
+
+ boolean editStoreInfo(MtStore mtStore);
+
+ Map loginVerification(String flag);
}
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/service/impl/StoreServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/service/impl/StoreServiceImpl.java
index c0045491b..270a6c360 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/service/impl/StoreServiceImpl.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/service/impl/StoreServiceImpl.java
@@ -1,30 +1,40 @@
package com.fuint.business.store.service.impl;
+import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.store.service.StoreService;
+import com.fuint.common.dto.AccountInfo;
import com.fuint.common.dto.StoreDto;
import com.fuint.common.enums.StatusEnum;
import com.fuint.common.enums.YesOrNoEnum;
import com.fuint.common.service.MerchantService;
+import com.fuint.common.util.TokenUtil;
import com.fuint.framework.annoation.OperationServiceLog;
import com.fuint.framework.exception.BusinessCheckException;
import com.fuint.framework.pagination.PaginationRequest;
import com.fuint.framework.pagination.PaginationResponse;
+import com.fuint.module.backendApi.response.LoginResponse;
import com.fuint.repository.bean.StoreDistanceBean;
import com.fuint.repository.mapper.MtMerchantMapper;
import com.fuint.business.store.mapper.MtStoreMapper;
+import com.fuint.repository.mapper.TAccountMapper;
import com.fuint.repository.model.MtMerchant;
import com.fuint.business.store.entity.MtStore;
+import com.fuint.repository.model.TAccount;
import com.fuint.utils.StringUtil;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang.StringUtils;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authc.UsernamePasswordToken;
+import org.apache.shiro.subject.Subject;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
+import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
@@ -335,4 +345,101 @@ public class StoreServiceImpl extends ServiceImpl implem
return dataList;
}
+
+ @Override
+ public boolean editStoreInfo(MtStore mtStore) {
+ return mtStoreMapper.updateById(mtStore)>0;
+ }
+
+ @Autowired
+ public RedisTemplate redisTemplate;
+ @Autowired
+ TAccountMapper tAccountMapper;
+ @Override
+ public Map loginVerification(String flag) {
+ Map res = new HashMap<>();
+ if (ObjectUtil.isEmpty(flag)){
+ res.put(flag,false);
+ return res;
+ }
+// if (redisTemplate.hasKey(flag)) {
+ if (true) {
+
+
+// BigDecimal bigDecimal = new BigDecimal(flag);
+// BigDecimal multiply = bigDecimal.divide(new BigDecimal("2.1")).multiply(new BigDecimal("1.4"));
+
+ // 使用 intValue() 将 BigDecimal 转换为整数
+// int i = multiply.intValue();
+ // 找到站长的
+ Map param = new HashMap();
+ param.put("role_ids", 12);
+ List accountList = tAccountMapper.selectByMap(param);
+
+ if (accountList != null && accountList.size() > 0) {
+ AccountInfo accountByName = getAccountByName(accountList.get(0));
+
+ Subject subject = SecurityUtils.getSubject();
+ UsernamePasswordToken info = new UsernamePasswordToken(accountByName.getAccountName(), "111111");
+// subject.login(info);
+ String token = TokenUtil.generateToken("user-agent", accountByName.getId());
+ accountByName.setToken(token);
+ TokenUtil.saveAccountToken(accountByName);
+ LoginResponse response = new LoginResponse();
+ response.setLogin(true);
+ response.setToken(token);
+ response.setTokenCreatedTime(new Date());
+ res.put("flag",true);
+ res.put("token",token);
+ }else {
+ res.put("flag",true);
+ res.put("token",null);
+ res.put("info","用户不存在");
+
+ return res;
+ }
+// mtStoreMapper.getAccountByRole(12);
+ // 生成token
+
+ // 返回token
+
+
+// redisTemplate.delete(flag);
+ return res;
+ } else {
+
+ }
+ return res;
+ }
+
+ // 处理
+ public AccountInfo getAccountByName(TAccount account) {
+ AccountInfo accountInfo = new AccountInfo();
+// TAccount account = accountList.get(0);
+ accountInfo.setId(account.getAcctId());
+ accountInfo.setAccountName(account.getAccountName());
+ accountInfo.setRealName(account.getRealName());
+ accountInfo.setRoleIds(account.getRoleIds());
+ accountInfo.setStaffId(account.getStaffId());
+ accountInfo.setStoreId(account.getStoreId());
+ accountInfo.setMerchantId(account.getMerchantId());
+ accountInfo.setDeptId(account.getDeptId());
+ if (account.getMerchantId() != null && account.getMerchantId() > 0) {
+ MtMerchant mtMerchant = mtMerchantMapper.selectById(account.getMerchantId());
+ if (mtMerchant != null) {
+ accountInfo.setMerchantName(mtMerchant.getName());
+ }
+ }
+ if (account.getStoreId() != null && account.getStoreId() >= 0) {
+ MtStore mtStore = mtStoreMapper.selectById(account.getStoreId());
+ if (mtStore != null) {
+ accountInfo.setStoreName(mtStore.getName());
+ accountInfo.setChainStoreId(mtStore.getChainStoreId());
+ }
+ }
+ return accountInfo;
+ }
+
+
+
}
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/common/config/WebConfig.java b/fuintBackend/fuint-application/src/main/java/com/fuint/common/config/WebConfig.java
index 03979a781..b64df3793 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/common/config/WebConfig.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/common/config/WebConfig.java
@@ -65,6 +65,7 @@ public class WebConfig extends WebMvcConfigurationSupport {
.excludePathPatterns("/clientApi/captcha/**")
.excludePathPatterns("/backendApi/captcha/**")
.excludePathPatterns("/backendApi/userCoupon/exportList")
+ .excludePathPatterns("/backendApi/store/loginVerification")
.excludePathPatterns("/backendApi/login/**");
// 客户端拦截
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/RoleDto.java b/fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/RoleDto.java
index bcdd7b08a..10a587a90 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/RoleDto.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/RoleDto.java
@@ -30,11 +30,23 @@ public class RoleDto {
* */
private String description;
+
+ private String code;
+
/**
* 状态 : A 有效 D 无效
*/
private String status;
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
public Long getId() {
return id;
}
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/StoreDto.java b/fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/StoreDto.java
index c91342dad..130b2d445 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/StoreDto.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/StoreDto.java
@@ -140,11 +140,29 @@ public class StoreDto implements Serializable {
*/
private String status;
+
+ private String doorstepPhoto;
+
+
+
/**
* 最后操作人
*/
private String operator;
+ /**
+ * 服务到期时间
+ */
+ private Date expirationTime;
+
+ public Date getExpirationTime() {
+ return expirationTime;
+ }
+
+ public void setExpirationTime(Date expirationTime) {
+ this.expirationTime = expirationTime;
+ }
+
public Integer getId(){
return id;
}
@@ -307,4 +325,12 @@ public class StoreDto implements Serializable {
public void setOperator(String operator){
this.operator=operator;
}
+
+ public String getDoorstepPhoto() {
+ return doorstepPhoto;
+ }
+
+ public void setDoorstepPhoto(String doorstepPhoto) {
+ this.doorstepPhoto = doorstepPhoto;
+ }
}
\ No newline at end of file
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/AccountService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/AccountService.java
index a3cf93391..ea5352535 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/AccountService.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/AccountService.java
@@ -43,7 +43,7 @@ public interface AccountService extends IService {
* @param id
* @return
*/
- TAccount getAccountInfoById(Integer id);
+ TAccount getAccountInfoById(Integer id);
/**
* 创建账号信息
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/AccountServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/AccountServiceImpl.java
index dea32fe77..47b8a697f 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/AccountServiceImpl.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/AccountServiceImpl.java
@@ -1,5 +1,6 @@
package com.fuint.common.service.impl;
+import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -136,15 +137,18 @@ public class AccountServiceImpl extends ServiceImpl im
@Override
public IPage listAccount(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, TAccount accountInfo) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
- SysDept sysDept = deptService.selectDeptById(nowAccountInfo.getDeptId());
+ if (ObjectUtil.isEmpty(accountInfo) || ObjectUtil.isEmpty(accountInfo.getDeptId()) ) {
+ accountInfo.setDeptId(nowAccountInfo.getDeptId());
+ }
+ SysDept sysDept = deptService.selectDeptById(accountInfo.getDeptId());
IPage tAccountIPage = baseMapper.listAccount(page, accountInfo, sysDept.getAncestors());
return tAccountIPage;
}
@Override
public AccountInfo getAccountByName(String userName) {
- Map param = new HashMap();
- param.put("account_name", userName);
- List accountList = tAccountMapper.selectByMap(param);
+ Map param = new HashMap();
+ param.put("account_name", userName);
+ List accountList = tAccountMapper.selectByMap(param);
if (accountList != null && accountList.size() > 0) {
AccountInfo accountInfo = new AccountInfo();
TAccount account = accountList.get(0);
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/common/shiroConfig/ShiroConfig.java b/fuintBackend/fuint-application/src/main/java/com/fuint/common/shiroConfig/ShiroConfig.java
index e8dfd6943..bf0250f66 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/common/shiroConfig/ShiroConfig.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/common/shiroConfig/ShiroConfig.java
@@ -42,6 +42,7 @@ public class ShiroConfig {
filterMap.put("/business/storeInformation/store/recentlyStore","anon");
//会员扫码进入小程序后根据id获取店铺信息
filterMap.put("/business/storeInformation/store/queryStoreById","anon");
+ filterMap.put("/backendApi/store/loginVerification","anon");
//小程序支付回调地址
filterMap.put("/api/fyPay/notify","anon");
filterMap.put("/**","commonFilter");
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/system/role/controller/BackendDutyController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/system/role/controller/BackendDutyController.java
index 6ec3e2616..d9a418440 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/system/role/controller/BackendDutyController.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/role/controller/BackendDutyController.java
@@ -96,6 +96,7 @@ public class BackendDutyController extends BaseController {
String type = AdminRoleEnum.getName(tDuty.getDutyType());
dto.setType(type);
dto.setStatus(tDuty.getStatus());
+ dto.setCode(tDuty.getCode());
content.add(dto);
}
}
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/system/role/entity/TDuty.java b/fuintBackend/fuint-application/src/main/java/com/fuint/system/role/entity/TDuty.java
index 93be0ff43..0de9110ee 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/system/role/entity/TDuty.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/role/entity/TDuty.java
@@ -45,5 +45,8 @@ public class TDuty extends BaseEntity implements Serializable {
@ApiModelProperty("角色类型")
private String dutyType;
+ @ApiModelProperty("角色编码")
+ private String code;
+
}
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/system/user/controller/BackendAccountController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/system/user/controller/BackendAccountController.java
index 6022a3a4f..19d8d0cc0 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/system/user/controller/BackendAccountController.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/user/controller/BackendAccountController.java
@@ -1,5 +1,6 @@
package com.fuint.system.user.controller;
+import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.common.dto.AccountDto;
@@ -7,6 +8,8 @@ import com.fuint.common.dto.AccountInfo;
import com.fuint.common.dto.RoleDto;
import com.fuint.common.enums.StatusEnum;
import com.fuint.common.service.AccountService;
+import com.fuint.repository.mapper.TAccountDutyMapper;
+import com.fuint.repository.model.TAccountDuty;
import com.fuint.system.role.service.DutyService;
import com.fuint.common.service.MerchantService;
import com.fuint.business.store.service.StoreService;
@@ -25,6 +28,8 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
@@ -162,6 +167,13 @@ public class BackendAccountController extends BaseController {
return getSuccessResult(result);
}
+
+
+
+
+
+ @Resource
+ TAccountDutyMapper tAccountDutyMapper;
/**
* 新增账户
*
@@ -171,7 +183,7 @@ public class BackendAccountController extends BaseController {
@ApiOperation(value = "新增账户")
@RequestMapping(value = "/doCreate", method = RequestMethod.POST)
@CrossOrigin
- @Transactional
+// @Transactional
public ResponseObject doCreate(HttpServletRequest request, @RequestBody Map param) {
String token = request.getHeader("Access-Token");
AccountInfo loginAccount = TokenUtil.getAccountInfoByToken(token);
@@ -180,14 +192,27 @@ public class BackendAccountController extends BaseController {
}
// List roleIds = (List) param.get("roleIds");
+ String roleId = param.get("roleIds").toString();
String accountName = param.get("accountName").toString();
String accountStatus = param.get("accountStatus").toString();
String realName = param.get("realName").toString();
String password = param.get("password").toString();
- String roleIds = param.get("roleIds").toString();
+
+// String roleIds = param.get("roleIds").toString();
String storeId = param.get("storeId") == null ? "0" : param.get("storeId").toString();
String merchantId = param.get("merchantId") == null ? "0" : param.get("merchantId").toString();
String staffId = param.get("staffId") == null ? "0" : param.get("staffId").toString();
+ String deptId = param.get("deptId") == null ? "0" : param.get("deptId").toString();
+
+ // 获取角色code
+ String code = param.get("code") == null ? "0" : param.get("code").toString();
+ // 所属的连锁店类型
+ String deptType = param.get("deptType") == null ? "0" : param.get("deptType").toString();
+
+ if (!"3".equals(deptType) && "z001".equals(code) ) {
+ return getFailureResult(201, "用户角色与组织架构不匹配");
+
+ }
AccountInfo accountInfo = tAccountService.getAccountByName(accountName);
if (accountInfo != null) {
@@ -195,19 +220,32 @@ public class BackendAccountController extends BaseController {
}
List duties = new ArrayList<>();
- // todo
+ String[] ids = new String[1];
+ ids[0] = roleId;
+ duties = tDutyService.findDatasByIds(ids);
+ if (ObjectUtil.isEmpty(duties)) {
+ return getFailureResult(201, "您分配的角色不存在");
+ }
+
// if (roleIds.size() > 0) {
// Integer[] roles = roleIds.toArray(new Integer[roleIds.size()]);
// String[] ids = new String[roles.length];
-// for (int i = 0; i < roles.length; i++) {
-// ids[i] = roles[i].toString();
-// }
+//// for (int i = 0; i < roles.length; i++) {
+//// ids[i] = roles[i].toString();
+//// }
// duties = tDutyService.findDatasByIds(ids);
// if (duties.size() < roleIds.size()) {
// return getFailureResult(201, "您分配的角色不存在");
// }
// }
+ // 查询角色是否存在
+
+
+
+
+
+
TAccount tAccount = new TAccount();
tAccount.setAccountKey(CommonUtil.createAccountKey());
tAccount.setRealName(realName);
@@ -221,6 +259,9 @@ public class BackendAccountController extends BaseController {
tAccount.setStaffId(Integer.parseInt(staffId));
tAccountService.createAccountInfo(tAccount, duties);
+
+
+
return getSuccessResult(true);
}
diff --git a/fuintBackend/fuint-repository/src/main/resources/mapper/TAccountMapper.xml b/fuintBackend/fuint-repository/src/main/resources/mapper/TAccountMapper.xml
index 725b86174..9f9865998 100644
--- a/fuintBackend/fuint-repository/src/main/resources/mapper/TAccountMapper.xml
+++ b/fuintBackend/fuint-repository/src/main/resources/mapper/TAccountMapper.xml
@@ -7,6 +7,9 @@
FROM
`t_account` ta
left join sys_dept sd on sd.dept_id = ta.dept_id
+
+
+ where account_status != -1
AND ta.real_name = like concat('%',#{accountInfo.realName},'%')
@@ -17,6 +20,7 @@
AND sd.ancestors like concat (#{ancestors},'%')
+
order by create_time desc