tianwu.sun преди 4 месеца
родител
ревизия
28fe01b823

+ 1 - 1
src/main/java/com/bootdo/datas/controller/DataRecoverController.java

@@ -75,7 +75,7 @@ public class DataRecoverController {
         if (gyDataService.recover(id) > 0) {
             return R.ok();
         }
-        return R.error();
+        return R.error("不能恢复,同企业下已经存在同名的数据(也可能是存在同名驳回数据)");
     }
 
     /**

+ 2 - 2
src/main/java/com/bootdo/datas/controller/UnitController.java

@@ -109,7 +109,7 @@ public class UnitController {
         Long[] ids = new Long[]{id};
         int i = unitService.batchRemove(ids);
         if(i==0){
-            return R.error("选中的责任主体中包含已审批完成或者待审批的数据目录,不允许删除");
+            return R.error("选中的责任主体中包含数据目录,不允许删除");
         }
         return R.ok();
     }
@@ -124,7 +124,7 @@ public class UnitController {
 
         int i = unitService.batchRemove(ids);
         if(i==0){
-            return R.error("选中的责任主体中包含已审批完成或者待审批的数据目录,不允许删除");
+            return R.error("选中的责任主体中包含数据目录,不允许删除");
         }
         return R.ok();
     }

+ 3 - 1
src/main/java/com/bootdo/datas/dao/GyDataDao.java

@@ -17,6 +17,8 @@ public interface GyDataDao {
 
     int countTotal(Map<String, Object> map);
 
+    int countTotal4Del(Map<String, Object> map);
+
     List<GyDataImportDTO> listId(Map<String, Object> map);
 
     int save(GyDataDO data);
@@ -43,5 +45,5 @@ public interface GyDataDao {
 
     int batchPhysicalDeletion(Long[] ids);
 
-    GyDataImportDTO getRecoverUnit(Long id);
+    GyDataImportDTO getRecoverData(Long id);
 }

+ 1 - 1
src/main/java/com/bootdo/datas/dao/UnitDao.java

@@ -35,5 +35,5 @@ public interface UnitDao {
 
     GyUnitDO getUnitById(Long id);
 
-    int updateUnitByCreditCode(String creditCode);
+
 }

+ 0 - 13
src/main/java/com/bootdo/datas/domain/GyUnitDO.java

@@ -79,10 +79,6 @@ public class GyUnitDO implements Serializable {
      */
     private String dataSecurityWay;
 
-    /**
-     * 状态 0:正常 1:删除
-     */
-    private String status;
 
     /**
      * 审核状态,0待审核,1已通过,2已驳回
@@ -245,14 +241,6 @@ public class GyUnitDO implements Serializable {
         this.dataSecurityWay = dataSecurityWay;
     }
 
-    public String getStatus() {
-        return status;
-    }
-
-    public void setStatus(String status) {
-        this.status = status;
-    }
-
     public Date getCreateTime() {
         return createTime;
     }
@@ -295,7 +283,6 @@ public class GyUnitDO implements Serializable {
                 ", dataSecurityId='" + dataSecurityId + '\'' +
                 ", dataSecurityOffice='" + dataSecurityOffice + '\'' +
                 ", dataSecurityWay='" + dataSecurityWay + '\'' +
-                ", status='" + status + '\'' +
                 ", auditStatus='" + auditStatus + '\'' +
                 ", createTime=" + createTime +
                 ", updateTime=" + updateTime +

+ 1 - 16
src/main/java/com/bootdo/datas/domain/UnitDO.java

@@ -32,8 +32,7 @@ public class UnitDO implements Serializable {
     private String industryType;
     // 备注
     private String desc;
-    // 状态 0:正常 1:删除
-    private String status;
+
     // 申请者
     private String uploadUser;
     // 申请者ID
@@ -149,19 +148,6 @@ public class UnitDO implements Serializable {
         return desc;
     }
 
-    /**
-     * 设置:状态 0:正常 1:删除
-     */
-    public void setStatus(String status) {
-        this.status = status;
-    }
-
-    /**
-     * 获取:状态 0:正常 1:删除
-     */
-    public String getStatus() {
-        return status;
-    }
 
     /**
      * 设置:申请者
@@ -288,7 +274,6 @@ public class UnitDO implements Serializable {
                 ", dataIndustry='" + dataIndustry + '\'' +
                 ", industryType='" + industryType + '\'' +
                 ", desc='" + desc + '\'' +
-                ", status='" + status + '\'' +
                 ", uploadUser='" + uploadUser + '\'' +
                 ", uploadUserid='" + uploadUserid + '\'' +
                 ", createTime=" + createTime +

+ 0 - 14
src/main/java/com/bootdo/datas/dto/GyDataImportDTO.java

@@ -11,11 +11,6 @@ public class GyDataImportDTO {
      */
     private String reporterUnit;
 
