Selaa lähdekoodia

数据采集录入

hejizheng 1 vuosi sitten
vanhempi
commit
269fb0d8f3

+ 22 - 0
zhbsq-admin/src/main/java/com/hjy/modlue/gather/CbGatherController.java

@@ -86,6 +86,26 @@ public class CbGatherController extends BaseController {
     @Log(title = "数据采集", businessType = BusinessType.UPDATE)
     @PostMapping("edit")
     public AjaxResult edit(@RequestBody CbGatherVo entity) {
+        return toAjax(cbGatherService.updateEntity(entity));
+    }
+
+
+    @ApiOperation("数据上报")
+    @PreAuthorize("@ss.hasPermi('gather:GATHER:report')")
+    @Log(title = "数据上报", businessType = BusinessType.UPDATE)
+    @PostMapping("report")
+    public AjaxResult report(@RequestBody CbGatherVo entity) {
+        entity.setReportStatus("1");
+        return toAjax(cbGatherService.updateById(entity));
+    }
+
+
+    @ApiOperation("数据审核")
+    @PreAuthorize("@ss.hasPermi('gather:GATHER:approve')")
+    @Log(title = "数据审核", businessType = BusinessType.UPDATE)
+    @PostMapping("approve")
+    public AjaxResult approve(@RequestBody CbGatherVo entity) {
+        entity.setApproveStatus("1");
         return toAjax(cbGatherService.updateById(entity));
     }
 
@@ -96,4 +116,6 @@ public class CbGatherController extends BaseController {
     public AjaxResult remove(@PathVariable String[] ids) {
         return toAjax(cbGatherService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
     }
+
+
 }

+ 0 - 4
zhbsq-modlue/src/main/java/com/hjy/module/aspect/ResVoDictAspect.java

@@ -88,10 +88,6 @@ public class ResVoDictAspect {
                 Object resultObj = ((AjaxResult) result).get("data");
                 if (Objects.isNull(resultObj)) return result;
                 //update-begin--Author:zyf -- Date:20220606 ----for:【VUEN-1230】 判断是否含有字典注解,没有注解返回-----
-//                Boolean hasDict = dictFilterUtils.checkHasDict(new ArrayList<Object>(){{add(resultObj);}}, ResultDict.class);
-//                if (!hasDict) {
-//                    return result;
-//                }
                 String json = "{}";
                 JSONObject item = null;
             try {

+ 3 - 1
zhbsq-modlue/src/main/java/com/hjy/module/domain/gether/CbGatherWarning.java

@@ -12,6 +12,8 @@ import lombok.EqualsAndHashCode;
 import lombok.ToString;
 import lombok.experimental.Accessors;
 
+import java.math.BigDecimal;
+
 /**
  * 数据采集预警对象 CB_GATHER_WARNING
  *
@@ -70,7 +72,7 @@ public class CbGatherWarning extends BaseEntity {
      */
     @ApiModelProperty("异常详细数据值")
     @Excel(name = "异常详细数据值")
-    private String errValue;
+    private BigDecimal errValue;
 
     /**
      * 处置人

+ 7 - 0
zhbsq-modlue/src/main/java/com/hjy/module/service/gather/ICbGatherService.java

@@ -53,4 +53,11 @@ public interface ICbGatherService extends IService<CbGather> {
      * @return
      */
     boolean saveEntity(CbGatherVo entity);
+
+    /**
+     * 修改采集数据
+     * @param entity
+     * @return
+     */
+    boolean updateEntity(CbGatherVo entity);
 }

+ 29 - 3
zhbsq-modlue/src/main/java/com/hjy/module/service/gather/impl/CbGatherServiceImpl.java

@@ -6,6 +6,7 @@ import com.hjy.common.utils.CommomUtils;
 import com.hjy.common.utils.PageUtils;
 import com.hjy.module.domain.gether.CbGather;
 import com.hjy.module.domain.gether.CbGatherFee;
+import com.hjy.module.domain.gether.CbGatherWarning;
 import com.hjy.module.domain.norm.CbGive;
 import com.hjy.module.domain.norm.CbNorm;
 import com.hjy.module.domain.norm.CbNormFee;
@@ -18,6 +19,7 @@ import com.hjy.module.service.norm.ICbNormFeeService;
 import com.hjy.module.service.norm.ICbNormService;
 import com.hjy.module.vo.gather.CbGatherFeeVo;
 import com.hjy.module.vo.gather.CbGatherVo;
+import com.hjy.module.vo.gather.CbGatherWarningVo;
 import com.hjy.module.vo.norm.CbNormFeeVo;
 import com.hjy.module.vo.norm.CbNormVo;
 import org.apache.commons.compress.utils.Lists;
@@ -124,13 +126,27 @@ public class CbGatherServiceImpl extends ServiceImpl<CbGatherMapper, CbGather> i
      */
     @Override
     public boolean saveEntity(CbGatherVo entity){
-        this.baseMapper.insert(entity);
+        entity.setCollStatus("1");
+        this.baseMapper.updateById(entity);
         gatherFeeService.saveBatch(CommomUtils.copyList(entity.getFeeLists(), CbGatherFee.class));
         this.checkWraingData(entity); // 校验数据 生成预警信息
         return true;
     }
 
     /**
+     * 修改采集数据
+     * @param entity
+     * @return
+     */
+    @Override
+    public boolean updateEntity(CbGatherVo entity){
+        this.baseMapper.updateById(entity);
+        gatherFeeService.updateBatchById(CommomUtils.copyList(entity.getFeeLists(), CbGatherFee.class));
+        this.checkWraingData(entity); // 校验数据 生成预警信息
+        return true;
+    }
+
+    /**
      * 校验数据 生成预警信息
      * @param entity
      */
@@ -145,7 +161,12 @@ public class CbGatherServiceImpl extends ServiceImpl<CbGatherMapper, CbGather> i
                 BigDecimal msDtuValue = msValue.subtract(msValue.multiply(feeVo.getMsRetio())); // 下公差
                 if (!bjdtodtu(collValue,msDtoValue,msDtuValue)){
                     // 数据异常->产生预警信息
-
+                    CbGatherWarningVo warningVo = new CbGatherWarningVo();
+                    warningVo.setType(entity.getType());
+                    warningVo.setGetherId(entity.getId());
+                    warningVo.setGetherfeeId(feeVo.getId());
+                    warningVo.setErrValue(collValue);
+                    warningService.save(warningVo);
                 }
             }
 
@@ -158,7 +179,12 @@ public class CbGatherServiceImpl extends ServiceImpl<CbGatherMapper, CbGather> i
                 BigDecimal msDtuValue = msValue.subtract(msValue.multiply(feeVo.getMsRetio())); // 下公差
                 if (!bjdtodtu(collValue,msDtoValue,msDtuValue)){
                     // 数据异常->产生预警信息
-
+                    CbGatherWarningVo warningVo = new CbGatherWarningVo();
+                    warningVo.setType(entity.getType());
+                    warningVo.setGetherId(entity.getId());
+                    warningVo.setGetherfeeId(feeVo.getId());
+                    warningVo.setErrValue(collValue);
+                    warningService.save(warningVo);
                 }
             }
         }