Browse Source

Merge remote-tracking branch 'origin/V0.0.2' into V0.0.2

jingyuanchao 2 years ago
parent
commit
dd4e2800e7

+ 6 - 0
project_data/sql/0.0.2/soc/soc.sql

@@ -1033,6 +1033,12 @@ IF
         ALTER TABLE `core_resumption_plan` ADD COLUMN `distribute` VARCHAR ( 2 ) DEFAULT NULL COMMENT '是否已下发';
 
     END IF;
+	-- 履职任务NFC表增加submitby
+    IF
+        NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'core_resumption_data_nfc' AND COLUMN_NAME = 'submit_by' ) THEN
+        ALTER TABLE `soc`.`core_resumption_data_nfc` ADD COLUMN `submit_by` bigint NULL COMMENT '提交人id' AFTER `submit_time`;
+
+    END IF;
 	ALTER TABLE `core_protection` MODIFY COLUMN `device_id` BIGINT NULL DEFAULT NULL COMMENT '设备ID' AFTER `id`;
 -- 机构扩展添加是否业务库
 	ALTER TABLE sys_org_extend MODIFY COLUMN business_library INT COMMENT '是否业务库';

+ 4 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/domain/AppResumptionDataNfc.java

@@ -46,6 +46,10 @@ public class AppResumptionDataNfc extends Model<AppResumptionDataNfc> implements
     private Date submitTime;
 
     /**
+     * 提交人
+     */
+    private Long submitBy;
+    /**
      * 扫描方式,0:扫描,1:拍照
      */
     private Integer scanMethod;

+ 72 - 71
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/gx/service/ResumptionServiceImpl.java

@@ -22,7 +22,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.util.*;
 
 @Service("gxResumptionService")
