فهرست منبع

feat:刷新大屏数据

hmc 1 سال پیش
والد
کامیت
4393b4afdd

+ 54 - 6
zkqy-admin/src/main/java/com/zkqy/web/controller/system/SysLoginController.java

@@ -3,13 +3,13 @@ package com.zkqy.web.controller.system;
 import java.util.List;
 import java.util.Set;
 
+import com.zkqy.business.entity.MobilePageData;
+import com.zkqy.business.service.IMobilePageDataService;
 import com.zkqy.common.core.domain.entity.DataSource;
 import com.zkqy.common.core.domain.entity.SysTenant;
 import com.zkqy.framework.web.service.TokenService;
 import com.zkqy.system.domain.LoginPageConfiguration;
-import com.zkqy.system.service.IDataSourceService;
-import com.zkqy.system.service.ILoginPageConfigurationService;
-import com.zkqy.system.service.ISysTenantService;
+import com.zkqy.system.service.*;
 import com.zkqy.system.service.impl.LoginPageConfigurationServiceImpl;
 import com.zkqy.system.service.impl.SysTenantServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -27,7 +27,6 @@ import com.zkqy.common.core.domain.model.LoginBody;
 import com.zkqy.common.utils.SecurityUtils;
 import com.zkqy.framework.web.service.SysLoginService;
 import com.zkqy.framework.web.service.SysPermissionService;
-import com.zkqy.system.service.ISysMenuService;
 import org.springframework.web.client.RestTemplate;
 
 import javax.annotation.Resource;