-    /**
-     * 数据处理者状态
-     */
-    private String status;
-
     /**
      * 统一社会信用代码
      */
@@ -401,14 +396,6 @@ public class GyDataImportDTO {
         this.id = id;
     }
 
-    public String getStatus() {
-        return status;
-    }
-
-    public void setStatus(String status) {
-        this.status = status;
-    }
-
     public String getReporterUnit() {
         return reporterUnit;
     }
@@ -1006,7 +993,6 @@ public class GyDataImportDTO {
         return "GyDataImportDTO{" +
                 "id=" + id +
                 ", reporterUnit='" + reporterUnit + '\'' +
-                ", status='" + status + '\'' +
                 ", creditCode='" + creditCode + '\'' +
                 ", supervisoryOrg='" + supervisoryOrg + '\'' +
                 ", unitCharacter='" + unitCharacter + '\'' +

+ 2 - 0
src/main/java/com/bootdo/datas/service/GyDataService.java

@@ -28,6 +28,8 @@ public interface GyDataService {
 
     void batchRemove(Long[] longArray);
 
+    int countTotal4Del(Map<String, Object> map);
+
     void updateStatus(GyDataImportDTO data);
 
     void addExpertOpinion(ExpertOpinionDO expertOpinionDO);

+ 1 - 3
src/main/java/com/bootdo/datas/service/UnitService.java

@@ -24,12 +24,10 @@ public interface UnitService {
 	
 	int save(UnitDO unit);
 
-	
-	int remove(Long id);
 
 	int batchRemove(Long[] ids);
 
 	GyUnitDO getUnitById(Long id);
 
-	int updateUnitByCreditCode(String creditCode);
+
 }

+ 14 - 16
src/main/java/com/bootdo/datas/service/impl/GyDataServiceImpl.java

@@ -322,7 +322,6 @@ public class GyDataServiceImpl implements GyDataService {
                 try {
                     this.createGyUnitDO(gyUnitDO, row);
                     gyUnitDO.setCreateTime(new Date());
-                    gyUnitDO.setStatus("0");
                     gyUnitDO.setAuditStatus("0");
                     gyUnitDao.save(gyUnitDO);
                     log.info("========first_load_data======create_gy_unit======sucess:"+gyUnitDO.toString());
@@ -345,7 +344,6 @@ public class GyDataServiceImpl implements GyDataService {
                 if (count == 0) {
                     try {
                         gyUnitDO.setCreateTime(new Date());
-                        gyUnitDO.setStatus("0");
                         gyUnitDao.save(gyUnitDO);
                     } catch (Exception e) {
                         log.error("error enterprise-only : {}", e.getMessage());
@@ -485,7 +483,6 @@ public class GyDataServiceImpl implements GyDataService {
                 if (count == 0) {
                     try {
                         gyUnitDO.setCreateTime(new Date());
-                        gyUnitDO.setStatus("0");
                         gyUnitDO.setAuditStatus("0");
                         gyUnitDao.save(gyUnitDO);
                     } catch (Exception e) {
@@ -634,6 +631,10 @@ public class GyDataServiceImpl implements GyDataService {
         gyDataDao.batchRemove(ids);
     }
 
+    @Override
+    public int countTotal4Del(Map<String, Object> map) {
+        return gyDataDao.countTotal4Del(map);
+    }
 
     @Override
     public List<GyDataImportDTO> listRecover(Map<String, Object> map) {
@@ -698,19 +699,16 @@ public class GyDataServiceImpl implements GyDataService {
 
     @Override
     public int recover(Long id) {
-        GyDataImportDTO gyDataImportDTO = gyDataDao.getRecoverUnit(id);
-
-        Map<String, Object> params = new HashMap<>();
-        params.put("dataName", gyDataImportDTO.getDataName());// 数据名称
-        params.put("gyUnitId", gyDataImportDTO.getGyUnitId());// 单位
-        params.put("neqDataStatus", "4");
-        List<GyDataImportDTO> listInfo = gyDataDao.list(params);
-        if (listInfo !=null && listInfo.size()>0) {
-            // 存在非驳回数据,不允许恢复
-           return 0;
-        }
-        if ("1".equals(gyDataImportDTO.getStatus())) {
-            unitService.updateUnitByCreditCode(gyDataImportDTO.getGyUnitId());
+        GyDataImportDTO gyDataImportDTO = gyDataDao.getRecoverData(id);
+        if("1".equals(gyDataImportDTO.getDeleteStatus())){ //属于删除数据
+            Map<String, Object> params = new HashMap<>();
+            params.put("dataName", gyDataImportDTO.getDataName());// 数据名称
+            params.put("gyUnitId", gyDataImportDTO.getGyUnitId());// 单位
+            int countTotal = gyDataDao.countTotal(params);
+            if (countTotal > 0) {
+                // //未删除的数据存在企业机构编码和数据名一样的,不允许恢复
+                return 0;
+            }
         }
 
         String auditStage =null;

+ 2 - 12
src/main/java/com/bootdo/datas/service/impl/UnitServiceImpl.java

@@ -92,19 +92,13 @@ public class UnitServiceImpl implements UnitService {
     }
 
 
-
-    @Override
-    public int remove(Long id) {
-        return unitDao.remove(id);
-    }
-
     @Override
     public int batchRemove(Long[] ids) {
         for (Long l:ids) {
             Map<String, Object> params = new HashMap<>();
             GyDataImportDTO unit = unitService.get(l);
-            params.put("creditCode",unit.getCreditCode());
-            int total = gyDataService.countTotal(params);
+            params.put("gyUnitId",unit.getCreditCode());
+            int total = gyDataService.countTotal4Del(params);
             if (total > 0){
                 return 0;
             }
@@ -117,9 +111,5 @@ public class UnitServiceImpl implements UnitService {
         return unitDao.getUnitById(id);
     }
 
-    @Override
-    public int updateUnitByCreditCode(String creditCode) {
-        return unitDao.updateUnitByCreditCode(creditCode);
-    }
 
 }

+ 3 - 3
src/main/java/com/bootdo/system/controller/DeptController.java

@@ -118,19 +118,19 @@ public class DeptController extends BaseController {
     @RequiresPermissions("system:sysDept:remove")
     public R remove(Long deptId) {
         if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
-            return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+            return R.error(1, "演示系统不允许删除,完整体验请部署程序");
         }
         Map<String, Object> map = new HashMap<String, Object>();
         map.put("parentId", deptId);
         if (sysDeptService.count(map) > 0) {
-            return R.error(1, "包含下级部门,不允许修改");
+            return R.error(1, "包含下级部门,不允许删除");
         }
         if (sysDeptService.checkDeptHasUser(deptId)) {
             if (sysDeptService.remove(deptId) > 0) {
                 return R.ok();
             }
         } else {
-            return R.error(1, "部门包含用户,不允许修改");
+            return R.error(1, "部门包含用户,不允许删除");
         }
         return R.error();
     }

+ 21 - 17
src/main/resources/mybatis/datas/GyDataMapper.xml

@@ -6,7 +6,6 @@
     <sql id="selectSql">
         b.ID as id,
         a.REPORTER_UNIT as reporterUnit,
-        a.STATUS as status,
         a.CREDIT_CODE as creditCode,
         a.UNIT_CHARACTER as unitCharacter,
         a.INDUSTRY_TYPE_ONE as industryTypeOne,
@@ -79,14 +78,16 @@
         FROM gy_unit a,gy_data b
         where b.ID = #{value} and
         a.CREDIT_CODE = b.GY_NUIT_ID
-        AND a.STATUS = '0'
     </select>
-    <select id="getRecoverUnit" resultType="com.bootdo.datas.dto.GyDataImportDTO">
-        select
-        <include refid="selectSql"/>
-        FROM gy_unit a,gy_data b
-        where b.ID = #{value} and
-        a.CREDIT_CODE = b.GY_NUIT_ID
+
+    <select id="getRecoverData" resultType="com.bootdo.datas.dto.GyDataImportDTO">
+        SELECT
+        b.ID as id,
+        b.DATA_NAME as dataName,
+        b.GY_NUIT_ID as gyUnitId,
+        b.DATA_STATUS as dataStatus,
+        b.DELETE_STATUS as deleteStatus
+        FROM gy_data b  where b.ID = #{value}
     </select>
 
     <select id="getDataExcel" resultType="com.bootdo.datas.domain.GyDataExcelDO">
@@ -95,7 +96,6 @@
         FROM gy_unit a,gy_data b
         where b.ID = #{value} and
         a.CREDIT_CODE = b.GY_NUIT_ID
-        AND a.STATUS = '0'
     </select>
 
     <select id="getGbDataExcel" resultType="com.bootdo.datas.domain.GbDataExcelDO">
@@ -104,17 +104,15 @@
         FROM gy_unit a,gy_data b
         where b.ID = #{value} and
         a.CREDIT_CODE = b.GY_NUIT_ID
-        AND a.STATUS = '0'
     </select>
 
 
     <select id="listId" resultType="com.bootdo.datas.dto.GyDataImportDTO">
         SELECT
         b.ID as id,b.DATA_STATUS as dataStatus
-        FROM gy_unit a,gy_data b
+        FROM gy_data b
         <where>
-            a.CREDIT_CODE = b.GY_NUIT_ID
-            AND b.DELETE_STATUS = '0'
+            b.DELETE_STATUS = '0'
             and b.DATA_NAME = #{dataName}
             and b.GY_NUIT_ID = #{gyUnitId}
         </where>
@@ -127,7 +125,6 @@
         <where>
             a.CREDIT_CODE = b.GY_NUIT_ID
             AND b.DELETE_STATUS = '0'
-            AND a.STATUS = '0'
             <if test="neqDataStatus != null and neqDataStatus != ''"> and b.DATA_STATUS != #{neqDataStatus}</if>
             <if test="industryTypeOne != null and industryTypeOne != ''"> and a.INDUSTRY_TYPE_ONE like CONCAT('%',#{industryTypeOne},'%')</if>
             <if test="dataName != null and dataName != ''"> and b.DATA_NAME like CONCAT('%',#{dataName},'%')</if>
@@ -186,7 +183,6 @@
         <where>
             a.CREDIT_CODE = b.GY_NUIT_ID
             AND b.DELETE_STATUS = '0'
-            AND a.STATUS = '0'
             <if test="neqDataStatus != null and neqDataStatus != ''"> and b.DATA_STATUS != #{neqDataStatus}</if>
             <if test="industryTypeOne != null and industryTypeOne != ''"> and a.INDUSTRY_TYPE_ONE like CONCAT('%',#{industryTypeOne},'%')</if>
             <if test="dataName != null and dataName != ''"> and b.DATA_NAME like CONCAT('%',#{dataName},'%')</if>
@@ -235,7 +231,6 @@
             a.CREDIT_CODE = b.GY_NUIT_ID
             AND (b.DELETE_STATUS = '1'
             or b.DATA_STATUS = '4')
-            AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= date(b.UPDATE_TIME)
             <if test="industryTypeOne != null and industryTypeOne != ''"> and a.INDUSTRY_TYPE_ONE like CONCAT('%',#{industryTypeOne},'%')</if>
             <if test="dataName != null and dataName != ''">and b.DATA_NAME like CONCAT('%',#{dataName},'%')</if>
             <if test="dataLevel != null and dataLevel != ''">and b.DATA_LEVEL = #{dataLevel}</if>
@@ -286,7 +281,6 @@
             a.CREDIT_CODE = b.GY_NUIT_ID
             AND (b.DELETE_STATUS = '1'
             or b.DATA_STATUS = '4')
-            AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= date(b.UPDATE_TIME)
             <if test="industryTypeOne != null and industryTypeOne != ''"> and a.INDUSTRY_TYPE_ONE like CONCAT('%',#{industryTypeOne},'%')</if>
             <if test="dataName != null and dataName != ''">and b.DATA_NAME like CONCAT('%',#{dataName},'%')</if>
             <if test="dataLevel != null and dataLevel != ''">and b.DATA_LEVEL = #{dataLevel}</if>
@@ -441,6 +435,7 @@
         SET DELETE_STATUS = 0,
             DATA_STATUS = 0,
             SEND_VERIFY = 0,
+            del_unigue_key = 0,
             AUDIT_STAGE = #{auditStage},
             UPDATE_TIME = NOW()
         WHERE
@@ -471,6 +466,15 @@
         </foreach>
     </update>
 
+    <select id="countTotal4Del" resultType="int">
+        SELECT
+        count(*)
+        FROM gy_data b
+        <where>
+          b.GY_NUIT_ID =#{gyUnitId}
+        </where>
+    </select>
+
     <update id="remove">
         UPDATE gy_data
         SET DELETE_STATUS = 1,

+ 2 - 4
src/main/resources/mybatis/datas/GyUnitMapper.xml

@@ -24,14 +24,14 @@
             a.mobile_phone as mobilePhone
         from gy_unit a
             where
-            a.STATUS = '0' and a.CREDIT_CODE = #{creditCode}
+            a.CREDIT_CODE = #{creditCode}
     </select>
     <select id="getGyUnit" resultType="java.lang.Integer">
         SELECT
             count(*)
         FROM gy_unit
         <where>
-            STATUS = '0' and CREDIT_CODE = #{creditCode}
+          CREDIT_CODE = #{creditCode}
         </where>
     </select>
 
@@ -48,7 +48,6 @@
          DATA_SECURITY_MAN,
          DATA_SECURITY_OFFICE,
          DATA_SECURITY_WAY,
-         STATUS,
          CREATE_TIME,
          UPDATE_TIME,
          NOTE)
@@ -63,7 +62,6 @@
             #{dataSecurityMan},
             #{dataSecurityOffice},
             #{dataSecurityWay},
-            #{status},
             #{createTime},
             #{updateTime},
             #{note}

+ 3 - 20
src/main/resources/mybatis/datas/UnitMapper.xml

@@ -68,7 +68,7 @@
             a.UPDATE_TIME as updateTime
         from gy_unit a
         <where>
-            a.STATUS = '0' and a.audit_status = '1'
+            1 = 1
             <if test="reporterUnit != null and reporterUnit != ''">and REPORTER_UNIT like
                 CONCAT('%',#{reporterUnit},'%')
             </if>
@@ -93,7 +93,7 @@
     <select id="count" resultType="int">
         select count(*) from gy_unit
         <where>
-            STATUS = "0"
+            1 = 1
             <if test="reporterUnit != null and reporterUnit != ''">and REPORTER_UNIT like
                 CONCAT('%',#{reporterUnit},'%')
             </if>
@@ -120,7 +120,6 @@
             DATA_SECURITY_MAN,
             DATA_SECURITY_OFFICE,
             DATA_SECURITY_WAY,
-            STATUS,
             CREATE_TIME,
             UPDATE_TIME,
             NOTE)
@@ -138,33 +137,17 @@
             #{dataSecurityMan},
             #{dataSecurityOffice},
             #{dataSecurityWay},
-            #{status},
             #{createTime},
             #{updateTime},
             #{note}
                )
     </insert>
 
-
-
-    <update id="remove">
-        update gy_unit
-        set status = '1',
-        del_unigue_key = ID
-        where ID = #{value}
-    </update>
-
     <delete id="batchRemove">
-        update gy_unit set status = '1' where ID in
+        delete from gy_unit where ID in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
     </delete>
 
-    <update id="updateUnitByCreditCode">
-        update gy_unit
-        set status = '0'
-        where CREDIT_CODE = #{value}
-    </update>
-
 </mapper>