瀏覽代碼

暂存功能实现和动态配置距离计算

songxy 1 年之前
父節點
當前提交
3d7340de1f

+ 8 - 0
BJYSYBZ_S/src/main/java/com/zjugis/ysgzybz/controller/aliyun/OSSController.java

@@ -8,6 +8,7 @@ import com.zjugis.ysgzybz.service.IFileService;
 import com.zjugis.ysgzybz.utils.AliyunOSSUtils;
 import com.zjugis.ysgzybz.utils.UploadFileUtil;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.util.FileCopyUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -109,4 +110,11 @@ public class OSSController extends BaseRestController {
         }
     }
 
+    @Value("${aliyun.location}")
+    private Boolean location;
+
+    @GetMapping("/location")
+    public Object location(){
+        return result(location);
+    }
 }

+ 3 - 0
BJYSYBZ_S/src/main/java/com/zjugis/ysgzybz/domain/entity/Bjxcry.java

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
+import java.util.List;
+
 /**
  * @Author 陈俊
  * @Date 2023/12/21 9:52
@@ -31,4 +33,5 @@ public class Bjxcry {
      * 管地单位
      */
     private String gddw;
+
 }

+ 2 - 0
BJYSYBZ_S/src/main/java/com/zjugis/ysgzybz/domain/vo/BjxcjlCreateReqVO.java

@@ -2,6 +2,7 @@ package com.zjugis.ysgzybz.domain.vo;
 
 import lombok.Data;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -40,4 +41,5 @@ public class BjxcjlCreateReqVO {
     private String dksyh;
 
     private List<BjxcjlImgCreateReqVO> imgList;
+
 }

+ 1 - 0
BJYSYBZ_S/src/main/java/com/zjugis/ysgzybz/service/impl/XcjlServiceImpl.java

@@ -57,6 +57,7 @@ public class XcjlServiceImpl extends ServiceImpl<XcjlMapper, Bjxcjl> implements
     public List<BjxcjlRespVO> getListByDksyh(String dksyh) {
         QueryWrapper<Bjxcjl> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("dksyh", dksyh);
+//        queryWrapper.eq("is_xc", 1);
         queryWrapper.orderByDesc("xcsj");
         List<Bjxcjl> list = super.list(queryWrapper);
         List<BjxcjlRespVO> respVOList = new ArrayList<>();

+ 1 - 0
BJYSYBZ_S/src/main/resources/application-tinker.yml

@@ -70,6 +70,7 @@ mybatis-plus:
 
 #阿里云oos文件上传配置
 aliyun:
+  location: true
   oss:
     file:
       endpoint: oss-cn-hangzhou-zjzwy01-d01-a.cloud-inner.zj.gov.cn

+ 75 - 49
YSGZYBZ_WXAPP/pages/nocheckDetail/index.vue

@@ -78,6 +78,7 @@
           </view>
         </view>
         <button class="btn" @tap="saveWarning">确认上报</button>
+        <button style="background: #ff9900;" class="btn" @tap="temporaryXcjl">暂存</button>
       </view>
     </view>
   </view>
@@ -125,10 +126,8 @@ export default {
         width: 64,
         height: 64,
       },
-
       baseFormData: {
-        lawBreakType: '',
-        xzms: '',
+        xzms: ''
       },
     };
   },
