|
|
@@ -53,8 +53,10 @@ import com.fs.hisStore.mapper.FsStoreVerifyCodeScrmMapper;
|
|
|
import com.fs.hisStore.param.*;
|
|
|
import com.fs.hisStore.service.*;
|
|
|
import com.fs.hisStore.vo.*;
|
|
|
+import com.fs.common.core.domain.entity.SysDept;
|
|
|
import com.fs.system.domain.SysConfig;
|
|
|
import com.fs.system.mapper.SysConfigMapper;
|
|
|
+import com.fs.system.mapper.SysDeptMapper;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import me.chanjar.weixin.mp.bean.card.Abstract;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
@@ -130,6 +132,9 @@ public class FsStoreOrderScrmController extends BaseController {
|
|
|
@Autowired
|
|
|
SysConfigMapper sysConfigMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysDeptMapper sysDeptMapper;
|
|
|
+
|
|
|
@Autowired
|
|
|
private IFsDfAccountService fsDfAccountService;
|
|
|
|
|
|
@@ -183,6 +188,8 @@ public class FsStoreOrderScrmController extends BaseController {
|
|
|
@PostMapping("/list")
|
|
|
public TableDataInfo list(@RequestBody FsStoreOrderParam param) {
|
|
|
startPage();
|
|
|
+ // 数据隔离:非超级管理员且非总公司部门时,按登录用户部门ID过滤(含下级部门)
|
|
|
+ this.applyDeptDataScope(param);
|
|
|
if(!StringUtils.isEmpty(param.getCreateTimeRange())){
|
|
|
param.setCreateTimeList(param.getCreateTimeRange().split("--"));
|
|
|
}
|
|
|
@@ -308,8 +315,10 @@ public class FsStoreOrderScrmController extends BaseController {
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('store:storeOrder:export')")
|
|
|
@Log(title = "订单", businessType = BusinessType.EXPORT)
|
|
|
- @PostMapping("/export")
|
|
|
- public AjaxResult export(@RequestBody FsStoreOrderParam param) {
|
|
|
+ @GetMapping("/export")
|
|
|
+ public AjaxResult export(FsStoreOrderParam param) {
|
|
|
+ // 数据隔离:非超级管理员且非总公司部门时,按登录用户部门ID过滤(含下级部门)
|
|
|
+ this.applyDeptDataScope(param);
|
|
|
if ("".equals(param.getBeginTime()) && "".equals(param.getEndTime())){
|
|
|
param.setBeginTime(null);
|
|
|
param.setEndTime(null);
|
|
|
@@ -374,8 +383,10 @@ public class FsStoreOrderScrmController extends BaseController {
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('store:storeOrder:export:details')")
|
|
|
@Log(title = "订单", businessType = BusinessType.EXPORT)
|
|
|
- @PostMapping("/exportDetails")
|
|
|
- public AjaxResult exportDetails(@RequestBody FsStoreOrderParam param) {
|
|
|
+ @GetMapping("/exportDetails")
|
|
|
+ public AjaxResult exportDetails(FsStoreOrderParam param) {
|
|
|
+ // 数据隔离:非超级管理员且非总公司部门时,按登录用户部门ID过滤(含下级部门)
|
|
|
+ this.applyDeptDataScope(param);
|
|
|
if ("".equals(param.getBeginTime()) && "".equals(param.getEndTime())){
|
|
|
param.setBeginTime(null);
|
|
|
param.setEndTime(null);
|
|
|
@@ -421,6 +432,8 @@ public class FsStoreOrderScrmController extends BaseController {
|
|
|
@Log(title = "订单明细导出", businessType = BusinessType.EXPORT)
|
|
|
@GetMapping("/exportItems")
|
|
|
public AjaxResult exportItems(FsStoreOrderParam param) {
|
|
|
+ // 数据隔离:非超级管理员且非总公司部门时,按登录用户部门ID过滤(含下级部门)
|
|
|
+ this.applyDeptDataScope(param);
|
|
|
if ("".equals(param.getBeginTime()) && "".equals(param.getEndTime())){
|
|
|
param.setBeginTime(null);
|
|
|
param.setEndTime(null);
|
|
|
@@ -472,6 +485,8 @@ public class FsStoreOrderScrmController extends BaseController {
|
|
|
@Log(title = "订单明细导出", businessType = BusinessType.EXPORT)
|
|
|
@GetMapping("/exportItemsDetails")
|
|
|
public AjaxResult exportItemsDetails(FsStoreOrderParam param) {
|
|
|
+ // 数据隔离:非超级管理员且非总公司部门时,按登录用户部门ID过滤(含下级部门)
|
|
|
+ this.applyDeptDataScope(param);
|
|
|
if ("".equals(param.getBeginTime()) && "".equals(param.getEndTime())){
|
|
|
param.setBeginTime(null);
|
|
|
param.setEndTime(null);
|
|
|
@@ -511,7 +526,8 @@ public class FsStoreOrderScrmController extends BaseController {
|
|
|
|
|
|
@GetMapping("/orderItemsNum")
|
|
|
public R orderItemsNum(FsStoreOrderParam param) {
|
|
|
-
|
|
|
+ // 数据隔离:非超级管理员且非总公司部门时,按登录用户部门ID过滤(含下级部门)
|
|
|
+ this.applyDeptDataScope(param);
|
|
|
if(!StringUtils.isEmpty(param.getCreateTimeRange())){
|
|
|
param.setCreateTimeList(param.getCreateTimeRange().split("--"));
|
|
|
}
|
|
|
@@ -1082,4 +1098,36 @@ public class FsStoreOrderScrmController extends BaseController {
|
|
|
}
|
|
|
return df;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 数据隔离:非超级管理员且非总公司部门(deptId=1)时,限定 deptId 为登录用户部门
|
|
|
+ * SQL 层会匹配该部门及其下级部门的订单
|
|
|
+ */
|
|
|
+ private void applyDeptDataScope(FsStoreOrderParam param) {
|
|
|
+ if (param == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ if (loginUser != null && !loginUser.isAdmin()
|
|
|
+ && !checkDept(loginUser.getUser().getDeptId())) {
|
|
|
+ param.setDeptId(loginUser.getDeptId());
|
|
|
+ }
|
|
|
+ } catch (Exception ignore) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 校验是否为总公司部门(deptId = 1)
|
|
|
+ */
|
|
|
+ public boolean checkDept(Long deptId) {
|
|
|
+ if (deptId == null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ SysDept dept = sysDeptMapper.selectDeptById(deptId);
|
|
|
+ if (dept == null || !dept.getDeptId().equals(1L)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|