@@ -45,6 +44,9 @@ public class SysLoginController {
     @Autowired
     private SysLoginService loginService;
 
+    @Autowired
+    private ISysUserService userService;
+    
     @Autowired
     private ISysMenuService menuService;
 
@@ -60,6 +62,9 @@ public class SysLoginController {
     @Resource
     private ISysTenantService iSysTenantService;
 
+    @Resource
+    private IMobilePageDataService iMobilePageDataService;
+
 
     @Autowired //登录页面配置信息
     private ILoginPageConfigurationService loginPageConfigurationService;
@@ -174,20 +179,59 @@ public class SysLoginController {
 
 
     /**
-     * 登录方法
+     * 登录方法(化纤用的)
      *
      * @param loginBody 登录信息
      * @return 结果
      */
     @PostMapping("/uniappLogin")
     public AjaxResult uniappLogin(@RequestBody LoginBody loginBody) {
+
+        //校验不能是admin
+        if (loginBody.getUsername().equals("admin")) {
+            return AjaxResult.error("未有此用户信息");
+        }
+        // 生成令牌
+        String token = loginService.login(loginBody.getTenantID() + "¥¥¥" + loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
+                loginBody.getUuid(), false);
+        if (tokenService.getLoginUserIsAdminByToken(token)) {
+            return AjaxResult.error("用户不存在!");
+        }
+        //检查租户过期时间
+        String checkTenantExpirationTimeMsg = loginService.checkTenantExpirationTime(loginBody.getTenantID() + "¥¥¥" +loginBody.getUsername());
+        if (!checkTenantExpirationTimeMsg.isEmpty()) {
+            return AjaxResult.error(checkTenantExpirationTimeMsg);
+        }
+        //校验租户状态?生成token
+        AjaxResult ajax = AjaxResult.success();
+        ajax.put(Constants.TOKEN, token);
+        return ajax;
+    }
+
+
+
+    /**
+     * 平台移动端通用登录方法
+     */
+    @PostMapping("/commonUniappLogin")
+    public AjaxResult commonUniappLogin(@RequestBody LoginBody loginBody) {
         //校验租户状态?生成token
         AjaxResult ajax = AjaxResult.success();
         //校验不能是admin
         if (loginBody.getUsername().equals("admin")) {
             return AjaxResult.error("未有此用户信息");
         }
-        // 生成令牌
+        if(loginBody.getUsername().indexOf("@")==-1){
+            return AjaxResult.error("请输入正确的用户名");
+        }
+        // 获取登录用户名
+        String username = loginBody.getUsername();
+        String[] split = username.split("@");
+        // 根据租户code查询租户信息
+        SysTenant sysTenant = iSysTenantService.selectSysTenantByTenantCode(split[0]);
+        loginBody.setTenantID(sysTenant.getTenantId().toString());
+        loginBody.setUsername(split[1]);
+        //生成令牌
         String token = loginService.login(loginBody.getTenantID() + "¥¥¥" + loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
                 loginBody.getUuid(), false);
         if (tokenService.getLoginUserIsAdminByToken(token)) {
@@ -199,10 +243,14 @@ public class SysLoginController {
             return AjaxResult.error(checkTenantExpirationTimeMsg);
         }
         ajax.put(Constants.TOKEN, token);
+//        MobilePageData mobilePageData = iMobilePageDataService.selectMobilePageDataIndexTrue();
+//        ajax.put("indexId",mobilePageData);
         return ajax;
     }
 
 
+
+
     /**
      * 登录方法
      *

+ 15 - 0
zkqy-business/src/main/java/com/zkqy/business/controller/MobilePageDataController.java

@@ -44,6 +44,19 @@ public class MobilePageDataController extends BaseController {
         return getDataTable(list);
     }
 
+
+    /**
+     * 查询移动端数据列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:data:list')")
+    @GetMapping("/getIndexTrue")
+    @ApiOperation(value = "查询当前租户的首页信息")
+    public AjaxResult IndexTrue() {
+        MobilePageData mobilePageData = mobilePageDataService.selectMobilePageDataIndexTrue();
+        return AjaxResult.success(mobilePageData);
+    }
+
+    
     /**
      * 导出移动端数据列表
      */
@@ -57,6 +70,8 @@ public class MobilePageDataController extends BaseController {
         util.exportExcel(response, list, "移动端数据数据");
     }
 
+
+
     /**
      * 获取移动端数据详细信息
      */

+ 6 - 0
zkqy-business/src/main/java/com/zkqy/business/mapper/MobilePageDataMapper.java

@@ -60,4 +60,10 @@ public interface MobilePageDataMapper
      * @return 结果
      */
     public int deleteMobilePageDataByIds(Long[] ids);
+
+    /**
+     * 查询当前租户的首页信息
+     * @return
+     */
+    MobilePageData selectMobilePageDataIndexTrue();
 }

+ 7 - 0
zkqy-business/src/main/java/com/zkqy/business/service/IMobilePageDataService.java

@@ -23,6 +23,13 @@ public interface IMobilePageDataService
      */
     public MobilePageData selectMobilePageDataById(Long id);
 
+
+    /**
+     * 查询首页信息
+     * @return 移动端数据
+     */
+    public MobilePageData selectMobilePageDataIndexTrue();
+
     /**
      * 查询移动端数据列表
      * 

+ 5 - 0
zkqy-business/src/main/java/com/zkqy/business/service/impl/MobilePageDataServiceImpl.java

@@ -34,6 +34,11 @@ public class MobilePageDataServiceImpl implements IMobilePageDataService
         return mobilePageDataMapper.selectMobilePageDataById(id);
     }
 
+    @Override
+    public MobilePageData selectMobilePageDataIndexTrue() {
+        return mobilePageDataMapper.selectMobilePageDataIndexTrue();
+    }
+
     /**
      * 查询移动端数据列表
      * 

+ 6 - 1
zkqy-business/src/main/resources/mapper/dragmapper/MobilePageDataMapper.xml

@@ -26,7 +26,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectMobilePageDataVo"/>
         where id = #{id}
     </select>
-        
+
+    <select id="selectMobilePageDataIndexTrue" resultType="com.zkqy.business.entity.MobilePageData">
+        <include refid="selectMobilePageDataVo"/>
+        where isIndex ='true'
+    </select>
+
     <insert id="insertMobilePageData" parameterType="com.zkqy.business.entity.MobilePageData" useGeneratedKeys="true" keyProperty="id">
         insert into mobile_page_data
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 1 - 1
zkqy-framework/src/main/java/com/zkqy/framework/config/SecurityConfig.java

@@ -108,7 +108,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
                 // 过滤请求
                 .authorizeRequests()
                 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
-                .antMatchers("/login", "/register", "/captchaImage", "/uniappLogin", "/isTenantExist").permitAll()
+                .antMatchers("/login", "/register", "/captchaImage", "/uniappLogin", "/commonUniappLogin","/isTenantExist").permitAll()
                 // 静态资源,可匿名访问
                 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
                 .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

+ 1 - 0
zkqy-framework/src/main/java/com/zkqy/framework/web/service/SysLoginService.java

@@ -76,6 +76,7 @@ public class SysLoginService {
     }
 
 
+
     /**
      * 登录验证
      *

+ 15 - 4
zkqy-ui/src/views/orderMange/planTable/show/fangsi.vue

@@ -270,7 +270,18 @@ export default {
     //业务员信息
     // this.getSalesman();
     //得到排产产品信息
-
+    //查询字典信息
+        getDicts("dpsx").then(res=>{
+          //制定周期跑一次定时任务
+          console.log(res.data[0].dictValue)
+          this.timerId = setInterval(() => {
+            this.counter++;
+            console.log(`计数器:`,this.counter);
+            // 注意:适时清理定时器,例如在组件销毁时
+            // 得到排产计划信息
+            this.getSpinningPlanList();
+          }, res.data[0].dictValue);
+        })
   },
   methods: {
     //五个显示为一排
@@ -309,7 +320,7 @@ export default {
     getProductsInfo() {
       getProductsInfo().then((response) => {
         this.productsInfo = response.data;
-        console.log(this.productsInfo,"产品信息")
+        // console.log(this.productsInfo,"产品信息")
         this.productsInfo.forEach(item => {
           item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
         });
@@ -329,7 +340,7 @@ export default {
       getMaterielInfo(queryParams).then((response) => {
         if (response.data!=null) {
           this.materiel = response.data;
-          console.log(response.data,"规格")
+          // console.log(response.data,"规格")
           //色号 母粒编码+色号
           row.currentColorCode = this.materiel.materieEncoding+"("+this.materiel.materieColorNumber+")";
         }
@@ -501,7 +512,7 @@ export default {
           item.productId=parseInt(item.productId)
         })
         this.tableData2=response.data;
-        console.log( this.tableData2)
+        // console.log( this.tableData2)
         // 在数据加载完成后,手动触发每个行的第一个下拉框的 change 事件
         // this.$nextTick(() => {
         //   // 获取第一个业务员选择框(假设表格只有一行)

+ 14 - 4
zkqy-ui/src/views/orderMange/planTable/show/fankuang.vue

@@ -315,6 +315,18 @@ export default {
     this.getSpinningPlanList();
     // this.getSalesman();
     this.getProductsInfo();
+    //查询字典信息
+    getDicts("dpsx").then(res=>{
+      //制定周期跑一次定时任务
+      console.log(res.data[0].dictValue)
+      this.timerId = setInterval(() => {
+        this.counter++;
+        console.log(`计数器:`,this.counter);
+        // 注意:适时清理定时器,例如在组件销毁时
+        // 得到排产计划信息
+        this.getSpinningPlanList();
+      }, res.data[0].dictValue);
+    })
   },
   methods: {
     //五个显示为一排
@@ -352,7 +364,6 @@ export default {
     //   })
     // },
     getProductsInfo() {
-      console.log("ddddddddddddddddddddddd")
       getProductsInfo().then((response) => {
         this.productsInfo = response.data;
         this.productsInfo.forEach(item => {
@@ -363,7 +374,6 @@ export default {
     // 下拉框数据改变查询色号批号信息
     selectedChangeDate(row,selectedProduct) {
       //选择的那个销售产品
-      console.log(this.productsInfo,"hhhhhh")
       this.product = this.productsInfo.find(product => product.id === selectedProduct);
       //选择的那个产品
       this.form.product=selectedProduct;
@@ -545,7 +555,7 @@ export default {
           item.productId=parseInt(item.productId)
         })
         this.tableData2=response.data;
-        console.log( this.tableData2)
+        // console.log( this.tableData2)
         // 在数据加载完成后,手动触发每个行的第一个下拉框的 change 事件
         this.$nextTick(() => {
           // 获取第一个业务员选择框(假设表格只有一行)
@@ -591,7 +601,7 @@ export default {
     //更新状态
     updateStatus(ind, row,planStatus){
       const a=planStatus;
-      console.log( row.planStatus,this.tableDataStatus[ind].planStatus)
+      // console.log( row.planStatus,this.tableDataStatus[ind].planStatus)
       if(planStatus==this.tableDataStatus[ind].planStatus){
         this.$message({
           message: '并未更改状态,不会发送请求',

+ 15 - 2
zkqy-ui/src/views/orderMange/planTable/show/luotong.vue

@@ -257,6 +257,7 @@ import {
   getPlanSpinningInfo,
   updateSpinningInfoPlanOne
 } from "@/api/plan/paln.js";
+import {getDicts} from "@/api/system/dict/data";
 export default {
   data() {
     return {
@@ -316,6 +317,18 @@ export default {
     // //
     // this.getSalesman();
     this.getProductsInfo();
+    //查询字典信息
+    getDicts("dpsx").then(res=>{
+      //制定周期跑一次定时任务
+      console.log(res.data[0].dictValue)
+      this.timerId = setInterval(() => {
+        this.counter++;
+        console.log(`计数器:`,this.counter);
+        // 注意:适时清理定时器,例如在组件销毁时
+        // 得到排产计划信息
+        this.getSpinningPlanList();
+      }, res.data[0].dictValue);
+    })
   },
   methods: {
     //五个显示为一排
@@ -542,7 +555,7 @@ export default {
           item.productId=parseInt(item.productId)
         })
         this.tableData2=response.data;
-        console.log( this.tableData2)
+        // console.log( this.tableData2)
         // 在数据加载完成后,手动触发每个行的第一个下拉框的 change 事件
         this.$nextTick(() => {
           // 获取第一个业务员选择框(假设表格只有一行)
@@ -588,7 +601,7 @@ export default {
     //更新状态
     updateStatus(ind, row,planStatus){
       const a=planStatus;
-      console.log( row.planStatus,this.tableDataStatus[ind].planStatus)
+      // console.log( row.planStatus,this.tableDataStatus[ind].planStatus)
       if(planStatus==this.tableDataStatus[ind].planStatus){
         this.$message({
           message: '并未更改状态,不会发送请求',

+ 15 - 1
zkqy-ui/src/views/orderMange/planTable/show/northWorkshop.vue

@@ -58,6 +58,7 @@ import {
   getAllPlanListByMachineId,
   getAllPlanListByProductTypeAndStatus, updatePlanOne
 } from "@/api/plan/paln.js";
+import {getDicts} from "@/api/system/dict/data";
 export default {
   data() {
     return {
@@ -117,6 +118,18 @@ export default {
     // 得到业务员信息
     // this.getSalesman();
     this.getProductsInfo();
+    //查询字典信息
+    getDicts("dpsx").then(res=>{
+      //制定周期跑一次定时任务
+      console.log(res.data[0].dictValue)
+      this.timerId = setInterval(() => {
+        this.counter++;
+        console.log(`计数器:`,this.counter);
+        // 注意:适时清理定时器,例如在组件销毁时
+        // 得到排产计划信息
+        this.getAmmunitionPlanInfo();
+      }, res.data[0].dictValue);
+    })
   },
   methods: {
     // 查询排产信息
@@ -125,6 +138,7 @@ export default {
         this.tableData = response.data
       });
     },
+
     // 合并单元格
     spanMethod2({ row, column, rowIndex, columnIndex }) {
       //第二列合并
@@ -163,7 +177,7 @@ export default {
         let nextRow2 = this.tableData[rowIndex + 1] //下一行数据
         // 当上一行的数据等于当前行数据时,当前行单元格隐藏
 
-        console.log(row.listOfPendingProduction)
+        // console.log(row.listOfPendingProduction)
         if(row.listOfPendingProduction==null||row.listOfPendingProduction==undefined|| row.listOfPendingProduction==""){
           return;
         }

+ 20 - 150
zkqy-ui/src/views/orderMange/planTable/show/southWorkshop.vue

@@ -59,6 +59,8 @@ import {
   getAllPlanListByMachineId,
   getAllPlanListByProductTypeAndStatus, updatePlanOne
 } from "@/api/plan/paln.js";
+
+import {getDicts} from "@/api/system/dict/data"
 export default {
   data() {
     return {
@@ -110,6 +112,8 @@ export default {
       },
       // 产品类别
       productTypeList:[{value:"A面",lable:"A面"},{value:"B面",lable:"B面"}],
+      counter:0,
+      timerId: null
     }
   },
   mounted() {
@@ -118,6 +122,18 @@ export default {
     // 得到业务员信息
     // this.getSalesman();
     this.getProductsInfo();
+    //查询字典信息
+    getDicts("dpsx").then(res=>{
+      //制定周期跑一次定时任务
+      console.log(res.data[0].dictValue)
+      this.timerId = setInterval(() => {
+        this.counter++;
+        console.log(`计数器:`,this.counter);
+        // 注意:适时清理定时器,例如在组件销毁时
+        // 得到排产计划信息
+        this.getAmmunitionPlanInfo();
+      }, res.data[0].dictValue);
+    })
   },
   methods: {
     // 查询排产信息
@@ -164,7 +180,7 @@ export default {
         let nextRow2 = this.tableData[rowIndex + 1] //下一行数据
         // 当上一行的数据等于当前行数据时,当前行单元格隐藏
 
-        console.log(row.listOfPendingProduction)
+        // console.log(row.listOfPendingProduction)
         if(row.listOfPendingProduction==null||row.listOfPendingProduction==undefined|| row.listOfPendingProduction==""){
           return;
         }
@@ -268,48 +284,6 @@ export default {
         });
       })
     },
-    // 下拉框数据改变查询色号批号信息
-    selectedChangeDate(row,selectedProduct) {
-      //选择的那个销售产品
-      this.product = this.productsInfo.find(product => product.id === selectedProduct);
-      this.form.product=selectedProduct;
-      //通过母粒编码查询到对应的母粒信息
-      let queryParams = {
-        "materielCode": this.product.colourNumber
-      }
-      //得到对应的母粒信息
-      getMaterielInfo(queryParams).then((response) => {
-        if (response.data!=null) {
-          this.materiel = response.data;
-          //色号 母粒编码+色号
-          row.currentColorCode = this.materiel.materieEncoding+"("+this.materiel.materieColorNumber+")";
-        }
-      });
-      //isDisabled(有批号就用,没批号就自己输入)
-      if(this.product.lotNumber!=undefined&&this.product.lotNumber!=""){
-        row.currentLotNumber=this.product.lotNumber;
-        this.isDisabled=true;
-      }else {
-        this.isDisabled=false;
-      }
-      //产品规格
-      row.currentSpecification= this.product.productSpecifications;
-      //销售单编号(以前打算存的是业务员信息后来存的是销售单编号)
-      row.salesmanId=this.product.saleOrderNo;
-    },
-    // 新增计划产品信息
-    handleAddPlan(row) {
-      if(this.selectedWorkshop=="南车间"){
-        this.nanInsertDialogTableVisible = true
-      }else{
-        this.beiInsertDialogTableVisible = true
-      }
-      this.tableData2=[]
-      //先清空
-      this.machineId=""
-      //当前操作机台号
-      this.machineId=row.machineId;
-    },
 
     // tab栏点击切换
     tabClick(tab, event) {
@@ -375,114 +349,7 @@ export default {
     isRowFilled(row) {
       return row.currentSpecification && row.currentSpindleCount && row.number && row.startTime && row.plannedEndTime;
     },
-    // 新增一行标记为可编辑
-    addEditableRow() {
-      // 检查当前编辑行是否已填写完毕
-      if(this.tableData2.length!=0){
-        if (this.editingRowIndex !== -1 && !this.isRowFilled(this.tableData2[this.editingRowIndex])) {
-          this.$message({
-            message: '请先完成上一条数据的填写',
-            type: 'warning'
-          });
-          return;
-        }
-        //新增行之前先让以前的行不能编辑
-        this.tableData2.forEach(item => {
-          item.isEditing = false;
-        })
-      }
-      this.tableData2.push({
-        currentColorCode: '',
-        currentSpecification: '',
-        currentLotNumber: '',
-        currentSpindleCount: '',
-        number: '',
-        startTime: '',
-        plannedEndTime:'',
-        planStatus:0,
-        productId:'',
-        salesmanId:'',
-        isEditing: true // 标记为正在编辑状态
-      });
-      this.editingRowIndex = this.tableData2.length - 1; // 更新当前编辑的行索引
-      this.lastEditLine = this.tableData2.length - 1
-    },
-    // 添加计划
-    addPlanInfo(){
-      const datatime=Date.now()+this.machineId;
-      //处理表格数据
-      this.tableData2.forEach(item=>{
-        item.timestampRandomCode=datatime;
-        item.machineId=this.machineId;
-      })
-      //时间戳
-      let data={
-        //机台号
-        machineId: this.machineId,
-        timestampRandomCode:datatime,
-        //计划信息
-        detailsOfTheRefuelingPlans: this.tableData2
-      }
-      //添加计划信息
-      addMaterielInfo(data).then(response => {
-        if (response.code == 200) {
-          this.$message({
-            message: '添加成功',
-            type: 'success'
-          });
-          this.getAmmunitionPlanInfo();
-          //最后把弹窗关掉
-          this.nanInsertDialogTableVisible=false
-          //更改订单投产信息的批号,
-        } else {
-          this.$message({
-            message: '添加失败',
-            type: 'error'
-          });
-          //最后把弹窗关掉
-          this.nanInsertDialogTableVisible=false
-        }
-      });
-
-    },
-    // 修改产品计划
-    handleEditPlan(row) {
-      this.tableData2=[];
-      //弹窗
-      if(this.selectedWorkshop=="南车间"){
-        this.nanUpdateDialogTableVisible = true
-      }else{
-        this.beiUpdateDialogTableVisible = true
-      }
-      this.tableData2=[];
-      getAllPlanListByMachineId(row.machineId).then((response) => {
-        //得到生产中,停产的,待产的
-        response.data.forEach(item => {
-          item.isEditing=false;
-          item.planStatus=parseInt(item.planStatus);
-          item.productId=parseInt(item.productId)
-        })
-        this.tableData2=response.data;
-        console.log( this.tableData2)
-        // 在数据加载完成后,手动触发每个行的第一个下拉框的 change 事件
-        this.$nextTick(() => {
-          // 获取第一个业务员选择框(假设表格只有一行)
-          for (let i = 0; i < this.tableData2.length; i++) {
-            const firstSalesmanSelect = this.$refs['salesmanSelect'+i];
-            // console.log(firstSalesmanSelect,11111111)
-            // 触发 change 事件
-            if (firstSalesmanSelect) {
-              firstSalesmanSelect.$emit('change', {
-                target: {value: "ddd"},
-              });
-            }
-          }
-
-        });
-      })
-
 
-    },
     //弹窗里边的点击查询
     onSubmit(){
       this.formData.machineId=this.machineId;
@@ -521,6 +388,9 @@ export default {
   computed: {
 
   },
+  beforeDestroy() {
+    clearInterval(this.timerId); // 清理定时器
+  }
 }
 </script>