@@ -138,8 +137,15 @@ export default {
   onLoad(option) {
     const idStr = JSON.parse(option['obj']);
     this.objs = idStr;
-    console.log(this.objs);
     this.initLayCenter(idStr.dksyh);
+	if(this.objs && this.objs.dksyh){
+		const tempXcjl = uni.getStorageSync(this.objs.dksyh)
+		if(tempXcjl){
+			this.fileList = tempXcjl['fileList']
+			this.fileImgList = tempXcjl['fileImgList']
+			this.baseFormData = tempXcjl['baseFormData']
+		}
+	}
   },
   beforeDestroy() {},
   methods: {
@@ -243,21 +249,11 @@ export default {
       return (s * 1000).toFixed(0);
     },
 
-    relationFileById(fileObj) {
+    async relationFileById(fileObj) {
       //文件上传
       let _that = this;
-      // let sendData = fileObj;
       let files = [];
       console.log(fileObj);
-      let sendData = {
-        xcryId: uni.getStorageSync('userInfo').id,
-        xzms: this.baseFormData.xzms,
-        xcryName: uni.getStorageSync('userInfo').xcry,
-        xcryMobile: uni.getStorageSync('userInfo').lxdh,
-        dksyh: this.objs.dksyh,
-        imgList: [],
-      };
-
       let laycenterArr = [];
       fileObj.forEach((item) => {
         let obj = {
@@ -272,10 +268,18 @@ export default {
         };
         laycenterArr.push(obj1);
       });
-      sendData.imgList = files;
 
       let laycenter = this.centerLay;
 
+	  const locationResult = await httpAjax({
+		  url: 'api/oss/location',
+		  method: 'GET'
+		});
+	  let isLocation = false;
+	  if(locationResult && locationResult['data']){
+		  isLocation = true;
+	  }
+	  let isSubmit = true;
       for (let i = 0; i < laycenterArr.length; i++) {
         let m = this.getDistance(
           laycenter.lat,
@@ -283,7 +287,8 @@ export default {
           laycenterArr[i].lat,
           laycenterArr[i].lng,
         );
-        if (m > 50) {
+        if (isLocation && m > 50) {
+		  isSubmit = false;
           uni.showModal({
             title: '提示',
             content: `超出地块拍摄范围`,
@@ -293,41 +298,62 @@ export default {
               }
             },
           });
-          return;
-        } else {
-          httpAjax({
-            url: 'app/xc/addXcjl',
-            method: 'POST',
-            data: sendData,
-          })
-            .then((result) => {
-              if (result.data) {
-                uni.showModal({
-                  title: '提示',
-                  content: '上报成功,是否返回首页',
-                  success: function (res) {
-                    if (res.confirm) {
-                      uni.navigateTo({
-                        url: '/pages/main/index',
-                      });
-                    } else if (res.cancel) {
-                      uni.navigateTo({
-                        url: `/pages/receivedDetail/index?obj=${JSON.stringify(
-                          _that.objs,
-                        )}`,
-                      });
-                    }
-                  },
-                });
-              }
-            })
-            .catch((err) => {
-              console.error('');
-            });
-          return;
+          break;
         }
       }
+	  if(!isSubmit) return;
+	  this.addXcjlAjax(files).then((result)=>{
+		  if (result.data) {
+		  		uni.showModal({
+		  		  title: '提示',
+		  		  content: '上报成功,是否返回首页',
+		  		  success: function (res) {
+		  			if (res.confirm) {
+		  			  uni.navigateTo({
+		  				url: '/pages/main/index',
+		  			  });
+		  			} else if (res.cancel) {
+		  			  uni.navigateTo({
+		  				url: `/pages/receivedDetail/index?obj=${JSON.stringify(
+		  				  _that.objs,
+		  				)}`,
+		  			  });
+		  			}
+		  		  },
+		  		});
+			  if(_that.objs && _that.objs.dksyh){
+				   uni.removeStorageSync(_that.objs.dksyh)
+			  }
+		  }
+	  });
     },
+	async addXcjlAjax(files = []){
+		const _that = this;
+		const sendData = {
+		  xcryId: uni.getStorageSync('userInfo').id,
+		  xzms: this.baseFormData.xzms,
+		  xcryName: uni.getStorageSync('userInfo').xcry,
+		  xcryMobile: uni.getStorageSync('userInfo').lxdh,
+		  dksyh: this.objs.dksyh,
+		  imgList: files
+		};
+		return await httpAjax({
+			url: 'app/xc/addXcjl',
+			method: 'POST',
+			data: sendData,
+		});
+	},
+	temporaryXcjl(){
+		if(this.objs && this.objs.dksyh){
+			const obj = {
+				fileImgList: this.fileImgList,
+				fileList: this.fileList,
+				baseFormData: this.baseFormData
+			}
+			uni.setStorageSync(this.objs.dksyh, obj);
+			uni.showToast({title: '暂存成功!'})
+		}
+	},
     selectFileChange(file) {
       console.log(file);
       const that = this;

File diff suppressed because it is too large
+ 0 - 0
YSGZYBZ_WXAPP/unpackage/dist/dev/.sourcemap/mp-weixin/common/main.js.map


File diff suppressed because it is too large
+ 0 - 0
YSGZYBZ_WXAPP/unpackage/dist/dev/.sourcemap/mp-weixin/common/vendor.js.map


File diff suppressed because it is too large
+ 0 - 0
YSGZYBZ_WXAPP/unpackage/dist/dev/.sourcemap/mp-weixin/pages/nocheckDetail/index.js.map


+ 154 - 69
YSGZYBZ_WXAPP/unpackage/dist/dev/mp-weixin/pages/nocheckDetail/index.js

@@ -165,6 +165,8 @@ Object.defineProperty(exports, "__esModule", {
   value: true
 });
 exports.default = void 0;
+var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 104));
+var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 106));
 var _https = _interopRequireDefault(__webpack_require__(/*! @/utils/https.js */ 39));
 var _CustomMixins = _interopRequireDefault(__webpack_require__(/*! @/mixins/CustomMixins.js */ 57));
 var _config = _interopRequireDefault(__webpack_require__(/*! @/utils/config.js */ 40));
@@ -208,7 +210,6 @@ var _default = {
         height: 64
       },
       baseFormData: {
-        lawBreakType: '',
         xzms: ''
       }
     };
@@ -219,8 +220,15 @@ var _default = {
   onLoad: function onLoad(option) {
     var idStr = JSON.parse(option['obj']);
     this.objs = idStr;
-    console.log(this.objs);
     this.initLayCenter(idStr.dksyh);
+    if (this.objs && this.objs.dksyh) {
+      var tempXcjl = uni.getStorageSync(this.objs.dksyh);
+      if (tempXcjl) {
+        this.fileList = tempXcjl['fileList'];
+        this.fileImgList = tempXcjl['fileImgList'];
+        this.baseFormData = tempXcjl['baseFormData'];
+      }
+    }
   },
   beforeDestroy: function beforeDestroy() {},
   methods: {
@@ -313,74 +321,151 @@ var _default = {
       return (s * 1000).toFixed(0);
     },
     relationFileById: function relationFileById(fileObj) {
-      //文件上传
-      var _that = this;
-      // let sendData = fileObj;
-      var files = [];
-      console.log(fileObj);
-      var sendData = {
-        xcryId: uni.getStorageSync('userInfo').id,
-        xzms: this.baseFormData.xzms,
-        xcryName: uni.getStorageSync('userInfo').xcry,
-        xcryMobile: uni.getStorageSync('userInfo').lxdh,
-        dksyh: this.objs.dksyh,
-        imgList: []
-      };
-      var laycenterArr = [];
-      fileObj.forEach(function (item) {
-        var obj = {
-          fileId: item.fileId,
-          lat: item.lat,
-          lng: item.lng
-        };
-        files.push(obj);
-        var obj1 = {
-          lat: item.lat,
-          lng: item.lng
-        };
-        laycenterArr.push(obj1);
-      });
-      sendData.imgList = files;
-      var laycenter = this.centerLay;
-      for (var i = 0; i < laycenterArr.length; i++) {
-        var m = this.getDistance(laycenter.lat, laycenter.lng, laycenterArr[i].lat, laycenterArr[i].lng);
-        if (m > 50) {
-          uni.showModal({
-            title: '提示',
-            content: "\u8D85\u51FA\u5730\u5757\u62CD\u6444\u8303\u56F4",
-            success: function success(res) {
-              if (res.confirm) {} else if (res.cancel) {}
-            }
-          });
-          return;
-        } else {
-          (0, _https.default)({
-            url: 'app/xc/addXcjl',
-            method: 'POST',
-            data: sendData
-          }).then(function (result) {
-            if (result.data) {
-              uni.showModal({
-                title: '提示',
-                content: '上报成功,是否返回首页',
-                success: function success(res) {
-                  if (res.confirm) {
-                    uni.navigateTo({
-                      url: '/pages/main/index'
-                    });
-                  } else if (res.cancel) {
-                    uni.navigateTo({
-                      url: "/pages/receivedDetail/index?obj=".concat(JSON.stringify(_that.objs))
-                    });
+      var _this2 = this;
+      return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
+        var _that, files, laycenterArr, laycenter, locationResult, isLocation, isSubmit, i, m;
+        return _regenerator.default.wrap(function _callee$(_context) {
+          while (1) {
+            switch (_context.prev = _context.next) {
+              case 0:
+                //文件上传
+                _that = _this2;
+                files = [];
+                console.log(fileObj);
+                laycenterArr = [];
+                fileObj.forEach(function (item) {
+                  var obj = {
+                    fileId: item.fileId,
+                    lat: item.lat,
+                    lng: item.lng
+                  };
+                  files.push(obj);
+                  var obj1 = {
+                    lat: item.lat,
+                    lng: item.lng
+                  };
+                  laycenterArr.push(obj1);
+                });
+                laycenter = _this2.centerLay;
+                _context.next = 8;
+                return (0, _https.default)({
+                  url: 'api/oss/location',
+                  method: 'GET'
+                });
+              case 8:
+                locationResult = _context.sent;
+                isLocation = false;
+                if (locationResult && locationResult['data']) {
+                  isLocation = true;
+                }
+                isSubmit = true;
+                i = 0;
+              case 13:
+                if (!(i < laycenterArr.length)) {
+                  _context.next = 22;
+                  break;
+                }
+                m = _this2.getDistance(laycenter.lat, laycenter.lng, laycenterArr[i].lat, laycenterArr[i].lng);
+                if (!(isLocation && m > 50)) {
+                  _context.next = 19;
+                  break;
+                }
+                isSubmit = false;
+                uni.showModal({
+                  title: '提示',
+                  content: "\u8D85\u51FA\u5730\u5757\u62CD\u6444\u8303\u56F4",
+                  success: function success(res) {
+                    if (res.confirm) {} else if (res.cancel) {}
                   }
+                });
+                return _context.abrupt("break", 22);
+              case 19:
+                i++;
+                _context.next = 13;
+                break;
+              case 22:
+                if (isSubmit) {
+                  _context.next = 24;
+                  break;
                 }
-              });
+                return _context.abrupt("return");
+              case 24:
+                _this2.addXcjlAjax(files).then(function (result) {
+                  if (result.data) {
+                    uni.showModal({
+                      title: '提示',
+                      content: '上报成功,是否返回首页',
+                      success: function success(res) {
+                        if (res.confirm) {
+                          uni.navigateTo({
+                            url: '/pages/main/index'
+                          });
+                        } else if (res.cancel) {
+                          uni.navigateTo({
+                            url: "/pages/receivedDetail/index?obj=".concat(JSON.stringify(_that.objs))
+                          });
+                        }
+                      }
+                    });
+                    if (_that.objs && _that.objs.dksyh) {
+                      uni.removeStorageSync(_that.objs.dksyh);
+                    }
+                  }
+                });
+              case 25:
+              case "end":
+                return _context.stop();
             }
-          }).catch(function (err) {
-            console.error('');
-          });
-          return;
-        }
+          }
+        }, _callee);
+      }))();
+    },
+    addXcjlAjax: function addXcjlAjax() {
+      var _arguments = arguments,
+        _this3 = this;
+      return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
+        var files, _that, sendData;
+        return _regenerator.default.wrap(function _callee2$(_context2) {
+          while (1) {
+            switch (_context2.prev = _context2.next) {
+              case 0:
+                files = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : [];
+                _that = _this3;
+                sendData = {
+                  xcryId: uni.getStorageSync('userInfo').id,
+                  xzms: _this3.baseFormData.xzms,
+                  xcryName: uni.getStorageSync('userInfo').xcry,
+                  xcryMobile: uni.getStorageSync('userInfo').lxdh,
+                  dksyh: _this3.objs.dksyh,
+                  imgList: files
+                };
+                _context2.next = 5;
+                return (0, _https.default)({
+                  url: 'app/xc/addXcjl',
+                  method: 'POST',
+                  data: sendData
+                });
+              case 5:
+                return _context2.abrupt("return", _context2.sent);
+              case 6:
+              case "end":
+                return _context2.stop();
+            }
+          }
+        }, _callee2);
+      }))();
+    },
+    temporaryXcjl: function temporaryXcjl() {
+      if (this.objs && this.objs.dksyh) {
+        var obj = {
+          fileImgList: this.fileImgList,
+          fileList: this.fileList,
+          baseFormData: this.baseFormData
+        };
+        uni.setStorageSync(this.objs.dksyh, obj);
+        uni.showToast({
+          title: '暂存成功!'
+        });
       }
     },
     selectFileChange: function selectFileChange(file) {
@@ -452,7 +537,7 @@ var _default = {
     },
     //拍摄时获取设备的经纬度
     getLocationApi: function getLocationApi(data) {
-      var _this2 = this;
+      var _this4 = this;
       var _that = this;
       wx.authorize({
         scope: 'scope.userLocation',
@@ -477,7 +562,7 @@ var _default = {
         },
         fail: function fail(err) {
           console.log('获取授权失败', err);
-          _this2.handleOpenSetting();
+          _this4.handleOpenSetting();
         }
       });
     },

File diff suppressed because it is too large
+ 0 - 0
YSGZYBZ_WXAPP/unpackage/dist/dev/mp-weixin/pages/nocheckDetail/index.wxml


Some files were not shown because too many files changed in this diff