diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java index be255f2b9..17921d978 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -16,6 +16,7 @@ import com.iformall.mapper.*; import com.iformall.service.WxFlowRecordService; import com.iformall.service.WxFlowService; import com.iformall.service.WxPropertyContractService; +import com.iformall.service.WxRentContractService; import com.iformall.utils.DateUtils; import org.apache.commons.collections.map.HashedMap; import org.apache.commons.lang3.StringUtils; @@ -25,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; @@ -69,6 +71,9 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService @Autowired WxFlowRecordService wxFlowRecordService; + @Autowired + WxRentContractService wxRentContractService; + @Override public Map listAsPage(WxPropertyContract record, Integer pageIndex, Integer pageSize) { //Object rentContractStatusInfo = getRentContractStatusInfo(record); @@ -325,19 +330,42 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService message = "更新物业合同信息成功"; } - if (!CollectionUtils.isEmpty(record.getFlowParams())) { - if(wxFlowService.getModelByType((Integer)record.getFlowParams().get("businessType"),record.getTenantId()) == null){ - updatePropertyContractStatus(record.getId()); - }else{ - record.getFlowParams().put("businessId", record.getId().toString()); - wxFlowService.start(record.getFlowParams(), userId, userName, record.getTenantId()); - - // 合同状态改成待签约 - WxPropertyContract updateRentContract = new WxPropertyContract(); - updateRentContract.setId(record.getId()); - updateRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); - wxPropertyContractMapper.updateStatus(updateRentContract); - logger.info("id:{},启动审批流成功", record.getId().toString()); + if (record.getOperationType().equals(EnumContractOperationType.PART.getCode())) { + if (!CollectionUtils.isEmpty(record.getFlowParams())) { + if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record.getTenantId()) == null) { + updatePropertyContractStatus(record.getId()); + } else { + record.getFlowParams().put("businessId", record.getId().toString()); + wxFlowService.start(record.getFlowParams(), userId, userName, record.getTenantId()); + + // 合同状态改成待签约 + WxPropertyContract updateRentContract = new WxPropertyContract(); + updateRentContract.setId(record.getId()); + updateRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); + wxPropertyContractMapper.updateStatus(updateRentContract); + logger.info("id:{},启动审批流成功", record.getId().toString()); + } + } + } else { + //有模板,启动审批流,没有,直接生产账单 + if (!CollectionUtils.isEmpty(record.getFlowParams())) { + if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record.getTenantId()) == null + && record.getMerchantId() != null) { + wxRentContractService.updateRentContractStatus(record.getId()); + } else { + record.getFlowParams().put("businessId", record.getId().toString()); + if (record.getMerchantId() != null) { + record.getFlowParams().put("supplement", true); //设置补录 + } + wxFlowService.start(record.getFlowParams(), userId, userName, record.getTenantId()); + + // 合同状态改成待签约 + WxRentContract updateRentContract = new WxRentContract(); + updateRentContract.setId(record.getId()); + updateRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); + wxRentContractMapper.updateStatus(updateRentContract); + logger.info("id:{},启动审批流成功,是否补录:{}", record.getId().toString(), record.getMerchantId() != null); + } } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index 91e34315c..7a8ecdbd2 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -359,7 +359,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { //有模板,启动审批流,没有,直接生产账单 if (!CollectionUtils.isEmpty(record.getFlowParams())){ - if(wxFlowService.getModelByType((Integer)record.getFlowParams().get("businessType"),record.getTenantId()) == null){ + if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record.getTenantId()) == null + && record.getMerchantId() != null) { updateRentContractStatus(record.getId()); }else{ record.getFlowParams().put("businessId", record.getId().toString()); @@ -415,7 +416,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { //有模板,启动审批流,没有,直接生产账单 if (!CollectionUtils.isEmpty(record.getFlowParams())) { - if(wxFlowService.getModelByType((Integer)record.getFlowParams().get("businessType"),record.getTenantId()) == null){ + if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record.getTenantId()) == null + && record.getMerchantId() != null) { updateRentContractStatus(record.getId()); }else{ record.getFlowParams().put("businessId", record.getId().toString()); @@ -1304,7 +1306,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { //有模板,启动审批流,没有,直接生产账单 if (!CollectionUtils.isEmpty(record.getFlowParams())) { - if(wxFlowService.getModelByType((Integer)record.getFlowParams().get("businessType"),record.getTenantId()) == null){ + if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record.getTenantId()) == null + && record.getMerchantId() != null) { updateRentContractStatus(record.getId()); }else{ record.getFlowParams().put("businessId", record.getId().toString());