Commit bcbeee19 by kangxiaoshan

关联合同

parent a0f98c4c
......@@ -8,7 +8,9 @@
<component name="ChangeListManager">
<list default="true" id="a014dff6-23ae-4886-96e2-e6af5bd7ea48" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/webapp/WEB-INF/web.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/web.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/common/repository/ContractRelationRepository.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/common/repository/ContractRelationRepository.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/common/repository/ContractRepository.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/common/repository/ContractRepository.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/common/service/impl/ContractServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/common/service/impl/ContractServiceImpl.java" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/target/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
......@@ -19,11 +21,11 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/main/java/common/service/impl/ContractServiceImpl.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="9645">
<caret line="753" column="61" selection-start-line="753" selection-start-column="61" selection-end-line="753" selection-end-column="61" />
<state relative-caret-position="221">
<caret line="758" column="38" selection-start-line="758" selection-start-column="38" selection-end-line="758" selection-end-column="38" />
</state>
</provider>
</entry>
......@@ -32,15 +34,15 @@
<entry file="file://$PROJECT_DIR$/src/main/java/common/repository/ContractRelationRepository.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="176">
<caret line="15" column="15" selection-start-line="15" selection-start-column="15" selection-end-line="15" selection-end-column="15" />
<caret line="16" column="21" selection-start-line="16" selection-start-column="21" selection-end-line="16" selection-end-column="21" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/webapp/WEB-INF/web.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="352">
<state relative-caret-position="1024">
<caret line="64" column="31" selection-start-line="64" selection-start-column="31" selection-end-line="64" selection-end-column="31" />
</state>
</provider>
......@@ -49,7 +51,7 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/pom.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="45">
<state relative-caret-position="679">
<caret line="97" column="13" selection-start-line="97" selection-start-column="13" selection-end-line="97" selection-end-column="17" />
</state>
</provider>
......@@ -67,8 +69,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/common/repository/ContractRepository.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="535">
<caret line="65" column="19" selection-start-line="65" selection-start-column="19" selection-end-line="65" selection-end-column="19" />
<state relative-caret-position="482">
<caret line="68" column="40" selection-start-line="68" selection-start-column="40" selection-end-line="68" selection-end-column="40" />
<folding>
<element signature="imports" expanded="true" />
</folding>
......@@ -80,7 +82,7 @@
<entry file="file://$PROJECT_DIR$/src/main/java/common/controller/ContractController.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="336">
<caret line="63" column="43" lean-forward="true" selection-start-line="63" selection-start-column="43" selection-end-line="63" selection-end-column="43" />
<caret line="63" column="40" selection-start-line="63" selection-start-column="40" selection-end-line="63" selection-end-column="40" />
<folding>
<element signature="docComment;class#ContractController#0" />
<element signature="method#export#0;class#ContractController#0" />
......@@ -129,7 +131,7 @@
<file pinned="false" current-in-tab="false">
<entry file="jar://$MAVEN_REPOSITORY$/org/springframework/spring-core/4.3.4.RELEASE/spring-core-4.3.4.RELEASE.jar!/org/springframework/cglib/proxy/MethodProxy.class">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1424">
<state relative-caret-position="36">
<caret line="104" selection-start-line="104" selection-end-line="104" />
</state>
</provider>
......@@ -193,12 +195,12 @@
<option value="$PROJECT_DIR$/src/main/java/common/controller/ContractController.java" />
<option value="$PROJECT_DIR$/src/main/java/util/Constant.java" />
<option value="$PROJECT_DIR$/src/main/resources/mail.properties" />
<option value="$PROJECT_DIR$/src/main/java/common/repository/ContractRelationRepository.java" />
<option value="$PROJECT_DIR$/src/main/java/common/service/impl/ContractServiceImpl.java" />
<option value="$PROJECT_DIR$/src/main/java/common/repository/ContractRepository.java" />
<option value="$PROJECT_DIR$/pom.xml" />
<option value="$PROJECT_DIR$/src/main/java/util/MailUtils.java" />
<option value="$PROJECT_DIR$/src/main/webapp/WEB-INF/web.xml" />
<option value="$PROJECT_DIR$/src/main/java/common/repository/ContractRelationRepository.java" />
<option value="$PROJECT_DIR$/src/main/java/common/repository/ContractRepository.java" />
<option value="$PROJECT_DIR$/src/main/java/common/service/impl/ContractServiceImpl.java" />
</list>
</option>
</component>
......@@ -233,8 +235,8 @@
</treeState>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="-7" />
<option name="y" value="2" />
<option name="x" value="170" />
<option name="y" value="245" />
<option name="width" value="1378" />
<option name="height" value="733" />
</component>
......@@ -244,6 +246,8 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
<expand>
......@@ -281,8 +285,6 @@
<select />
</subPane>
</pane>
<pane id="Scope" />
<pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
......@@ -453,17 +455,19 @@
<workItem from="1556246315995" duration="115000" />
<workItem from="1556504898324" duration="85000" />
<workItem from="1556505038023" duration="24140000" />
<workItem from="1557123619889" duration="4459000" />
<workItem from="1557129693360" duration="3281000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="55912000" />
<option name="totallyTimeSpent" value="64255000" />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1382" height="744" extended-state="6" />
<editor active="true" />
<layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.1623867" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.16389728" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="UI Designer" order="2" />
<window_info id="Favorites" order="3" side_tool="true" />
......@@ -516,27 +520,6 @@
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/main/java/track/service/impl/TrackAccountServiceImpl.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="189">
<caret line="56" column="51" selection-start-line="56" selection-start-column="28" selection-end-line="56" selection-end-column="51" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/adi/dic/PackageEnum.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="80">
<caret line="5" column="4" selection-start-line="5" selection-start-column="4" selection-end-line="5" selection-end-column="4" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/tkio/model/IncrementFlow.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="80">
<caret line="10" column="13" selection-start-line="10" selection-start-column="13" selection-end-line="10" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/tkio/repository/IncrementFlowRepository.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="80">
......@@ -790,6 +773,48 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/security/interceptor/AuthorizationInterceptor.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="76">
<caret line="79" selection-start-line="79" selection-end-line="79" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/resources/mail.properties">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="112">
<caret line="7" column="21" selection-start-line="7" selection-start-column="21" selection-end-line="7" selection-end-column="21" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/util/Constant.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="256">
<caret line="19" column="71" selection-start-line="19" selection-start-column="71" selection-end-line="19" selection-end-column="71" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/util/MailUtils.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="178">
<caret line="105" column="18" selection-start-line="105" selection-start-column="14" selection-end-line="105" selection-end-column="18" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/webapp/WEB-INF/web.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1024">
<caret line="64" column="31" selection-start-line="64" selection-start-column="31" selection-end-line="64" selection-end-column="31" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/common/model/Contract.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3392">
<caret line="357" selection-start-line="357" selection-start-column="2" selection-end-line="363" selection-end-column="7" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/common/task/ContractSendEmailThread.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="528">
......@@ -801,31 +826,24 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/security/interceptor/AuthorizationInterceptor.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="76">
<caret line="79" selection-start-line="79" selection-end-line="79" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/resources/mail.properties">
<entry file="file://$PROJECT_DIR$/src/main/java/common/repository/UserRepository.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="112">
<caret line="7" column="21" selection-start-line="7" selection-start-column="21" selection-end-line="7" selection-end-column="21" />
<state relative-caret-position="160">
<caret line="16" column="20" selection-start-line="16" selection-start-column="20" selection-end-line="16" selection-end-column="77" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/common/repository/ContractRelationRepository.java">
<entry file="file://$PROJECT_DIR$/pom.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="176">
<caret line="15" column="15" selection-start-line="15" selection-start-column="15" selection-end-line="15" selection-end-column="15" />
<state relative-caret-position="679">
<caret line="97" column="13" selection-start-line="97" selection-start-column="13" selection-end-line="97" selection-end-column="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/common/controller/ContractController.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="336">
<caret line="63" column="43" lean-forward="true" selection-start-line="63" selection-start-column="43" selection-end-line="63" selection-end-column="43" />
<caret line="63" column="40" selection-start-line="63" selection-start-column="40" selection-end-line="63" selection-end-column="40" />
<folding>
<element signature="docComment;class#ContractController#0" />
<element signature="method#export#0;class#ContractController#0" />
......@@ -848,48 +866,34 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/common/service/impl/ContractServiceImpl.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="9645">
<caret line="753" column="61" selection-start-line="753" selection-start-column="61" selection-end-line="753" selection-end-column="61" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/common/repository/ContractRepository.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="535">
<caret line="65" column="19" selection-start-line="65" selection-start-column="19" selection-end-line="65" selection-end-column="19" />
<state relative-caret-position="482">
<caret line="68" column="40" selection-start-line="68" selection-start-column="40" selection-end-line="68" selection-end-column="40" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/util/Constant.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="256">
<caret line="19" column="71" selection-start-line="19" selection-start-column="71" selection-end-line="19" selection-end-column="71" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/common/model/Contract.java">
<entry file="jar://$MAVEN_REPOSITORY$/org/springframework/spring-core/4.3.4.RELEASE/spring-core-4.3.4.RELEASE.jar!/org/springframework/cglib/proxy/MethodProxy.class">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3392">
<caret line="357" selection-start-line="357" selection-start-column="2" selection-end-line="363" selection-end-column="7" />
<state relative-caret-position="36">
<caret line="104" selection-start-line="104" selection-end-line="104" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pom.xml">
<entry file="file://$PROJECT_DIR$/src/main/java/common/repository/ContractRelationRepository.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="45">
<caret line="97" column="13" selection-start-line="97" selection-start-column="13" selection-end-line="97" selection-end-column="17" />
<state relative-caret-position="176">
<caret line="16" column="21" selection-start-line="16" selection-start-column="21" selection-end-line="16" selection-end-column="21" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/util/MailUtils.java">
<entry file="file://$PROJECT_DIR$/src/main/java/common/service/impl/ContractServiceImpl.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="178">
<caret line="105" column="18" selection-start-line="105" selection-start-column="14" selection-end-line="105" selection-end-column="18" />
<state relative-caret-position="221">
<caret line="758" column="38" selection-start-line="758" selection-start-column="38" selection-end-line="758" selection-end-column="38" />
</state>
</provider>
</entry>
......
......@@ -4,6 +4,7 @@ import common.model.ContractRelation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.math.BigInteger;
import java.util.List;
......@@ -12,8 +13,8 @@ import java.util.List;
*/
public interface ContractRelationRepository extends JpaRepository<ContractRelation, Long> {
@Query(value = "select relation_id id from contract_relation where main_contract = ?1 union all select main_contract id from contract_relation where relation_id = ?1",nativeQuery = true)
List<Long> findRelationIds(String contractId);
@Query(value = "select relation_id id from contract_relation where main_contract in ?1 union all select main_contract id from contract_relation where relation_id in ?1",nativeQuery = true)
List<BigInteger> findRelationIds(List contractId);
@Query(value = "select * from contract_relation where main_contract = ?1 and relation_id = ?2 and platform = ?3",nativeQuery = true)
ContractRelation findByRelationData(Long mainContract, Long relationId, String platform);
......
......@@ -60,10 +60,10 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
Contract findByCodePlatform(String contractCode, String platform);
@Query(value="select * from contract where start_date >= ?1 and start_date <= ?2 and platform in ?3 and id in ?4 and status!='del' order by ds desc",nativeQuery=true)
List<Contract> findByDsRelation(String startDate, String endDate, List<String> platform, List<Long> contractIds);
List<Contract> findByDsRelation(String startDate, String endDate, List<String> platform, List<String> contractIds);
@Query(value="select * from contract where start_date >= ?1 and start_date <= ?2 and platform in ?3 and create_account in ?4 and id in ?5 and status!='del' order by ds desc",nativeQuery=true)
List<Contract> findByDsAndRoileRelation(String startDate, String endDate, List<String> platform, List<Long> create_account, List<Long> contractIds);
List<Contract> findByDsAndRoileRelation(String startDate, String endDate, List<String> platform, List<Long> create_account, List<String> contractIds);
@Query(value = "select new map( c.id as id, c.contractCode as contractCode ) from Contract c where c.platform in ?1 and c.contractCode is not null and c.contractCode <> 'null' ")
......
......@@ -748,11 +748,15 @@ public class ContractServiceImpl implements ContractService {
List<Long> contractIds = null;
List<String> platforms = new ArrayList<>();
Map<String,String> idsDic = new HashMap<>();
platforms.add(platform);
if (!StringUtils.isEmpty(contractId)) {
//获取 关联合同列表
contractIds = contractRelationRepository.findRelationIds(contractId);
List<String> conIds = new ArrayList<>();
conIds.add(contractId);
this.getContractRelationIds(conIds,idsDic);
idsDic.remove(contractId);
if("fake".equals(platform)){
platforms.add("tkio");
}
......@@ -760,7 +764,7 @@ public class ContractServiceImpl implements ContractService {
List<Contract> contractList = new ArrayList<>();
List<String> ids = new ArrayList<>(idsDic.keySet());
if (loginAccount.getRole().equals(RoleEnum.SOUTH_BUSSINUSS.getKey()) || loginAccount.getRole().equals(RoleEnum.NORTH_BUSSINUSS.getKey())) {
......@@ -777,7 +781,7 @@ public class ContractServiceImpl implements ContractService {
if(!StringUtils.isEmpty(contractId)){
//查看关联合同
if (contractIds != null && contractIds.size() > 0) {
contractList = contractRepository.findByDsAndRoileRelation(startDate, endDate, platforms, idList, contractIds);
contractList = contractRepository.findByDsAndRoileRelation(startDate, endDate, platforms, idList, ids);
}
}else{
......@@ -790,7 +794,7 @@ public class ContractServiceImpl implements ContractService {
if(!StringUtils.isEmpty(contractId)){
if (contractIds != null && contractIds.size() > 0) {
contractList = contractRepository.findByDsRelation(startDate, endDate, platforms, contractIds);
contractList = contractRepository.findByDsRelation(startDate, endDate, platforms, ids);
}
}else{
contractList = contractRepository.findByDs(startDate, endDate, platform);
......@@ -827,44 +831,31 @@ public class ContractServiceImpl implements ContractService {
return result;
}
// @Override
// public List<Contract> findAllContract(User loginAccount, String startDate, String endDate, String platform, String contractId) {
//
// List<Long> contractIds = null;
//
// if (!StringUtils.isEmpty(contractId)) {
// //获取 关联合同列表
// contractIds = contractRelationRepository.findRelationIds(contractId);
// }
//
// List<Contract> contractList;
// if (!loginAccount.getRole().equals(RoleEnum.MANAGER.getKey())) {
// //非 管理员
// List<User> userList = userService.findAllSons(loginAccount.getId());
// List<Long> idList = new ArrayList<>();
// idList.add(loginAccount.getId());
// for (User u : userList) {
// idList.add(u.getId());
// }
//
// if (contractIds != null && contractIds.size() > 0) {
// contractList = contractRepository.findByDsAndRoileRelation(startDate, endDate, platform, idList, contractIds);
// } else {
// contractList = contractRepository.findByDsAndRoile(startDate, endDate, platform, idList);
// }
//
// } else {
//
// if (contractIds != null && contractIds.size() > 0) {
// contractList = contractRepository.findByDsRelation(startDate, endDate, platform, contractIds);
// } else {
// contractList = contractRepository.findByDs(startDate, endDate, platform);
// }
//
// }
//
// return contractList;
// }
private void getContractRelationIds (List<String> contractId,Map<String,String> idsDic){
//获取 关联合同 id
List<String> contractIds = new ArrayList<>();
List<BigInteger> ids = contractRelationRepository.findRelationIds(contractId);
if (ids != null && ids.size() > 0) {
for(BigInteger id : ids){
String idss = id.toString();
if (idsDic.get(idss) == null) {
contractIds.add(idss);
idsDic.put(idss,"0");
}
}
if(contractIds.size()>0){
//递归 查询 id 查询所有相关联的合同
this.getContractRelationIds(contractIds,idsDic);
}
}
}
@Override
public Contract contractStatusUpdate(String platform, String contractId, String status) {
......
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