-public class ResumptionServiceImpl implements ResumptionService{
+public class ResumptionServiceImpl implements ResumptionService {
 
     @Autowired
     private ResumptionMapper resumptionMapper;
@@ -49,7 +49,7 @@ public class ResumptionServiceImpl implements ResumptionService{
     public Map<String, List<ResumptionTaskListVo>> getTaskList(ResumptionTaskNewDto dto) {
 
         Date dateTime = dto.getDateTime();
-        if(dateTime == null){
+        if (dateTime == null) {
             dateTime = new Date();
             dto.setDateTime(dateTime);
         }
@@ -59,7 +59,6 @@ public class ResumptionServiceImpl implements ResumptionService{
          */
 
 
-
         return null;
     }
 
@@ -80,20 +79,20 @@ public class ResumptionServiceImpl implements ResumptionService{
          *    2)获取计划对应的数据,组装数据
          */
         DateHelper dateTime = new DateHelper(taskDetailVo.getTaskDate());
-        int year =dateTime.getYear();
-        int quarter =dateTime.getQuarter() ;
+        int year = dateTime.getYear();
+        int quarter = dateTime.getQuarter();
         //履职状态:1 待履职,2 进行中,3 已完成,4 已过期
-        Resumption resumption = resumptionMapper.findOneByTaskIdAndDate(taskDetailVo.getTaskId(), year,quarter);
+        Resumption resumption = resumptionMapper.findOneByTaskIdAndDate(taskDetailVo.getTaskId(), year, quarter);
         Integer status = resumption.getStatus();
         List<ResumptionPlanVo> resumptionPlanVos = new ArrayList<>();
         boolean isExist = false;
-        if(status == 1 || status == 4){
+        if (status == 1 || status == 4) {
             //履职中待履职 和已过期的数据是没有保存过数据的只能根据计划获取
             Long planId = resumption.getPlanId();
             resumptionPlanVos = appPlanMapper.selectResumptionPlan(planId);
             isExist = false;
 
-        }else{
+        } else {
             resumptionPlanVos = resumptionMapper.selectResumptionPlan(taskDetailVo.getTaskId());
             isExist = true;
         }
@@ -115,10 +114,10 @@ public class ResumptionServiceImpl implements ResumptionService{
          */
         Long taskId = taskDetailVo.getTaskId();
         DateHelper dateTime = new DateHelper(taskDetailVo.getTaskDate());
-        int year =dateTime.getYear();
-        int quarter =dateTime.getQuarter() ;
+        int year = dateTime.getYear();
+        int quarter = dateTime.getQuarter();
         //获取履职任务
-        Resumption sysResumption = resumptionMapper.findOneByTaskIdAndDate(taskId,year,quarter);
+        Resumption sysResumption = resumptionMapper.findOneByTaskIdAndDate(taskId, year, quarter);
         Long orgId = sysResumption.getOrgId();
 
         sysResumption.setUpdateBy(SecurityUtils.getUsername());
@@ -126,18 +125,13 @@ public class ResumptionServiceImpl implements ResumptionService{
         sysResumption.setSubmitTime(new Date());
         sysResumption.setStatus(2);
 
-        if(taskDetailVo.getSubType() == 2){
+        if (taskDetailVo.getSubType() == 2) {
             if (sysResumption.getStatus() == 3) {
                 throw new RuntimeException("该任务已过期不能完成提交");
             }
             sysResumption.setStatus(3);
         }
 
-
-        resumptionMapper.updateById(sysResumption);
-
-
-
         //删除之前的数据
         appResumptionDataMapper.deleteByResumptionId(taskId);
         appResumptionDataNfcMapper.deleteByResumptionId(taskId);
@@ -146,30 +140,31 @@ public class ResumptionServiceImpl implements ResumptionService{
         //保存新的数据
         AppResumptionData data = null;
         List<ResumptionItemVo> checks = taskDetailVo.getChecks();
+        Integer exceptionCount = 0;
         for (ResumptionItemVo check : checks) {
             List<ResumptionPointVo> points = check.getPoints();
             for (ResumptionPointVo point : points) {
-                 data = new AppResumptionData();
-                 data.setDataStatus(point.getDataStatus());
-                 data.setResumptionId(taskId);
-                 data.setAreaId(check.getAreaId());
-                 data.setItemId(point.getPointId());
-                 data.setRectificationDeadline(point.getRectificationDeadline());
-                 data.setResRemark(point.getResRemark());
-                 data.setResValue(point.getResValue());
-                 data.setSubmitTime(new Date());
-                 data.setResTime(new Date());
-                 data.setPlanId(sysResumption.getPlanId());
-                 data.setSubmitBy(SecurityUtils.getLoginUser().getUserid());
-                 data.setSubmitName(SecurityUtils.getUsername());
-                if(taskDetailVo.getSubType() == 2){
-                    if(point.getDataStatus() == 1){
+                data = new AppResumptionData();
+                data.setDataStatus(point.getDataStatus());
+                data.setResumptionId(taskId);
+                data.setAreaId(check.getAreaId());
+                data.setItemId(point.getPointId());
+                data.setRectificationDeadline(point.getRectificationDeadline());
+                data.setResRemark(point.getResRemark());
+                data.setResValue(point.getResValue());
+                data.setSubmitTime(new Date());
+                data.setResTime(new Date());
+                data.setPlanId(sysResumption.getPlanId());
+                data.setSubmitBy(SecurityUtils.getLoginUser().getUserid());
+                data.setSubmitName(SecurityUtils.getUsername());
+                if (taskDetailVo.getSubType() == 2) {
+                    if (point.getDataStatus() == 1) {
                         data.setDataStatus(2);
                     }
                 }
-                 appResumptionDataMapper.insert(data);
+                appResumptionDataMapper.insert(data);
 
-                if(taskDetailVo.getSubType() == 2 && ObjectUtil.equal(point.getResValue(),1) ){
+                if (taskDetailVo.getSubType() == 2 && ObjectUtil.equal(point.getResValue(), 1)) {
                     SysOrg org = remoteOrgService.selectSysOrgById(sysResumption.getOrgId(), SecurityConstants.INNER);
                     Question question = Question.builder()
                             .srcTaskId(taskId)
@@ -192,6 +187,9 @@ public class ResumptionServiceImpl implements ResumptionService{
                     questionService.insertQuestion(question);
                 }
 
+                if (ObjectUtil.equal(point.getResValue(), 1)) {
+                    exceptionCount++;
+                }
                 List<AppResumptionDataRemarkimg> imgs = point.getImgs();
                 for (AppResumptionDataRemarkimg img : imgs) {
                     img.setResumptionDataId(data.getId());
@@ -200,33 +198,36 @@ public class ResumptionServiceImpl implements ResumptionService{
                 }
             }
         }
-
+        sysResumption.setExceptionCount(exceptionCount);
 
         List<ResumptionNFCVo> nfcs = taskDetailVo.getNfcs();
         AppResumptionDataNfc dataNfc = null;
         for (ResumptionNFCVo nfc : nfcs) {
-            if(nfc.getStatus() == 0){
+            if (nfc.getStatus() == 0) {
                 continue;
             }
             dataNfc = new AppResumptionDataNfc();
             dataNfc.setResumptionId(taskId);
             dataNfc.setNfcId(nfc.getNfcId());
             dataNfc.setPointId(nfc.getAreaId());
-            dataNfc.setSubmitTime(new Date());
             dataNfc.setImg(nfc.getImg());
             dataNfc.setScanMethod(nfc.getScanMethod());
             dataNfc.setStatus(nfc.getStatus());
+            dataNfc.setSubmitTime(ObjectUtil.isNull(nfc.getSubmitTime()) ? new Date() : nfc.getSubmitTime());
+            dataNfc.setSubmitBy(nfc.getSubmitBy());
             appResumptionDataNfcMapper.insert(dataNfc);
         }
 
+        resumptionMapper.updateById(sysResumption);
     }
 
     /**
      * 组装到前端的数据
+     *
      * @param resumptionPlanVos
      * @return
      */
-    private ResumptionTaskDetailVo assemblyData(List<ResumptionPlanVo> resumptionPlanVos, boolean isExist, Resumption resumption){
+    private ResumptionTaskDetailVo assemblyData(List<ResumptionPlanVo> resumptionPlanVos, boolean isExist, Resumption resumption) {
 
         ResumptionTaskDetailVo taskVo = new ResumptionTaskDetailVo();
         taskVo.setTaskId(resumption.getId());
@@ -239,8 +240,8 @@ public class ResumptionServiceImpl implements ResumptionService{
          *  2.根据检查内容获取检查图片
          *  3.构建返回到前端的数据
          */
-        Map<Long,List<AppResumptionDataRemarkimg>> imgMap = new HashMap<>();
-        if(isExist){
+        Map<Long, List<AppResumptionDataRemarkimg>> imgMap = new HashMap<>();
+        if (isExist) {
             //数据存在,需要获取任务的所有图片信息
             QueryWrapper<AppResumptionDataRemarkimg> qw = new QueryWrapper<>();
             qw.lambda().eq(AppResumptionDataRemarkimg::getResumptionId, resumption.getId());
@@ -248,7 +249,7 @@ public class ResumptionServiceImpl implements ResumptionService{
             for (AppResumptionDataRemarkimg img : imgs) {
                 Long resumptionDataId = img.getResumptionDataId();
                 List<AppResumptionDataRemarkimg> paths = imgMap.get(resumptionDataId);
-                if(paths == null){
+                if (paths == null) {
                     paths = new ArrayList<>();
                 }
                 paths.add(img);
@@ -257,24 +258,24 @@ public class ResumptionServiceImpl implements ResumptionService{
         }
         Integer yesPointNum = 0;
         Integer noPointNum = 0;
-        Map<Long,ResumptionItemVo> itemMap = new HashMap<>();
-        Map<Long,Map<String,Integer>> itComMap = new HashMap<>();
+        Map<Long, ResumptionItemVo> itemMap = new HashMap<>();
+        Map<Long, Map<String, Integer>> itComMap = new HashMap<>();
         for (ResumptionPlanVo vo : resumptionPlanVos) {
-            if(vo.getDataStatus() == 1){
+            if (vo.getDataStatus() == 1) {
                 noPointNum++;
-            }else{
+            } else {
                 yesPointNum++;
             }
 
-            if(isExist){
+            if (isExist) {
                 //如果存在数据则设置图片啊
                 List<AppResumptionDataRemarkimg> imgs = imgMap.get(vo.getDataId());
-                if(imgs != null && imgs.size() > 0){
+                if (imgs != null && imgs.size() > 0) {
                     vo.getImgs().addAll(imgs);
                 }
             }
             ResumptionItemVo resumptionItemVo = itemMap.get(vo.getItemId());
-            if(resumptionItemVo == null){
+            if (resumptionItemVo == null) {
                 resumptionItemVo = new ResumptionItemVo();
             }
             resumptionItemVo.setItemName(vo.getItemName());
@@ -287,44 +288,44 @@ public class ResumptionServiceImpl implements ResumptionService{
             pointVo.setImgs(vo.getImgs());
             pointVo.setPointId(vo.getPointId());
             pointVo.setResRemark(vo.getResRemark());
-            if(vo.getResValue() == null){
+            if (vo.getResValue() == null) {
                 pointVo.setResValue(0);
-            }else{
+            } else {
                 pointVo.setResValue(vo.getResValue());
             }
             pointVo.setRectificationDeadline(vo.getRectificationDeadline());
             pointVo.setDataStatus(vo.getDataStatus());
             resumptionItemVo.getPoints().add(pointVo);
             Map<String, Integer> itCom = itComMap.get(vo.getAreaId());
-            if(itCom == null){
+            if (itCom == null) {
                 itCom = new HashMap<>();
                 itCom.put("total", 1);
-                if(pointVo.getDataStatus() == 1){
-                    itCom.put("yes",0);
-                }else{
-                    itCom.put("yes",1);
+                if (pointVo.getDataStatus() == 1) {
+                    itCom.put("yes", 0);
+                } else {
+                    itCom.put("yes", 1);
                 }
-                itComMap.put(vo.getAreaId(),itCom);
-            }else{
-                itCom.put("total",itCom.get("total") + 1);
-                if(pointVo.getDataStatus() == 2){
-                    itCom.put("yes",itCom.get("yes") + 1);
+                itComMap.put(vo.getAreaId(), itCom);
+            } else {
+                itCom.put("total", itCom.get("total") + 1);
+                if (pointVo.getDataStatus() == 2) {
+                    itCom.put("yes", itCom.get("yes") + 1);
                 }
             }
 
-            itemMap.put(vo.getItemId(),resumptionItemVo);
+            itemMap.put(vo.getItemId(), resumptionItemVo);
         }
 
         Map<Long, AreaResumptionVo> map = new HashMap<>();
         List<ResumptionItemVo> items = new ArrayList<>();
-        for (Map.Entry<Long, ResumptionItemVo> entry: itemMap.entrySet()) {
+        for (Map.Entry<Long, ResumptionItemVo> entry : itemMap.entrySet()) {
             ResumptionItemVo itemVo = entry.getValue();
             AreaResumptionVo areaData = map.get(itemVo.getAreaId());
-            if(areaData == null){
+            if (areaData == null) {
                 areaData = new AreaResumptionVo();
                 areaData.setAreaId(itemVo.getAreaId());
                 areaData.setAreaName(itemVo.getAreaName());
-                map.put(itemVo.getAreaId(),areaData);
+                map.put(itemVo.getAreaId(), areaData);
             }
             items.add(itemVo);
         }
@@ -335,7 +336,7 @@ public class ResumptionServiceImpl implements ResumptionService{
 
         List<ResumptionNFCVo> nfcs = new ArrayList<>();
         List<AreaResumptionVo> areas = new ArrayList<>();
-        for (Map.Entry<Long, AreaResumptionVo> entry: map.entrySet()) {
+        for (Map.Entry<Long, AreaResumptionVo> entry : map.entrySet()) {
             AreaResumptionVo vo = entry.getValue();
             Long areaId = entry.getKey();
             //获取每个区域下的nfc
@@ -343,24 +344,24 @@ public class ResumptionServiceImpl implements ResumptionService{
             for (ResumptionNFCVo resumptionNFCVo : resumptionNFCVos) {
                 Integer status = resumptionNFCVo.getStatus();
                 Map<String, Integer> com = itComMap.get(resumptionNFCVo.getAreaId());
-                com.put("total",com.get("total") + 1);
-                if(status == 0){
+                com.put("total", com.get("total") + 1);
+                if (status == 0) {
                     noNFC++;
                     continue;
                 }
-                com.put("yes",com.get("yes") + 1);
+                com.put("yes", com.get("yes") + 1);
                 yesNFC++;
             }
             nfcs.addAll(resumptionNFCVos);
             Map<String, Integer> com = itComMap.get(areaId);
             Integer total = com.get("total");
             Integer yes = com.get("yes");
-            if(total.equals(yes)){
+            if (total.equals(yes)) {
                 //总数等于处理数
                 vo.setAreaStatus("1");
-            }else if(yes > 0){
+            } else if (yes > 0) {
                 vo.setAreaStatus("2");
-            }else if(yes == 0){
+            } else if (yes == 0) {
                 vo.setAreaStatus("0");
             }
             areas.add(vo);

+ 14 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/gx/vo/ResumptionNFCVo.java

@@ -1,7 +1,11 @@
 package com.xunmei.core.resumption.gx.vo;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+
+import java.util.Date;
+
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
@@ -44,4 +48,14 @@ public class ResumptionNFCVo {
      */
     private String img;
 
+    /**
+     * 扫描或上传图片的时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date submitTime;
+
+    /**
+     * 扫描或上传图片的人
+     */
+    private Long submitBy;
 }

+ 9 - 9
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/AppRuleItemServiceImpl.java

@@ -96,17 +96,17 @@ public class AppRuleItemServiceImpl extends ServiceImpl<AppRuleItemMapper, AppRu
         }
 
 
-        final List<Long> pointIds = appRulePointMapper.selectPointIds(item.getId());
+        List<Long> pointIds = appRulePointMapper.selectPointIds(item.getId());
         if (pointIds.size() > 0) {
             List<Long> idList2 = pointDtoList.stream().map(AppRulePointDto::getId).collect(Collectors.toList());
-            for (Long pointId : pointIds) {
-                if (!idList2.contains(pointId)) {
-                    Integer isUsed = appRulePointMapper.checkIsUsed(pointId);
-                    if (isUsed == null) {
-                        appRulePointMapper.deleteById(pointId);
-                    } else {
-                        throw new RuntimeException("履职内容已被使用,不能删除!");
-                    }
+            pointIds= pointIds.stream().filter(p->!idList2.contains(p))
+                    .collect(Collectors.toList());
+            if(CollectionUtil.isNotEmpty(pointIds)){
+                Integer isUsed= appRulePointMapper.checkIsJoinResumptionPlan(pointIds);
+                if(ObjectUtil.isNotNull(isUsed)){
+                    throw new RuntimeException("履职内容已被履职计划使用,不能删除!");
+                }else{
+                    appRulePointMapper.deleteBatchIds(pointIds);
                 }
             }
         }

+ 3 - 3
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/vo/resumptionRecord/ResumptionRecordPageVo.java

@@ -31,7 +31,7 @@ public class ResumptionRecordPageVo {
     /**
      * 任务名称
      */
-    @ExcelProperty(value = "任务名称",index = 1)
+    @ExcelProperty(value = "履职任务",index = 1)
     @ColumnWidth(30)
     private String name;
 
@@ -41,12 +41,12 @@ public class ResumptionRecordPageVo {
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @ApiModelProperty("任务开始时间")
-    @ExcelProperty(value ="任务开始时间",index=5)
+    @ExcelProperty(value ="开始时间",index=5)
     @ColumnWidth(30)
     private Date planStartTime;
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    @ApiModelProperty(value ="任务结束时间")
+    @ApiModelProperty(value ="截止时间")
     @ExcelProperty(value ="截止时间",index = 6)
     @ColumnWidth(30)
     private Date planEndTime;

+ 2 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/service/impl/CoreMonitoringRetrievalTaskServiceImpl.java

@@ -470,8 +470,8 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
         task.setBatchNum(batchNum);
         task.setPlanId(plan.getId());
         task.setOrderNum(frequency);
-        task.setPlanStartTime(dateRange.getStartTime());
-        task.setPlanEndTime(dateRange.getEndTime());
+        task.setPlanStartTime(DateTime.of(dateRange.getStartTime()).setField(DateField.MILLISECOND, 0));
+        task.setPlanEndTime(DateTime.of(dateRange.getEndTime()).setField(DateField.MILLISECOND, 0));
         task.setYmdDate(ymd.getDate());
         task.setYmdYear(ymd.getYear());
         task.setYmdHalfyear(ymd.getHalfyear());

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/controller/SafetyCheckRegisterController.java

@@ -41,7 +41,7 @@ public class SafetyCheckRegisterController extends BaseController {
     @ApiOperation(value = "获取App登记信息")
     @GetMapping("app/{id}")
 //    @RequiresPermissions("core:safetycheck:appregister")
-    public AjaxResult appIinfo(@PathVariable Long id) {
+    public AjaxResult appInfo(@PathVariable Long id) {
         return success(safetyCheckRegisterSerice.appInfo(id));
     }
 

+ 3 - 2
soc-modules/soc-modules-core/src/main/resources/mapper/resumption/AppRulePointMapper.xml

@@ -230,8 +230,9 @@
     </select>
     <select id="checkIsJoinResumptionPlan" resultType="java.lang.Integer">
         SELECT DISTINCT 1
-        FROM core_resumption_plan_to_point
-        WHERE point_id in
+        FROM core_resumption_plan_to_point pp
+        INNER join core_resumption_plan p on p.id=pp.plan_id and p.deleted=0
+        WHERE pp.point_id in
         <foreach collection="pointIds" item="pointId" index="index" open="(" separator="," close=")">
             #{pointId}
         </foreach>

+ 1 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/resumption/ResumptionRecordMapper.xml

@@ -436,7 +436,7 @@
     <select id="selectResumptionPlan" resultType="com.xunmei.common.core.vo.IdNameVo">
         select id, plan_name as name
         from core_resumption_plan
-        where plan_create_org_id=plan_of_org_id
+        where plan_create_org_id=plan_of_org_id and deleted=0
         <if test="query.planCycle != null">
             and plan_cycle = #{query.planCycle}
         </if>