Commit e2402da5 by 杨清松

增加项目删除判断接口

parent 973ada41
...@@ -316,4 +316,20 @@ public class ContractDao { ...@@ -316,4 +316,20 @@ public class ContractDao {
return flag; return flag;
} }
public KObject queryContractByProjectId(UUID projectId) {
return (KObject)template.execute(new HibernateCallback<KObject>() {
@Override
public KObject doInHibernate(Session session) throws HibernateException {
Query<KObject> query = session.createQuery("from " + ContractConstant.ENTITY_CONTRACT_INFO + " where (discard is null or discard = 0) and project.id =:projectId ", KObject.class);
query.setParameter("projectId", projectId);
//query.setParameter("contractState", ContractStateEnum.EXECUTING.name());
List<KObject> resultList = query.getResultList();
if (resultList.size() > 0) {
return resultList.get(0);
}
return null;
}
});
}
} }
...@@ -552,4 +552,10 @@ public class ContractServiceImpl implements ContractService { ...@@ -552,4 +552,10 @@ public class ContractServiceImpl implements ContractService {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
@Override
public KObject queryContractByProjectId(UUID projectId) {
KObject obj = contractDao.queryContractByProjectId(projectId);
return obj;
}
} }
...@@ -122,4 +122,6 @@ public interface ContractService { ...@@ -122,4 +122,6 @@ public interface ContractService {
* @param KObject contract 对应的合同 * @param KObject contract 对应的合同
*/ */
void remindToCreatorApproved(String result,KObject contract); void remindToCreatorApproved(String result,KObject contract);
KObject queryContractByProjectId(UUID fromString);
} }
...@@ -17,6 +17,10 @@ import org.springframework.web.bind.annotation.GetMapping; ...@@ -17,6 +17,10 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.beecode.amino.core.Amino; import com.beecode.amino.core.Amino;
...@@ -226,14 +230,19 @@ public class ContractController { ...@@ -226,14 +230,19 @@ public class ContractController {
} }
/** /**
* 合同更改状态 * 根据项目id查询合同
* @param contractId * @param projectId
* @return * @param contract
*/ * @return
@PostMapping("/contract/updateContractState") */
public Object updateContractState(@RequestBody String contractState) { @ResponseBody
JSONObject jsonObject = new JSONObject(contractState); @RequestMapping(value = "/contract/queryContractByProjectId", method = RequestMethod.GET)
return contractService.updateContractState(jsonObject); public Object queryContractByProjectId(@RequestParam("projectId") String projectId) {
} KObject kObject = contractService.queryContractByProjectId(UUID.fromString(projectId));
if (kObject != null) {
return ResponseObj.success("success", kObject.getUuid("id"));
}
return ResponseObj.success("success", null);
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment