Kaynağa Gözat

1.合同bug调整

wuhp 1 yıl önce
ebeveyn
işleme
3499863671

+ 10 - 0
src/main/java/com/ydtech/modules/fnc/controller/contract/ContractController.java

@@ -151,4 +151,14 @@ public class ContractController extends BaseController {
         return HttpResult.ok("合同编辑成功");
     }
 
+    /**
+     * @description: 合同编辑
+     * @author: whp
+     **/
+    @GetMapping("updateTimer")
+    @ApiOperation(value = "定时任务测试")
+    public HttpResult updateTimer(@RequestBody ContractVo contractVo) {
+        contractService.updateTimer(contractVo);
+        return HttpResult.ok("定时任务测试");
+    }
 }

+ 7 - 0
src/main/java/com/ydtech/modules/fnc/service/contract/ContractService.java

@@ -76,4 +76,11 @@ public interface ContractService extends IService<ContractEntity> {
      * @author: whp
      **/
     void updateByEntity(ContractVo contractVo);
+
+    /**
+     * 测试定时任务
+     * @param contractVo
+     */
+    void updateTimer(ContractVo contractVo);
+
 }

+ 21 - 2
src/main/java/com/ydtech/modules/fnc/service/contract/impl/contractServiceImpl.java

@@ -9,6 +9,7 @@ import com.ydtech.exception.SystemException;
 import com.ydtech.modules.admin.model.vo.SysDeptTreeVo;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.base.model.vo.PageVo;
+import com.ydtech.modules.fnc.controller.contract.ControllerTimer;
 import com.ydtech.modules.fnc.dao.contract.ContractMapper;
 import com.ydtech.modules.fnc.dao.contract.ContractSupplierMapper;
 import com.ydtech.modules.fnc.dto.contract.ContractDto;
@@ -376,7 +377,7 @@ public class contractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
         // 查询当前状态的合同
         QueryWrapper<ContractEntity> contractQueryWrapper = new QueryWrapper<>();
         contractQueryWrapper.eq("id", contractVo.getId());
-        if (StringUtils.isNotEmpty(contractVo.getContractStatus())) {
+        if (StringUtils.isNotEmpty(contractVo.getContractStatus())  || StringUtils.isEmpty(contractVo.getIsView())) {
             contractQueryWrapper.eq("contract_status", "0");
         }
         List<ContractEntity> currentContracts = baseMapper.selectList(contractQueryWrapper);
@@ -384,7 +385,7 @@ public class contractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
         // 查询以其为父合同的合同
         QueryWrapper<ContractEntity> parentContractQueryWrapper = new QueryWrapper<>();
         parentContractQueryWrapper.eq("parent_id", contractVo.getId());
-        if (StringUtils.isNotEmpty(contractVo.getContractStatus())) {
+        if (StringUtils.isNotEmpty(contractVo.getContractStatus()) || StringUtils.isEmpty(contractVo.getIsView())) {
             parentContractQueryWrapper.eq("contract_status", "0");
         }
         List<ContractEntity> parentContracts = baseMapper.selectList(parentContractQueryWrapper);
@@ -483,4 +484,22 @@ public class contractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
         BeanUtils.copyProperties(contractVo, contractEntity);
         baseMapper.updateById(contractEntity);
     }
+
+    /**
+     * 测试定时任务
+     * @param contractVo
+     */
+    @Override
+    @Transactional
+    public void updateTimer(ContractVo contractVo) {
+        String nowTime ="";
+        if(StringUtils.isNotEmpty(contractVo.getTimeDate())){
+            nowTime=contractVo.getTimeDate();
+        }else {
+            nowTime = LocalDateTime.now().toString();
+        }
+        List<ContractEntity> contractEntityList = baseMapper.selectFilterFailure(nowTime.toString());
+        this.saveOrUpdateBatch(contractEntityList);
+
+    }
 }

+ 7 - 0
src/main/java/com/ydtech/modules/fnc/vo/ContractVo.java

@@ -113,4 +113,11 @@ public class ContractVo implements Serializable {
 
     @ApiModelProperty("合同idList")
     private List<String> idList;
+
+
+    @ApiModelProperty("定时测试时间")
+    private String timeDate;
+
+    @ApiModelProperty("是否是查看详情")
+    private String isView;
 }

+ 20 - 7
src/main/resources/mapper/modules/fnc/contract/ContractMapper.xml

@@ -67,14 +67,28 @@
 
     <select id="selectFilterFailure" resultType="com.ydtech.modules.fnc.entity.ContractEntity">
         select
-            ic.id as "id",
-            "1"  as "contractStatus"
-            from
-            ins_contract  ic
+        ic.id as "id",
+        "1" as "contractStatus"
+        from
+        ins_contract ic
+        <where>
+            ic.contract_status  ='0'
+            and  ( ic.expiring_date is not null and ic.should_postponed_effective_date is not null )
+            <if test="nowTime !=null  and  nowTime != ''">
+                and ic.should_postponed_effective_date &lt; #{nowTime}
+            </if>
+        </where>
+        UNION ALL
+        select
+        ic.id as "id",
+        "1" as "contractStatus"
+        from
+        ins_contract ic
         <where>
-            ic.expiring_date is not  null
+            ic.contract_status  ='0'
+           and  ic.expiring_date is not null and ic.should_postponed_effective_date is null
             <if test="nowTime !=null  and  nowTime != ''">
-               and  ic.expiring_date &lt; #{nowTime}
+                and ic.expiring_date &lt; #{nowTime}
             </if>
         </where>
     </select>
@@ -100,7 +114,6 @@
             file_path_id                    =#{filePathId},
             extern_type                     =#{externType},
             internal_type                   =#{internalType},
-            parent_id                       =#{parentId},
             date_time                       =#{dateTime},
             date_type                       =#{dateType}
         WHERE id = #{id};